Why does symfile.c use printf_filtered?

Jim Ingham jingham@apple.com
Wed Oct 22 23:35:00 GMT 2003


On Oct 22, 2003, at 3:14 PM, gdb-digest-help@sources.redhat.com wrote:

> "J. Johnston" <jjohnstn@redhat.com> writes:
>
>> Does anybody know why symfile.c uses printf_filtered()?
>>
>> This causes a couple of problems, most notably when you load a module
>> with a lot of shared library references.  The messages for "Reading
>> symbols from"... inside symfile.c are printed filtered so eventually
>> we end up causing a page break.  I do not think this information is
>> worthy of requiring user intervention.
>>
>> Would anybody have an objection to me changing to use
>> printf_unfiltered() in symfile.c?
>
> No, that'd be fine.
>
> I have to wonder, though --- if one doesn't care whether the messages
> are scrolling off the screen or not, should one print them at all?
> What would folks think of just ditching the fprintf altogether, and
> making sure there's some general message that says it's reading
> symbols?
>
> I suppose those messages are nice in that they provide a context for
> any error messages that might come afterwards, but I think it'd be
> better just to improve the error messages to mention the filename
> involved, rather than spew stuff all the time on the off chance
> something will go wrong.

These messages only show up when you set verbose on, so they don't 
appear in the normal case.  Then I think you just get one dot per 
shared library.  On a big application stack (like the Mac OS X 
framework stacks, for instance) there are lots of libraries to be read 
in.  Having the dots serves as a progress meter, so you know gdb is not 
just hung...

If you are working on the frameworks, you usually have the system copy 
in the regular install location, and then the copy you are working on.  
Instead of installing your working copy (which can mess up your whole 
machine) most folks use the environment variable (LD_LIBRARY_PATH, or 
on Mac OS X DYLD_FRAMEWORK_PATH) to point at the version they want to 
use.  I have noticed that the folks who  do this around here often keep 
the verbose setting on to make sure that they are indeed using the 
versions of the libraries that they intended.  I bet this is not all 
that uncommon.

So I think these messages are useful.

Jim
--
Jim Ingham                                   jingham@apple.com
Developer Tools
Apple Computer



More information about the Gdb mailing list