public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/30107] New: Value history entries not necessarily dissociated from the inferior
@ 2023-02-10  1:44 macro at orcam dot me.uk
  2023-02-10 13:55 ` [Bug exp/30107] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: macro at orcam dot me.uk @ 2023-02-10  1:44 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30107
           Summary: Value history entries not necessarily dissociated from
                    the inferior
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
          Assignee: unassigned at sourceware dot org
          Reporter: macro at orcam dot me.uk
  Target Milestone: ---

We have this comment in `record_latest_value':

   /* We don't want this value to have anything to do with the inferior
anymore.
      In particular, "set $1 = 50" should not affect the variable from which
      the value was taken, and fast watchpoints should be able to assume that
      a value on the value history never changes.  */

however it is not necessarily always the case that the original variable
remains unchanged.  Given gdb/testsuite/gdb.base/max-value-size.c if we set
a breakpoint at `main', run the program and then execute these commands:

  (gdb) print -elements 3 -- one_hundred
  $1 = {0, 1, 2...}
  (gdb) print -elements 3 -- $1
  $2 = {0, 1, 2...}
  (gdb) set $1[0] = -1
  (gdb) print -elements 3 -- $1
  $3 = {0, 1, 2...}
  (gdb) print -elements 3 -- one_hundred
  $4 = {-1, 1, 2...}
  (gdb)

we can see that while the value history itself does not get changed, but
the original variable does.  This is confusing to say the least.

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

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

* [Bug exp/30107] Value history entries not necessarily dissociated from the inferior
  2023-02-10  1:44 [Bug exp/30107] New: Value history entries not necessarily dissociated from the inferior macro at orcam dot me.uk
@ 2023-02-10 13:55 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2023-02-10 13:55 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
It would be great to have "principled" approach to this issue --
meaning one that is clear and can easily be explained and understood.
Right now gdb uses a mix of things.  In addition to the case you
found, if you print a structure, and that struct hold a char*,
gdb will read memory to print the string.  However, this memory
isn't stashed in the value, so later on you can 'print $2' and
see a different string.

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

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

end of thread, other threads:[~2023-02-10 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  1:44 [Bug exp/30107] New: Value history entries not necessarily dissociated from the inferior macro at orcam dot me.uk
2023-02-10 13:55 ` [Bug exp/30107] " tromey at sourceware dot 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).