Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330060 - Can't easily issue GDB commands in Mac
Summary: Can't easily issue GDB commands in Mac
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 7.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-12 03:15 EST by roln CLA
Modified: 2020-09-04 15:20 EDT (History)
5 users (show)

See Also:


Attachments
how does [Switch process xyz] happen (10.84 KB, text/plain)
2010-11-12 15:09 EST, roln CLA
no flags Details
missing ~ in interpreter-exec output (2.20 KB, text/plain)
2010-11-12 15:11 EST, roln CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description roln CLA 2010-11-12 03:15:48 EST
Build Identifier: 20100917-070

CDT GDB Common
Version: 7.0.0.201009241320
Build id: 201009241320

Snow Leopard 10.6.4

The only way I can issue GDB commands is by doing this:

1. Start debugging session in Eclipse
2. Open 2 consoles in Eclipse debugger
2.1 One console for "gdb traces"
2.2 Another console for "gdb"

This is an example of how all this looks. I am issuing "p i" to print variable i.

http://img809.imageshack.us/img809/4579/screenshot20101028at102.png

Every time I want to issue a gdb command, I have to input my command in the gdb console, and see the output in gdb traces.

Also, my gdb traces output isn't really what I want. I get a lot of formatting garbage, and useless information.

I was told in 

http://www.eclipse.org/forums/index.php?t=rview&goto=638677&SQ=98ac8122651c7795d4aa2d96d95c0776&S=66aec324878854260ee1fe79d64888fa& 

that in Linux you can issue GDB commands in single console like I want,  so this maybe a bug.

Reproducible: Always

Steps to Reproduce:
1. Enable gdb traces
2. Set a breakpoint
3. Debug
4. Open a gdb terminal
5. Open a gdb-traces terminal
Comment 1 Marc Khouzam CLA 2010-11-12 09:17:48 EST
On Linux the output of gdb traces is:

105,945 38-interpreter-exec console "p i"
105,949 ~"$2 = 9"

unlike your screenshot where it is


105,945 38-interpreter-exec console "p i"
105,949 $2 = 9

There is a missing ~ before the output, which is why the output does not end up on the gdb console.  Can you include the full gdb traces output?  I'm curious to see why we get the output [Switching to process 9544] in the gdb console.  Probably some issue with Mac's GDB.

For more info, can you try this from a command shell (not in eclipse)

> gdb -i mi <yourBinary>
(gdb) b main
(gdb) run
(gdb) p i
(gdb) -interpreter-exec console "p i"

I'm curious to see if it is -interpreter-exec console that is causing the missing ~.
Comment 2 roln CLA 2010-11-12 15:09:15 EST
Created attachment 183036 [details]
how does [Switch process xyz] happen
Comment 3 roln CLA 2010-11-12 15:11:55 EST
Created attachment 183039 [details]
missing ~ in interpreter-exec output
Comment 4 Marc Khouzam CLA 2010-11-12 16:21:57 EST
(In reply to comment #3)
> Created an attachment (id=183039) [details]
> missing ~ in interpreter-exec output

So it's a bug in apple's GDB.
We could try to avoid using -interpreter-exec console on the mac.  It may not be complicated to do but it won't be trivial, so I'll need someone to tackle it.

BTW, Marc-Andre, you never saw this issue before?
Comment 5 Marc-André Laperle CLA 2010-11-13 15:26:29 EST
(In reply to comment #4)
> BTW, Marc-Andre, you never saw this issue before?

No, I never noticed. I'll take a look.
Comment 6 Marc-André Laperle CLA 2012-08-19 10:24:10 EDT
Proposed fix:
https://git.eclipse.org/r/#/c/7290/