From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13810 invoked by alias); 4 Jan 2003 16:31:15 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13803 invoked from network); 4 Jan 2003 16:31:14 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by 209.249.29.67 with SMTP; 4 Jan 2003 16:31:14 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18UrBT-0004na-00 for ; Sat, 04 Jan 2003 17:30:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gdb-patches@sources.redhat.com Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18Ur5P-0004Rq-00 for ; Sat, 04 Jan 2003 17:23:47 +0100 Path: not-for-mail From: "Raoul Gough" Subject: Re: coffread.c extension for DLLs without debugging symbols Date: Sat, 04 Jan 2003 16:31:00 -0000 Message-ID: References: <20030104044408.GA7364@redhat.com> X-Complaints-To: usenet@main.gmane.org X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2003-01/txt/msg00148.txt.bz2 "Christopher Faylor" wrote in message news:20030104044408.GA7364@redhat.com... > On Fri, Jan 03, 2003 at 07:39:31PM -0000, Raoul Gough wrote: > >Proposed ChangeLog entry, assuming the code is accepted: > > > >2003-01-03 Raoul Gough > > > > * coffread.c: Support non-debug export symbols for win32 DLLs > > WONDERFUL! I would love to have this code in the windows version of gdb. > I've often thought about doing something like this but I've never had > the stamina to look into what it would take to do this. > > I have a few comments. > > 0) The ChangeLog needs more information. Every new function should be > mentioned and changes to specific functions should be documented. How's this: 2003-01-03 Raoul Gough * coffread.c: Support non-debug export symbols for win32 DLLs. (coff_symtab_read): call read_pe_exported_syms iff no symbols found and objfile is "pe-i386" or "pei-i386". (read_pe_exported_syms): New function. (read_pe_section_data): New struct (temporary section info). (read_pe_section_index): New function. (read_pe_truncate_name): New function. (get_section_vmas): New function. (add_pe_exported_sym): New function. (pe_get16, pe_get32, pe_as32): New functions. > > 1) AFAICT, the formatting of the code looks great (a rarity for a first > timer) except for an odd comment or two which doesn't end in a "." as > required for a complete sentence. Yeah, yeah, a total nit but hey we've > got standards! OK, I've fixed those comments (new diff attached). Note also that I'd used strncmp, *and* got the "n" wrong, where I should have used strcmp anyway. > > 2) I wonder if this code should be ifdef'ed somehow for Windows since > it will add extra code for no gain on every COFF platform. Of course, > how many of those are there out there? Maybe this isn't a huge issue > after all. I wondered about that myself. However, wouldn't that suggest putting the bulk of the code somewhere like win32-nat.c? > > 3) objdump -p already has the ability to read and report on the export > table. I wonder if it would be useful (or possible) to generalize this > code so that gdb and objdump would be using the same base. I haven't I assumed that since ld did it the hard way, there wasn't any proper support for this in bfd - maybe that's not true. Obviously, sharing this kind of code between code bases would be the ideal situation, but I don't think I've got enough of an overview to do that. I never new about the -p or --private-headers option to objdump! I always thought that it should have been able to dump the export table, but never figured out how to make it do it. That's why I went to the ld codebase, since I knew that it would have to understand this information. > looked too closely but I think the code in question is in bfd/peicode.h. > Hmm. Maybe objdump isn't interested in the kinds of things that gdb > is, though, like what section a symbol is associated with... > > Anyway, I'll be giving this an actual test run in the next couple of > days. In the meantime, THANK YOU for doing this. Even given the very > minor above points, I think this will be a great boon for the Windows > version of gdb. This will help enormously in debugging on Windows. Thanks for the encouragement! > > You will definitely need to get an assignment in to the FSF, though, > unfortunately. I think jimb at redhat dot com is the person to help > you with that. OK. will look into this further. > > cgf > > P.S. Assuming that this works as advertised, I assume that you will > have no objections to my releasing a new version of gdb for windows > with this patch in it before the patch makes its way into the official > gdb repository, right? I think there are a few users in the cygwin > mailing list that would appreciate this change. By all means - please do. You may as well use the new diff for the comment fixes and the strncmp business. > Special for spam email harvesters: send email to aaaspam@sources.redhat.com > and be permanently blocked from mailing lists at sources.redhat.com. Alright! Sock it to 'em, redhat! Regards, Raoul Gough. begin 666 coffread.c.diff2 M26YD97@Z(&-O9F9R96%D+F,-"CT]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T-"E)# M4R!F:6QE.B O8W9S+W-R8R]S6UT86)?&%M:6YE(&5A8V@@6US(#T](# I("8F("AP95]F:6QE M*2D-"BL@(" @('L-"BL@(" @(" @+RH@5V4G=F4@9V]T(&YO(&1E8G5G9VEN M9R!S>6UB;VQS+"!B=70@:VYO=R!H;W<@=&\@PT**R )("!R96%D7W!E7V5X<&]R=&5D M7W-Y;7,@*&]B:F9I;&4I.PT**R )?0T**R @(" @?0T**R -"B @("!I9B H M;&%S=%]S;W5R8V5?9FEL92D-"B @(" @(&-O9F9?96YD7W-Y;71A8B H;V)J M9FEL92D[#0H@( T**BHJ*BHJ*BHJ*BHJ*BHJ(')E861?;VYE7W-Y;2 H'0L(&1A M=&$@86YD(&)S" H8V]N'0B*2 ]/2 P*0T**R @ M(" @>PT**R @(" @("!R971U'0[#0HK(" @:6YT('-E8W1I>" ](')E861?<&5?" H2!F;W(@86X@97AP;W)T960@6U?;F%M92P-"BL@"0D@(" @('5N&UA;&QO8R H9&QL7VYA;65? M;&5N("L@6U?;F%M92D@*R R*3L-"BL@#0HK(" @2 H<75A;&EF:65D7VYA;64L(&1L;%]N86UE+"!D;&Q?;F%M95]L96XI.PT* M*R @('%U86QI9FEE9%]N86UE6V1L;%]N86UE7VQE;ET@/2 G(2<[#0HK(" @ MPT**R @('=H M:6QE("@J9&QL7VYA;64I#0HK(" @("![#0HK(" @(" @(&EF("@H*F1L;%]N M86UE*2 ]/2 G+B&5C=71A8FQEF5D('-Y;6)O;',N($-O9&4-"BL@("H@;&EF=&5D("AW M:71H(&UO9&EF:6-A=&EO;G,I(&9R;VT@<&4M9&QL+F,@9G)O;2!L9"X@*B\- M"BL@#0HK('-T871I8R!U;G-I9VYE9"!I;G0-"BL@<&5?9V5T,38@*&%B9F0L M('=H97)E*0T**R @(" @(&)F9" J86)F9#L-"BL@(" @("!I;G0@=VAEF5?='EP92D@,BP@86)F9"D[#0HK(" @ MPT**R @('5N M7!E*2 T+"!A8F9D*3L-"BL@("!R971U'!O&5C=71A8FQE+B @;W)I9VEN86QL>2!F MS L(#$L(# L(&US=%]D871A?2P-"BL@"7LP+" Q+" P M+"!MF4@/2!P95]G970S,B H9&QL+"!O<'1H M9')?;V9S("L@,3 P*3L-"BL@("!NF4@;V8@=&AE M(&5X<&]R="!S96-T:6]N+B @*B\@#0HK(" @9F]R("AI(#T@,#L@:2 \(&YS M96-T:6]NPT**R @(" @("!C:&%R('-N86UE6SA= M.PT**R @(" @("!U;G-I9VYE9"!L;VYG('-E8W!TF5?='EP92D@."P@9&QL*3L-"BL@#0HK(" @(" @(&EF M("AV861D'!OF4@/B!E>'!O MPT**R )("!E>'!P='(@/2!F<'1R("L@*&5X<&]R=%]R M=F$@+2!V861D'!OF4@/B!V861DF4@+2 H97AP;W)T7W)V82 M('9A9&1R*3L-"BL@"2 @8G)E86L[#0HK( E] M#0HK(" @("!]#0HK( T**R @(&EF("AE>'!OPT**R @(" @(" O*B!%;7!T>2!E>'!OF4@;V8@=&AE(')E;&5V86YT M('-E8W1I;VYS+B J+PT**R @(&9OPT**R )("!S96-T:6]N7V1A=&%;%TN MF4[#0HK( E]#0HK(" @("!]#0HK( T* M*R @(&5X<&1A=&$@/2 H=6YS:6=N960@8VAA'!O M&9R964L M(&5X<&1A=&$I.PT**R -"BL@("!B9F1?'!D871A("T@97AP;W)T7W)V83L-"BL@#0HK(" @;F5X<" ]('!E7V%S M,S(@*&5X<&1A=&$@*R R-"D[#0HK(" @;F%M95]R=F%S(#T@<&5?87,S,B H M97AP9&%T82 K(#,R*3L-"BL@("!O6UB;VQS M(&9R;VT@)7,N+BXB+"!D;&Q?;F%M92D[#0HK(" @=W)A<%]H97)E("@B(BD[ M#0HK( T**R @("\J(%1R=6YC871E(&YA;64@870@9FER6UB M;VQS+B @*B\-"BL@("!F;W(@*&D@/2 P.R!I(#P@;F5X<#L@:2LK*0T**R @ M(" @>PT**R @(" @(" O*B!0;VEN=&5R('1O('1H92!N86UE2X@ M*B\-"BL@(" @(" @:6YT('-E8W1I>" ](# [#0HK( T**R @(" @("!F;W(@ M*'-E8W1I>" ](# [('-E8W1I>" \(%!%7U-%0U1)3TY?5$%"3$5?4TE:13L@ M*RMS96-T:7@I#0HK( E[#0HK( D@(&EF("@H9G5N8U]R=F$@/CT@%TN%TNPT**R )(" @(" @861D7W!E7V5X<&]R=&5D7W-Y;2 H97)V82 K(&YA;65? M