Bug 353005 - [remote][attach] Wrong path keeps being re-used after user inputs wrong but valid binary when attaching
Summary: [remote][attach] Wrong path keeps being re-used after user inputs wrong but v...
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-25 09:06 EDT by Marc Khouzam CLA
Modified: 2020-09-04 15:17 EDT (History)
2 users (show)

See Also:


Attachments
First fix to only store path on success (2.42 KB, patch)
2011-07-25 15:07 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 2011-07-25 09:06:28 EDT
In the GdbConnectCommand we store the path of a binary that is specified by the user.  The problem is that if that path was wrong, we keep re-using it, and the user has no way of clearing it, other than restarting the debug session.

To reproduce:
1- Start a remote attach session with no binary specified in the launch
2- attach to a process
3- type the wrong path in the prompt
=> the attach will fail, that is normal
4- try to attach to the same process again
=> there is no more prompting and the attach fails automatically

There are more than one way the user can put in the wrong path:

1- an path to an invalid binary (file does not exist), which will cause GDB to return an error.  In that case, we should not store the path, and we should re-prompt the user

2- a valid binary but not the correct one for the process.  Here GDB will not give an error, but the debug session will be messed up.  In this case, I don't see a way that we can know of the error.  So, the user will either need to restart the debug session, or will need a way to clear the stored binary paths.
Comment 1 Marc Khouzam CLA 2011-07-25 15:07:27 EDT
Created attachment 200304 [details]
First fix to only store path on success

This fix simply waits until we confirm that the attach succeeded before storing the path into our map.  That way, for an invalid path, we won't store it.

This does not fix the problem of the user inputing a wrong but valid binary.  In that case, we will need a new UI action to allow the user to clear the map.  Can't put that in cdt_8_0 anyway.  For master, I was thinking of an action in the DebugView context menu only visible for remote-attach sessions.

I will commit the current patch to master and cdt_8_0
Comment 2 Marc Khouzam CLA 2011-07-25 15:18:54 EDT
I'm not going to work on the extra improvement just yet.  No time.
Comment 3 CDT Genie CLA 2011-07-25 16:18:44 EDT
*** cdt git genie on behalf of 353005 ***

    Bug 353005: [remote][attach] Wrong path keeps being re-used after user mistaken when attaching

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=03824cc6cad59d39222b3770c31bed766f33a873
Comment 4 CDT Genie CLA 2011-07-25 16:18:46 EDT
*** cdt git genie on behalf of 353005 ***

    Bug 353005: [remote][attach] Wrong path keeps being re-used after user mistaken when attaching

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=32ce139214d585d7a1576d641850f8133855b258