This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/22763] New: "info registers" for calling frames should show which registers are caller-saved


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

            Bug ID: 22763
           Summary: "info registers" for calling frames should show which
                    registers are caller-saved
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com
  Target Milestone: ---

If you select a calling frame (a frame other than #0) and do info registers,
GDB shows a value for all registers.  Some of these registers are callee-saved,
therefore we know what value they will have when execution returns to that
frame.  If a callee has saved the value of a callee-saved register somewhere,
GDB is able to retrieve it using the DWARF information and shows it.  If no
callee uses that register, then the value in the current frame (which GDB
shows) should be the same value as for the selected frame, so the value should
be right.

However, for caller-saved registers, we don't really know what value they will
have when execution returns to the selected frame.  As a best guess, GDB shows
the current value.  In that case, I think there should be an indication to the
user the shown value is not necessarily the value the register will have when
the execution returns to the frame they are inspecting.

I would suggest adding an asterisk next to those, with an explanation (a bit
like with "info shared", when a library is missing debug info):

(gdb) frame 4
(gdb) info reg
rax (*)        0x7fffffffd883   140737488345219
...
(*) This is a caller-saved register, so this register may not hold the same
value when execution returns to frame 4.

There's a paragraph at the bottom of

  https://sourceware.org/gdb/onlinedocs/gdb/Registers.html

about what GDB shows in "info registers" for caller and callee-saved registers.
 However, I don't remember ever seeing the '<not saved>' value.

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]