disassembly c program with gdb get error

0

When I disassemble c program with gdb, I get error. I googled it but no result found that I want. Can someone help me?

my document first.asm is:

global main     
main:
   mov eax, 1
   mov ebx, 2
   add eax, ebx
   ret                                                                                                                                         






root@kali-linux:~/my-document/test# gdb ./first 
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show 
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./first...(no debugging symbols found)...done.
(gdb) set disassembly-flavor intel
(gdb) disas main
Dump of assembler code for function main:
   0x000004f0 <+0>: mov    eax,0x1
   0x000004f5 <+5>: mov    ebx,0x2
   0x000004fa <+10>:    add    eax,ebx
   0x000004fc <+12>:    ret    
   0x000004fd <+13>:    xchg   ax,ax
   0x000004ff <+15>:    nop
End of assembler dump.
(gdb) break *0x000004fa
Breakpoint 1 at 0x4fa
(gdb) run
Starting program: /root/my-document/test/first 
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x4fa

(gdb) 

Here is error: enter image description here

I restart disassemble c program with gdb,and I do it with b 4 instead of break*0x000004fa and run the code ,it still can not work!

I think the correct output should be:

(gdb) run
Starting program: /root/my-document/test/first
Breakpoint 1, 0x000004fa in main()
(gdb)
c
gdb
disassembly
asked on Stack Overflow Oct 1, 2017 by (unknown user) • edited Oct 2, 2017 by (unknown user)

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0