Skip to content

Instantly share code, notes, and snippets.

@jralls
Created April 13, 2018 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jralls/124311cdc8d44134c90a5d666f4854dd to your computer and use it in GitHub Desktop.
Save jralls/124311cdc8d44134c90a5d666f4854dd to your computer and use it in GitHub Desktop.
GDB transcript showing scm_to_utf8_string() misbehavior.
Thread 1 hit Breakpoint 1, gnc_extension_name (extension=0x10e703c0)
at C:/gcdev64/gnucash/unstable/src/gnucash-git/gnucash/gnome-utils/gnc-menu-extensions.c:117
117 initialize_getters();
Thread 1 hit Breakpoint 2, gnc_scm_call_1_to_string (func=0xeb137a0,
arg=0x10e703c0)
at C:/gcdev64/gnucash/unstable/src/gnucash-git/libgnucash/core-utils/gnc-guile-utils.c:141
141 return gnc_scm_to_utf8_string(value);
$18 = (gchar *) 0xfba96e8 "Saldo (Sal▒rio)"
(gdb) s
gnc_scm_to_utf8_string (scm_string=0xedf3890)
at C:/gcdev64/gnucash/unstable/src/gnucash-git/libgnucash/core-utils/gnc-guile-utils.c:41
41 if (scm_is_string (scm_string))
(gdb) n
46 str = scm_to_utf8_string(scm_string);
(gdb) p scm_to_utf8_stringn(scm_string, 0)
$19 = 0xfba8fb8 "Saldo (Salário)"
(gdb) p scm_to_utf8_string(scm_string)
$20 = 0xfba9128 "Saldo (Salário)"
(gdb) n
47 s = g_strdup(str);
(gdb) p str
$21 = 0xcc30f58 "Saldo (Sal▒rio)"
(gdb) p strlen($20)
$22 = 16
(gdb) x/17bx $20
0xfba9128: 0x53 0x61 0x6c 0x64 0x6f 0x20 0x28 0x53
0xfba9130: 0x61 0x6c 0xc3 0xa1 0x72 0x69 0x6f 0x29
0xfba9138: 0x00
(gdb) expr $foo = scm_to_utf8_string(scm_string)
Could not load libcc1.so: The specified module could not be found.
(gdb) call $foo = scm_to_utf8_string(scm_string)
$23 = 0xfba8e78 "Saldo (Salário)"
(gdb) p $foo
$24 = 0xfba8e78 "Saldo (Salário)"
(gdb) x/16bx $21
0xcc30f58: 0x53 0x61 0x6c 0x64 0x6f 0x20 0x28 0x53
0xcc30f60: 0x61 0x6c 0xe1 0x72 0x69 0x6f 0x29 0x00
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment