public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/13487] New: Hook for next command shows previous value for register.
@ 2011-12-09  1:15 ray.seyfarth at gmail dot com
  2011-12-09  1:15 ` [Bug gdb/13487] " ray.seyfarth at gmail dot com
  2011-12-09 10:07 ` pedro at codesourcery dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ray.seyfarth at gmail dot com @ 2011-12-09  1:15 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13487

             Bug #: 13487
           Summary: Hook for next command shows previous value for
                    register.
           Product: gdb
           Version: 7.3
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: ray.seyfarth@gmail.com
    Classification: Unclassified


When you enter a hook for the next command which refers to a register, the
value of the register is what it was before the instruction was executed.  This
matters in assembly programming.  Let's suppose you enter:

define hook-next
print $rsp
end

If the value of $rsp is 0x7ffffff8050 and the next instruction is "sub rsp,
80", the value printed after issuing the "next" command remains as
0x7fffffff8050.  After the next "next" command the hook will print
0x7fffffff8000.

This is a minor issue.  It probably will confuse beginning assembly
programmers, but people with more experience will guess rapidly what is
happening.  In my case I have this as part of a package using python scripts
which will allow watching various things including the top elements of the
stack.  My students will be less confused if the value is immediately available
to the hook-next macro.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/13487] Hook for next command shows previous value for register.
  2011-12-09  1:15 [Bug gdb/13487] New: Hook for next command shows previous value for register ray.seyfarth at gmail dot com
@ 2011-12-09  1:15 ` ray.seyfarth at gmail dot com
  2011-12-09 10:07 ` pedro at codesourcery dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ray.seyfarth at gmail dot com @ 2011-12-09  1:15 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13487

Ray Seyfarth <ray.seyfarth at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ray.seyfarth at gmail dot
                   |                            |com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/13487] Hook for next command shows previous value for register.
  2011-12-09  1:15 [Bug gdb/13487] New: Hook for next command shows previous value for register ray.seyfarth at gmail dot com
  2011-12-09  1:15 ` [Bug gdb/13487] " ray.seyfarth at gmail dot com
@ 2011-12-09 10:07 ` pedro at codesourcery dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pedro at codesourcery dot com @ 2011-12-09 10:07 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13487

Pedro Alves <pedro at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |pedro at codesourcery dot
                   |                            |com
         Resolution|                            |INVALID

--- Comment #1 from Pedro Alves <pedro at codesourcery dot com> 2011-12-09 10:06:34 UTC ---
hook-next executes before next is executed, as per the manual:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hooks
User-defined Command Hooks

hook
You may define hooks, which are a special kind of user-defined
command.  Whenever you run the command foo, if the user-defined
command hook-foo exists, it is executed (with no arguments)
before that command.

hooks, post-command
hookpost

A hook may also be defined which is run after the command you executed.
Whenever you run the command foo, if the user-defined command
hookpost-foo exists, it is executed (with no arguments) after
that command.  Post-execution hooks may exist simultaneously with
pre-execution hooks, for the same command.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You need to define hookpost-next instead:

define hookpost-next
print $rsp
end

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2011-12-09 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09  1:15 [Bug gdb/13487] New: Hook for next command shows previous value for register ray.seyfarth at gmail dot com
2011-12-09  1:15 ` [Bug gdb/13487] " ray.seyfarth at gmail dot com
2011-12-09 10:07 ` pedro at codesourcery dot com

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