1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 07:08:05 +02:00

eeshow/main.c: run under gdb if argv[1] is "gdb"

I.e., instead of
eeshow foo bar
invoke with
eeshow gdb foo bar
This commit is contained in:
Werner Almesberger 2016-08-18 12:06:33 -03:00
parent 4ffdeeb910
commit 7c4ee702e0

View File

@ -50,6 +50,7 @@ void usage(const char *name)
" %*s[-- driver_spec]\n" " %*s[-- driver_spec]\n"
" %s [-v ...] -C [rev:]file\n" " %s [-v ...] -C [rev:]file\n"
" %s [-v ...] -H path_into_repo\n" " %s [-v ...] -H path_into_repo\n"
" %s gdb ...\n"
"\n" "\n"
" rev git revision\n" " rev git revision\n"
" -r recurse into sub-sheets\n" " -r recurse into sub-sheets\n"
@ -57,6 +58,7 @@ void usage(const char *name)
" -C 'cat' the file to standard output\n" " -C 'cat' the file to standard output\n"
" -H show history of repository on 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" " -N n limit history to n revisions (unlimited if omitted or 0)\n"
" gdb run eeshow under gdb\n"
"\n" "\n"
"No driver spec: enter GUI\n" "No driver spec: enter GUI\n"
"\n" "\n"
@ -81,7 +83,7 @@ void usage(const char *name)
" diff [-o output.pdf] [-s scale] [file.lib ...] file.sch\n" " diff [-o output.pdf] [-s scale] [file.lib ...] file.sch\n"
"\n" "\n"
" see PNG\n" " see PNG\n"
, name, name, (int) strlen(name) + 1, "", name, name); , name, name, (int) strlen(name) + 1, "", name, name, name);
exit(1); exit(1);
} }
@ -103,6 +105,19 @@ int main(int argc, char **argv)
char **gfx_argv; char **gfx_argv;
const struct gfx_ops **ops = ops_list; 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++) for (dashdash = 1; dashdash != argc; dashdash++)
if (!strcmp(argv[dashdash], "--")) { if (!strcmp(argv[dashdash], "--")) {
have_dashdash = 1; have_dashdash = 1;