Useful info for debugging

  • hexdump -C <file_name>. Displays ASCII value of the file. Very useful to debug errors while you are interested in a string value.
  • Always enable a single breakpoint in a multithreaded application under GDB. This helps your execution flow stick to one single thread of execution (provided the breakpoint is unique).
  • To access elements of an array, typecast the pointer with an equivalent array size. The other way of accessing is using @num_of_elements. gdb) (char[1024]) *ptr
  • gdb) set print pretty (useful to understand nested structure)

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: