public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31369] New: [gdb] command aborted with debug frame
@ 2024-02-11 11:50 vries at gcc dot gnu.org
  2024-02-12 14:57 ` [Bug gdb/31369] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-11 11:50 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/31369] [gdb] command aborted with debug frame
  2024-02-11 11:50 [Bug gdb/31369] New: [gdb] command aborted with debug frame vries at gcc dot gnu.org
@ 2024-02-12 14:57 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-12 14:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2024-February/206526.html

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/31369] [gdb] command aborted with debug frame
  2024-02-11 11:50 [Bug gdb/31369] New: [gdb] command aborted with debug frame vries at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-26 14:31 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2aaba7444679492ae9e2757d7d05ba63bd2ec3c7

commit 2aaba7444679492ae9e2757d7d05ba63bd2ec3c7
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Feb 26 15:31:34 2024 +0100

    [gdb] Fix "value is not available" with debug frame

    On arm-linux, with a started hello world, running "info frame" works fine,
but
    when I set debug frame to on, I run into:
    ...
    (gdb) info frame
      ...
    [frame] frame_unwind_register_value: exit
    value is not available
    (gdb)
    ...

    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 ();
    ...
    where we call value->contents () while !value->entirely_available ().

    Fix this by checking value->entirely_available () and printing:
    ...
        [frame] frame_unwind_register_value:   -> register=91 unavailable
    ...

    Tested on arm-linux.

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/31369] [gdb] command aborted with debug frame
  2024-02-11 11:50 [Bug gdb/31369] New: [gdb] command aborted with debug frame vries at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-26 14:32 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |15.1
             Status|NEW                         |RESOLVED

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-26 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11 11:50 [Bug gdb/31369] New: [gdb] command aborted with debug frame vries at gcc dot gnu.org
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

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).