Hi all,
We're bringing up the currentish gdb sources here at Apple and I was debugging a problem with inside_main_func () [*] when I noticed that there seems to be a bit of extra computation that has snuck into the function during the changes since July.
Previously, inside_main_func() would find the "main" function in the "symfile_objfile", find its start and end addresses (if debug symbols were present I guess) and on subsequent invocations, use those cached addresses to determine if the addr in question is contained within the "main" function.
The current inside_main_func() will do
msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile);// every time
if (msymbol != NULL // once
&& symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC
&& symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC)
if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_text) // every time
{
[... lots of stuff ...]
}
I realize this is hardly a performance critical function, but it's still a long shot from the version that existed before July which would find the start/end addresses and then do
if (symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC && // once
symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC)
[... lookup symbol ... ]
return (symfile_objfile->ei.main_func_lowpc <= pc
&& symfile_objfile->ei.main_func_highpc > pc);