c - GDB conditional break on function parameter -



c - GDB conditional break on function parameter -

i'm wanting set breakpoint on function parameter if greater value. dummy code below:

int main(void) { uint64_t num = 123456; uint64_t x = 847534; uint64_t other = (num*x) - (x/num); .... other stuff here (multithreaded stuff) calc(other); } void calc(uint64_t size) { ...do stuff size }

i've tried set breakpoint by:

(gdb) b calc if size == 852479

but not know size since parameter i'm guessing. how break if parameter equals number. not alternative break on calls function because gets called billion times in multithreaded environment.

assuming x86-64 calling conventions on gnu/linux platform examine %rdi (64-bit) register straight check function's first parameter:

b calc if $rdi == 852479

this allows break on function calc if don't have debugging symbols loaded (thus no code listing, i.e. list calc).

note method fail if function inlined optimizing compiler.

c gdb

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -