Re: [PATCH] DW_AT_calling_convention support REV 2

Petr Sorfa
2002-07-10T20:27:22Z

Hi,

> > Good, I agree, that makes it more generic. Need to check for
> > check_symbol for NULL as this might tank GDB at the second if.
>
> Why should NULL be a legitimate argument? Calling the function without
> a symbol is useless...
Just error trapping. In case something goes wrong and a NULL pointer
gets accidentally passed.

> > > And then change all callers of get_main_name () to use this.
> > >
> > > (Note that this requires being careful if symbol_of_main gets
> > > unloaded and we load a C program afterwards!)
> > >
> > > Make sense? Sound reasonable?
> > Um, you've lost me. There is no get_main_name() function, do you mean
> > get_main_symbol() or main_name()? I still not sure what the callers of
> > the function should do.
>
> main_name(), I assume. Basically I would like everywhere that
> currently checks by a strcmp/STREQ with main_name() to use
> is_main_symbol () instead, etc. Things that call lookup_symbol on
> main_name() should just use get_main_symbol () if possible. Then
> set_main_name () could include calling lookup_symbol(main_name()), so
> that get_main_symbol would always be valid, etc....
Ok, got it.

> > Although, I do agree that the patch should catch unloading the
> > main_symbol, but how?
>
> I'm not sure :( Is there a hook for when object files are unloaded?
Nope. In the cu_header patch, I have a hook from elfread.c to
dwarf2read.c to clear up stuff when a new program is about to be
debugged. The function will be called dwarf_init (). But as for a
generic solution..

Petr