gdb+osx: no output when using printf/CFShow
- by yairchu
I attached to a program with gdb in OSX and I want to use CFShow in the gdb console etc. However, nothing shows up. printf shows nothing as well:
(gdb) call (int) printf("Hello\n")
$10 = 6
(gdb) call (int) printf("Hello World!\n")
$11 = 13
Apple suggests the following tip for when attaching with gdb, to make the output appear in the gdb console:
(gdb) call (void) close(1)
(gdb) call (void) close(2)
(gdb) shell tty
/dev/ttyp1
(gdb) call (int) open("/dev/ttyp1", 2, 0)
$1 = 1
(gdb) call (int) open("/dev/ttyp1", 2, 0)
$2 = 2
In xcode's gdb console tty gives "not a tty", so I tried it in gdb in a terminal. There tty does work but after redirecting stdout there's still no output. Also no output if I direct stdout to a file.. :/
Any salvation?