Re: RFC: Demangle partial symbols and save memory too

David Carlton
2003-01-27T22:09:59Z

On Mon, 27 Jan 2003 16:21:46 -0500, Andrew Cagney <ac131313@redhat.com> said:

> The more `char *' -> `const char *' stomping, the better.

I spent some time on my branch trying to make this change quite
broadly (basically, turning name members of various structs into const
char *'s and dealing with the fallout). It ran into some serious
problems, though; I seem to recall that, ultimately, they came down to
decode_line_1 taking a char ** instead of a const char **. And
decode_line_1 really does (temporarily) change the characters that are
pointed to, unfortunately. So if we ever want to get this right
across the board, fixing decode_line_1 is probably the main
outstanding task.

I also toyed with trying to replace 'struct XXX *' with 'const struct
XXX *' wherever appropriate. That one's harder, though, because there
are structures in GDB where values are computed lazily and cached: so
not only are there functions that are logically const but not actually
const, but I also worried that making too many declarations const now
would inhibit such caching in the future. Maybe in a couple of years
we can switch GDB over to C++ instead of C and use 'mutable'...

David Carlton
carlton@math.stanford.edu