This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Consistent display of "<optimized out>"
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: aburgess at broadcom dot com
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 6 Aug 2013 15:18:22 +0200 (CEST)
- Subject: Re: [PATCH] Consistent display of "<optimized out>"
- References: <5200F55E dot 2050308 at broadcom dot com>
> Date: Tue, 6 Aug 2013 14:08:46 +0100
> From: "Andrew Burgess" <aburgess@broadcom.com>
>
> In some cases we report optimized out registers as "*value not available*"
> rather than "<optimized out>", the patch below makes this more consistent
> in the case I've spotted.
>
> Here's an example:
>
> (gdb) up
> #1 0x0000000000400800 in first_frame () at dw2-reg-undefined.c:27
> 27 in dw2-reg-undefined.c
> (gdb) info registers rax
> rax *value not available*
> (gdb) p/x $rax
> $1 = <optimized out>
>
> After the patch the behaviour is now:
>
> (gdb) up
> #1 0x0000000000400800 in first_frame () at dw2-reg-undefined.c:27
> 27 in dw2-reg-undefined.c
> (gdb) info registers rax
> rax <optimized out>
> (gdb) p/x $rax
> $1 = <optimized out>
>
> The behaviour for values that are unavailable is currently unchanged,
> though I have a follow up patch for this too.
>
> OK to apply?
I'd say no. There is a difference between "unavailable" and
"optimized out". Registers will be unavailable even if you compile
without any optimization, because the ABI specifies that their
contents are not saved across function calls. So "optimized out"
makes very little sense for registers.