disassembly c program with gdb get error


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     
   mov eax, 1
   mov ebx, 2
   add eax, ebx

root@kali-linux:~/my-document/test# gdb ./first 
GNU gdb (Debian 7.12-6)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show 
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:
Find the GDB manual and other documentation resources online at:
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 
Cannot insert breakpoint 1.
Cannot access memory at address 0x4fa


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