This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC-v4] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>, "'Pedro Alves'" <palves at redhat dot com>, "'Eli Zaretskii'" <eliz at gnu dot org>, gdb-patches at sourceware dot org
- Date: Mon, 26 Nov 2012 11:36:35 -0700
- Subject: Re: [RFC-v4] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)
- References: <83y5jb7rfe.fsf@gnu.org> <006001cdaada$00c81f00$02585d00$@muller@ics-cnrs.unistra.fr> <20121024194517.GK3555@adacore.com> <011901cdb2ab$48076b90$d81642b0$@muller@ics-cnrs.unistra.fr> <20121105171121.GA2972@adacore.com> <50991f5f.8382440a.1100.ffff82abSMTPIN_ADDED@mx.google.com> <509ABA17.30507@redhat.com> <000301cdbd96$f5cd9f10$e168dd30$@muller@ics-cnrs.unistra.fr> <20121122173019.GF9964@adacore.com> <009801cdcb5f$38ecd830$aac68890$@muller@ics-cnrs.unistra.fr> <20121126172227.GB3089@adacore.com>
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> prim_record_minimal_symbol
Joel> -> prim_record_minimal_symbol_full with copy_name=1
Joel> -> SYMBOL_SET_NAMES (msymbol, name, name_len, copy_name, objfile);
Joel> | else
Joel> | {
Joel> | lookup_len = len;
Joel> | lookup_name = linkage_name;
Joel> | linkage_name_copy = linkage_name;
Joel> | }
Joel> |
Joel> | entry.mangled = (char *) lookup_name;
Joel> | slot = ((struct demangled_name_entry **)
Joel> | htab_find_slot (objfile->demangled_names_hash,
Joel> | &entry, INSERT));
Joel> Does it looks like a reference to the string might actually
Joel> get inserted in the htab if not found, thus defeating the
Joel> mechanism above? Tom might be better suited to answer that
Joel> question more authoritatively.
Here, 'entry' is used to look in the hash table, but it is not entered
into the hash table itself. For that you have to go into the subsequent
"*slot == NULL" code; and there it allocates a new entry on the
objfile's obstack. There are two cases, but e.g.:
*slot = obstack_alloc (&objfile->objfile_obstack,
offsetof (struct demangled_name_entry,
demangled)
+ demangled_len + 1);
Joel> In the meantime, one approach that might be equally suitable, but
Joel> without the bug, is if allocate the name on the objfile obstack,
Joel> and then call prim_record_minimal_symbol_full directly
I think there's no need; this is what the 'copy_name=1' case is for.
Tom