OpenCBM
Macros | Typedefs | Functions | Variables
debug.h File Reference

Define makros for debugging purposes. More...

#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define DBG_I_BREAKPOINT()
 Execute a breakpoint. More...
 
#define OutputDebugString(_xxx)   printf( "%s\n", _xxx);
 
#define IN   const
 
#define OUT
 
#define STATUS_SUCCESS   0
 
#define DBG_MEMDUMP(_Where, _Buffer, _Count)   dbg_memdump(_Where, _Buffer, _Count)
 output a memory dump to the debugging system More...
 
#define DBG_MAX_BUFFERLEN   4096
 Maximum size of a debugging buffer.
 
#define DBG_MAX_BUFFER   1 /* This *MUST* be a power of 2! */
 the maximum number of buffers to be used for debugging
 
#define DBGF_BREAK   0x80000000
 
#define DBGF_ENTER   0x40000000
 
#define DBGF_LEAVE   0x20000000
 
#define DBGF_LEAVE_FAILURE   0x10000000
 
#define DBGF_PARAM   0x08000000
 
#define DBGF_PPORT   0x0010
 
#define DBGF_SUCCESS   0x0008
 
#define DBGF_WARNING   0x0004
 
#define DBGF_ERROR   0x0002
 
#define DBGF_ASSERT   0x0001
 
#define DBG_I_ASSUME(_x)
 
#define ISDBG_BREAK()   (DbgFlags & DBGF_BREAK)
 
#define ISDBG_ENTER()   (DbgFlags & DBGF_ENTER)
 
#define ISDBG_LEAVE()   (DbgFlags & DBGF_LEAVE)
 
#define ISDBG_LEAVE_FAILURE()   (DbgFlags & (DBGF_LEAVE|DBGF_LEAVE_FAILURE))
 
#define ISDBG_PARAM()   (DbgFlags & DBGF_PARAM)
 
#define ISDBG_PPORT()   (DbgFlags & DBGF_PPORT)
 
#define ISDBG_SUCCESS()   (DbgFlags & DBGF_SUCCESS)
 
#define ISDBG_WARN()   (DbgFlags & DBGF_WARNING)
 
#define ISDBG_ERROR()   (DbgFlags & DBGF_ERROR)
 
#define ISDBG_ASSERT()   (DbgFlags & DBGF_ASSERT)
 
#define ISDBG_PANIC()   (1)
 
#define _DBG_PERFORM(_xxx)   OutputDebugString(_xxx);
 
#define FUNC_DEF
 
#define _DBG_START_ADD
 
#define _DBG_END_ADD
 
#define DEBUG_BUFFER_NO   0
 
#define DBG_PREFIX   DEBUG_BUFFER_NO,
 
#define _DBGO(_xxx)   DbgOutputIntoBuffer _xxx
 
#define _DBG_START()   _DBG_START_ADD DbgBufferPos[DEBUG_BUFFER_NO] = 0; DbgOutputIntoBuffer(DBG_PREFIX "%s," __FUNCTION__ "(%u): ", DBG_PROGNAME, __LINE__)
 
#define _DBG_END()   DbgOutputIntoBuffer(DBG_PREFIX "\n"); _DBG_PERFORM(&DbgBuffer[DEBUG_BUFFER_NO][0]) _DBG_END_ADD
 
#define DBGO(_xxx)   { _DBG_START(); _DBGO(_xxx); _DBG_END() }
 
#define DBG_BREAKPOINT()   { if (ISDBG_BREAK()) { DBG_I_BREAKPOINT(); }; }
 
#define FUNC_ENTER()   FUNC_DEF { if (ISDBG_ENTER()) { DBGO(( DBG_PREFIX "Entering %s", __FUNCTION__ )); } }
 
#define FUNC_LEAVE()   { if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s", __FUNCTION__ )); } return; }
 
#define FUNC_PARAM(_xxx)   { if (ISDBG_PARAM()) { _DBG_START(); _DBGO(( DBG_PREFIX "Parameter for %s: ", __FUNCTION__ )); _DBGO( _xxx ); _DBG_END() } }
 
#define FUNC_LEAVE_BOOL(_xxx)   { const BOOL _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with BOOL=%s", __FUNCTION__, (_OUT_)?"TRUE":"FALSE" )); } return _OUT_; }
 
#define FUNC_LEAVE_BOOLEAN(_xxx)   { const BOOLEAN _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with BOOL=%s", __FUNCTION__, (_OUT_)?"TRUE":"FALSE" )); } return _OUT_; }
 
#define FUNC_LEAVE_INT(_xxx)   { const int _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, (unsigned int)(_OUT_), (signed int)(_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_UINT(_xxx)   { const unsigned int _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, _OUT_, _OUT_ )); } return _OUT_; }
 
#define FUNC_LEAVE_USHORT(_xxx)   { const USHORT _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, (unsigned int)(_OUT_), (signed int)(_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_UCHAR(_xxx)   { const UCHAR _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with UCHAR=%u", __FUNCTION__, (unsigned int)(_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_HANDLE(_xxx)   { const HANDLE _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with HANDLE=%u", __FUNCTION__, (unsigned int)(_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_STRING(_xxx)   { const char * _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with '%s'", __FUNCTION__, (_OUT_) )); } return _xxx; }
 
#define FUNC_LEAVE_ULONG(_xxx)   { const ULONG _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with ULONG=%ul", __FUNCTION__, (ULONG) (_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_LONG(_xxx)   { const LONG _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with LONG=%l", __FUNCTION__, (LONG) (_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_TYPE(_xxx, _TYPE, _FORMAT)   { _TYPE _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with " #_TYPE "=" _FORMAT, __FUNCTION__, (_OUT_) )); } return _OUT_; }
 
#define FUNC_LEAVE_PTR(_xxx, _TYPE)   FUNC_LEAVE_TYPE( _xxx, _TYPE, "0x%p")
 
#define FUNC_LEAVE_HMODULE(_xxx)   FUNC_LEAVE_TYPE( _xxx, HMODULE, "0x%08x")
 
#define DBG_PPORT(_xxx)   { if (ISDBG_PPORT()){ DBGO( _xxx ); } }
 
#define DBG_SUCCESS(_xxx)   { if (ISDBG_SUCCESS()) { _DBG_START(); _DBGO( _xxx ); _DBGO((DBG_PREFIX " SUCCESS")); _DBG_END(); } }
 
#define DBG_WARN(_xxx)   { if (ISDBG_WARN()) { _DBG_START(); _DBGO(( DBG_PREFIX "Warning: ")); _DBGO( _xxx ); _DBG_END(); } }
 
#define DBG_ERROR(_xxx)   { if (ISDBG_ERROR()) { _DBG_START(); _DBGO(( DBG_PREFIX "***ERROR***: ")); _DBGO( _xxx ); _DBG_END(); } }
 
#define DBG_PANIC(_xxx)   { if (ISDBG_PANIC()) { _DBG_START(); _DBGO(( DBG_PREFIX "***PANIC***: ")); _DBGO( _xxx ); _DBG_END(); } }
 
#define DBG_ASSERT(_xxx)   { if (!(_xxx)) if (ISDBG_ASSERT()) { DBGO(( DBG_PREFIX "***ASSERTION FAILED!***: %s in %s:%s(%u)", #_xxx, __FILE__, __FUNCTION__, __LINE__ )); DBG_BREAKPOINT(); } DBG_I_ASSUME(_xxx); }
 
#define DBG_PRINT(_xxx)   { DBGO( _xxx ); }
 
#define DBG_VERIFY(_xxx)   DBG_ASSERT( _xxx )
 
#define DBGDO(_xxx)   _xxx
 
#define DBG_IRPPATH_PROCESS(_Where_)   DBG_IRPPATH((DBG_PREFIX "IrpPath: + Processing IRP %08x in " _Where_, (char*)Irp))
 Debug IRPPATH: Processing of the IRP.
 
#define DBG_IRPPATH_COMPLETE(_Where_)   DBG_IRPPATH((DBG_PREFIX "IrpPath: - Completing IRP %08x in " _Where_ " with ntStatus = %s", (char*)Irp, (char*)DebugNtStatus(ntStatus)))
 Debug IRPPATH: Completing of the IRP.
 
#define DBG_IRPPATH_CANCEL(_Where_)   DBG_IRPPATH((DBG_PREFIX "IrpPath: - CANCELLING IRP %08x in " _Where_, (char*)Irp))
 Debug IRPPATH: Cancelling of the IRP.
 
#define DBG_IRPPATH_EXECUTE(_Where_)   DBG_IRPPATH((DBG_PREFIX "IrpPath: = Executing IRP %08x in " _Where_, (char*)Irp))
 Debug IRPPATH: Executing of the IRP.
 

Typedefs

typedef void VOID
 
typedef char CHAR
 
typedef unsigned char UCHAR
 
typedef long LONG
 
typedef unsigned long ULONG
 
typedef char * PCHAR
 
typedef unsigned long * PULONG
 
typedef int NTSTATUS
 
typedef void * PDEVICE_EXTENSION
 

Functions

void dbg_memdump (const char *Where, const unsigned char *InputBuffer, const unsigned int Count)
 output a memory dump to the debugging system More...
 
void DbgOutputIntoBuffer (unsigned long BufferNumber, const char *const Format,...)
 Append something to the DebugBuffer. More...
 
void cbm_get_debugging_flags (const char *ModuleName)
 Set the debugging flags. More...
 

Variables

unsigned char DbgBuffer [DBG_MAX_BUFFER][DBG_MAX_BUFFERLEN]
 
int DbgBufferPos []
 
unsigned long DbgFlags
 

Detailed Description

Define makros for debugging purposes.



Author
Spiro Trikaliotis

Definition in file debug.h.

Macro Definition Documentation

#define _DBG_END ( )    DbgOutputIntoBuffer(DBG_PREFIX "\n"); _DBG_PERFORM(&DbgBuffer[DEBUG_BUFFER_NO][0]) _DBG_END_ADD

end the debugging output line

Definition at line 338 of file debug.h.

#define _DBG_END_ADD

Some additional work when we are done with the debug buffer.
In user-mode, nothing has to be done.

Definition at line 310 of file debug.h.

#define _DBG_PERFORM (   _xxx)    OutputDebugString(_xxx);

This macro is called to output the buffer

Definition at line 299 of file debug.h.

#define _DBG_START ( )    _DBG_START_ADD DbgBufferPos[DEBUG_BUFFER_NO] = 0; DbgOutputIntoBuffer(DBG_PREFIX "%s," __FUNCTION__ "(%u): ", DBG_PROGNAME, __LINE__)

start the debugging output line

Definition at line 333 of file debug.h.

#define _DBG_START_ADD

Some additional work when the debug buffer is initialized.
In user-mode, nothing has to be done.

Definition at line 306 of file debug.h.

#define _DBGO (   _xxx)    DbgOutputIntoBuffer _xxx

Write something into the debug buffer

Definition at line 323 of file debug.h.

#define DBG_ASSERT (   _xxx)    { if (!(_xxx)) if (ISDBG_ASSERT()) { DBGO(( DBG_PREFIX "***ASSERTION FAILED!***: %s in %s:%s(%u)", #_xxx, __FILE__, __FUNCTION__, __LINE__ )); DBG_BREAKPOINT(); } DBG_I_ASSUME(_xxx); }
#define DBG_BREAKPOINT ( )    { if (ISDBG_BREAK()) { DBG_I_BREAKPOINT(); }; }

set a hard-coded breakpoint

Definition at line 344 of file debug.h.

#define DBG_ERROR (   _xxx)    { if (ISDBG_ERROR()) { _DBG_START(); _DBGO(( DBG_PREFIX "***ERROR***: ")); _DBGO( _xxx ); _DBG_END(); } }
#define DBG_I_ASSUME (   _x)

hint for the optimiser (and prefast): _x holds true

Definition at line 205 of file debug.h.

#define DBG_I_BREAKPOINT ( )

Execute a breakpoint.

Remarks
Depending upon the environment, this macro uses different means to generate a system agnostic breakpoint.

Definition at line 52 of file debug.h.

#define DBG_MEMDUMP (   _Where,
  _Buffer,
  _Count 
)    dbg_memdump(_Where, _Buffer, _Count)

output a memory dump to the debugging system

Generates a byte dump and outputs it to the debugging system

Parameters
_WhereSome text to output in front of the memory dump. This text can be used to identify where this dump occurred.
_BufferPointer to a buffer which contains the data bytes to be dumped.
_CountThe size of the buffer to be dumped.
Remarks
as dumping memory is used regularly when debugging, we give a debug helper function for this

Definition at line 105 of file debug.h.

Referenced by cbm_raw_read(), and cbm_raw_write().

#define DBG_PANIC (   _xxx)    { if (ISDBG_PANIC()) { _DBG_START(); _DBGO(( DBG_PREFIX "***PANIC***: ")); _DBGO( _xxx ); _DBG_END(); } }

Output if DBGF_PANIC is defined

Definition at line 399 of file debug.h.

#define DBG_PPORT (   _xxx)    { if (ISDBG_PPORT()){ DBGO( _xxx ); } }

Output if DBGF_PPORT is defined

Definition at line 391 of file debug.h.

Referenced by cbmiec_interrupt(), ParPortInit(), ParPortSetModeWdm(), and ParPortUnsetModeWdm().

#define DBG_PREFIX   DEBUG_BUFFER_NO,

The prefix which has to be used to any call of DbgOutputIntoBuffer(), _DBGO(), and the various other DBG_xxx functions.

Definition at line 320 of file debug.h.

Referenced by AddDevice(), AddDeviceCommonInit(), cbm_createopenclose(), cbm_devicecontrol(), cbm_driver_install(), cbm_driver_open_ex(), cbm_driver_start(), cbm_driver_stop(), cbm_execute_createopen(), cbm_execute_devicecontrol(), cbm_execute_readwrite(), cbm_get_debugging_flags(), cbm_get_driver_name_ex(), cbm_identify_xp1541(), cbm_ioctl(), cbm_lock(), cbm_lock_parport(), cbm_open(), cbm_registry_open_for_read(), cbm_registry_read_ulong(), cbm_registry_write_ulong(), cbm_start_thread(), cbm_startio(), cbm_unlock(), cbm_unlock_parport(), CbmCheckDriver(), cbmiec_checkcable(), cbmiec_close(), cbmiec_i_pp_read_debounced(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_iec_dbg_read(), cbmiec_iec_dbg_write(), cbmiec_iec_setrelease(), cbmiec_iec_wait(), cbmiec_interrupt(), cbmiec_listen(), cbmiec_open(), cbmiec_parallel_burst_read_track(), cbmiec_parallel_burst_read_track_var(), cbmiec_pp_write(), cbmiec_raw_read(), cbmiec_raw_write(), cbmiec_reset(), cbmiec_send_byte(), cbmiec_show_port(), cbmiec_show_state(), cbmiec_talk(), cbmiec_test_irq(), cbmiec_wait_for_drives_ready(), cbmiec_wait_for_listener(), CbmInstall(), CbmParportRestart(), CbmRemove(), dbg_memdump(), DbgRp(), DbgWp(), DllMain(), DriverEntry(), gcr_4_to_5_encode(), gcr_5_to_4_decode(), get_all_installed_plugins(), IsDriverStartedAutomatically(), main(), opencbm_plugin_get_all_plugin_names(), opencbm_plugin_install_do_install(), opencbm_plugin_install_do_uninstall(), opencbm_plugin_install_plugin_data(), opencbm_plugin_parallel_burst_read_track(), opencbm_plugin_parallel_burst_read_track_var(), opencbm_plugin_parallel_burst_write_track(), ParPortAllocInterrupt(), ParPortEnumerateOpen(), ParPortInit(), ParPortSetModeNt4(), ParPortSetModeWdm(), ParPortUnsetModeNt4(), ParPortUnsetModeWdm(), plugin_is_active(), RegGetDWORD(), vdd_uninstall_iohook(), VDDDispatch(), and VDDInitialize().

#define DBG_PRINT (   _xxx)    { DBGO( _xxx ); }
#define DBG_SUCCESS (   _xxx)    { if (ISDBG_SUCCESS()) { _DBG_START(); _DBGO( _xxx ); _DBGO((DBG_PREFIX " SUCCESS")); _DBG_END(); } }
#define DBG_VERIFY (   _xxx)    DBG_ASSERT( _xxx )

Similar to DBG_ASSERT(). However, the argument is executed even on release builds.

Definition at line 406 of file debug.h.

Referenced by cbmiec_wait_for_listener().

#define DBG_WARN (   _xxx)    { if (ISDBG_WARN()) { _DBG_START(); _DBGO(( DBG_PREFIX "Warning: ")); _DBGO( _xxx ); _DBG_END(); } }
#define DBGDO (   _xxx)    _xxx

only execute the command when debugging is compiled in

Definition at line 409 of file debug.h.

Referenced by cbmiec_block_irq(), cbmiec_release_irq(), cbmiec_wait_for_listener(), CbmParportRestart(), DriverCommonUninit(), and ParPortEnumerateClose().

#define DBGF_ASSERT   0x0001

debugging flag: show ASSERTs

Definition at line 191 of file debug.h.

#define DBGF_BREAK   0x80000000

debugging flag: generate breakpoints

Definition at line 125 of file debug.h.

#define DBGF_ENTER   0x40000000

debugging flag: show entering of functions

Definition at line 128 of file debug.h.

#define DBGF_ERROR   0x0002

debugging flag: show ERRORS

Definition at line 188 of file debug.h.

#define DBGF_LEAVE   0x20000000

debugging flag: show leaving of functions

Definition at line 131 of file debug.h.

#define DBGF_LEAVE_FAILURE   0x10000000

debugging flag: show leaving of functions with return value NTSTATUS, if it is not STATUS_SUCCESS

Definition at line 135 of file debug.h.

#define DBGF_PARAM   0x08000000

debugging flag: show parameters of entered functions

Definition at line 138 of file debug.h.

#define DBGF_PPORT   0x0010

debugging flag: show parallel port acquisition related output

Definition at line 179 of file debug.h.

#define DBGF_SUCCESS   0x0008

debugging flag: show SUCCESS messages

Definition at line 182 of file debug.h.

#define DBGF_WARNING   0x0004

debugging flag: show WARNINGS

Definition at line 185 of file debug.h.

#define DBGO (   _xxx)    { _DBG_START(); _DBGO(_xxx); _DBG_END() }

Output exactly one line to the debugging output

Definition at line 341 of file debug.h.

#define DEBUG_BUFFER_NO   0

Get the number of the debug buffer.
In user-mode, it is always 0.

Definition at line 314 of file debug.h.

#define FUNC_DEF

What has to be defined at the start of each function?

Definition at line 302 of file debug.h.

Referenced by cbmiec_show_port(), cbmiec_show_state(), DbgRp(), and DbgWp().

#define FUNC_ENTER ( )    FUNC_DEF { if (ISDBG_ENTER()) { DBGO(( DBG_PREFIX "Entering %s", __FUNCTION__ )); } }

enter a function

Definition at line 347 of file debug.h.

Referenced by AddDevice(), AddDeviceCommonInit(), cbm_cleanup(), cbm_clear_eoi(), cbm_close(), cbm_createopenclose(), cbm_dbg_readbuffer(), cbm_device_status(), cbm_devicecontrol(), cbm_driver_close(), cbm_driver_install(), cbm_driver_open(), cbm_driver_open_ex(), cbm_driver_start(), cbm_driver_stop(), cbm_exec_command(), cbm_execute_close(), cbm_execute_createopen(), cbm_execute_devicecontrol(), cbm_execute_readwrite(), cbm_get_debugging_buffer(), cbm_get_debugging_flags(), cbm_get_driver_name(), cbm_get_driver_name_ex(), cbm_get_eoi(), cbm_get_plugin_function_address(), cbm_identify(), cbm_identify_xp1541(), cbm_iec_dbg_read(), cbm_iec_dbg_write(), cbm_iec_get(), cbm_iec_poll(), cbm_iec_release(), cbm_iec_set(), cbm_iec_setrelease(), cbm_iec_wait(), cbm_init_registry(), cbm_initialize_cable_deferred(), cbm_install(), cbm_ioctl(), cbm_listen(), cbm_lock(), cbm_lock_parport(), cbm_open(), cbm_parallel_burst_read(), cbm_parallel_burst_read_track(), cbm_parallel_burst_read_track_var(), cbm_parallel_burst_write(), cbm_parallel_burst_write_track(), cbm_pp_read(), cbm_pp_write(), cbm_raw_read(), cbm_raw_write(), cbm_readwrite(), cbm_registry_close(), cbm_registry_close_hardwarekey(), cbm_registry_open_for_read(), cbm_registry_open_hardwarekey(), cbm_registry_read_ulong(), cbm_registry_write_ulong(), cbm_reset(), cbm_srq_burst_read(), cbm_srq_burst_read_track(), cbm_srq_burst_write(), cbm_srq_burst_write_track(), cbm_start_thread(), cbm_startio(), cbm_stop_thread(), cbm_talk(), cbm_tap_download_config(), cbm_tap_get_sense(), cbm_tap_get_ver(), cbm_tap_motor_off(), cbm_tap_motor_on(), cbm_tap_prepare_capture(), cbm_tap_prepare_write(), cbm_tap_start_capture(), cbm_tap_start_write(), cbm_tap_upload_config(), cbm_tap_wait_for_play_sense(), cbm_tap_wait_for_stop_sense(), cbm_thread(), cbm_unlisten(), cbm_unlock(), cbm_unlock_parport(), cbm_untalk(), cbm_upload(), CbmCheckDriver(), CbmCheckPresence(), cbmiec_block_irq(), cbmiec_check_device(), cbmiec_checkcable(), cbmiec_cleanup(), cbmiec_clear_eoi(), cbmiec_close(), cbmiec_get_eoi(), cbmiec_global_init(), cbmiec_i_pp_read_debounced(), cbmiec_i_raw_read(), cbmiec_i_raw_write(), cbmiec_iec_dbg_read(), cbmiec_iec_dbg_write(), cbmiec_iec_poll(), cbmiec_iec_release(), cbmiec_iec_set(), cbmiec_iec_setrelease(), cbmiec_iec_wait(), cbmiec_init(), cbmiec_interrupt(), cbmiec_listen(), cbmiec_open(), cbmiec_parallel_burst_read(), cbmiec_parallel_burst_read_track(), cbmiec_parallel_burst_read_track_var(), cbmiec_parallel_burst_write(), cbmiec_pp_read(), cbmiec_pp_write(), cbmiec_raw_read(), cbmiec_raw_write(), cbmiec_release_bus(), cbmiec_release_irq(), cbmiec_reset(), cbmiec_schedule_timeout(), cbmiec_send_byte(), cbmiec_set_cabletype(), cbmiec_setcablestate(), cbmiec_talk(), cbmiec_test_irq(), cbmiec_udelay(), cbmiec_unlisten(), cbmiec_untalk(), cbmiec_wait_for_drives_ready(), cbmiec_wait_for_listener(), CbmInstall(), CbmOpenDeviceRegistryKey(), CbmParportRestart(), CbmRemove(), CbmUpdateParameter(), DllMain(), DriverCommonInit(), DriverCommonUninit(), DriverEntry(), DriverUnload(), gcr_4_to_5_encode(), gcr_5_to_4_decode(), get_all_installed_plugins(), get_all_plugins(), IsDriverStartedAutomatically(), LoadLocalOpenCBMDll(), LogError(), main(), opencbm_plugin_clear_eoi(), opencbm_plugin_close(), opencbm_plugin_driver_close(), opencbm_plugin_driver_open(), opencbm_plugin_get_all_plugin_names(), opencbm_plugin_get_driver_name(), opencbm_plugin_get_eoi(), opencbm_plugin_iec_dbg_read(), opencbm_plugin_iec_dbg_write(), opencbm_plugin_iec_poll(), opencbm_plugin_iec_release(), opencbm_plugin_iec_set(), opencbm_plugin_iec_setrelease(), opencbm_plugin_iec_wait(), opencbm_plugin_install_do_install(), opencbm_plugin_install_do_uninstall(), opencbm_plugin_install_generic(), opencbm_plugin_install_get_needed_files(), opencbm_plugin_install_plugin_data(), opencbm_plugin_install_process_commandline(), opencbm_plugin_listen(), opencbm_plugin_lock(), opencbm_plugin_open(), opencbm_plugin_parallel_burst_read(), opencbm_plugin_parallel_burst_read_track(), opencbm_plugin_parallel_burst_read_track_var(), opencbm_plugin_parallel_burst_write(), opencbm_plugin_parallel_burst_write_track(), opencbm_plugin_pp_read(), opencbm_plugin_pp_write(), opencbm_plugin_raw_read(), opencbm_plugin_raw_write(), opencbm_plugin_reset(), opencbm_plugin_talk(), opencbm_plugin_unlisten(), opencbm_plugin_unlock(), opencbm_plugin_untalk(), ParPortAllocate(), ParPortAllocInterrupt(), ParPortAllowInterruptIoctl(), ParPortDeinit(), ParPortEnumerate(), ParPortEnumerateClose(), ParPortEnumerateOpen(), ParPortFree(), ParPortFreeInterrupt(), ParPortInit(), ParPortSetMode(), ParPortSetModeNt4(), ParPortSetModeWdm(), ParPortUnsetMode(), ParPortUnsetModeNt4(), ParPortUnsetModeWdm(), plugin_is_active(), plugin_set_active(), plugin_set_inactive(), PluginForAll(), PluginListFree(), ProcessPluginCommandlineAndAddIt(), QueueCleanup(), QueueCompleteIrp(), QueueInit(), QueueIsDropping(), QueueIsStalled(), QueuePoll(), QueueShouldCancelCurrentIrp(), QueueSignal(), QueueStall(), QueueStartPacket(), QueueUnstall(), RegGetDWORD(), vdd_clear_eoi(), vdd_close(), vdd_driver_close(), vdd_driver_open(), vdd_get_eoi(), vdd_identify_xp1541(), vdd_iec_get(), vdd_iec_poll(), vdd_iec_release(), vdd_iec_set(), vdd_iec_setrelease(), vdd_iec_wait(), vdd_install_iohook(), vdd_listen(), vdd_pp_read(), vdd_pp_write(), vdd_reset(), vdd_talk(), vdd_uninstall_iohook(), vdd_uninstall_iohook_internal(), vdd_unlisten(), vdd_untalk(), vdd_usleep(), VDDDispatch(), VDDInitialize(), VDDRegisterInit(), WaitForIoCompletion(), WaitForIoCompletionCancelAll(), WaitForIoCompletionConstruct(), WaitForIoCompletionDeinit(), and WaitForIoCompletionInit().

#define FUNC_LEAVE ( )    { if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s", __FUNCTION__ )); } return; }
#define FUNC_LEAVE_BOOL (   _xxx)    { const BOOL _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with BOOL=%s", __FUNCTION__, (_OUT_)?"TRUE":"FALSE" )); } return _OUT_; }
#define FUNC_LEAVE_BOOLEAN (   _xxx)    { const BOOLEAN _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with BOOL=%s", __FUNCTION__, (_OUT_)?"TRUE":"FALSE" )); } return _OUT_; }
#define FUNC_LEAVE_HANDLE (   _xxx)    { const HANDLE _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with HANDLE=%u", __FUNCTION__, (unsigned int)(_OUT_) )); } return _OUT_; }

leave the function with a return value of type HANDLE

Definition at line 366 of file debug.h.

#define FUNC_LEAVE_HMODULE (   _xxx)    FUNC_LEAVE_TYPE( _xxx, HMODULE, "0x%08x")

leave the function with a return value of a HMODULE

Definition at line 387 of file debug.h.

Referenced by LoadLocalOpenCBMDll().

#define FUNC_LEAVE_INT (   _xxx)    { const int _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, (unsigned int)(_OUT_), (signed int)(_OUT_) )); } return _OUT_; }

leave the function with a return value of type INT

Definition at line 358 of file debug.h.

Referenced by cbm_clear_eoi(), cbm_close(), cbm_device_status(), cbm_driver_install(), cbm_driver_open(), cbm_driver_open_ex(), cbm_exec_command(), cbm_get_debugging_buffer(), cbm_get_eoi(), cbm_identify(), cbm_identify_xp1541(), cbm_iec_dbg_read(), cbm_iec_dbg_write(), cbm_iec_get(), cbm_iec_poll(), cbm_iec_wait(), cbm_listen(), cbm_open(), cbm_parallel_burst_read_track(), cbm_parallel_burst_read_track_var(), cbm_parallel_burst_write_track(), cbm_raw_read(), cbm_raw_write(), cbm_reset(), cbm_srq_burst_read_track(), cbm_srq_burst_write_track(), cbm_talk(), cbm_tap_download_config(), cbm_tap_get_sense(), cbm_tap_get_ver(), cbm_tap_motor_off(), cbm_tap_motor_on(), cbm_tap_prepare_capture(), cbm_tap_prepare_write(), cbm_tap_start_capture(), cbm_tap_start_write(), cbm_tap_upload_config(), cbm_tap_wait_for_play_sense(), cbm_tap_wait_for_stop_sense(), cbm_unlisten(), cbm_untalk(), cbm_upload(), CbmCheckDriver(), gcr_4_to_5_encode(), gcr_5_to_4_decode(), main(), opencbm_plugin_clear_eoi(), opencbm_plugin_close(), opencbm_plugin_driver_open(), opencbm_plugin_get_eoi(), opencbm_plugin_iec_dbg_read(), opencbm_plugin_iec_dbg_write(), opencbm_plugin_iec_poll(), opencbm_plugin_iec_wait(), opencbm_plugin_listen(), opencbm_plugin_open(), opencbm_plugin_parallel_burst_read_track(), opencbm_plugin_parallel_burst_read_track_var(), opencbm_plugin_parallel_burst_write_track(), opencbm_plugin_raw_read(), opencbm_plugin_raw_write(), opencbm_plugin_reset(), opencbm_plugin_talk(), opencbm_plugin_unlisten(), opencbm_plugin_untalk(), plugin_is_active(), plugin_set_active(), plugin_set_inactive(), and RegGetDWORD().

#define FUNC_LEAVE_LONG (   _xxx)    { const LONG _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with LONG=%l", __FUNCTION__, (LONG) (_OUT_) )); } return _OUT_; }

leave the function with a return value of type ULONG

Definition at line 372 of file debug.h.

Referenced by cbmiec_i_pp_read_debounced().

#define FUNC_LEAVE_PTR (   _xxx,
  _TYPE 
)    FUNC_LEAVE_TYPE( _xxx, _TYPE, "0x%p")

leave the function with a return value of a pointer type

Definition at line 376 of file debug.h.

Referenced by cbm_get_plugin_function_address().

#define FUNC_LEAVE_STRING (   _xxx)    { const char * _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with '%s'", __FUNCTION__, (_OUT_) )); } return _xxx; }

leave the function with a return value of type STRING

Definition at line 368 of file debug.h.

Referenced by cbm_get_driver_name(), cbm_get_driver_name_ex(), and opencbm_plugin_get_driver_name().

#define FUNC_LEAVE_TYPE (   _xxx,
  _TYPE,
  _FORMAT 
)    { _TYPE _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with " #_TYPE "=" _FORMAT, __FUNCTION__, (_OUT_) )); } return _OUT_; }

leave the function with a return value of a specific type

Definition at line 374 of file debug.h.

#define FUNC_LEAVE_UCHAR (   _xxx)    { const UCHAR _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with UCHAR=%u", __FUNCTION__, (unsigned int)(_OUT_) )); } return _OUT_; }

leave the function with a return value of type UCHAR

Definition at line 364 of file debug.h.

Referenced by cbm_parallel_burst_read(), cbm_pp_read(), cbm_srq_burst_read(), opencbm_plugin_parallel_burst_read(), and opencbm_plugin_pp_read().

#define FUNC_LEAVE_UINT (   _xxx)    { const unsigned int _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, _OUT_, _OUT_ )); } return _OUT_; }

leave the function with a return value of type INT

Definition at line 360 of file debug.h.

Referenced by opencbm_plugin_install_get_needed_files(), and opencbm_plugin_install_process_commandline().

#define FUNC_LEAVE_ULONG (   _xxx)    { const ULONG _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with ULONG=%ul", __FUNCTION__, (ULONG) (_OUT_) )); } return _OUT_; }

leave the function with a return value of type ULONG

Definition at line 370 of file debug.h.

#define FUNC_LEAVE_USHORT (   _xxx)    { const USHORT _OUT_ = _xxx; if (ISDBG_LEAVE()) { DBGO(( DBG_PREFIX "Leaving %s with INT=%u (%d)", __FUNCTION__, (unsigned int)(_OUT_), (signed int)(_OUT_) )); } return _OUT_; }

leave the function with a return value of type INT

Definition at line 362 of file debug.h.

Referenced by vdd_uninstall_iohook_internal().

#define FUNC_PARAM (   _xxx)    { if (ISDBG_PARAM()) { _DBG_START(); _DBGO(( DBG_PREFIX "Parameter for %s: ", __FUNCTION__ )); _DBGO( _xxx ); _DBG_END() } }
#define ISDBG_ASSERT ( )    (DbgFlags & DBGF_ASSERT)

is DBGF_ASSERT defined?

Definition at line 247 of file debug.h.

#define ISDBG_BREAK ( )    (DbgFlags & DBGF_BREAK)

is DBGF_BREAK defined?

Definition at line 225 of file debug.h.

#define ISDBG_ENTER ( )    (DbgFlags & DBGF_ENTER)

is DBGF_ENTER defined?

Definition at line 226 of file debug.h.

#define ISDBG_ERROR ( )    (DbgFlags & DBGF_ERROR)

is DBGF_ERROR defined?

Definition at line 246 of file debug.h.

#define ISDBG_LEAVE ( )    (DbgFlags & DBGF_LEAVE)

is DBGF_LEAVE defined?

Definition at line 227 of file debug.h.

#define ISDBG_LEAVE_FAILURE ( )    (DbgFlags & (DBGF_LEAVE|DBGF_LEAVE_FAILURE))

is DBGF_LEAVE or DBGF_LEAVE_FAILURE defined?

Definition at line 228 of file debug.h.

#define ISDBG_PANIC ( )    (1)

is DBGF_PANIC defined? (does not exist, always 1 = yes)

Definition at line 248 of file debug.h.

#define ISDBG_PARAM ( )    (DbgFlags & DBGF_PARAM)

is DBGF_PARAM defined?

Definition at line 229 of file debug.h.

#define ISDBG_PPORT ( )    (DbgFlags & DBGF_PPORT)

is DBGF_PPORT defined?

Definition at line 243 of file debug.h.

#define ISDBG_SUCCESS ( )    (DbgFlags & DBGF_SUCCESS)

is DBGF_SUCCESS defined?

Definition at line 244 of file debug.h.

#define ISDBG_WARN ( )    (DbgFlags & DBGF_WARNING)

is DBGF_WARNING defined?

Definition at line 245 of file debug.h.

Function Documentation

void cbm_get_debugging_flags ( const char *  ModuleName)

Set the debugging flags.

This function gets the debugging flags from the registry. If there are any, it sets the flags to that value.

Definition at line 97 of file registry.c.

References CBM_REGKEY_SERVICE, CBM_REGKEY_SERVICE_DLL_DEBUGFLAGS, cbmlibmisc_strcat(), cbmlibmisc_strdup(), cbmlibmisc_strfree(), DBG_PREFIX, DBG_WARN, DbgFlags, FUNC_ENTER, FUNC_LEAVE, and RegGetDWORD().

Referenced by DllMain().

void dbg_memdump ( const char *  Where,
const unsigned char *  InputBuffer,
const unsigned int  Count 
)

output a memory dump to the debugging system

Generates a byte dump and outputs it to the debugging system

Parameters
WhereSome text to output in front of the memory dump. This text can be used to identify where this dump occurred.
InputBufferPointer to a buffer which contains the data bytes to be dumped.
CountThe size of the buffer to be dumped.
Remarks
as dumping memory is used regularly when debugging, we give a debug helper function for this

Definition at line 64 of file dbghelp.c.

References DBG_PREFIX, and DBG_PRINT.

void DbgOutputIntoBuffer ( unsigned long  BufferNumber,
const char *const  Format,
  ... 
)

Append something to the DebugBuffer.

This function appends a string to the DebugBuffer. It can be used with a format-string like printf().

Parameters
BufferNumberThe number of the DebugBuffer in which the content is to be written.
FormatA printf()-style format specifier
...The variables which are used as parameters for the printf() style format specifier.

Definition at line 91 of file arch/windows/debug.c.

References DBG_MAX_BUFFERLEN, DbgBuffer, and DbgBufferPos.

Variable Documentation

unsigned char DbgBuffer[DBG_MAX_BUFFER][DBG_MAX_BUFFERLEN]

Buffers where the debug string will be build up before it is send to the system (or into memory)

Definition at line 26 of file arch/windows/debug.c.

Referenced by DbgOutputIntoBuffer().

int DbgBufferPos[]

Index into the DbgBuffer buffers, for each one one index

Definition at line 29 of file arch/windows/debug.c.

Referenced by DbgOutputIntoBuffer().

unsigned long DbgFlags

initialize debugging flags

Definition at line 32 of file arch/windows/debug.c.

Referenced by cbm_get_debugging_flags(), cbm_init_registry(), cbm_isr(), and cbmiec_test_irq().