This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: Is there any assembly language debugger?


Hi,

On Wed, Sep 18, 2019 at 10:33:10AM +0530, Mayuresh Kathe wrote:

> GDB looks interesting but too convoluted for my needs.

A quick way to make gdb immediately usable for assembler debugging is the
command

(gdb) display /4i $pc

This sets up a repeating display for the next four assembler instructions,
so you can single-step using the "si" (step instruction) and "ni" (next
instruction) commands, and immediately get a listing. For example:

(gdb) display /4i $pc
1: x/4i $pc
=> 0x555555567c35 <main(int, char**)+27>:       lea    0xeae0(%rip),%rdi        # 0x55555557671c
   0x555555567c3c <main(int, char**)+34>:       callq  0x555555568050 <QTextCodec::codecForName(char const*)>
   0x555555567c41 <main(int, char**)+39>:       mov    %rax,%rdi
   0x555555567c44 <main(int, char**)+42>:       callq  0x5555555680b2 <QTextCodec::setCodecForCStrings(QTextCodec*)>
(gdb) si
0x0000555555567c3c      16          QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
1: x/4i $pc
=> 0x555555567c3c <main(int, char**)+34>:       callq  0x555555568050 <QTextCodec::codecForName(char const*)>
   0x555555567c41 <main(int, char**)+39>:       mov    %rax,%rdi
   0x555555567c44 <main(int, char**)+42>:       callq  0x5555555680b2 <QTextCodec::setCodecForCStrings(QTextCodec*)>
   0x555555567c49 <main(int, char**)+47>:       mov    -0xa0(%rbp),%rdx
(gdb) ni
0x0000555555567c41      16          QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
1: x/4i $pc
=> 0x555555567c41 <main(int, char**)+39>:       mov    %rax,%rdi
   0x555555567c44 <main(int, char**)+42>:       callq  0x5555555680b2 <QTextCodec::setCodecForCStrings(QTextCodec*)>
   0x555555567c49 <main(int, char**)+47>:       mov    -0xa0(%rbp),%rdx
   0x555555567c50 <main(int, char**)+54>:       lea    -0x94(%rbp),%rsi
(gdb) si
0x0000555555567c44      16          QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
1: x/4i $pc
=> 0x555555567c44 <main(int, char**)+42>:       callq  0x5555555680b2 <QTextCodec::setCodecForCStrings(QTextCodec*)>
   0x555555567c49 <main(int, char**)+47>:       mov    -0xa0(%rbp),%rdx
   0x555555567c50 <main(int, char**)+54>:       lea    -0x94(%rbp),%rsi
   0x555555567c57 <main(int, char**)+61>:       lea    -0x60(%rbp),%rax
(gdb) si
QTextCodec::setCodecForCStrings (c=0x0) at /usr/include/qt4/QtCore/qtextcodec.h:158
158     inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; }
1: x/4i $pc
=> 0x5555555680b2 <QTextCodec::setCodecForCStrings(QTextCodec*)>:       push   %rbp
   0x5555555680b3 <QTextCodec::setCodecForCStrings(QTextCodec*)+1>:     mov    %rsp,%rbp
   0x5555555680b6 <QTextCodec::setCodecForCStrings(QTextCodec*)+4>:     mov    %rdi,-0x8(%rbp)
   0x5555555680ba <QTextCodec::setCodecForCStrings(QTextCodec*)+8>:     mov    -0x8(%rbp),%rax

   Simon


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