Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311965 - [launch] Remote attach launch does not work with GDB 7.1
Summary: [launch] Remote attach launch does not work with GDB 7.1
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.0.1   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-06 16:00 EDT by Marc Khouzam CLA
Modified: 2010-07-07 13:52 EDT (History)
2 users (show)

See Also:
john.cortell: review+
john.cortell: review+


Attachments
Messed up launch (11.68 KB, image/png)
2010-05-06 16:00 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details
Fix for HEAD (3.22 KB, patch)
2010-06-30 09:02 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Fix for 7.0.1 (7.18 KB, patch)
2010-06-30 15:08 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2010-05-06 16:00:25 EDT
Created attachment 167383 [details]
Messed up launch

On my Linux I run:

gdbserver.7.1 --multi :9999

Then, in Eclipse, I create an attach launch using gdbserver and gdb.7.1 and press debug. The resulting launch is messed up as shown in the snapshot.
Comment 1 Marc Khouzam CLA 2010-06-30 08:52:38 EDT
This problem is because with GDB 7.1, we can receive a bogus process when we are not debugging anything
  -list-thread-groups
  ^done,groups=[{id="0",type="process",pid="0"}]

I also noticed that GDB HEAD, which will soon become GDB 7.2, the pid field is missing altogether in this case
  -list-thread-groups
  ^done,groups=[{id="i1",type="process"}]

We should ignore those kind of entries since they don't actually indicate a process that is being debugged.
Comment 2 Marc Khouzam CLA 2010-06-30 09:02:33 EDT
Created attachment 173087 [details]
Fix for HEAD

Fix committed to HEAD
Comment 3 Marc Khouzam CLA 2010-06-30 09:04:44 EDT
John, this is a small patch, can you review?
Comment 4 Marc Khouzam CLA 2010-06-30 09:05:03 EDT
Adding John for a review
Comment 6 John Cortell CLA 2010-06-30 11:08:49 EDT
(In reply to comment #3)
> John, this is a small patch, can you review?

I don't claim to fully understand the reasoning behind the logic since I'm not all that familiar with gdb thread groups, but superficially, I see nothing wrong with the changes. I do question whether the assumption that a pid of zero is bogus. Does gdb reserve that value? Is is not possible some environment might actually have a process with ID 0? I would keep this fix but pursue this issue with the gdb folks since this seems to me more of a workaround than a solution.
Comment 7 Marc Khouzam CLA 2010-06-30 11:57:33 EDT
(In reply to comment #6)
> (In reply to comment #3)
> > John, this is a small patch, can you review?
> 
> I don't claim to fully understand the reasoning behind the logic since I'm not
> all that familiar with gdb thread groups, but superficially, I see nothing
> wrong with the changes. I do question whether the assumption that a pid of zero
> is bogus. Does gdb reserve that value? Is is not possible some environment
> might actually have a process with ID 0? I would keep this fix but pursue this
> issue with the gdb folks since this seems to me more of a workaround than a
> solution.

:-)
http://sourceware.org/ml/gdb/2010-06/msg00138.html
But no answer yet.

P.S. I'm working on a patch for 7.0.1 as well.
Comment 8 Marc Khouzam CLA 2010-06-30 15:08:08 EDT
Created attachment 173147 [details]
Fix for 7.0.1

This is the fix for 7.0.1.  It's pretty much the same as for HEAD, but smaller, as I only added the exact changes that were actually needed.  In HEAD, I had added support for a more detailed parsing of GDB output, which is not needed for 7.0.1.

Committed to 7.0.1
Comment 9 Marc Khouzam CLA 2010-06-30 15:08:56 EDT
John, another quick review just to make sure I didn't make a stupid mistake in this patch.  Thanks.