Re: spu-gdb vs. stabs

Ulrich Weigand
2006-12-14T17:34:12Z

Alan Modra wrote:

> There are a number of ways to fix this. One is to modify dbxread.c
> to accept a zero return from bfd_get_size. Another is to make the
> default iovec stat function return INT_MAX in st_size to effectively
> circumvent the dbxread.c checks. I chose to extend bfd_openr_iovec
> to accept a user "stat" function so that the actual size can be
> provided, but then cowardly decided to just return a size of INT_MAX
> in the spu implementation for stat. See the comment.

That sounds great, thanks!

> If the kernel
> /proc file used to find the address of a spu embedded binary also
> returned the size then we could easily provide a better stat
> function.

That's not so easy, the information gets lost during embedding
already. It would require ABI changes throughout the process ...

If we really need a proper size at some point, I think parsing
the ELF headers should suffice for that.

> gdb/
> * spu-linux-nat.c (spu_bfd_iovec_stat): New function.
> (spu_bfd_open): Adjust bfd_openr_iovec call.

This is OK, except ...

> +#ifdef INT_MAX
> + sb->st_size = INT_MAX;
> +#else
> + sb->st_size = ((unsigned) -1) >> 1;
> +#endif

... GDB's defs.h already has a fallback definition for INT_MAX,
so you can just use the macro unconditionally here.

Thanks,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com