This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Add DW_FORM_strp support


Jakub Jelinek writes:
 > On Thu, Nov 08, 2001 at 10:26:29PM -0500, Andrew Cagney wrote:
 > > > +#if HOST_CHAR_BIT == 8
 > > > +  if (dwarf_str_buffer[str_offset] == '\0')
 > > > +    return NULL;
 > > > +  return dwarf_str_buffer + str_offset;
 > > > +#else
 > > > +  {
 > > > +    unsigned int len;
 > > > +
 > > > +    return read_string (abfd, dwarf_str_buffer + str_offset, &len);
 > > > +  }
 > > > +#endif
 > > 
 > > Just FYI (this isn't my file :-).  If the HOST's char size isn't 8, GDB 
 > > won't even build (grep for ``you loose'' in the sources).  A 
 > > ``gdb_assert (HOST_CHAR_SIZE == 8)'' wouldn't hurt though.  If the test 
 > > has something to do with the target's object file's char size though 
 > > then the above is wrong.
 > 
 > read_string does this, so I wanted to match what it does too.
 > 
 > 	Jakub


Jakub, we need this patch in gdb now, because it is broken with the
current gcc, which emits DW_FORM_strp. 

These checks for HOST_CHAR_BITS are only in dwarf2read.c in
read_string and read_n_bytes. They were introduced by Peter Schauer
in 1996:

Sun Dec  1 00:18:59 1996  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)

	Add support for Irix 6.2 native O32 and N32 ABI.
[...]
	* dwarf2read.c: (read_n_bytes, read_string): Allocate storage
	from the temporary obstack. If the host char size permits it,
	return pointer to buffer instead of allocating storage.


I think the test was correct at the time.  Can you address Andrew's
concern by changing the test into an assert (and getting rid of the
#else part) and repost the patch?
(We should clean the other two tests similarly in a second pass).

Otherwise the patch looks fine to me.
JimB, any comments?

I am currently using you patch and it seems to work fine.

Thanks
Elena


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]