Bug 69522 - [MacOSX] Variables are not shown in debugger
Summary: [MacOSX] Variables are not shown in debugger
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.1   Edit
Assignee: Ken Ryall CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on: 114793
Blocks:
  Show dependency tree
 
Reported: 2004-07-07 16:17 EDT by Doug Schaefer CLA
Modified: 2008-06-19 13:25 EDT (History)
3 users (show)

See Also:


Attachments
getMIArgs() patch (1.56 KB, patch)
2004-07-08 00:16 EDT, Greg Watson CLA
bjorn.freeman-benson: iplog+
Details | Diff
Mac OS X 10.4 Tuple patch (5.64 KB, patch)
2005-10-05 14:56 EDT, Greg Watson CLA
no flags Details | Diff
Tuple patch with debugging removed (5.81 KB, patch)
2005-10-05 15:12 EDT, Greg Watson CLA
bjorn.freeman-benson: iplog+
Details | Diff
patch fixing arguments and variables (7.03 KB, patch)
2005-12-04 01:21 EST, Greg Watson CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Schaefer CLA 2004-07-07 16:17:25 EDT
In my simple hello world program, I was unable to see any variables.
Comment 1 Doug Schaefer CLA 2004-07-07 16:26:22 EDT
This is with the XTools 1.2 which include gdb 5.3.
Comment 2 Doug Schaefer CLA 2004-07-07 16:29:51 EDT
Make that XCode Tools 1.2. I'm still learning the lingo :-)
Comment 3 Greg Watson CLA 2004-07-07 16:50:38 EDT
Hmm, neither am I. I'll see what I can find...
Comment 4 Kleo Hapitas CLA 2004-07-07 16:55:32 EDT
PR was not targeted to any particular release. Changing target milestone to 2.1
Comment 5 Greg Watson CLA 2004-07-08 00:16:50 EDT
Created attachment 13041 [details]
getMIArgs() patch
Comment 6 Greg Watson CLA 2004-07-08 00:18:19 EDT
The problem is that getMIArgs() does not parse gdb output correctly. According to the docs, a value 
can consist of a list containing a tuple that contains only a single result. This is how gdb under MacOSX 
formats the result of a '-stack-list-locals 0' command.

Under MacOSX:

-stack-list-locals 0
^done,locals=[{name="a"}]

Under Linux:

-stack-list-locals 0
^done,locals=[name="a"]

Both of these seem to be valid syntax. While this fixes the variable display problem, I suspect other 
parsing problems may come to light.
Comment 7 Doug Schaefer CLA 2004-07-08 00:30:51 EDT
Actually, I'll leave this bug open until we get the patch committed. First, I'd 
like Mikhail to give his stamp of approval.

Mikhail, could you review this and if you approve, commit it for us. Thanks.
Comment 8 Nobody - feel free to take it CLA 2004-07-08 10:36:51 EDT
Sorry Doug, but I have to redirect this to our mi expert - Alain.
Comment 9 Greg Watson CLA 2004-07-08 19:46:07 EDT
I've noticed that while the correct value for a variable is displayed when the variable is selected, it's 
value in the variables view is not updated when stepping through the code (it is if you run to a 
breakpoint). I don't have another platform to see if this is a debugger problem, or a problem with 
macosx. Can someone let me know if this is the case on other platforms?
Comment 10 Nobody - feel free to take it CLA 2004-07-09 10:20:34 EDT
The variable update seems to work fine on other platforms.
Comment 11 Alain Magloire CLA 2004-07-09 13:56:04 EDT
> Both of these seem to be valid syntax. While this fixes the variable display
> problem, I suspect other parsing problems may come to light.

Interresting.

Is this something you would want for the 2.0.1(2.0_branch) ?
I'll take a look closer at it(The patch) later.
I beleive you are rigth the syntax does allowed the return
of tuple, not sure why gdb-5.3 is different on Mac.
Let me know of other discrepencies.

I'll grab this one from you for the follups
Thanks.


Comment 12 Doug Schaefer CLA 2004-07-09 14:27:34 EDT
Thanks, Alain,

No, this is for HEAD.

We're finding a few other differences with the gnu tools that Apple has munged 
to work with OS X. I have no idea why...
Comment 13 Greg Watson CLA 2004-07-09 14:29:00 EDT
Apple patch gdb pretty heavily to support the macosx architecture. I suspect they have modified this to 
support their development tools.
Comment 14 Alain Magloire CLA 2004-07-09 16:08:07 EDT
Allright the patch looks good.

Applied to the head, Thanks.

PR flipped to Fixed.

Doug|Gwatson can you verify the PR.
Comment 15 Amos Anderson CLA 2004-07-21 00:12:24 EDT
was this bug fix included in the 2.0 version that's available online now? does comment 4 mean that it 
will be fixed for version 2.1? is there an easy way for me to apply a patch? (i'm not a CDT developer in 
any way...)

i don't understand how xcode is related to this problem but i don't see any variables within eclipse on 
OSX on a custom makefile project either. the files are compiled with options like -ggdb.

Comment 16 Doug Schaefer CLA 2004-07-21 09:51:13 EDT
This is fixed for 2.1. You can get the latest nightly builds from 
http://download.eclipse.org/tools/cdt/builds.

We are using the gnu tools from xcode which appear to be heavily customized for 
the xcode integration.
Comment 17 Greg Watson CLA 2005-09-07 22:40:43 EDT
The gdb version for MacOS X 10.4 has changed the output format for the -stack-list-locals command 
which has broken the variables view again. It seems that they now use a tuple of tuples rather than a list of 
tuples, so that the following output is generated:

-stack-list-locals 0
^done,locals={{name="a"},{name="b"}}

I'll submit a patch when I get a chance  (next few days), but feel free to fix it before then :-)
Comment 18 Nobody - feel free to take it CLA 2005-09-08 12:24:02 EDT
Returning to the pool.
Comment 19 Greg Watson CLA 2005-10-05 14:56:42 EDT
Created attachment 27889 [details]
Mac OS X 10.4 Tuple patch
Comment 20 Greg Watson CLA 2005-10-05 15:01:47 EDT
Unfortunately it looks like Apple have modified the tuple syntax in 10.4. The syntax is now the same as 
that for lists, i.e.:

list -> "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]"
tuple -> "{}" | "{" value ( "," value )* "}" | "{" result ( "," result )* "}"

At least one debugger command (-stack-list-locals) returns results using this format. The patch fixes this 
particular command, though there may be others that I have missed.

I'm not sure how best to deal with this, since it's introducing non-standard MI syntax. 
Comment 21 Greg Watson CLA 2005-10-05 15:12:00 EDT
Created attachment 27892 [details]
Tuple patch with debugging removed

Here's the same patch with debugging println's removed.
Comment 22 Greg Watson CLA 2005-12-04 01:21:09 EST
Created attachment 31099 [details]
patch fixing arguments and variables

There is also a problem display function arguments that is caused by the same problem. This is an updated patch that fixes both the variable and argument problem on Mac OS X 10.4
Comment 23 Nobody - feel free to take it CLA 2006-01-25 16:00:45 EST
This will be addressed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=114793.
Comment 24 Nobody - feel free to take it CLA 2006-02-07 16:40:05 EST
Greg,

I created an extension point to contribute a gdb/mi command factory to the CDT debugger (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=114793). I have already added command factories for Linux and Windows. 
To fix this bug I need to create a new command factory by extending the "CommandFactory" class and applying your patches. 
But first I need the answer to the following questions:
Are these patches complete? Do they cover all gdb commands used by CDT?
Do we need different command factories for different versions of MacOS?
The problem is that I don't have access to MacOS and I can't even try it.

Thank you,
Mikhail
Comment 25 Greg Watson CLA 2006-02-07 17:19:06 EST
Mikhail,

The patches are unlikely to be complete because I only fixed problems that I saw with arguments/variables. I suspect that anywhere you would normally expect to see a list, you'll see a tuple under MacOS. Most things do seem to work ok though (breakpoints, etc.) but I haven't checked the more obscure functions. Nevertheless, I would be satisfied with an initial fix of arguments/variables and patch other problems as they come to light. The alternative would be to look through the changes in the Darwin version of gdb which is available from http://www.opensource.apple.com/darwinsource/10.4.4.ppc/gdb-413/.

I believe there are differences between the 10.3.X and 10.4.X versions of gdb, but its highly unlikely that anyone is running Eclipse under anything earlier than 10.3.X. I would think that it is also not worth providing a 10.3.X version, since most would have upgraded to 10.4.X by now. There *may* be differences in gdb between minor releases, but since it's relatively simple to upgrade a minor release I would suggest starting at 10.4.4.

I'm happy to test 10.4.4 and later versions for you, but unfortunately don't have any machines running earlier versions of 10.4. I do have a machine running 10.3, so if you really want to support that version, I can test it for you.

Regards,

Greg
Comment 26 Nobody - feel free to take it CLA 2006-02-08 15:04:41 EST
Thanks, Greg. I'll try the patch.
Comment 27 Ken Ryall CLA 2006-05-17 12:29:52 EDT
Added gdb/mi command factory for Mac OS. Reviewed and applied Greg's patch that beefs up support for MI  results containing tuples. Added one additional change in MIVarUpdateInfo. Debug sessions now startup and variables display correctly on Mac OS 10.4.6 with latest dev tools.

Ran before and after tests on Windows and saw no ill effects or changes in behavior for variable display.
Comment 28 Nobody - feel free to take it CLA 2006-05-17 13:17:08 EDT
Thanks, Ken.