Skip to content

Commit

Permalink
Fix bad bug parsing Seer command line arguments. (SORRY!)
Browse files Browse the repository at this point in the history
  • Loading branch information
epasveer committed Apr 20, 2023
1 parent be3593d commit 60ef4db
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 35 deletions.
51 changes: 27 additions & 24 deletions src/resources/help/seergdb.hlp
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@

Usage: seergdb [LAUNCHOPTIONS] [MISCOPTIONS] executable [arguments ...]

Seer - A gui frontend for gdb.

-h, --help Displays help on commandline options.
-v, --version Displays version information.
-h, --help Displays help on commandline options.
-v, --version Displays version information.


Launch Options (pick one):

-r, --run Load the executable and run it.
-r, --run <executable> <arguments> Load the executable and run it.

-s, --start <executable> <arguments> Load the executable, break in "main", and run it.

-s, --start Load the executable, break in "main", and run it.
--attach <pid> <executable> Attach to a locally running process.

--attach <pid> Attach to a locally running process.
--connect <medium> [--sym <symbolfile>] Connect to an already running gdbserver (local or remote).
Possible connection mediums are:

--connect <medium> Connect to an already running gdbserver (local or remote).
Possible connection mediums are:
host:port
/dev/<serialdev>

host:port
/dev/<serialdev>
'sym' is optional if the debugging info is in a separate file.

--rr <host:port> Connect to an already running 'rr replay -s <port> -k' session.
--rr <host:port> Connect to an already running 'rr replay -s <port> -k' session.

--core <corefile> Load a corefile.
--core <corefile> <executable> Load a corefile.

--project <project> Launch using a Seer project.
--project <project> Launch using a Seer project.

--config Launch with Seer's config dialog.
Save settings with: 'Settings->Save Configuration'
--config Launch with Seer's config dialog.
Save settings with: 'Settings->Save Configuration'

Misc Options:

--sym, --symbol-file <symbolfilename> Load symbols from a separate file than the executable.
--bl, --break-load <filename> Load a previously saved breakpoints file. For --run or --start
--bf, --break-function <function> Set a breakpoint in a function/address. For --run or --start
--sat, --show-assembly-tab <yes|no> Show the Assembly Tab on Seer startup. For --run or --start
--sar, --start-address-randomize <yes|no> Randomize the program's starting address. For --run or --start
--nsm, --non-stop-mode <yes|no> Continue to run other threads at breakpoints. For --run or --start
--xxx Turn on internal Seer debugging messages.
--sym, --symbol-file <symbolfilename> Load symbols from a separate file than the executable.
--bl, --break-load <filename> Load a previously saved breakpoints file. For 'run' or 'start'.
--bf, --break-function <function> Set a breakpoint in a function/address. For 'run' or 'start'.
--sat, --show-assembly-tab <yes|no> Show the Assembly Tab on Seer startup. For 'run' or 'start'.
--sar, --start-address-randomize <yes|no> Randomize the program's starting address. For 'run' or 'start'.
--nsm, --non-stop-mode <yes|no> Continue to run other threads at breakpoints. For 'run' or 'start'.
--xxx Turn on internal Seer debugging messages.


Arguments:

executable The executable to debug. Needed for all run modes.
arguments Arguments for the executable.
Needed for --run and --start.
executable The executable to debug. Needed for 'run', 'start', 'attach', and
'core' run modes.
arguments Arguments for the executable. Needed for 'run' and 'start'.

28 changes: 18 additions & 10 deletions src/seergdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,31 @@ int main (int argc, char* argv[]) {
QCommandLineOption startOption(QStringList() << "s" << "start");
parser.addOption(startOption);

QCommandLineOption attachOption(QStringList() << "attach");
QCommandLineOption attachOption(QStringList() << "attach", "", "pid");
parser.addOption(attachOption);

QCommandLineOption connectOption(QStringList() << "connect");
QCommandLineOption connectOption(QStringList() << "connect", "", "medium");
parser.addOption(connectOption);

QCommandLineOption rrOption(QStringList() << "rr");
QCommandLineOption rrOption(QStringList() << "rr", "", "hostport");
parser.addOption(rrOption);

QCommandLineOption corefileOption(QStringList() << "core");
QCommandLineOption corefileOption(QStringList() << "core", "", "corefile");
parser.addOption(corefileOption);

QCommandLineOption projectOption(QStringList() << "project");
QCommandLineOption projectOption(QStringList() << "project", "", "project");
parser.addOption(projectOption);

QCommandLineOption configOption(QStringList() << "config");
parser.addOption(configOption);

QCommandLineOption symbolfileOption(QStringList() << "sym" << "symbol-file");
QCommandLineOption symbolfileOption(QStringList() << "sym" << "symbol-file", "", "symbolfile");
parser.addOption(symbolfileOption);

QCommandLineOption breakfileOption(QStringList() << "bl" << "break-load");
QCommandLineOption breakfileOption(QStringList() << "bl" << "break-load", "", "breakpointfile");
parser.addOption(breakfileOption);

QCommandLineOption breakfunctionOption(QStringList() << "bf" << "break-function");
QCommandLineOption breakfunctionOption(QStringList() << "bf" << "break-function", "", "breakpointfunction");
parser.addOption(breakfunctionOption);

QCommandLineOption showAssemblyTabOption(QStringList() << "sat" << "show-assembly-tab");
Expand All @@ -112,8 +112,7 @@ int main (int argc, char* argv[]) {

// A positional argument for executable name.
// All other arguments after that are treated as positional arguments for the executable.
parser.addPositionalArgument("executable", QObject::tr("The executable to debug. Needed for all run modes."));
parser.addPositionalArgument("arguments", QObject::tr("Arguments for the executable. Needed for --run and --start."), "[arguments ...]");
parser.addPositionalArgument("executableandarguments", "");

// Process the arguments.
parser.process(app);
Expand Down Expand Up @@ -285,6 +284,15 @@ int main (int argc, char* argv[]) {
}
}

qDebug() << "EXECUTABLENAME" << executableName;
qDebug() << "SYMBOLNAME" << executableSymbolFilename;
qDebug() << "PID" << executablePid;
qDebug() << "CONNECTHOST" << executableConnectHostPort;
qDebug() << "RRHOSTPORT" << executableRRHostPort;
qDebug() << "COREFILENAME" << executableCoreFilename;
qDebug() << "PROJECTFILE" << projectFilename;
qDebug() << "ARGUMENTS" << positionalArguments;

seer.setExecutablePid(executablePid);
seer.setExecutableConnectHostPort(executableConnectHostPort);
seer.setExecutableRRHostPort(executableRRHostPort);
Expand Down
2 changes: 1 addition & 1 deletion tests/hellosegv/corefile.seer
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"seerproject": {
"corefilemode": {
"corefile": "/nas/erniep/Development/seer/tests/hellosegv/core.hellosegv.26364"
"corefile": "/nas/erniep/Development/seer/tests/hellosegv/core.hellosegv.18539"
},
"executable": "/nas/erniep/Development/seer/tests/hellosegv/hellosegv",
"postgdbcommands": [
Expand Down
20 changes: 20 additions & 0 deletions tests/hellovalgrind/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

https://github.com/epasveer/seer/wiki/Valgrind-and-Seer.

In one terminal, run:

$ valgrind -q --vgdb-error=0 ./hellovalgrind
==12596== (action at startup) vgdb me ...
==12596==
==12596== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==12596== /path/to/gdb ./hellovalgrind
==12596== and then give GDB the following command
==12596== target remote | /usr/lib/valgrind/../../bin/vgdb --pid=12596
==12596== --pid is optional if only one valgrind process is running
==12596==

In another terminal, start Seer.

$ seergdb --connect '| vgdb' --sym hellovalgrind


0 comments on commit 60ef4db

Please sign in to comment.