Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break on assembly instruction at a given address in gdb?

Tags:

assembly

gdb

0x0000000000400448 <main+0>:    push   %rbp 0x0000000000400449 <main+1>:    mov    %rsp,%rbp 0x000000000040044c <main+4>:    mov    $0x6,%eax 0x0000000000400451 <main+9>:    leaveq  0x0000000000400452 <main+10>:   retq    

I tried:

breaki 0x0000000000400448 

but it seems that there not such command.

Does gdb have such a feature?

like image 662
compile-fan Avatar asked Mar 28 '11 13:03

compile-fan


People also ask

How do you set a breakpoint at a specific line in GDB?

Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.

What is a breakpoint in assembly?

A breakpoint is traditionally defined as a place in your program where you want execution to stop so that you can examine program variables and data structures. A watchpoint causes your program to be executed one instruction or source line at a time, watching for the value of an expression to become true.

How do I show breakpoints in GDB?

You can see these breakpoints with the GDB maintenance command `maint info breakpoints' . Using the same format as `info breakpoints' , display both the breakpoints you've set explicitly, and those GDB is using for internal purposes. Internal breakpoints are shown with negative breakpoint numbers.

How do you step out in GDB?

Bookmark this question. Show activity on this post. Those who use Visual Studio will be familiar with the Shift + F11 hotkey, which steps out of a function, meaning it continues execution of the current function until it returns to its caller, at which point it stops.


1 Answers

try break *0x0000000000400448

like image 143
Laurent G Avatar answered Oct 03 '22 11:10

Laurent G