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.
Asked
Active
Viewed 3,708 times
6
Gilles 'SO- stop being evil'
- 1,358
- 13
- 23
-
Borderline off topic. Debuggers are dual use, but this question is definitely borderline since you debug, i.e. you forward engineer code - and state that. Still +1 because it's interesting. – 0xC0000022L Apr 19 '13 at 14:18
-
3@0xC0000022L I don't see any sign that blahfish isn't reverse engineering an unknown binary. – Gilles 'SO- stop being evil' Apr 21 '13 at 09:48
-
@0xC0000022L Thanks for your comment. Im curious, I don't understand why a question on debuggers is closed off as off-topic and not related to reverse engineering. Its dynamic analysis, the way i see it. Am I missing something? – Apr 22 '13 at 04:07
-
1@blahfish: a.) this was a comment and I didn't flag this way, in fact I voted it up, a mod closed it, ask him/her and b.) yes, I maintain that this is borderline off topic, because this could be asked on StackOverflow without problem and answered by bus loads of programmers, whereas the same could not be said of actual RCE problems. But then, you are welcome to join the discussion on meta.RE.SE to contribute your opinion and help shape the community further ;) – 0xC0000022L Apr 22 '13 at 12:45
-
1@0xC0000022L Gotcha, you do have valid points there, thanks! – Apr 23 '13 at 01:59
-
I wonder if it's relevant only to OSX – Mellowcandle May 01 '13 at 07:33
1 Answers
4
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.
ixje
- 1,733
- 14
- 25