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

@addr 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()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ gdbudp_configure()

struct gdb_transport* gdbudp_configure ( const char *  name,
struct sockaddr_in addr 
)

Definition at line 213 of file gdbudp.c.

213  {
214  struct settings *settings;
215 
216  /* Release old network device */
217  netdev_put ( netdev );
218 
219  netdev = find_netdev ( name );
220  if ( !netdev ) {
221  return NULL;
222  }
223 
224  /* Hold network device */
225  netdev_get ( netdev );
226 
227  /* Source UDP port */
228  source_addr.sin_port = ( addr && addr->sin_port ) ? addr->sin_port : htons ( DEFAULT_PORT );
229 
230  /* Source IP address */
231  if ( addr && addr->sin_addr.s_addr ) {
232  source_addr.sin_addr.s_addr = addr->sin_addr.s_addr;
233  } else {
235  fetch_ipv4_setting ( settings, &ip_setting, &source_addr.sin_addr );
236  if ( source_addr.sin_addr.s_addr == 0 ) {
237  netdev_put ( netdev );
238  netdev = NULL;
239  return NULL;
240  }
241  }
242 
243  return &udp_gdb_transport;
244 }
const char * name
Definition: ath9k_hw.c:1984
int fetch_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
Definition: settings.c:912
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
Definition: netdevice.h:583
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:572
static struct net_device * netdev
Definition: gdbudp.c:52
uint16_t sin_port
TCP/IP port (part of struct sockaddr_tcpip)
Definition: in.h:91
A settings block.
Definition: settings.h:132
u32 addr
Definition: sky2.h:8
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
Definition: netdevice.h:561
static struct sockaddr_in source_addr
Definition: gdbudp.c:55
uint32_t s_addr
Definition: in.h:40
struct in_addr sin_addr
IPv4 address.
Definition: in.h:98
struct net_device * find_netdev(const char *name)
Get network device by name.
Definition: netdevice.c:988
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define htons(value)
Definition: byteswap.h:135

References addr, DEFAULT_PORT, fetch_ipv4_setting(), find_netdev(), htons, name, netdev, 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().