Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321259 - [launch] [cdi] Need to set environment dir before sourcing init file.
Summary: [launch] [cdi] Need to set environment dir before sourcing init file.
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-07-29 14:34 EDT by Marc Khouzam CLA
Modified: 2010-07-30 10:23 EDT (History)
3 users (show)

See Also:
elaskavaia.cdt: review+


Attachments
Proposed fix (2.52 KB, patch)
2010-07-29 14:49 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Fix for GDBJtagDSFFinalLaunchSequence (2.72 KB, patch)
2010-07-29 15:40 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-07-29 14:34:22 EDT
With DSF-GDB,
 GDB starts off by using the directory in which you started

eclipse.  This is where gdb will
 expect to find the .gdbinit file.
  Right after, we
 change the working directory, using 
-environment-cd, based on what is specified in the launch
 Environment tab.



CDI does it a little bit differently and (using --cd and --command) effectively sets
 the working directory first, then reads .gdbinit.


My first thought is that being dependent on where eclipse
 was started to find the .gdbinit file is a bad thing.


We should first do -environment-cd then source .gdbinit.

This will require a small re-ordering of steps in the FinalLaunchSequence
Comment 1 Marc Khouzam CLA 2010-07-29 14:49:53 EDT
Created attachment 175520 [details]
Proposed fix

Here is the fix which does the -environment-cd first then source .gdbinit.
Comment 2 Marc Khouzam CLA 2010-07-29 15:00:19 EDT
Committed to HEAD and 7_0 branch.
Comment 3 Marc Khouzam CLA 2010-07-29 15:22:38 EDT
Elena, since you are knee deep in the FinalLaunchSequence, can you review this simple change?
Comment 4 Marc Khouzam CLA 2010-07-29 15:22:55 EDT
CCing Elena for review
Comment 5 CDT Genie CLA 2010-07-29 15:23:05 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 321259: Need to set environment dir before sourcing init file, so that we look for the init file in the right place

[*] FinalLaunchSequence.java 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java?root=Tools_Project&r1=1.11&r2=1.12

[*] FinalLaunchSequence.java 1.11.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java?root=Tools_Project&r1=1.11&r2=1.11.2.1
Comment 6 Marc Khouzam CLA 2010-07-29 15:40:36 EDT
Created attachment 175525 [details]
Fix for GDBJtagDSFFinalLaunchSequence

This is the same fix but for GDBJtagDSFFinalLaunchSequence, which has copied FinalLaunchSequence.

I've committed it to HEAD only since I can't test it myself and I don't feel safe putting it in 7_0
Comment 7 CDT Genie CLA 2010-07-29 16:23:02 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 321259: Need to set environment dir before sourcing init file, so that we look for the init file in the right place

[*] GDBJtagDSFFinalLaunchSequence.java 1.11 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java?root=Tools_Project&r1=1.10&r2=1.11
Comment 8 Elena Laskavaia CLA 2010-07-30 09:50:14 EDT
reviewed - you just swapped two steps. Good catch about JTag I would have
forgot about it. If fix FLS it would be change only in one place next time hopefully.
Comment 9 Elena Laskavaia CLA 2010-07-30 09:54:13 EDT
I think it is safe to put on 7.0
Comment 10 Marc Khouzam CLA 2010-07-30 10:00:44 EDT
(In reply to comment #9)
> I think it is safe to put on 7.0

I got a mid-air collision asking if you though it was safe for 7_0 :-)
Committed to 7_0.
Comment 11 CDT Genie CLA 2010-07-30 10:23:03 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 321259: Need to set environment dir before sourcing init file to make sure we look for the init file in the right place.

[*] GDBJtagDSFFinalLaunchSequence.java 1.10.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java?root=Tools_Project&r1=1.10&r2=1.10.2.1