iPXE
Functions
gdbudp.h File Reference

GDB remote debugging over UDP. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
network device name

Set up the UDP transport with network address

IP address and UDP listen port, may be NULL and fields may be zero

Return values:
transportsuitable for starting the GDB stub or NULL on error
struct gdb_transportgdbudp_configure (const char *name, struct sockaddr_in *addr)

Detailed Description

GDB remote debugging over UDP.

Definition in file gdbudp.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
struct gdb_transport* gdbudp_configure ( const char *  name,
struct sockaddr_in addr 
) [read]

Definition at line 213 of file gdbudp.c.

References DEFAULT_PORT, fetch_ipv4_setting(), find_netdev(), htons, netdev_get(), netdev_put(), netdev_settings(), NULL, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_port, and source_addr.

Referenced by gdbudp_init().

                                                                                      {
        struct settings *settings;

        /* Release old network device */
        netdev_put ( netdev );

        netdev = find_netdev ( name );
        if ( !netdev ) {
                return NULL;
        }

        /* Hold network device */
        netdev_get ( netdev );

        /* Source UDP port */
        source_addr.sin_port = ( addr && addr->sin_port ) ? addr->sin_port : htons ( DEFAULT_PORT );

        /* Source IP address */
        if ( addr && addr->sin_addr.s_addr ) {
                source_addr.sin_addr.s_addr = addr->sin_addr.s_addr;
        } else {
                settings = netdev_settings ( netdev );
                fetch_ipv4_setting ( settings, &ip_setting, &source_addr.sin_addr );
                if ( source_addr.sin_addr.s_addr == 0 ) {
                        netdev_put ( netdev );
                        netdev = NULL;
                        return NULL;
                }
        }

        return &udp_gdb_transport;
}