mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-26 19:44:11 +08:00
* nlm/gdbserve.c: merge in command line argument parsing changes
and bug fixes made to i386-nlmstub.c.
This commit is contained in:
parent
e356aae315
commit
1e47d512c5
@ -1,5 +1,8 @@
|
|||||||
Wed Jul 27 14:34:42 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
|
Wed Jul 27 14:34:42 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
|
||||||
|
|
||||||
|
* nlm/gdbserve.c: merge in command line argument parsing changes
|
||||||
|
and bug fixes made to i386-nlmstub.c.
|
||||||
|
|
||||||
* i386-nlmstub.c: The returnLength field must be initialized
|
* i386-nlmstub.c: The returnLength field must be initialized
|
||||||
before portConfig is passed to AIOGetPortConfiguration.
|
before portConfig is passed to AIOGetPortConfiguration.
|
||||||
Compare command line arguments with strnicmp(); args are
|
Compare command line arguments with strnicmp(); args are
|
||||||
|
@ -932,13 +932,40 @@ handle_exception (frame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *baudRates[] = { "50", "75", "110", "134.5", "150", "300", "600", "1200",
|
char *progname;
|
||||||
"1800", "2000", "2400", "3600", "4800", "7200", "9600",
|
|
||||||
"19200", "38400", "57600", "115200" };
|
|
||||||
|
|
||||||
char dataBits[] = "5678";
|
struct bitRate {
|
||||||
|
BYTE bitRate;
|
||||||
|
const char *bitRateString;
|
||||||
|
};
|
||||||
|
|
||||||
char *stopBits[] = { "1", "1.5", "2" };
|
struct bitRate bitRateTable[] =
|
||||||
|
{
|
||||||
|
{ AIO_BAUD_50 , "50" },
|
||||||
|
{ AIO_BAUD_75 , "75" },
|
||||||
|
{ AIO_BAUD_110 , "110" },
|
||||||
|
{ AIO_BAUD_134p5 , "134.5" },
|
||||||
|
{ AIO_BAUD_150 , "150" },
|
||||||
|
{ AIO_BAUD_300 , "300" },
|
||||||
|
{ AIO_BAUD_600 , "600" },
|
||||||
|
{ AIO_BAUD_1200 , "1200" },
|
||||||
|
{ AIO_BAUD_1800 , "1800" },
|
||||||
|
{ AIO_BAUD_2000 , "2000" },
|
||||||
|
{ AIO_BAUD_2400 , "2400" },
|
||||||
|
{ AIO_BAUD_3600 , "3600" },
|
||||||
|
{ AIO_BAUD_4800 , "4800" },
|
||||||
|
{ AIO_BAUD_7200 , "7200" },
|
||||||
|
{ AIO_BAUD_9600 , "9600" },
|
||||||
|
{ AIO_BAUD_19200 , "19200" },
|
||||||
|
{ AIO_BAUD_38400 , "38400" },
|
||||||
|
{ AIO_BAUD_57600 , "57600" },
|
||||||
|
{ AIO_BAUD_115200, "115200" },
|
||||||
|
{ -1, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
char dataBitsTable[] = "5678";
|
||||||
|
|
||||||
|
char *stopBitsTable[] = { "1", "1.5", "2" };
|
||||||
|
|
||||||
char parity[] = "NOEMS";
|
char parity[] = "NOEMS";
|
||||||
|
|
||||||
@ -954,30 +981,94 @@ main (argc, argv)
|
|||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int hardware, board, port;
|
int hardware, board, port;
|
||||||
|
BYTE bitRate;
|
||||||
|
BYTE dataBits;
|
||||||
|
BYTE stopBits;
|
||||||
|
BYTE parityMode;
|
||||||
LONG err;
|
LONG err;
|
||||||
struct debuggerStructure s;
|
struct debuggerStructure s;
|
||||||
|
int cmdindx;
|
||||||
char *cmdlin;
|
char *cmdlin;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Use the -B option to invoke the NID if you want to debug the stub. */
|
/* set progname */
|
||||||
|
progname = "gdbserve";
|
||||||
|
|
||||||
if (argc > 1 && strcmp(argv[1], "-B") == 0)
|
/* set default serial line */
|
||||||
|
hardware = -1;
|
||||||
|
board = 0;
|
||||||
|
port = 0;
|
||||||
|
|
||||||
|
/* set default serial line characteristics */
|
||||||
|
bitRate = AIO_BAUD_9600;
|
||||||
|
dataBits = AIO_DATA_BITS_8;
|
||||||
|
stopBits = AIO_STOP_BITS_1;
|
||||||
|
parityMode = AIO_PARITY_NONE;
|
||||||
|
|
||||||
|
cmdindx = 0;
|
||||||
|
for (argc--, argv++; *argv; argc--, argv++)
|
||||||
{
|
{
|
||||||
Breakpoint(argc);
|
char *bp;
|
||||||
++argv, --argc;
|
char *ep;
|
||||||
|
|
||||||
|
if (strnicmp(*argv, "BAUD=", 5) == 0)
|
||||||
|
{
|
||||||
|
struct bitRate *brp;
|
||||||
|
|
||||||
|
bp = *argv + 5;
|
||||||
|
for (brp = bitRateTable; brp->bitRate != (BYTE) -1; brp++)
|
||||||
|
{
|
||||||
|
if (strcmp(brp->bitRateString, bp) == 0)
|
||||||
|
{
|
||||||
|
bitRate = brp->bitRate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (brp->bitRateString == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: %s: unknown or unsupported bit rate",
|
||||||
|
progname, bp);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strnicmp(*argv, "NODE=", 5) == 0)
|
||||||
|
{
|
||||||
|
bp = *argv + 5;
|
||||||
|
board = strtol (bp, &ep, 0);
|
||||||
|
if (ep == bp || *ep != '\0')
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: %s: expected integer argument\n",
|
||||||
|
progname, bp);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strnicmp(*argv, "PORT=", 5) == 0)
|
||||||
|
{
|
||||||
|
bp = *argv + 5;
|
||||||
|
port = strtol (bp, &ep, 0);
|
||||||
|
if (ep == bp || *ep != '\0')
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: %s: expected integer argument\n",
|
||||||
|
progname, bp);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdindx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 4)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Usage: load gdbserve board port program [arguments]\n");
|
"Usage: load %s [options] program [arguments]\n", progname);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
hardware = -1;
|
|
||||||
board = strtol (argv[1], (char **) NULL, 0);
|
|
||||||
port = strtol (argv[2], (char **) NULL, 0);
|
|
||||||
|
|
||||||
err = AIOAcquirePort (&hardware, &board, &port, &AIOhandle);
|
err = AIOAcquirePort (&hardware, &board, &port, &AIOhandle);
|
||||||
if (err != AIO_SUCCESS)
|
if (err != AIO_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -1000,23 +1091,24 @@ main (argc, argv)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = AIOConfigurePort (AIOhandle, AIO_BAUD_9600, AIO_DATA_BITS_8,
|
err = AIOConfigurePort (AIOhandle, bitRate, dataBits, stopBits, parityMode,
|
||||||
AIO_STOP_BITS_1, AIO_PARITY_NONE,
|
|
||||||
AIO_HARDWARE_FLOW_CONTROL_OFF);
|
AIO_HARDWARE_FLOW_CONTROL_OFF);
|
||||||
|
|
||||||
if (err == AIO_QUALIFIED_SUCCESS)
|
if (err == AIO_QUALIFIED_SUCCESS)
|
||||||
{
|
{
|
||||||
AIOPORTCONFIG portConfig;
|
AIOPORTCONFIG portConfig;
|
||||||
AIODVRCONFIG dvrConfig;
|
|
||||||
|
|
||||||
fprintf (stderr, "Port configuration changed!\n");
|
fprintf (stderr, "Port configuration changed!\n");
|
||||||
AIOGetPortConfiguration (AIOhandle, &portConfig, &dvrConfig);
|
|
||||||
|
portConfig.returnLength = sizeof(portConfig);
|
||||||
|
AIOGetPortConfiguration (AIOhandle, &portConfig, NULL);
|
||||||
|
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
" Bit Rate: %s, Data Bits: %c, Stop Bits: %s, Parity: %c,\
|
" Bit Rate: %s, Data Bits: %c, Stop Bits: %s, Parity: %c,\
|
||||||
Flow:%s\n",
|
Flow:%s\n",
|
||||||
baudRates[portConfig.bitRate],
|
bitRateTable[portConfig.bitRate].bitRateString,
|
||||||
dataBits[portConfig.dataBits],
|
dataBitsTable[portConfig.dataBits],
|
||||||
stopBits[portConfig.stopBits],
|
stopBitsTable[portConfig.stopBits],
|
||||||
parity[portConfig.parityMode],
|
parity[portConfig.parityMode],
|
||||||
portConfig.flowCtrlMode ? "ON" : "OFF");
|
portConfig.flowCtrlMode ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
@ -1065,7 +1157,7 @@ main (argc, argv)
|
|||||||
/* Get the command line we were invoked with, and advance it past
|
/* Get the command line we were invoked with, and advance it past
|
||||||
our name and the board and port arguments. */
|
our name and the board and port arguments. */
|
||||||
cmdlin = getcmd ((char *) NULL);
|
cmdlin = getcmd ((char *) NULL);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < cmdindx; i++)
|
||||||
{
|
{
|
||||||
while (! isspace (*cmdlin))
|
while (! isspace (*cmdlin))
|
||||||
++cmdlin;
|
++cmdlin;
|
||||||
|
Loading…
Reference in New Issue
Block a user