public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "lukas.graetz@tu-darmstadt.de" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31436] <error reading variable: value has been optimized out> with .cfi_undefined
Date: Thu, 29 Feb 2024 19:39:31 +0000	[thread overview]
Message-ID: <bug-31436-4717-5QZZoOU29l@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31436-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31436

--- Comment #1 from Lukas Grätz <lukas.graetz@tu-darmstadt.de> ---
(In reply to Lukas Grätz from comment #0) 
> The backtrace is still incorrect (also observed in [2]):
> 
> $ gdb bar-artificial-fix-undefined
> GNU gdb (GDB) 15.0.50.20240229-git
> 
> (gdb) run
> Starting program: bar-artificial-fix-undefined
> 
> Program received signal SIGABRT, Aborted.
> 0x00007ffff7dee00b in raise () from /lib/x86_64-linux-gnu/libc.so.6
> (gdb) bt
> #0  0x00007ffff7dee00b in raise () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x00007ffff7dcd859 in abort () from /lib/x86_64-linux-gnu/libc.so.6
> #2  0x00000000004011b0 in bar () at bar-artificial.c:30
> #3  0x00000000004011d1 in baz (
>     a=<error reading variable: value has been optimised out>, 
>     b=<optimised out>, c=<optimised out>, d=<optimised out>, 
>     e=<optimised out>, f=<optimised out>, g=48, h=49) at bar-artificial.c:38
> 
> 
> Here, the backtrace did not reach the functions qux() and main(). In this
> case, the stack base pointer rbp was clobbered and marked with
> .cfi_undefined. But it still should be possible without rbp to reconstruct
> the backtrace.


Edit: The last sentence was partly incorrect, I re-checked the assembler code.
In qux(), there is a:

        movq    %rsp, %rbp
        .cfi_def_cfa_register 6

And then rsp is clobbered in qux(). And rbp is clobbert in bar(). So the return
address from qux() is lost and main() cannot be reached by the backtrace. But
the backtrace should still have reached qux(). And the parameters a,b,c of
baz() are also reconstructable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-02-29 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 17:55 [Bug gdb/31436] New: " lukas.graetz@tu-darmstadt.de
2024-02-29 18:07 ` [Bug gdb/31436] " lukas.graetz@tu-darmstadt.de
2024-02-29 19:39 ` lukas.graetz@tu-darmstadt.de [this message]
2024-03-01  7:50 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31436-4717-5QZZoOU29l@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).