From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2682 invoked by alias); 12 Dec 2012 00:59:07 -0000 Received: (qmail 2670 invoked by uid 22791); 12 Dec 2012 00:59:06 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Dec 2012 00:58:58 +0000 Received: by mail-pa0-f41.google.com with SMTP id bj3so85870pad.0 for ; Tue, 11 Dec 2012 16:58:57 -0800 (PST) Received: by 10.68.252.69 with SMTP id zq5mr30878685pbc.104.1355273937680; Tue, 11 Dec 2012 16:58:57 -0800 (PST) Received: from [192.168.0.104] ([221.12.28.136]) by mx.google.com with ESMTPS id m3sm14757954pav.4.2012.12.11.16.58.47 (version=SSLv3 cipher=OTHER); Tue, 11 Dec 2012 16:58:56 -0800 (PST) Message-ID: <50C7D75E.8070204@gmail.com> Date: Wed, 12 Dec 2012 00:59:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0a1 MIME-Version: 1.0 To: Pierre Muller CC: 'Tom Tromey' , 'Joel Brobecker' , 'Pedro Alves' , 'Eli Zaretskii' , gdb-patches@sourceware.org Subject: Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior) References: <834nm07z0s.fsf@gnu.org> <5077FEB9.4030304@redhat.com> <83y5jb7rfe.fsf@gnu.org> <006001cdaada$00c81f00$02585d00$@muller@ics-cnrs.unistra.fr> <20121024194517.GK3555@adacore.com> <011901cdb2ab$48076b90$d81642b0$@muller@ics-cnrs.unistra.fr> <20121105171121.GA2972@adacore.com> <50991f5f.8382440a.1100.ffff82abSMTPIN_ADDED@mx.google.com> <509ABA17.30507@redhat.com> <000301cdbd96$f5cd9f10$e168dd30$@muller@ics-cnrs.unistra.fr> <20121122173019.GF9964@adacore.com> <15690.5992342674$1353883881@news.gmane.org> <87624si9ur.fsf@fleche.redhat.com> <42721.1671988063$1354028360@news.gmane.org> In-Reply-To: <42721.1671988063$1354028360@news.gmane.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00367.txt.bz2 On 2012-11-27 22:58, Pierre Muller wrote: > Thanks, Tom... > it really seems that this is the culprit: > I was freeing again already freed memory, which of course > created random crashes later. > > I send here rapidly a new patch version. > I really tested the allocation problems by adding > allocation + free'ing of each of the first parameters > used in prim_record_minimal_symbol > and it does seem that freeing of char array doesn't lead to any problem. > > So the only trouble was related to the > reallocation of section_data and seems to be fixed > thanks to Tom's proposal. > > Yuanhui Zhang, > could you please check if the new patch > suppresses the crash you had when you tried the previous version? > > Thanks to everyone... > > Pierre Muller > > > 2012-11-25 Pierre Muller > > * coff-pe-read.h (pe_text_section_offset): Declare new function. > * coff-pe-read.c (debug_coff_pe_read): New static variable. > (struct read_pe_section_data): Add section_name field. > (IMAGE_SCN_CNT_CODE): New macro, if not already defined. > (IMAGE_SCN_CNT_INITIALIZED_DATA): Ditto. > (IMAGE_SCN_CNT_UNINITIALIZED_DATA): Ditto. > (get_pe_section_index): New function. > (struct pe_sections_info): New type. > (get_section_vmas): Use new struct pe_sections_info. > (add_pe_exported_sym): Handle unnamed exported function. > (add_pe_forwarded_sym): New function. > (read_pe_truncate_name): Truncate at last dot. > (pe_as16): New function. > (read_pe_exported_syms): Use ordinal of function to > retrieve correct RVA address of function and handle > forwarded symbol. > (pe_text_section_offset): New function. > (show_debug_coff_pe_read): New function. > (_initialize_coff_pe_read): New function adding > 'set/show debug coff_pe_read' commands. > > * windows-tdep.c (windows_xfer_shared_library): Use > pe_text_section_offset function instead of possibly wrong > 0x1000 constant for .text sextion offset. > I test this patch again, it works fine without crash in the below cases: gdb_pure_cvs_20121207 + this patch + python_enabled ----> No crash on debugging, "print GetLastError()" works correctly. gdb_pure_cvs_20121207 + this patch + python_disabled----> No crash on debugging, "print GetLastError()" works correctly. Yuanhui Zhang