Set Breakpoint at Entry point fails (GDB)

China☆狼群 提交于 2019-12-10 10:56:01

问题


I'm currently practicing some RE w/ GDB and am having issues simply stopping the run/start on the first/second instruction. I am new to GDB/RE and have a limited knowledge of some of GDB's inner workings. So far when I open the program I have done:

(gdb) set disassembly-flavor intel
(gdb) file /path/to/binary
(gdb) info file
Symbols from "/path/to/binary".                                                                                                
Local exec file:                                                                                                          
    `/path/to/binary', file type elf32-i386.                                                                               
    Entry point: 0x8048450
    .
    .
    .
(gdb) b *0x8048450
(gdb) start
Temporary breakpoint 2 at 0x80485f7                                                                                       
Starting program: /path/to/binary                                                                                              
During startup program exited with code 1.

Another attempt at the program also produced this result:

(gdb) b *0x8048450
Breakpoint 1 at 0x8048450
(gdb) run
Starting program: /bomb/bomb                                                                                              
During startup program exited with code 1.                                                                                

So clearly setting the breakpoint at the entry point is not useful. Below is the output of the command :

 objdump /path/to/binary -M intel -D

At the preceeding memory address.

08048450 <_start>:
 8048450:       31 ed                   xor    ebp,ebp
 8048452:       5e                      pop    esi                                                                        
 8048453:       89 e1                   mov    ecx,esp                                                                    
 8048455:       83 e4 f0                and    esp,0xfffffff0                                                             
 8048458:       50                      push   eax                                                                        
 8048459:       54                      push   esp                                                                        
 804845a:       52                      push   edx                                                                        
 804845b:       68 c0 86 04 08          push   0x80486c0                                                                  
 8048460:       68 60 86 04 08          push   0x8048660                                                                  
 8048465:       51                      push   ecx                                                                        
 8048466:       56                      push   esi                                                                        
 8048467:       68 e9 85 04 08          push   0x80485e9                                                                  
 804846c:       e8 bf ff ff ff          call   8048430     <__libc_start_main@plt>                                            
 8048471:       f4                      hlt                                                                               
 8048472:       66 90                   xchg   ax,ax                                                                      
 8048474:       66 90                   xchg   ax,ax                                                                      
 8048476:       66 90                   xchg   ax,ax                                                                      
 8048478:       66 90                   xchg   ax,ax                                                                      
 804847a:       66 90                   xchg   ax,ax                                                                      
 804847c:       66 90                   xchg   ax,ax                                                                      
 804847e:       66 90                   xchg   ax,ax

My overall goal is to jump to a specific function in the program using the b *Mem, jump *Mem technique and execute the code w/in that function. In order to do this however I need to be able to stop the program while it is running I believe.

来源:https://stackoverflow.com/questions/33086844/set-breakpoint-at-entry-point-fails-gdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!