Are there any useful snippets or Gdb functions that you guys normally use to print out Unicode strings? I'm trying to debug Mach-O binaries and
x/s seems to be printing out junk. I believe the default encoding for Objective C strings is UTF-16.
If you think the encoding is wrong then you can try these 2 things:
- Try using
x/hsas described here
Each time you specify a unit size with x, that size becomes the default unit the next time you use x ... Use x /hs to display 16-bit char strings
- set the character set in gdb as described here
gdb has no way to automatically recognize which character set the inferior program uses; you must tell it, using the set target-charset command, described below.