Christmas gift from Lance: some assembly required

December 25, 2017 Incoherent ramblings No comments ,

Lance got me a little notebook for Christmas, the first page of which had a message that I had to work to decode:

Conveniently, it was all ASCII, and all in a single base.  He got the evil idea of wishing he’d encoding each character in a different base, which would have made life more difficult.  I used the following quick hack to decode:

There was one small encoding error, a missing zero that transformed an ‘s’ into a ‘;’.

gdb set target-charset

January 9, 2017 C/C++ development and debugging. No comments , , ,

I was looking for a way to convert ASCII and EBCDIC strings in gdb debugging sessions and was experimenting with gdb python script extensions. I managed to figure out how to add my own command that read a gdb variable, and print it out, but it failed when I tried to run a character conversion function. In the process of debugging that char encoding error, I found that there’s a built in way to do exactly what I wanted to do:

(gdb) p argv[0]
$16 = 0x7fd8fbda0108 "\323\326\303\301\323\305\303\326"
(gdb) set target-charset EBCDIC-US
(gdb) p argv[0]
$17 = 0x7fd8fbda0108 "LOCALECO"
(gdb) set target-charset ASCII
(gdb) p argv[0]
$18 = 0x7fd8fbda0108 "\323\326\303\301\323\305\303\326"