1
votes

We're using QtCreator 3.2.1 to analyse core dumps on Linux (Debian Jessie). Currently we load it up manually via the menu and "Load Core File" dialog, which allows us to specify a GDB startup script which we use to set up the source code search paths. The paths, and hence the startup script, depend on the specific build being debugged, and so need to be specified along with the executable and core file.

It would be convenient to be able to launch this from the command line via a small Bash helper script. Unfortunately, while QtCreator has command-line options to specify the core file and executable, it doesn't appear to have one to specify the debugger startup script.

Is there some alternative?

2
Is the "debugger startup script" something that you can put in Options -> Debugger > GDB (tab) > Additional Startup Commands ? Otherwise could you clarify what you want with "be able to launch this from a helper script"? - DBedrenko
@DBedrenko - I've reworded the question for (hopefully) clarity. - Jeremy
@DBedrenko - The problem with the Additional Startup Commands setting is that we need to invoke a different startup script on each invocation. But we might be able to achieve that by specifying a relative path and launching from an appropriate current directory, or some other way. Thanks for the idea! - Jeremy

2 Answers

0
votes

Just a crazy idea:

Create a wrapper $HOME/mygdb/gdb:

#!/bin/bash
gdb -command="${$HOME}/mygdb/.gdbinit" "$@"

Then invoke QtCreator like this:

PATH=$HOME/mygdb:$PATH qtcreator -debug myexecutable,core=mycorefile
0
votes

Inspired by @DBedrenko's initial comment, we configured the GDB Debugger with an Additional Startup Command of source startup.gdb.

The bash helper script simply cd's to a directory containing the appropriate startup.gdb file, and invokes qtcreator -debug <exe>,core=<core>.

Works nicely.