News for hackers. Stuff that matters.
Re:GDB 8.1 Released by monocasa on Wednesday January 31, 2018 @03:05PM (#16277058)
I'm a little unclear as to what your end goal is.
Re:GDB 8.1 Released by kazinator on Wednesday January 31, 2018 @05:51PM (#16278293)
One use case would be to have some debug_printf() in the program that shows up in the debugger, no matter whether the debugger is remote or local. It doesn't go to some console, or file, but always to the debugger.

The Microsoft environment has something like this: OutputDebugString. Very useful.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa3...

Also IsDebuggerPresent: https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...

and other things.

The debugging experience on Windows 20+ years ago was was ahead of debugging on GNU/Linux today, I'm afraid, so this stuff is above criticism from the "M$ SuX" angle.

Re:GDB 8.1 Released by monocasa on Wednesday January 31, 2018 @06:18PM (#16278457)
You don't need OutputDebugString on because you can always tap the write syscall on stdout from gdb.

And I don't really know what IsDebuggerPresent gets you.

You're really focusing on features, rather than use cases.

Re:GDB 8.1 Released by kazinator on Wednesday January 31, 2018 @09:40PM (#16279321)
Well, stdout isn't a debug channel; you might want to debug a program that actually uses stdout for its output, not for debug chatter.

Never mind that though, we can take some other descriptor, like 3, and bind it to, say /dev/null.

What are the gdb commands to have whatever is going to file descriptor 3 be shown inside gdb?

I really do not care how it's implemented. However, "tightly integrated" is better than "flimsy hack"; "consumes breakpoints" is better than "doesn't consume breakpoints".

Re:GDB 8.1 Released by flukus on Wednesday January 31, 2018 @11:49PM (#16279699)
> Well, stdout isn't a debug channel; you might want to debug a program that actually uses stdout for its output, not for debug chatter.

What's your use case for this that makes stderr unsuitable?

Re:GDB 8.1 Released by kazinator on Thursday February 01, 2018 @01:13PM (#16284164)
stderr also isn't for debug output.

If, say, a compiler puts out "hello.c: syntax error" on its standard error stream, that is not a debugging diagnostic regarding that compiler's internals; it's about "hello.c".

stderr is not an instrumentation tool which goes away when we're not debugging the program.

Re:GDB 8.1 Released by monocasa on Thursday February 01, 2018 @01:32PM (#16284390)
Why? It's not like it'd be printing debugging level messages on release builds in either case.