#include <stdio.h>
#include <getopt.h>
#include <gpxe/command.h>
#include <gpxe/gdbstub.h>
Go to the source code of this file.
Functions | |
| static void | gdbstub_syntax (char **argv) |
| "gdbstub" command syntax message | |
| static int | gdbstub_exec (int argc, char **argv) |
| The "gdbstub" command. | |
Variables | |
| struct command gdbstub_commands[] | __command |
| GDB stub commands. | |
Definition in file gdbstub_cmd.c.
| static void gdbstub_syntax | ( | char ** | argv | ) | [static] |
"gdbstub" command syntax message
| argv | Argument list |
Definition at line 35 of file gdbstub_cmd.c.
References printf().
Referenced by gdbstub_exec().
00035 { 00036 printf ( "Usage:\n" 00037 " %s <transport> [<options>...]\n" 00038 "\n" 00039 "Start remote debugging using one of the following transports:\n" 00040 " serial use serial port (if compiled in)\n" 00041 " udp <interface> use UDP over network interface (if compiled in)\n", 00042 argv[0] ); 00043 }
| static int gdbstub_exec | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
The "gdbstub" command.
| argc | Argument count | |
| argv | Argument list |
| rc | Exit code |
Definition at line 52 of file gdbstub_cmd.c.
References find_gdb_transport(), gdbstub_start(), gdbstub_syntax(), getopt_long(), gdb_transport::init, NULL, optind, and printf().
00052 { 00053 static struct option longopts[] = { 00054 { "help", 0, NULL, 'h' }, 00055 { NULL, 0, NULL, 0 }, 00056 }; 00057 const char *trans_name; 00058 struct gdb_transport *trans; 00059 int c; 00060 00061 /* Parse options */ 00062 while ( ( c = getopt_long ( argc, argv, "h", longopts, NULL ) ) >= 0 ){ 00063 switch ( c ) { 00064 case 'h': 00065 /* Display help text */ 00066 default: 00067 /* Unrecognised/invalid option */ 00068 gdbstub_syntax ( argv ); 00069 return 1; 00070 } 00071 } 00072 00073 /* At least one argument */ 00074 if ( optind == argc ) { 00075 gdbstub_syntax ( argv ); 00076 return 1; 00077 } 00078 00079 trans_name = argv[optind++]; 00080 00081 /* Initialise transport */ 00082 trans = find_gdb_transport ( trans_name ); 00083 if ( !trans ) { 00084 printf ( "%s: no such transport (is it compiled in?)\n", trans_name ); 00085 return 1; 00086 } 00087 00088 if ( trans->init ) { 00089 if ( trans->init ( argc - optind, &argv[optind] ) != 0 ) { 00090 return 1; 00091 } 00092 } 00093 00094 /* Enter GDB stub */ 00095 gdbstub_start ( trans ); 00096 return 0; 00097 }
Initial value:
{
{
.name = "gdbstub",
.exec = gdbstub_exec,
},
}
Definition at line 100 of file gdbstub_cmd.c.
1.5.7.1