This is the mail archive of the
mailing list for the GDB project.
Re: RFA: Don't use obsavestring in dwarf2read
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: drow at mvista dot com, gdb-patches at sources dot redhat dot com
- Date: Thu, 15 Jan 2004 09:23:08 -0500 (EST)
- Subject: Re: RFA: Don't use obsavestring in dwarf2read
I proofread this. I didn't think it worthwhile to run the test suite,
because almost all tests are simple "load file / run / exit" that would
not catch memory lifetime bugs.
I have one concern. read_string and read_indirect_string return NULL to
indicate a zero-length string. obstack_savestring understands this and
copies an empty string "" into the obstack. In most of your changes,
the string pointer is protected against being NULL, but in other
changes, it is possible for the string pointer to be NULL. If the
string is NULL, then your code will produce slightly different results
than previously, which is a bit scary in the symtab reader.
So could you do this in two places:
SET_FIELD_PHYSNAME (*fp, physname ? physname : "");
fnp->physname = physname ? physname : "";
Other than that, it looks okay to me. I stared at it for a while to
check that everything is coming from psymbol_obstack and symbol_obstack,
not dwarf2_tmp_obstack or alloca'd memory.