public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Is there a way to define a macro?
@ 2005-09-15 12:24 wmaple
  0 siblings, 0 replies; 4+ messages in thread
From: wmaple @ 2005-09-15 12:24 UTC (permalink / raw)
  To: gdb

Hi.

When I debug a program on disassambly level, for inspecting registers or memory units, I have to enter same commands again and again. For example, after execution of each instruction, I want to inspecting all common registers. So, every time, I have to enter command 'info register' several times. Is there a way to define a macro, by which I can enter these commands conveniently.

Thanks!



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

* Re: Is there a way to define a macro?
       [not found] <200509151224.j8FCOaR5030806@truba.ispras.ru>
@ 2005-09-15 12:44 ` Konstantin Karganov
  0 siblings, 0 replies; 4+ messages in thread
From: Konstantin Karganov @ 2005-09-15 12:44 UTC (permalink / raw)
  To: wmaple; +Cc: gdb

On Thu, 15 Sep 2005, wmaple wrote:

> Hi.
> 
> When I debug a program on disassambly level, for inspecting registers or 
> memory units, I have to enter same commands again and again. For 
> example, after execution of each instruction, I want to inspecting all common 
> registers. So, every time, I have to enter command 'info register' several 
> times. Is there a way to define a macro, by which I can enter these 
> commands conveniently.
> Thanks!
You need to use command hooks (see section 20.2 of UsersGuide for 
details).

I.e. putting this in your .gdbinit will print registers automatically on 
each "next" command:

  define hook-next
  info registers
  end


Best regards,
Konstantin.

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

* Re: Is there a way to define a macro?
  2005-09-15 12:33 ` Bob Rossi
@ 2005-09-15 12:41   ` Vincent Rubiolo
  0 siblings, 0 replies; 4+ messages in thread
From: Vincent Rubiolo @ 2005-09-15 12:41 UTC (permalink / raw)
  To: Bob Rossi; +Cc: wmaple, gdb

Hello,

You may also want to take a look at automatic display, which can also 
and save you lots of keystrokes.

See http://sources.redhat.com/gdb/current/onlinedocs/gdb_9.html#SEC62 
for more details,

Cheers,

Vincent

Bob Rossi wrote:
> On Thu, Sep 15, 2005 at 08:22:44PM +0800, wmaple wrote:
> 
>>Hi.
>>
>>When I debug a program on disassambly level, for inspecting registers or memory units, I have to enter same commands again and again. For example, after execution of each instruction, I want to inspecting all common registers. So, every time, I have to enter command 'info register' several times. Is there a way to define a macro, by which I can enter these commands conveniently.
>>
>>Thanks!
> 
> 
> Yes, try something like this,
> 
> define macro1
>    b main
>    r
>    next
>    next
>    next
> end
> 
> Put that in your .gdbinit file and then start up GDB and type 'macro1'
> to get it to execute the commands.
> 
> Bob Rossi

-- 
Using Firefox and Thunderbird at Wind River:
http://twiki.wrs.com/do/view/ENGtools/MozillaAtWindriver

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

* Re: Is there a way to define a macro?
       [not found] <20050915122428.XNUA13028.eastrmgxi08.cox.net@sourceware.org>
@ 2005-09-15 12:33 ` Bob Rossi
  2005-09-15 12:41   ` Vincent Rubiolo
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Rossi @ 2005-09-15 12:33 UTC (permalink / raw)
  To: wmaple; +Cc: gdb

On Thu, Sep 15, 2005 at 08:22:44PM +0800, wmaple wrote:
> Hi.
> 
> When I debug a program on disassambly level, for inspecting registers or memory units, I have to enter same commands again and again. For example, after execution of each instruction, I want to inspecting all common registers. So, every time, I have to enter command 'info register' several times. Is there a way to define a macro, by which I can enter these commands conveniently.
> 
> Thanks!

Yes, try something like this,

define macro1
   b main
   r
   next
   next
   next
end

Put that in your .gdbinit file and then start up GDB and type 'macro1'
to get it to execute the commands.

Bob Rossi

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

end of thread, other threads:[~2005-09-15 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-15 12:24 Is there a way to define a macro? wmaple
     [not found] <20050915122428.XNUA13028.eastrmgxi08.cox.net@sourceware.org>
2005-09-15 12:33 ` Bob Rossi
2005-09-15 12:41   ` Vincent Rubiolo
     [not found] <200509151224.j8FCOaR5030806@truba.ispras.ru>
2005-09-15 12:44 ` Konstantin Karganov

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