Search code examples
gdbremote-debugging

is there a way to print a variable of type char** in gdb?


Is there a way to print variables that are of type char** in gdb? I mean, say if there was a variable int length = 17; in the .c file and in gdb, typing p length will show length = 17. However, if its of char**, is there any way to print it and see the characters/strings inside that variable? Been searching on google but couldn't find any info.


Solution

  • However, if its of char**, is there any way to print it and see the characters/strings inside that variable?

    There are no characters / strings inside that variable.

    What you are probably asking is: can I print the string that is pointed to by *var, in which case either print *var or print var[0] would do.