iPXE
Data Structures | Functions | Variables
gdbstub_cmd.c File Reference

GDB stub command. More...

#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/gdbstub.h>

Go to the source code of this file.

Data Structures

struct  gdbstub_options
 "gdbstub" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int parse_gdb_transport (const char *text, struct gdb_transport **trans)
 Parse GDB transport name.
static int gdbstub_exec (int argc, char **argv)
 The "gdbstub" command.

Variables

static struct option_descriptor gdbstub_opts [] = {}
 "gdbstub" option list
static struct command_descriptor gdbstub_cmd
 "gdbstub" command descriptor
struct command gdbstub_commands[] __command
 GDB stub commands.

Detailed Description

GDB stub command.

Definition in file gdbstub_cmd.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int parse_gdb_transport ( const char *  text,
struct gdb_transport **  trans 
) [static]

Parse GDB transport name.

Parameters:
textText
Return values:
transGDB transport
rcReturn status code

Definition at line 47 of file gdbstub_cmd.c.

References assert, ENOTSUP, find_gdb_transport(), NULL, and printf().

Referenced by gdbstub_exec().

                                                                {

        /* Sanity check */
        assert ( text != NULL );

        /* Find transport */
        *trans = find_gdb_transport ( text );
        if ( ! *trans ) {
                printf ( "\"%s\": no such transport (is it compiled in?)\n",
                         text );
                return -ENOTSUP;
        }

        return 0;
}
static int gdbstub_exec ( int  argc,
char **  argv 
) [static]

The "gdbstub" command.

Parameters:
argcArgument count
argvArgument list
Return values:
rcReturn status code

Definition at line 82 of file gdbstub_cmd.c.

References gdbstub_start(), gdb_transport::init, optind, parse_gdb_transport(), parse_options(), and rc.

                                                  {
        struct gdbstub_options opts;
        struct gdb_transport *trans;
        int rc;

        /* Parse options */
        if ( ( rc = parse_options ( argc, argv, &gdbstub_cmd, &opts ) ) != 0 )
                return rc;

        /* Parse transport name */
        if ( ( rc = parse_gdb_transport ( argv[optind++], &trans ) ) != 0 )
                return rc;

        /* Initialise transport */
        if ( trans->init ) {
                if ( ( rc = trans->init ( argc - optind,
                                          &argv[optind] ) ) != 0 ) {
                        return rc;
                }
        }

        /* Enter GDB stub */
        gdbstub_start ( trans );

        return 0;
}

Variable Documentation

struct option_descriptor gdbstub_opts[] = {} [static]

"gdbstub" option list

Definition at line 68 of file gdbstub_cmd.c.

Initial value:
        COMMAND_DESC ( struct gdbstub_options, gdbstub_opts, 1, MAX_ARGUMENTS,
                       "<transport> [<options>...]" )

"gdbstub" command descriptor

Definition at line 71 of file gdbstub_cmd.c.

struct command gdbstub_commands [] __command
Initial value:
 {
        {
                .name = "gdbstub",
                .exec = gdbstub_exec,
        },
}

GDB stub commands.

Definition at line 110 of file gdbstub_cmd.c.