public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31369] New: [gdb] command aborted with debug frame
Date: Sun, 11 Feb 2024 11:50:18 +0000	[thread overview]
Message-ID: <bug-31369-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31369
           Summary: [gdb] command aborted with debug frame
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I investigated some problem on arm-linux in a gdb.in script, and added "set
debug frame on".

I ran into:
...
[frame] frame_unwind_register_value: exit
gdb.in:9: Error in sourced command file:
value is not available
...
and the script stopped.

The corresponding backtrace is:
...
(gdb) bt
#0  0xf75906d2 in __cxa_throw () from
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#1  0xab1ccffa in throw_it (reason=RETURN_ERROR, error=NOT_AVAILABLE_ERROR, 
    fmt=0xab3098ec "value is not available", ap=...)
    at /home/rock/gdb/src/gdbsupport/common-exceptions.cc:204
#2  0xab1cd076 in throw_verror (error=NOT_AVAILABLE_ERROR, 
    fmt=0xab3098ec "value is not available", ap=...)
    at /home/rock/gdb/src/gdbsupport/common-exceptions.cc:212
#3  0xab1cd0a8 in throw_error (error=NOT_AVAILABLE_ERROR, 
    fmt=0xab3098ec "value is not available")
    at /home/rock/gdb/src/gdbsupport/common-exceptions.cc:227
#4  0xab0490b6 in value::require_available (this=0xab5975d8)
    at /home/rock/gdb/src/gdb/value.c:1137
#5  0xab0499b0 in value::contents (this=0xab5975d8)
    at /home/rock/gdb/src/gdb/value.c:1307
#6  0xaad837ec in frame_unwind_register_value (next_frame=..., regnum=91)
    at /home/rock/gdb/src/gdb/frame.c:1320
#7  0xab04eae8 in value::fetch_lazy_register (this=0xab542d68)
    at /home/rock/gdb/src/gdb/value.c:3962
#8  0xab04f09c in value::fetch_lazy (this=0xab542d68)
    at /home/rock/gdb/src/gdb/value.c:4057
#9  0xab049a50 in value::optimized_out (this=0xab542d68)
    at /home/rock/gdb/src/gdb/value.c:1339
#10 0xaad83718 in frame_unwind_register_value (next_frame=..., regnum=91)
    at /home/rock/gdb/src/gdb/frame.c:1299
#11 0xaad8316e in frame_register_unwind (next_frame=..., regnum=91, 
    optimizedp=0xfffee5a4, unavailablep=0xfffee5a0, lvalp=0xfffee5a8,
addrp=0xfffee598, 
    realnump=0xfffee594, bufferp=0x0) at /home/rock/gdb/src/gdb/frame.c:1190
#12 0xaaf3f2ba in info_frame_command_core (fi=..., selected_frame_p=false)
    at /home/rock/gdb/src/gdb/stack.c:1761
#13 0xaaf448c6 in frame_command_helper<info_frame_command_core>::level (
    arg=0xfffef17f "0", from_tty=0) at /home/rock/gdb/src/gdb/stack.c:1891
#14 0xaaf444b4 in frame_command_helper<info_frame_command_core>::base_command (
    arg=0xfffef17f "0", from_tty=0) at /home/rock/gdb/src/gdb/stack.c:1966
#15 0xaac2774e in do_simple_func (args=0xfffef17f "0", from_tty=0,
c=0xab4d42c0)
    at /home/rock/gdb/src/gdb/cli/cli-decode.c:95
#16 0xaac2afaa in cmd_func (cmd=0xab4d42c0, args=0xfffef17f "0", from_tty=0)
    at /home/rock/gdb/src/gdb/cli/cli-decode.c:2742
#17 0xaafac12a in execute_command (p=0xfffef17f "0", from_tty=0)
    at /home/rock/gdb/src/gdb/top.c:571
#18 0xaad5c76a in command_handler (command=0xfffef174 "info frame 0")
    at /home/rock/gdb/src/gdb/event-top.c:566
#19 0xaafab920 in read_command_file (stream=0xab4b9818)
    at /home/rock/gdb/src/gdb/top.c:338
#20 0xaac3678e in script_from_file (stream=0xab4b9818, file=0xfffef811
"gdb.in")
    at /home/rock/gdb/src/gdb/cli/cli-script.c:1644
#21 0xaac205d6 in source_script_from_stream (stream=0xab4b9818, 
    file=0xfffef811 "gdb.in", file_to_open=0xfffef268 "gdb.in")
    at /home/rock/gdb/src/gdb/cli/cli-cmds.c:730
#22 0xaac206dc in source_script_with_search (file=0xfffef811 "gdb.in",
from_tty=0, 
    search_path=0) at /home/rock/gdb/src/gdb/cli/cli-cmds.c:775
#23 0xaac20730 in source_script (file=0xfffef811 "gdb.in", from_tty=0)
    at /home/rock/gdb/src/gdb/cli/cli-cmds.c:784
#24 0xaae3516c in catch_command_errors (
    command=0xaac2071d <source_script(char const*, int)>, arg=0xfffef811
"gdb.in", 
    from_tty=0, do_bp_actions=false) at /home/rock/gdb/src/gdb/main.c:507
#25 0xaae352e6 in execute_cmdargs (cmdarg_vec=0xfffef404,
file_type=CMDARG_FILE, 
    cmd_type=CMDARG_COMMAND, ret=0xfffef3f4) at
/home/rock/gdb/src/gdb/main.c:603
#26 0xaae36714 in captured_main_1 (context=0xfffef544)
    at /home/rock/gdb/src/gdb/main.c:1304
#27 0xaae368e2 in captured_main (data=0xfffef544) at
/home/rock/gdb/src/gdb/main.c:1325
#28 0xaae3694c in gdb_main (args=0xfffef544) at
/home/rock/gdb/src/gdb/main.c:1354
#29 0xaaaee8ea in main (argc=5, argv=0xfffef6b4) at
/home/rock/gdb/src/gdb/gdb.c:39
...

The problem is here in frame_unwind_register_value:
...
          if (value->lazy ())
            gdb_printf (&debug_file, " lazy");
          else
            {
              int i;
              gdb::array_view<const gdb_byte> buf = value->contents ();
...

It doesn't check for the value->entirely_available () case.

This fixes it:
...
diff --git a/gdb/frame.c b/gdb/frame.c
index fae89cbbc0a..4b97c23e3d5 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1314,6 +1314,8 @@ frame_unwind_register_value (frame_info_ptr next_frame,
int
 regnum)

          if (value->lazy ())
            gdb_printf (&debug_file, " lazy");
+         else if (!value->entirely_available ())
+           gdb_printf (&debug_file, " unavailable");
          else
            {
              int i;
...

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

             reply	other threads:[~2024-02-11 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 11:50 vries at gcc dot gnu.org [this message]
2024-02-12 14:57 ` [Bug gdb/31369] " vries at gcc dot gnu.org
2024-02-26 14:31 ` cvs-commit at gcc dot gnu.org
2024-02-26 14:32 ` vries at gcc dot gnu.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-31369-4717@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).