mirror of https://github.com/ipxe/ipxe.git
[debug] Expose pause() and more() debugging functions
Include the pause() and more() debugging functions within the general iPXE debugging framework, by introducing DBGxxx_PAUSE() and DBGxxx_MORE() macros. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
9f3c0c1f39
commit
7aa1d70e52
|
@ -4,13 +4,21 @@
|
||||||
#include <ipxe/io.h>
|
#include <ipxe/io.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
|
|
||||||
void pause ( void ) {
|
/**
|
||||||
printf ( "\nPress a key" );
|
* Pause until a key is pressed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void dbg_pause ( void ) {
|
||||||
|
printf ( "\nPress a key..." );
|
||||||
getchar();
|
getchar();
|
||||||
printf ( "\r \r" );
|
printf ( "\r \r" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void more ( void ) {
|
/**
|
||||||
|
* Indicate more data to follow and pause until a key is pressed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void dbg_more ( void ) {
|
||||||
printf ( "---more---" );
|
printf ( "---more---" );
|
||||||
getchar();
|
getchar();
|
||||||
printf ( "\r \r" );
|
printf ( "\r \r" );
|
||||||
|
|
|
@ -257,6 +257,8 @@ extern void dbg_autocolourise ( unsigned long id );
|
||||||
extern void dbg_decolourise ( void );
|
extern void dbg_decolourise ( void );
|
||||||
extern void dbg_hex_dump_da ( unsigned long dispaddr,
|
extern void dbg_hex_dump_da ( unsigned long dispaddr,
|
||||||
const void *data, unsigned long len );
|
const void *data, unsigned long len );
|
||||||
|
extern void dbg_pause ( void );
|
||||||
|
extern void dbg_more ( void );
|
||||||
|
|
||||||
#if DEBUG_SYMBOL
|
#if DEBUG_SYMBOL
|
||||||
#define DBGLVL_MAX DEBUG_SYMBOL
|
#define DBGLVL_MAX DEBUG_SYMBOL
|
||||||
|
@ -332,6 +334,28 @@ int __debug_disable;
|
||||||
DBG_HDA_IF ( level, _data, _data, len ); \
|
DBG_HDA_IF ( level, _data, _data, len ); \
|
||||||
} while ( 0 )
|
} while ( 0 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompt for key press if we are at a certain debug level
|
||||||
|
*
|
||||||
|
* @v level Debug level
|
||||||
|
*/
|
||||||
|
#define DBG_PAUSE_IF( level ) do { \
|
||||||
|
if ( DBG_ ## level ) { \
|
||||||
|
dbg_pause(); \
|
||||||
|
} \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompt for more output data if we are at a certain debug level
|
||||||
|
*
|
||||||
|
* @v level Debug level
|
||||||
|
*/
|
||||||
|
#define DBG_MORE_IF( level ) do { \
|
||||||
|
if ( DBG_ ## level ) { \
|
||||||
|
dbg_more(); \
|
||||||
|
} \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select colour for debug messages if we are at a certain debug level
|
* Select colour for debug messages if we are at a certain debug level
|
||||||
*
|
*
|
||||||
|
@ -380,41 +404,69 @@ int __debug_disable;
|
||||||
DBG_DC_IF ( level ); \
|
DBG_DC_IF ( level ); \
|
||||||
} while ( 0 )
|
} while ( 0 )
|
||||||
|
|
||||||
|
#define DBGC_PAUSE_IF( level, id ) do { \
|
||||||
|
DBG_AC_IF ( level, id ); \
|
||||||
|
DBG_PAUSE_IF ( level ); \
|
||||||
|
DBG_DC_IF ( level ); \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
|
#define DBGC_MORE_IF( level, id ) do { \
|
||||||
|
DBG_AC_IF ( level, id ); \
|
||||||
|
DBG_MORE_IF ( level ); \
|
||||||
|
DBG_DC_IF ( level ); \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( LOG, ... )*/
|
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( LOG, ... )*/
|
||||||
|
|
||||||
#define DBG( ... ) DBG_IF ( LOG, __VA_ARGS__ )
|
#define DBG( ... ) DBG_IF ( LOG, ##__VA_ARGS__ )
|
||||||
#define DBG_HDA( ... ) DBG_HDA_IF ( LOG, __VA_ARGS__ )
|
#define DBG_HDA( ... ) DBG_HDA_IF ( LOG, ##__VA_ARGS__ )
|
||||||
#define DBG_HD( ... ) DBG_HD_IF ( LOG, __VA_ARGS__ )
|
#define DBG_HD( ... ) DBG_HD_IF ( LOG, ##__VA_ARGS__ )
|
||||||
#define DBGC( ... ) DBGC_IF ( LOG, __VA_ARGS__ )
|
#define DBG_PAUSE( ... ) DBG_PAUSE_IF ( LOG, ##__VA_ARGS__ )
|
||||||
#define DBGC_HDA( ... ) DBGC_HDA_IF ( LOG, __VA_ARGS__ )
|
#define DBG_MORE( ... ) DBG_MORE_IF ( LOG, ##__VA_ARGS__ )
|
||||||
#define DBGC_HD( ... ) DBGC_HD_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_PAUSE( ... ) DBGC_PAUSE_IF ( LOG, ##__VA_ARGS__ )
|
||||||
|
#define DBGC_MORE( ... ) DBGC_MORE_IF ( LOG, ##__VA_ARGS__ )
|
||||||
|
|
||||||
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( EXTRA, ... )*/
|
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( EXTRA, ... )*/
|
||||||
|
|
||||||
#define DBG2( ... ) DBG_IF ( EXTRA, __VA_ARGS__ )
|
#define DBG2( ... ) DBG_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
#define DBG2_HDA( ... ) DBG_HDA_IF ( EXTRA, __VA_ARGS__ )
|
#define DBG2_HDA( ... ) DBG_HDA_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
#define DBG2_HD( ... ) DBG_HD_IF ( EXTRA, __VA_ARGS__ )
|
#define DBG2_HD( ... ) DBG_HD_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
#define DBGC2( ... ) DBGC_IF ( EXTRA, __VA_ARGS__ )
|
#define DBG2_PAUSE( ... ) DBG_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
#define DBGC2_HDA( ... ) DBGC_HDA_IF ( EXTRA, __VA_ARGS__ )
|
#define DBG2_MORE( ... ) DBG_MORE_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
#define DBGC2_HD( ... ) DBGC_HD_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_PAUSE( ... ) DBGC_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
|
#define DBGC2_MORE( ... ) DBGC_MORE_IF ( EXTRA, ##__VA_ARGS__ )
|
||||||
|
|
||||||
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( PROFILE, ... )*/
|
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( PROFILE, ... )*/
|
||||||
|
|
||||||
#define DBGP( ... ) DBG_IF ( PROFILE, __VA_ARGS__ )
|
#define DBGP( ... ) DBG_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
#define DBGP_HDA( ... ) DBG_HDA_IF ( PROFILE, __VA_ARGS__ )
|
#define DBGP_HDA( ... ) DBG_HDA_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
#define DBGP_HD( ... ) DBG_HD_IF ( PROFILE, __VA_ARGS__ )
|
#define DBGP_HD( ... ) DBG_HD_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
#define DBGCP( ... ) DBGC_IF ( PROFILE, __VA_ARGS__ )
|
#define DBGP_PAUSE( ... ) DBG_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
#define DBGCP_HDA( ... ) DBGC_HDA_IF ( PROFILE, __VA_ARGS__ )
|
#define DBGP_MORE( ... ) DBG_MORE_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
#define DBGCP_HD( ... ) DBGC_HD_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_PAUSE( ... ) DBGC_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
|
#define DBGCP_MORE( ... ) DBGC_MORE_IF ( PROFILE, ##__VA_ARGS__ )
|
||||||
|
|
||||||
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( IO, ... )*/
|
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( IO, ... )*/
|
||||||
|
|
||||||
#define DBGIO( ... ) DBG_IF ( IO, __VA_ARGS__ )
|
#define DBGIO( ... ) DBG_IF ( IO, ##__VA_ARGS__ )
|
||||||
#define DBGIO_HDA( ... ) DBG_HDA_IF ( IO, __VA_ARGS__ )
|
#define DBGIO_HDA( ... ) DBG_HDA_IF ( IO, ##__VA_ARGS__ )
|
||||||
#define DBGIO_HD( ... ) DBG_HD_IF ( IO, __VA_ARGS__ )
|
#define DBGIO_HD( ... ) DBG_HD_IF ( IO, ##__VA_ARGS__ )
|
||||||
#define DBGCIO( ... ) DBGC_IF ( IO, __VA_ARGS__ )
|
#define DBGIO_PAUSE( ... ) DBG_PAUSE_IF ( IO, ##__VA_ARGS__ )
|
||||||
#define DBGCIO_HDA( ... ) DBGC_HDA_IF ( IO, __VA_ARGS__ )
|
#define DBGIO_MORE( ... ) DBG_MORE_IF ( IO, ##__VA_ARGS__ )
|
||||||
#define DBGCIO_HD( ... ) DBGC_HD_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_PAUSE( ... ) DBGC_PAUSE_IF ( IO, ##__VA_ARGS__ )
|
||||||
|
#define DBGCIO_MORE( ... ) DBGC_MORE_IF ( IO, ##__VA_ARGS__ )
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG_SYMBOL == 0
|
#if DEBUG_SYMBOL == 0
|
||||||
|
|
Loading…
Reference in New Issue