summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-18 12:06:33 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-18 12:06:33 -0300
commit6d6a0781a54357840703f503f24225d14588c7ba (patch)
treee0c92d91e34a02fd627d0266436e19588134c157 /main.c
parente46620f6eb10770d8f43b7bd6bfa1467786c3d8d (diff)
downloadeeshow-6d6a0781a54357840703f503f24225d14588c7ba.tar.gz
eeshow-6d6a0781a54357840703f503f24225d14588c7ba.tar.bz2
eeshow-6d6a0781a54357840703f503f24225d14588c7ba.zip
eeshow/main.c: run under gdb if argv[1] is "gdb"
I.e., instead of eeshow foo bar invoke with eeshow gdb foo bar
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/main.c b/main.c
index c654d08..15fa8e7 100644
--- a/main.c
+++ b/main.c
@@ -50,6 +50,7 @@ void usage(const char *name)
" %*s[-- driver_spec]\n"
" %s [-v ...] -C [rev:]file\n"
" %s [-v ...] -H path_into_repo\n"
+" %s gdb ...\n"
"\n"
" rev git revision\n"
" -r recurse into sub-sheets\n"
@@ -57,6 +58,7 @@ void usage(const char *name)
" -C 'cat' the file to standard output\n"
" -H show history of repository on standard output\n"
" -N n limit history to n revisions (unlimited if omitted or 0)\n"
+" gdb run eeshow under gdb\n"
"\n"
"No driver spec: enter GUI\n"
"\n"
@@ -81,7 +83,7 @@ void usage(const char *name)
" diff [-o output.pdf] [-s scale] [file.lib ...] file.sch\n"
"\n"
" see PNG\n"
- , name, name, (int) strlen(name) + 1, "", name, name);
+ , name, name, (int) strlen(name) + 1, "", name, name, name);
exit(1);
}
@@ -103,6 +105,19 @@ int main(int argc, char **argv)
char **gfx_argv;
const struct gfx_ops **ops = ops_list;
+ if (argc > 1 && !strcmp(argv[1], "gdb")) {
+ char **args;
+
+ args = alloc_type_n(char *, argc + 2);
+ args[0] = "gdb";
+ args[1] = "--args";
+ args[2] = *argv;
+ memcpy(args + 3, argv + 2, sizeof(char *) * (argc - 1));
+ execvp("gdb", args);
+ perror(*argv);
+ return 1;
+ }
+
for (dashdash = 1; dashdash != argc; dashdash++)
if (!strcmp(argv[dashdash], "--")) {
have_dashdash = 1;