public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Question about disassembly
@ 2021-03-11 12:06 Mahmood Naderan
  2021-03-11 12:16 ` Christian Biesinger
  0 siblings, 1 reply; 5+ messages in thread
From: Mahmood Naderan @ 2021-03-11 12:06 UTC (permalink / raw)
  To: gdb

Hi
How can I debug disassembly instructions with "step" or "next"?
Right now, then I use 'n' it seems that gdb executes multiple assembly
instructions and then stops. Sound like it uses the source level debugging.

Any idea about that?

Regards,
Mahmood

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

* Re: Question about disassembly
  2021-03-11 12:06 Question about disassembly Mahmood Naderan
@ 2021-03-11 12:16 ` Christian Biesinger
  2021-03-11 12:22   ` Andrew Dinn
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Biesinger @ 2021-03-11 12:16 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: Reuben Thomas via Gdb

On Thu, Mar 11, 2021, 13:07 Mahmood Naderan via Gdb <gdb@sourceware.org>
wrote:

> Hi
> How can I debug disassembly instructions with "step" or "next"?
> Right now, then I use 'n' it seems that gdb executes multiple assembly
> instructions and then stops. Sound like it uses the source level debugging.
>

Use stepi / nexti

Christian


> Any idea about that?
>
> Regards,
> Mahmood
>

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

* Re: Question about disassembly
  2021-03-11 12:16 ` Christian Biesinger
@ 2021-03-11 12:22   ` Andrew Dinn
  2021-03-11 12:29     ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Dinn @ 2021-03-11 12:22 UTC (permalink / raw)
  To: gdb

On 11/03/2021 12:16, Christian Biesinger via Gdb wrote:
> On Thu, Mar 11, 2021, 13:07 Mahmood Naderan via Gdb <gdb@sourceware.org>
> wrote:
> 
>> Hi
>> How can I debug disassembly instructions with "step" or "next"?
>> Right now, then I use 'n' it seems that gdb executes multiple assembly
>> instructions and then stops. Sound like it uses the source level debugging.
>>
> 
> Use stepi / nexti
You will probably want to print the next instruction after each step 
which can be done using x/i $pc.

I use the following command definitions (added to my .gdbinit).

define si
   stepi
   x/i $pc
end

define ni
   nexti
   x/i $pc
end

regards,


Andrew Dinn
-----------


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

* Re: Question about disassembly
  2021-03-11 12:22   ` Andrew Dinn
@ 2021-03-11 12:29     ` Andreas Schwab
  2021-03-11 23:27       ` Ruslan Kabatsayev
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2021-03-11 12:29 UTC (permalink / raw)
  To: Andrew Dinn via Gdb

On Mär 11 2021, Andrew Dinn via Gdb wrote:

> You will probably want to print the next instruction after each step which
> can be done using x/i $pc.

You can do that with disp/i $pc.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: Question about disassembly
  2021-03-11 12:29     ` Andreas Schwab
@ 2021-03-11 23:27       ` Ruslan Kabatsayev
  0 siblings, 0 replies; 5+ messages in thread
From: Ruslan Kabatsayev @ 2021-03-11 23:27 UTC (permalink / raw)
  To: Andreas Schwab, mahmood.nt; +Cc: Andrew Dinn via Gdb

On Thu, 11 Mar 2021 at 16:10, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> On Mär 11 2021, Andrew Dinn via Gdb wrote:
>
> > You will probably want to print the next instruction after each step which
> > can be done using x/i $pc.
>
> You can do that with disp/i $pc.

Or, maybe even easier, use TUI. Namely, issue the command "layout
asm", and you won't need disp/i. (Press Ctrl-x followed by "a" key to
return to normal, non-TUI, mode.)
You may also find Single Key mode of the TUI useful. To use it, in the
TUI press Ctrl-x followed by key "s". Now you can step into
instruction by single key "i" (as if using "stepi"), and step over by
key "o" (as if using "nexti"). To exit single-key mode hit "q" key.
For more single-key commands see "TUI Single Key Mode" in the docs
[1].

[1]: https://sourceware.org/gdb/onlinedocs/gdb/TUI-Single-Key-Mode.html

>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."

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

end of thread, other threads:[~2021-03-11 23:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 12:06 Question about disassembly Mahmood Naderan
2021-03-11 12:16 ` Christian Biesinger
2021-03-11 12:22   ` Andrew Dinn
2021-03-11 12:29     ` Andreas Schwab
2021-03-11 23:27       ` Ruslan Kabatsayev

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