Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running code inside gdb debugger

Tags:

c

gdb

Is it possible to run code inside gdb? For example, if I were debugging a .c file, and I wanted to get the strlen() of a character array at a particular point in time, I can't just type in strlen(str) into the buffer - it is an invalid command. What can I do?

like image 556
George Newton Avatar asked Jun 22 '26 16:06

George Newton


1 Answers

From gdb prompt call strlen(the_char_array). Eg.,

(gdb) call strlen(the_char_array)
like image 184
Nipun Talukdar Avatar answered Jun 24 '26 05:06

Nipun Talukdar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!