Re: debugging a callq command

"Mahmood Naderan via gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Excuse me, I missed something while pasting the output. The correct output is:

(gdb) nexti
0x00007fffffffde6e in ?? ()
1: x/20i $pc
=> 0x7fffffffde6e:    jmp    0x7fffffffde7d
   0x7fffffffde70:    pop    %rsi
   0x7fffffffde71:    xor    %ecx,%ecx
   0x7fffffffde73:    mov    $0x21,%cl
   0x7fffffffde75:    xorb   $0x35,(%rsi)
   0x7fffffffde78:    rex.RX loop 0x7fffffffde75
   0x7fffffffde7b:    jmp    0x7fffffffde82
   0x7fffffffde7d:    callq  0x7fffffffde70
   0x7fffffffde82:    pop    %rdi
   0x7fffffffde83:    jae    0x7fffffffdef2
   0x7fffffffde85:    add    $0xee,%al
   0x7fffffffde87:    add    $0xfc,%al
   0x7fffffffde89:    clc    
   0x7fffffffde8a:    mov    $0x4,%ch
   0x7fffffffde8c:    out    %eax,$0x5f
   0x7fffffffde8e:    ds insl (%dx),%es:(%rdi)
   0x7fffffffde90:    addr32 pop %rbp
   0x7fffffffde92:    sbb    0x46(%rdi),%cl
   0x7fffffffde95:    pop    %rbp
   0x7fffffffde96:    pop    %rbp
(gdb) nexti
0x00007fffffffde7d in ?? ()
1: x/20i $pc
=> 0x7fffffffde7d:    callq  0x7fffffffde70
   0x7fffffffde82:    pop    %rdi
   0x7fffffffde83:    jae    0x7fffffffdef2
   0x7fffffffde85:    add    $0xee,%al
   0x7fffffffde87:    add    $0xfc,%al
   0x7fffffffde89:    clc    
   0x7fffffffde8a:    mov    $0x4,%ch
   0x7fffffffde8c:    out    %eax,$0x5f
   0x7fffffffde8e:    ds insl (%dx),%es:(%rdi)
   0x7fffffffde90:    addr32 pop %rbp
   0x7fffffffde92:    sbb    0x46(%rdi),%cl
   0x7fffffffde95:    pop    %rbp
   0x7fffffffde96:    pop    %rbp
   0x7fffffffde97:    sbb    0x5c(%rdi),%dl
   0x7fffffffde9a:    pop    %rbx
   0x7fffffffde9b:    mov    $0xbc6667d6,%esp
   0x7fffffffdea0:    (bad)  
   0x7fffffffdea1:    clc    
   0x7fffffffdea2:    mov    $0x90,%ch
   0x7fffffffdea4:    nop
(gdb) nexti

Program received signal SIGSEGV, Segmentation fault.
0x00007fffffffde8c in ?? ()
1: x/20i $pc
=> 0x7fffffffde8c:    out    %eax,$0x5f
   0x7fffffffde8e:    ds insl (%dx),%es:(%rdi)
   0x7fffffffde90:    addr32 pop %rbp
   0x7fffffffde92:    sbb    0x46(%rdi),%cl
   0x7fffffffde95:    pop    %rbp
   0x7fffffffde96:    pop    %rbp
   0x7fffffffde97:    sbb    0x5c(%rdi),%dl
   0x7fffffffde9a:    pop    %rbx
   0x7fffffffde9b:    mov    $0xbc6667d6,%esp
   0x7fffffffdea0:    (bad)  
   0x7fffffffdea1:    clc    
   0x7fffffffdea2:    mov    $0x90,%ch
   0x7fffffffdea4:    nop
   0x7fffffffdea5:    nop
   0x7fffffffdea6:    nop
   0x7fffffffdea7:    nop
   0x7fffffffdea8:    nop
   0x7fffffffdea9:    nop
   0x7fffffffdeaa:    nop
   0x7fffffffdeab:    nop



Regards,
Mahmood 

    On Friday, July 6, 2018, 3:45:53 PM GMT+4:30, Mahmood Naderan via gdb <[email protected]> wrote:  
 
 Hi,
Trying to debug an assembly code with gdb, I see that a call function to a valid address exists but the control won't go to the target address.

As you can see, the first instruction is a jmp to 0x7fffffffde7d and there, it will call 0x7fffffffde70. However, the next instruction is something else while the program receives seg fault.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.