Bug 288305 - [launch] Error in .gdbinit can go unreported
Summary: [launch] Error in .gdbinit can go unreported
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-01 17:48 EDT by John Cortell CLA
Modified: 2020-09-04 15:26 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Cortell CLA 2009-09-01 17:48:13 EDT
In FinalLaunchSequence, one of the steps attempts to source the gdb init file specified in the launch configuration. If the launch config setting is set to the default value (".gdbinit"), then any error from the 'source' command is ignored. The comment in the code explains why, but the reason is rooted on the likely scenario that the generically specified ".gdbinit" is not a file that gdb will find. But what about the less likely scenario? What if gdb did find the file and the user has some invalid commands or typos in the file. gdb will generate an error but we'll end up eating it because we just assume that gdb couldn't find the file. When running in a runtime-workbench environment, you can reproduce this by creating a .gdbinit file at the root of the development eclipse installation (e.g., c:\eclipse_3.5\.gdbinit). The gdb working directory is there at that point in the launch.

That said, I'm not sure if there's a reasonable solution. Two potential solutions that came to mind but which I quickly realized where a no-go:
- GDB doesn't give us the ability to differentiate between "file not found" and "error in the init file" except for the text of the message. We could do a string search through the message, but what about a gdb localized for another language?
- we could run the 'pwd' command first and try to determine where gdb will end up looking and see if the file exists. But, what about cygwin and its "/cygdrive" answer, and what if gdb is remote?
Comment 1 Jerry Quinn CLA 2010-05-24 11:20:35 EDT
My thought is that a partial solution is better than no solution.  The bug can at least be fixed for the probably common case of a local gdb unable to find .gdbinit.