This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Can back trace be stopped from always prints "char*" strings ?
- From: Michael Snyder <msnyder at specifix dot com>
- To: Chris Johns <chrisj at rtems dot org>
- Cc: gdb at sourceware dot org
- Date: Wed, 12 Mar 2008 12:03:05 -0700
- Subject: Re: Can back trace be stopped from always prints "char*" strings ?
- References: <47D79ECF.7000900@rtems.org>
On Wed, 2008-03-12 at 20:13 +1100, Chris Johns wrote:
> Hello,
>
> I have a union being passed to a function. The union is:
>
> typedef union {
> /** This is a pointer to a string name. */
> const char *name_p;
> /** This is the actual 32-bit "raw" integer name. */
> uint32_t name_u32;
> } Objects_Name;
>
> The problem is the bt command ties to read the string pointed to by name_p
> how-ever this can be any value if the name_u32 field has been set. This has
> side effects on the embedded target I am using like killing the session.
>
> Is there a way to stop the bt accessing the char* data and just printing the
> pointer value ?
Close...
The closest we have is "set print elements", which will set a limit
on how many elements of an array (including a string) are printed
by default. Unfortunately, zero has been used to mean "no limit",
otherwise it would do exactly what you want.
If you "set print elements 1", it will only print the first byte
of the string -- maybe that will help?
Gosh guys, it would mean changing documented behavior, but maybe
we ought to consider making zero mean zero, and maybe making -1
mean "unlimited"...