Re: RFC: printing pointers to global (data) variable on Windows...

Tom Tromey
2012-08-17T14:23:49Z

Tom> IIRC the full symbol tables only record address information for text
Tom> symbols, not for data symbols. If so, one cannot do this lookup.

Joel> I do not understand this part, though. Searches by name should return
Joel> global variables too, no?

build_address_symbolic is searching for the symbol by PC:

symbol = find_pc_sect_function (addr, section);

I think it would be reasonable, and maybe useful, if gdb could do
by-address searches for data symbols. That was a bigger change than I
wanted to make for the "set print symbol" series though.

Tom> Ok, horrible idea. Perhaps some flag bit on the minsym instead?
Tom> Or on the objfile?

Joel> You mean, setting a flag that allows us to know that sizes are not
Joel> available, and thus avoid the heuristics/filtering?

Yeah.

Joel> Looking at the definition of struct minimal_symbol, it looks like
Joel> we'd have some room for an extra flag.

Yes. pahole is super for this kind of thing... it reports a pretty big
hole after target_flag_2.

Joel> But I am not sure I really
Joel> want to go that way. The filtering wouldn't be a problem if we were
Joel> searching for all global symbols, not just functions.

That would be best, but I'm out of ideas.
I think the existing check is really what we want for ELF.

Maybe for ELF we could find some way to mark symbols we don't want.
But that's just the flag idea but the sense reversed.

Tom