From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5868 invoked by alias); 21 Dec 2001 16:58:06 -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 5105 invoked from network); 21 Dec 2001 16:56:50 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 21 Dec 2001 16:56:50 -0000 Received: from telocity.telocity.com (taarna.cygnus.com [205.180.230.102]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with SMTP id IAA27056; Fri, 21 Dec 2001 08:56:42 -0800 (PST) Message-ID: <3C2368E8.7384@redhat.com> Date: Fri, 21 Dec 2001 08:58:00 -0000 From: Michael Snyder X-Mailer: Mozilla 3.04 (Win95; I) MIME-Version: 1.0 To: Pierre Muller CC: Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: [PATCH] Further extend "maint info sections" cmd with ALLOBJ References: <200112202230.fBKMUAO31066@reddwarf.cygnus.com> <4.2.0.58.20011221115947.01848210@ics.u-strasbg.fr> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by cygnus.com id IAA27056 X-SW-Source: 2001-12/txt/msg00562.txt.bz2 Pierre Muller wrote: >=20 > At 11:53 21/12/2001 , Pierre Muller a =E9crit: > >At 23:30 20/12/2001 , Michael Snyder a =E9crit: > > > > >As a further extension, the "maint info sections" command > > >will now accept an argument "ALLOBJ" to iterate over all > > >known object files (which includes shared libraries. > > >You can now do (for instance): > > > > > > (gdb) maint info sect .bss ALLOBJ > > > > > >to see info on the .bss sections of all loaded object files. > > > >Great job! > > > > Just a little remark, I would have expected that I get the same output > >for the main executable in > > > >"maint info sect" > >and > >"maint info sect ALLOBJ" > >but when I tried it out on a freshly compiled GDB, > >the seciond command didn't should > >the .stab and .stabstr sections that were shown for the first command. > > > >This is intentional? >=20 > The problem might be quite general : >=20 > maint info sect NEVER_LOAD > gives the same output than > maint info sect HAS_CONTENT >=20 > Debugging a little more lead me to find out that > the reason of that bug is simply that > NEVER_LOAD contains LOAD, > ans strstr function returns thus true for strstr(string, "LOAD") > if string is "NEVER_LOAD" Oops! ;-( > I don't know the best way to solve this > especially as someone could ask for both > LOAD and NEVER_LOAD flags at the same time. > (maybe adding a space a start of args and looking for ' LOAD' with a lead= ing space). Wouldn't work if "LOAD" was the only argument. > Anyhow the current code also accepts thingss like NOCODE for CODE section > which is quite strange...) Maybe I'll have to check for these specific cases. I should have known that parsing wasn't this easy.=20=20 > To come back to the problem about .stab section, > the problem is related to the fact that > ALL_OBJFILE_OSECTIONS > is defined as > #define ALL_OBJFILE_OSECTIONS(objfile, osect) \ > for (osect =3D objfile->sections; osect < objfile->sections_end; osect= ++) >=20 > whereas the case without ALLOBJ is handled by a call to > bfd_map_over_sections () function which does iterate in a different way: > for (sect =3D abfd->sections; sect !=3D NULL; i++, sect =3D sect->next) >=20 > Wouldn't it be better to use the same bfd_map_over_sections () > function in the ALLOBJ case? The problem is that ALLOBJ includes shared libraries, and I wanted to print the relocated addresses for those, not the raw addresses that are in the BFD section table. I did not see a way to get back from the bfd section to the objfile=20 section, so I felt I had to start from the objfile section in the first place.