iPXE
Macros | Functions
Debugging infrastructure

Macros

#define DBG(...)   DBG_IF ( LOG, ##__VA_ARGS__ )
 Print a debugging message. More...
 
#define NDEBUG
 
#define DBGLVL_MAX   0
 
#define DBGLVL_DFLT   DBGLVL_MAX
 
#define __debug_disable(object)   _C2 ( __debug_disable_, object )
 
#define DBG_DISABLE_OBJECT(object, level)
 
#define DBG_ENABLE_OBJECT(object, level)
 
#define DBGLVL   0
 
#define DBG_DISABLE(level)   do { } while ( 0 )
 
#define DBG_ENABLE(level)   do { } while ( 0 )
 
#define DBGLVL_LOG   1
 
#define DBG_LOG   ( DBGLVL & DBGLVL_LOG )
 
#define DBGLVL_EXTRA   2
 
#define DBG_EXTRA   ( DBGLVL & DBGLVL_EXTRA )
 
#define DBGLVL_PROFILE   4
 
#define DBG_PROFILE   ( DBGLVL & DBGLVL_PROFILE )
 
#define DBGLVL_IO   8
 
#define DBG_IO   ( DBGLVL & DBGLVL_IO )
 
#define DBG_IF(level, ...)
 Print debugging message if we are at a certain debug level. More...
 
#define DBG_HDA_IF(level, dispaddr, data, len)
 Print a hex dump if we are at a certain debug level. More...
 
#define DBG_HD_IF(level, data, len)
 Print a hex dump if we are at a certain debug level. More...
 
#define DBG_MD5A_IF(level, dispaddr, data, len)
 Print an MD5 checksum if we are at a certain debug level. More...
 
#define DBG_MD5_IF(level, data, len)
 Print an MD5 checksum if we are at a certain debug level. More...
 
#define DBG_PAUSE_IF(level, ...)
 Prompt for key press if we are at a certain debug level. More...
 
#define DBG_MORE_IF(level, ...)
 Prompt for more output data if we are at a certain debug level. More...
 
#define DBG_AC_IF(level, id)
 Select colour for debug messages if we are at a certain debug level. More...
 
#define DBG_DC_IF(level)
 Revert colour for debug messages if we are at a certain debug level. More...
 
#define DBGC_IF(level, id, ...)
 
#define DBGC_HDA_IF(level, id, ...)
 
#define DBGC_HD_IF(level, id, ...)
 
#define DBGC_MD5A_IF(level, id, ...)
 
#define DBGC_MD5_IF(level, id, ...)
 
#define DBGC_PAUSE_IF(level, id)
 
#define DBGC_MORE_IF(level, id)
 
#define DBG_HDA(...)   DBG_HDA_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG_HD(...)   DBG_HD_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG_MD5A(...)   DBG_MD5A_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG_MD5(...)   DBG_MD5_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG_PAUSE(...)   DBG_PAUSE_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG_MORE(...)   DBG_MORE_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC(...)   DBGC_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_HDA(...)   DBGC_HDA_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_HD(...)   DBGC_HD_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_MD5A(...)   DBGC_MD5A_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_MD5(...)   DBGC_MD5_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_PAUSE(...)   DBGC_PAUSE_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_MORE(...)   DBGC_MORE_IF ( LOG, ##__VA_ARGS__ )
 
#define DBG2(...)   DBG_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_HDA(...)   DBG_HDA_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_HD(...)   DBG_HD_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_MD5A(...)   DBG_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_MD5(...)   DBG_MD5_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_PAUSE(...)   DBG_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBG2_MORE(...)   DBG_MORE_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2(...)   DBGC_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_HDA(...)   DBGC_HDA_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_HD(...)   DBGC_HD_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_MD5A(...)   DBGC_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_MD5(...)   DBGC_MD5_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_PAUSE(...)   DBGC_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_MORE(...)   DBGC_MORE_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGP(...)   DBG_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_HDA(...)   DBG_HDA_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_HD(...)   DBG_HD_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_MD5A(...)   DBG_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_MD5(...)   DBG_MD5_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_PAUSE(...)   DBG_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGP_MORE(...)   DBG_MORE_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP(...)   DBGC_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_HDA(...)   DBGC_HDA_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_HD(...)   DBGC_HD_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_MD5A(...)   DBGC_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_MD5(...)   DBGC_MD5_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_PAUSE(...)   DBGC_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_MORE(...)   DBGC_MORE_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGIO(...)   DBG_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_HDA(...)   DBG_HDA_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_HD(...)   DBG_HD_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_MD5A(...)   DBG_MD5A_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_MD5(...)   DBG_MD5_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_PAUSE(...)   DBG_PAUSE_IF ( IO, ##__VA_ARGS__ )
 
#define DBGIO_MORE(...)   DBG_MORE_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO(...)   DBGC_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_HDA(...)   DBGC_HDA_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_HD(...)   DBGC_HD_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_MD5A(...)   DBGC_MD5A_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_MD5(...)   DBGC_MD5_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_PAUSE(...)   DBGC_PAUSE_IF ( IO, ##__VA_ARGS__ )
 
#define DBGCIO_MORE(...)   DBGC_MORE_IF ( IO, ##__VA_ARGS__ )
 

Functions

void dbg_printf (const char *fmt,...)
 printf() for debugging More...
 
void dbg_autocolourise (unsigned long id)
 Select automatic colour for debug messages. More...
 
void dbg_decolourise (void)
 Revert to normal colour. More...
 
void dbg_hex_dump_da (unsigned long dispaddr, const void *data, unsigned long len)
 Print hex dump with specified display address. More...
 
void dbg_md5_da (unsigned long dispaddr, const void *data, unsigned long len)
 Print an MD5 checksum with specified display address. More...
 
void dbg_pause (void)
 Pause until a key is pressed. More...
 
void dbg_more (void)
 Indicate more data to follow and pause until a key is pressed. More...
 
char __debug_disable (OBJECT)
 

Detailed Description

Macro Definition Documentation

◆ DBG

#define DBG (   ...)    DBG_IF ( LOG, ##__VA_ARGS__ )

Print a debugging message.

The debug level is set at build time by specifying the DEBUG= parameter on the make command line. For example, to enable debugging for the PCI bus functions (in pci.c) in a .dsk image for the rtl8139 card, you could use the command line

make bin/rtl8139.dsk DEBUG=pci

This will enable the debugging statements (DBG()) in pci.c. If debugging is not enabled, DBG() statements will be ignored.

You can enable debugging in several objects simultaneously by separating them with commas, as in

make bin/rtl8139.dsk DEBUG=pci,buffer,heap

You can increase the debugging level for an object by specifying it with :N, where N is the level, as in

make bin/rtl8139.dsk DEBUG=pci,buffer:2,heap

which would enable debugging for the PCI, buffer-handling and heap-allocation code, with the buffer-handling code at level 2.

Definition at line 498 of file compiler.h.

◆ NDEBUG

#define NDEBUG

Definition at line 269 of file compiler.h.

◆ DBGLVL_MAX

#define DBGLVL_MAX   0

Definition at line 270 of file compiler.h.

◆ DBGLVL_DFLT

#define DBGLVL_DFLT   DBGLVL_MAX

Definition at line 274 of file compiler.h.

◆ __debug_disable

#define __debug_disable (   object)    _C2 ( __debug_disable_, object )

Definition at line 292 of file compiler.h.

◆ DBG_DISABLE_OBJECT

#define DBG_DISABLE_OBJECT (   object,
  level 
)
Value:
do { \
extern char __debug_disable(object); \
__debug_disable(object) |= (level); \
} while ( 0 )
#define __debug_disable(object)
Definition: compiler.h:292

Definition at line 294 of file compiler.h.

◆ DBG_ENABLE_OBJECT

#define DBG_ENABLE_OBJECT (   object,
  level 
)
Value:
do { \
extern char __debug_disable(object); \
__debug_disable(object) &= ~(level); \
} while ( 0 )
#define __debug_disable(object)
Definition: compiler.h:292

Definition at line 298 of file compiler.h.

◆ DBGLVL

#define DBGLVL   0

Definition at line 311 of file compiler.h.

◆ DBG_DISABLE

#define DBG_DISABLE (   level)    do { } while ( 0 )

Definition at line 312 of file compiler.h.

◆ DBG_ENABLE

#define DBG_ENABLE (   level)    do { } while ( 0 )

Definition at line 313 of file compiler.h.

◆ DBGLVL_LOG

#define DBGLVL_LOG   1

Definition at line 316 of file compiler.h.

◆ DBG_LOG

#define DBG_LOG   ( DBGLVL & DBGLVL_LOG )

Definition at line 317 of file compiler.h.

◆ DBGLVL_EXTRA

#define DBGLVL_EXTRA   2

Definition at line 318 of file compiler.h.

◆ DBG_EXTRA

#define DBG_EXTRA   ( DBGLVL & DBGLVL_EXTRA )

Definition at line 319 of file compiler.h.

◆ DBGLVL_PROFILE

#define DBGLVL_PROFILE   4

Definition at line 320 of file compiler.h.

◆ DBG_PROFILE

#define DBG_PROFILE   ( DBGLVL & DBGLVL_PROFILE )

Definition at line 321 of file compiler.h.

◆ DBGLVL_IO

#define DBGLVL_IO   8

Definition at line 322 of file compiler.h.

◆ DBG_IO

#define DBG_IO   ( DBGLVL & DBGLVL_IO )

Definition at line 323 of file compiler.h.

◆ DBG_IF

#define DBG_IF (   level,
  ... 
)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_printf ( __VA_ARGS__ ); \
} \
} while ( 0 )

Print debugging message if we are at a certain debug level.

Parameters
levelDebug level
...printf() argument list

Definition at line 331 of file compiler.h.

◆ DBG_HDA_IF

#define DBG_HDA_IF (   level,
  dispaddr,
  data,
  len 
)
Value:
do { \
if ( DBG_ ## level ) { \
union { \
unsigned long ul; \
typeof ( dispaddr ) raw; \
} da; \
da.ul = 0; \
da.raw = dispaddr; \
dbg_hex_dump_da ( da.ul, data, len ); \
} \
} while ( 0 )
uint8_t data[48]
Additional event data.
Definition: ena.h:22
__be32 raw[7]
Definition: CIB_PRM.h:28
uint32_t len
Length.
Definition: ena.h:14

Print a hex dump if we are at a certain debug level.

Parameters
levelDebug level
dispaddrDisplay address
dataData to print
lenLength of data

Definition at line 345 of file compiler.h.

◆ DBG_HD_IF

#define DBG_HD_IF (   level,
  data,
  len 
)
Value:
do { \
const void *_data = data; \
DBG_HDA_IF ( level, _data, _data, len ); \
} while ( 0 )
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint32_t len
Length.
Definition: ena.h:14

Print a hex dump if we are at a certain debug level.

Parameters
levelDebug level
dataData to print
lenLength of data

Definition at line 364 of file compiler.h.

◆ DBG_MD5A_IF

#define DBG_MD5A_IF (   level,
  dispaddr,
  data,
  len 
)
Value:
do { \
if ( DBG_ ## level ) { \
union { \
unsigned long ul; \
typeof ( dispaddr ) raw; \
} da; \
da.ul = 0; \
da.raw = dispaddr; \
dbg_md5_da ( da.ul, data, len ); \
} \
} while ( 0 )
uint8_t data[48]
Additional event data.
Definition: ena.h:22
__be32 raw[7]
Definition: CIB_PRM.h:28
uint32_t len
Length.
Definition: ena.h:14

Print an MD5 checksum if we are at a certain debug level.

Parameters
levelDebug level
dispaddrDisplay address
dataData to print
lenLength of data

Definition at line 377 of file compiler.h.

◆ DBG_MD5_IF

#define DBG_MD5_IF (   level,
  data,
  len 
)
Value:
do { \
const void *_data = data; \
DBG_MD5A_IF ( level, _data, _data, len ); \
} while ( 0 )
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint32_t len
Length.
Definition: ena.h:14

Print an MD5 checksum if we are at a certain debug level.

Parameters
levelDebug level
dataData to print
lenLength of data

Definition at line 396 of file compiler.h.

◆ DBG_PAUSE_IF

#define DBG_PAUSE_IF (   level,
  ... 
)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_pause(); \
} \
} while ( 0 )

Prompt for key press if we are at a certain debug level.

Parameters
levelDebug level

Definition at line 406 of file compiler.h.

◆ DBG_MORE_IF

#define DBG_MORE_IF (   level,
  ... 
)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_more(); \
} \
} while ( 0 )

Prompt for more output data if we are at a certain debug level.

Parameters
levelDebug level

Definition at line 417 of file compiler.h.

◆ DBG_AC_IF

#define DBG_AC_IF (   level,
  id 
)
Value:
do { \
if ( DBG_ ## level ) { \
union { \
unsigned long ul; \
typeof ( id ) raw; \
} dbg_stream; \
dbg_stream.ul = 0; \
dbg_stream.raw = id; \
dbg_autocolourise ( dbg_stream.ul ); \
} \
} while ( 0 )
uint8_t id
Request identifier.
Definition: ena.h:12
__be32 raw[7]
Definition: CIB_PRM.h:28

Select colour for debug messages if we are at a certain debug level.

Parameters
levelDebug level
idMessage stream ID

Definition at line 429 of file compiler.h.

◆ DBG_DC_IF

#define DBG_DC_IF (   level)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_decolourise(); \
} \
} while ( 0 )

Revert colour for debug messages if we are at a certain debug level.

Parameters
levelDebug level

Definition at line 446 of file compiler.h.

◆ DBGC_IF

#define DBGC_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 454 of file compiler.h.

◆ DBGC_HDA_IF

#define DBGC_HDA_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_HDA_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 460 of file compiler.h.

◆ DBGC_HD_IF

#define DBGC_HD_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_HD_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 466 of file compiler.h.

◆ DBGC_MD5A_IF

#define DBGC_MD5A_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_MD5A_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 472 of file compiler.h.

◆ DBGC_MD5_IF

#define DBGC_MD5_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_MD5_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 478 of file compiler.h.

◆ DBGC_PAUSE_IF

#define DBGC_PAUSE_IF (   level,
  id 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_PAUSE_IF ( level ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 484 of file compiler.h.

◆ DBGC_MORE_IF

#define DBGC_MORE_IF (   level,
  id 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_MORE_IF ( level ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 490 of file compiler.h.

◆ DBG_HDA

#define DBG_HDA (   ...)    DBG_HDA_IF ( LOG, ##__VA_ARGS__ )

Definition at line 499 of file compiler.h.

◆ DBG_HD

#define DBG_HD (   ...)    DBG_HD_IF ( LOG, ##__VA_ARGS__ )

Definition at line 500 of file compiler.h.

◆ DBG_MD5A

#define DBG_MD5A (   ...)    DBG_MD5A_IF ( LOG, ##__VA_ARGS__ )

Definition at line 501 of file compiler.h.

◆ DBG_MD5

#define DBG_MD5 (   ...)    DBG_MD5_IF ( LOG, ##__VA_ARGS__ )

Definition at line 502 of file compiler.h.

◆ DBG_PAUSE

#define DBG_PAUSE (   ...)    DBG_PAUSE_IF ( LOG, ##__VA_ARGS__ )

Definition at line 503 of file compiler.h.

◆ DBG_MORE

#define DBG_MORE (   ...)    DBG_MORE_IF ( LOG, ##__VA_ARGS__ )

Definition at line 504 of file compiler.h.

◆ DBGC

#define DBGC (   ...)    DBGC_IF ( LOG, ##__VA_ARGS__ )

Definition at line 505 of file compiler.h.

◆ DBGC_HDA

#define DBGC_HDA (   ...)    DBGC_HDA_IF ( LOG, ##__VA_ARGS__ )

Definition at line 506 of file compiler.h.

◆ DBGC_HD

#define DBGC_HD (   ...)    DBGC_HD_IF ( LOG, ##__VA_ARGS__ )

Definition at line 507 of file compiler.h.

◆ DBGC_MD5A

#define DBGC_MD5A (   ...)    DBGC_MD5A_IF ( LOG, ##__VA_ARGS__ )

Definition at line 508 of file compiler.h.

◆ DBGC_MD5

#define DBGC_MD5 (   ...)    DBGC_MD5_IF ( LOG, ##__VA_ARGS__ )

Definition at line 509 of file compiler.h.

◆ DBGC_PAUSE

#define DBGC_PAUSE (   ...)    DBGC_PAUSE_IF ( LOG, ##__VA_ARGS__ )

Definition at line 510 of file compiler.h.

◆ DBGC_MORE

#define DBGC_MORE (   ...)    DBGC_MORE_IF ( LOG, ##__VA_ARGS__ )

Definition at line 511 of file compiler.h.

◆ DBG2

#define DBG2 (   ...)    DBG_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 515 of file compiler.h.

◆ DBG2_HDA

#define DBG2_HDA (   ...)    DBG_HDA_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 516 of file compiler.h.

◆ DBG2_HD

#define DBG2_HD (   ...)    DBG_HD_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 517 of file compiler.h.

◆ DBG2_MD5A

#define DBG2_MD5A (   ...)    DBG_MD5A_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 518 of file compiler.h.

◆ DBG2_MD5

#define DBG2_MD5 (   ...)    DBG_MD5_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 519 of file compiler.h.

◆ DBG2_PAUSE

#define DBG2_PAUSE (   ...)    DBG_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 520 of file compiler.h.

◆ DBG2_MORE

#define DBG2_MORE (   ...)    DBG_MORE_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 521 of file compiler.h.

◆ DBGC2

#define DBGC2 (   ...)    DBGC_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 522 of file compiler.h.

◆ DBGC2_HDA

#define DBGC2_HDA (   ...)    DBGC_HDA_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 523 of file compiler.h.

◆ DBGC2_HD

#define DBGC2_HD (   ...)    DBGC_HD_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 524 of file compiler.h.

◆ DBGC2_MD5A

#define DBGC2_MD5A (   ...)    DBGC_MD5A_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 525 of file compiler.h.

◆ DBGC2_MD5

#define DBGC2_MD5 (   ...)    DBGC_MD5_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 526 of file compiler.h.

◆ DBGC2_PAUSE

#define DBGC2_PAUSE (   ...)    DBGC_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 527 of file compiler.h.

◆ DBGC2_MORE

#define DBGC2_MORE (   ...)    DBGC_MORE_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 528 of file compiler.h.

◆ DBGP

#define DBGP (   ...)    DBG_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 532 of file compiler.h.

◆ DBGP_HDA

#define DBGP_HDA (   ...)    DBG_HDA_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 533 of file compiler.h.

◆ DBGP_HD

#define DBGP_HD (   ...)    DBG_HD_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 534 of file compiler.h.

◆ DBGP_MD5A

#define DBGP_MD5A (   ...)    DBG_MD5A_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 535 of file compiler.h.

◆ DBGP_MD5

#define DBGP_MD5 (   ...)    DBG_MD5_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 536 of file compiler.h.

◆ DBGP_PAUSE

#define DBGP_PAUSE (   ...)    DBG_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 537 of file compiler.h.

◆ DBGP_MORE

#define DBGP_MORE (   ...)    DBG_MORE_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 538 of file compiler.h.

◆ DBGCP

#define DBGCP (   ...)    DBGC_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 539 of file compiler.h.

◆ DBGCP_HDA

#define DBGCP_HDA (   ...)    DBGC_HDA_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 540 of file compiler.h.

◆ DBGCP_HD

#define DBGCP_HD (   ...)    DBGC_HD_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 541 of file compiler.h.

◆ DBGCP_MD5A

#define DBGCP_MD5A (   ...)    DBGC_MD5A_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 542 of file compiler.h.

◆ DBGCP_MD5

#define DBGCP_MD5 (   ...)    DBGC_MD5_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 543 of file compiler.h.

◆ DBGCP_PAUSE

#define DBGCP_PAUSE (   ...)    DBGC_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 544 of file compiler.h.

◆ DBGCP_MORE

#define DBGCP_MORE (   ...)    DBGC_MORE_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 545 of file compiler.h.

◆ DBGIO

#define DBGIO (   ...)    DBG_IF ( IO, ##__VA_ARGS__ )

Definition at line 549 of file compiler.h.

◆ DBGIO_HDA

#define DBGIO_HDA (   ...)    DBG_HDA_IF ( IO, ##__VA_ARGS__ )

Definition at line 550 of file compiler.h.

◆ DBGIO_HD

#define DBGIO_HD (   ...)    DBG_HD_IF ( IO, ##__VA_ARGS__ )

Definition at line 551 of file compiler.h.

◆ DBGIO_MD5A

#define DBGIO_MD5A (   ...)    DBG_MD5A_IF ( IO, ##__VA_ARGS__ )

Definition at line 552 of file compiler.h.

◆ DBGIO_MD5

#define DBGIO_MD5 (   ...)    DBG_MD5_IF ( IO, ##__VA_ARGS__ )

Definition at line 553 of file compiler.h.

◆ DBGIO_PAUSE

#define DBGIO_PAUSE (   ...)    DBG_PAUSE_IF ( IO, ##__VA_ARGS__ )

Definition at line 554 of file compiler.h.

◆ DBGIO_MORE

#define DBGIO_MORE (   ...)    DBG_MORE_IF ( IO, ##__VA_ARGS__ )

Definition at line 555 of file compiler.h.

◆ DBGCIO

#define DBGCIO (   ...)    DBGC_IF ( IO, ##__VA_ARGS__ )

Definition at line 556 of file compiler.h.

◆ DBGCIO_HDA

#define DBGCIO_HDA (   ...)    DBGC_HDA_IF ( IO, ##__VA_ARGS__ )

Definition at line 557 of file compiler.h.

◆ DBGCIO_HD

#define DBGCIO_HD (   ...)    DBGC_HD_IF ( IO, ##__VA_ARGS__ )

Definition at line 558 of file compiler.h.

◆ DBGCIO_MD5A

#define DBGCIO_MD5A (   ...)    DBGC_MD5A_IF ( IO, ##__VA_ARGS__ )

Definition at line 559 of file compiler.h.

◆ DBGCIO_MD5

#define DBGCIO_MD5 (   ...)    DBGC_MD5_IF ( IO, ##__VA_ARGS__ )

Definition at line 560 of file compiler.h.

◆ DBGCIO_PAUSE

#define DBGCIO_PAUSE (   ...)    DBGC_PAUSE_IF ( IO, ##__VA_ARGS__ )

Definition at line 561 of file compiler.h.

◆ DBGCIO_MORE

#define DBGCIO_MORE (   ...)    DBGC_MORE_IF ( IO, ##__VA_ARGS__ )

Definition at line 562 of file compiler.h.

Function Documentation

◆ dbg_printf()

void dbg_printf ( const char *  fmt,
  ... 
)

printf() for debugging

printf() for debugging

Parameters
fmtFormat string
...Arguments

Definition at line 38 of file debug.c.

38  {
39  int saved_usage;
40  va_list args;
41 
42  /* Mark console as in use for debugging messages */
44 
45  /* Print message */
46  va_start ( args, fmt );
47  vprintf ( fmt, args );
48  va_end ( args );
49 
50  /* Restore console usage */
52 }
#define va_end(ap)
Definition: stdarg.h:9
#define CONSOLE_USAGE_DEBUG
Debug messages.
Definition: console.h:144
__builtin_va_list va_list
Definition: stdarg.h:6
static int console_set_usage(int usage)
Set console usage.
Definition: console.h:187
static unsigned int saved_usage
Definition: ansi_screen.c:13
int ssize_t const char * fmt
Definition: vsprintf.h:72
int vprintf(const char *fmt, va_list args)
Write a formatted string to the console.
Definition: vsprintf.c:449
#define va_start(ap, last)
Definition: stdarg.h:7

References console_set_usage(), CONSOLE_USAGE_DEBUG, fmt, saved_usage, va_end, va_start, and vprintf().

Referenced by check_bios_interrupts(), dbg_autocolourise(), dbg_decolourise(), dbg_hex_dump_da_row(), dbg_more(), and dbg_pause().

◆ dbg_autocolourise()

void dbg_autocolourise ( unsigned long  stream)

Select automatic colour for debug messages.

Parameters
streamMessage stream ID

Definition at line 196 of file debug.c.

196  {
197 
198  if ( DBGCOL_MIN ) {
199  dbg_printf ( "\033[%dm",
200  ( stream ?
201  ( DBGCOL_MIN + dbg_autocolour ( stream ) ) : 0));
202  }
203 }
#define DBGCOL_MIN
Base message stream colour.
Definition: debug.c:131
static int dbg_autocolour(unsigned long stream)
Choose colour index for debug autocolourisation.
Definition: debug.c:159
void dbg_printf(const char *fmt,...)
Print debug message.
Definition: debug.c:38

References dbg_autocolour(), dbg_printf(), DBGCOL_MIN, and autocolour::stream.

◆ dbg_decolourise()

void dbg_decolourise ( void  )

Revert to normal colour.

Definition at line 209 of file debug.c.

209  {
210 
211  if ( DBGCOL_MIN )
212  dbg_printf ( "\033[0m" );
213 }
#define DBGCOL_MIN
Base message stream colour.
Definition: debug.c:131
void dbg_printf(const char *fmt,...)
Print debug message.
Definition: debug.c:38

References dbg_printf(), and DBGCOL_MIN.

◆ dbg_hex_dump_da()

void dbg_hex_dump_da ( unsigned long  dispaddr,
const void *  data,
unsigned long  len 
)

Print hex dump with specified display address.

Parameters
dispaddrDisplay address
dataData to print
lenLength of data

Definition at line 116 of file debug.c.

117  {
118  unsigned int offset;
119 
120  for ( offset = 0 ; offset < len ; offset += 16 ) {
121  dbg_hex_dump_da_row ( dispaddr, data, len, offset );
122  }
123 }
static void dbg_hex_dump_da_row(unsigned long dispaddr, const void *data, unsigned long len, unsigned int offset)
Print row of a hex dump with specified display address.
Definition: debug.c:82
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
uint32_t len
Length.
Definition: ena.h:14

References data, dbg_hex_dump_da_row(), len, and offset.

◆ dbg_md5_da()

void dbg_md5_da ( unsigned long  dispaddr,
const void *  data,
unsigned long  len 
)

Print an MD5 checksum with specified display address.

Parameters
dispaddrDisplay address
dataData to checksum
lenLength of data

Definition at line 38 of file debug_md5.c.

39  {
40  struct digest_algorithm *digest = &md5_algorithm;
41  uint8_t digest_ctx[digest->ctxsize];
42  uint8_t digest_out[digest->digestsize];
43  unsigned int i;
44 
45  printf ( "md5sum ( %#08lx, %#lx ) = ", dispaddr, len );
46  digest_init ( digest, digest_ctx );
47  digest_update ( digest, digest_ctx, data, len );
48  digest_final ( digest, digest_ctx, digest_out );
49  for ( i = 0 ; i < sizeof ( digest_out ) ; i++ )
50  printf ( "%02x", digest_out[i] );
51  printf ( "\n" );
52 }
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
Definition: crypto.h:206
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
Definition: crypto.h:212
static void digest_init(struct digest_algorithm *digest, void *ctx)
Definition: crypto.h:201
unsigned char uint8_t
Definition: stdint.h:10
size_t ctxsize
Context size.
Definition: crypto.h:22
size_t digestsize
Digest size.
Definition: crypto.h:26
A message digest algorithm.
Definition: crypto.h:18
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint32_t len
Length.
Definition: ena.h:14
struct digest_algorithm md5_algorithm
MD5 algorithm.
Definition: md5.c:286

References digest_algorithm::ctxsize, data, digest_final(), digest_init(), digest_update(), digest_algorithm::digestsize, len, md5_algorithm, and printf().

◆ dbg_pause()

void dbg_pause ( void  )

Pause until a key is pressed.

Definition at line 58 of file debug.c.

58  {
59  dbg_printf ( "\nPress a key..." );
60  getchar();
61  dbg_printf ( "\r \r" );
62 }
int getchar(void)
Read a single character from any console.
Definition: console.c:85
void dbg_printf(const char *fmt,...)
Print debug message.
Definition: debug.c:38

References dbg_printf(), and getchar().

◆ dbg_more()

void dbg_more ( void  )

Indicate more data to follow and pause until a key is pressed.

Definition at line 68 of file debug.c.

68  {
69  dbg_printf ( "---more---" );
70  getchar();
71  dbg_printf ( "\r \r" );
72 }
int getchar(void)
Read a single character from any console.
Definition: console.c:85
void dbg_printf(const char *fmt,...)
Print debug message.
Definition: debug.c:38

References dbg_printf(), and getchar().

◆ __debug_disable()

char __debug_disable ( OBJECT  )