Re: RFA: Don't use obsavestring in dwarf2read

Michael Elizabeth Chastain
2004-01-15T14:23:52Z

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.

Michael C