Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324101

Summary: [launch] Have the JTag launch extend FinalLaunchSequence instead of copying it
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: ajin, elaskavaia.cdt, john, nobody, pawel.1.piech, vladimir.prus, zulliger
Version: 7.0   
Target Milestone: 8.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix
marc.khouzam: iplog-
Better fix
marc.khouzam: iplog-
Yet another small improvement marc.khouzam: iplog-

Description Marc Khouzam CLA 2010-08-31 11:21:22 EDT
Thanks to the solution to bug 321084, FinalLaunchSequence is easier to extend.

GDBJtagDSFFinalLaunchSequence was a copy of FinalLaunchSequence which should now extend it instead, to get the benefits.
Comment 1 Marc Khouzam CLA 2010-08-31 12:15:11 EDT
Created attachment 177856 [details]
Fix

This patch makes GDBJtagDSFFinalLaunchSequence extend FinalLaunchSequence.

Since there is currently no API in ReflectionSequence to insert/remove steps into/from a base sequence, I used Elena's suggestion of bug 321084 comment #40, and used a List.

I still find that the insert operation is brittle, since it bases itself on the name of an relatively arbitrary step of the base sequence, but I don't have a better suggestion.

I can't commit this fix because I cannot test it.
When Andy or Elena have a chance to test it, we can commit it.
Until then, it can still be used as an example of how we can extend FLS.
Comment 2 Marc Khouzam CLA 2010-08-31 12:16:38 EDT
I thought Mikhail and/or Volodya may be interested in this example of extending FinalLaunchSequence.
Comment 3 Marc Khouzam CLA 2010-08-31 12:32:57 EDT
Created attachment 177860 [details]
Better fix

I made a mistake in the way I used list.  This patch is better.
Comment 4 Marc Khouzam CLA 2010-09-01 11:19:59 EDT
Created attachment 177971 [details]
Yet another small improvement

I was thinking of how to make the overriding of steps as solid as we can with the current API (or lack of), and I thought that using the same step name would be more robust.
Comment 5 John Dallaway CLA 2013-01-23 09:29:34 EST
Marc, your most recent version of the patch is dated 2010-09-01 so may need some further work for CDT head. I am happy to look at this and/or test your own changes.

Are you aware of any reason why we should not use stepNewProcess() within the JTAG launcher?
Comment 6 Marc Khouzam CLA 2013-01-31 05:46:05 EST
(In reply to comment #5)
> Marc, your most recent version of the patch is dated 2010-09-01 so may need
> some further work for CDT head. I am happy to look at this and/or test your
> own changes.

I've been meaning to give you a patch to test but things keep getting in the way.  If you want to give it a shot, please let me know.  The tricky part is that we'll need multiple versions, called by the different GDBJTagControl*, while trying to use inheritance as much as possible.
 
> Are you aware of any reason why we should not use stepNewProcess() within
> the JTAG launcher?

Not off the top of my head.  I'd like us to re-use as much of the other code as possible.
Comment 7 Marc Khouzam CLA 2013-02-06 06:22:37 EST
I pushed a prototype of this to Gerrit:
https://git.eclipse.org/r/10202

I believe we cannot run the "stepNewProcess" step, so I had to compensate.  This change is not as valuable as I hoped, although it does allow to re-use code.

This prototype is for GDB <= 7.1.  It will need a small update for newer GDBs.

John, if you have an GDB <= 7.1, can you try this out to make sure the behavior is correct?  I only coded things based on comparing it to the old code, I'm not even sure what the behavior really should be, so I'm counting on your for that.
Comment 8 Marc Khouzam CLA 2013-02-06 06:48:32 EST
I've updated the patch to support newer GDBs and pushed it to gerrit.

I believe this should fix Bug 396764 as well.  But that should not be the main concern; the main concern now is to see if this new JTAG launch sequence does what it should.

John, please let me know how things go.
Comment 9 John Dallaway CLA 2013-02-06 08:04:24 EST
Marc, thank you for the patch. I will evaluate with GDB 6.8.50 and 7.0.

What is missing for GDB > 7.1 single process?
Comment 10 Marc Khouzam CLA 2013-02-06 08:58:51 EST
(In reply to comment #9)
> Marc, thank you for the patch. I will evaluate with GDB 6.8.50 and 7.0.
> 
> What is missing for GDB > 7.1 single process?

Path 2 on gerrit should now address those versions.
I haven't worked out the API-compatibility problem yet, but I wanted to see if this even worked as expected before spending more time.
Comment 11 John Dallaway CLA 2013-02-08 07:37:02 EST
Marc, patch set 2 on Gerrit appears to be functional in the case of a single threaded application for GDB (arm-eabi-gdb) 6.8.50.20080706, 7.0 and 7.3.1. I am still observing bug 394183 if I set a temporary breakpoint via the launch settings (frequently observed with GDB 6.8.50.20080706).

Thread filtering is working for GDB 6.8.50.20080706 and GDB 7.3.1. It was previously broken for GDB 7.3.1 (bug 396764).

With GDB 7.0, the thread filter dialog shows breakpoints on all threads disabled initially. Attempts to enable/disable breakpoints on individual threads are persisted at the UI level but otherwise ignored (there are no resulting GDB commands). This is a regression in behaviour. Bug 396764 was not previously observed with GDB 7.0.

Please let me know if there are further details that would help.
Comment 12 Marc Khouzam CLA 2013-02-08 10:25:51 EST
Thanks John!

So the launch is behaving as you would expect?  Breakpoints are being set and connections are being made as expected?  Great.

I'll look into your findings
Comment 13 Marc Khouzam CLA 2013-02-13 06:07:20 EST
How can I try the thread filtering?  Since I don't have a JTag device, I just use the launch directly, but nothing actually starts execution of the process.  How does execution start on when using JTag?
Comment 14 John Dallaway CLA 2013-02-13 11:03:12 EST
(In reply to comment #13)

> How can I try the thread filtering?  Since I don't have a JTag device, I
> just use the launch directly, but nothing actually starts execution of the
> process.  How does execution start on when using JTag?

In the general case, there is code already running on the board. The launch settings typically dictate that the JTAG probe should halt the processor and so CDT shows that the target is suspended at the end of the launch sequence. All threads of execution are suspended and resumed together since the JTAG probe is simply halting and resuming the processor.

It is also possible to connect to a GDB server rather than a JTAG probe using the JTAG launcher if that helps.
Comment 15 Marc Khouzam CLA 2013-03-07 16:32:45 EST
(In reply to comment #14)

> It is also possible to connect to a GDB server rather than a JTAG probe
> using the JTAG launcher if that helps.

Ok, I'm able to use the launch by telling it to load symbols and to connect to a gdbserver running a multi-threaded programs.

I pushed an updated version to gerrit (patch set 3) that I believe is final (and does not break the API).

(In reply to comment #11)
> I am still observing bug 394183 if I set a temporary breakpoint via the
> launch settings (frequently observed with GDB 6.8.50.20080706).

That has been fixed separately in bug 394183.

> With GDB 7.0, the thread filter dialog shows breakpoints on all threads
> disabled initially. Attempts to enable/disable breakpoints on individual
> threads are persisted at the UI level but otherwise ignored (there are no
> resulting GDB commands). This is a regression in behaviour. Bug 396764 was
> not previously observed with GDB 7.0.

I believe I've fixed this issue in this latest patch.

This patch also fixes bug 396764 (which was the reason for this fix :)).

John, if you can confirm that this patch works as expected, I can commit it.
Comment 16 John Dallaway CLA 2013-04-08 09:43:21 EDT
Marc, I've been evaluating patch set 3. Thread filtering behaviour is now looking good for GDB versions 6.8.50.x, 7.0  and 7.3.1.

We need a trivial GDBJtagControl_7_4 class (extending GDBControl_7_4 and referenced from GdbJtagDebugServicesFactory) for use with GDB 7.4 and above. This is critical for 7.5.x where "maintenance set python print-stack" will cause the launch sequence to fail. I can provide a patch on request, but it may be quicker for you to add this class yourself (copying from GDBJtagControl_7_2) than process a patch.

With GDB 7.4.1 and 7.5.1, the thread filtering UI behaves correctly and appears to drive GDB correctly, but thread filtering behaviour while debugging seems erratic.

> This patch also fixes bug 396764 (which was the reason for this fix :)).

Yes, I believe the problem reported in 396764 is indeed fixed by this patch set.

From my perspective, I think patch set 3 can be committed. I will continue to investigate erratic thread filtering observed with 7.4.1 and 7.5.1. If there is a real issue here, I will open a separate bug report.

Many thanks for all your help with this.
Comment 17 Marc Khouzam CLA 2013-04-11 21:36:21 EDT
(In reply to comment #16)
> We need a trivial GDBJtagControl_7_4 class (extending GDBControl_7_4 and
> referenced from GdbJtagDebugServicesFactory) for use with GDB 7.4 and above.

Thanks John!  That was a big oversight on my part.
I have fixed it and tried a session with GDB 7.5 successfully.

> > This patch also fixes bug 396764 (which was the reason for this fix :)).
> 
> Yes, I believe the problem reported in 396764 is indeed fixed by this patch
> set.

Great, I'll also mark that one as fixed.

> From my perspective, I think patch set 3 can be committed. I will continue
> to investigate erratic thread filtering observed with 7.4.1 and 7.5.1. If
> there is a real issue here, I will open a separate bug report.
> 
> Many thanks for all your help with this.

And thanks to you also, your help is essential for the launch type.

I've pushed a new version to gerrit and committed to master.