Add file & line to debug info.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2025-02-19 11:43:47 +01:00
parent 90fb86be64
commit 94a842fa04
2 changed files with 6 additions and 2 deletions

View File

@@ -238,6 +238,7 @@ function(add_impl_library target)
string(TOUPPER ${target} TARGET_UPPER) string(TOUPPER ${target} TARGET_UPPER)
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1) target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
endfunction() endfunction()
if(${USB_ITF_HID}) if(${USB_ITF_HID})
set(SOURCES ${SOURCES} set(SOURCES ${SOURCES}
${CMAKE_CURRENT_LIST_DIR}/src/usb/hid/hid.c ${CMAKE_CURRENT_LIST_DIR}/src/usb/hid/hid.c
@@ -246,6 +247,9 @@ if(${USB_ITF_HID})
${CMAKE_CURRENT_LIST_DIR}/src/usb/hid ${CMAKE_CURRENT_LIST_DIR}/src/usb/hid
) )
endif() endif()
add_definitions("-fmacro-prefix-map=${CMAKE_CURRENT_LIST_DIR}/=")
if(ENABLE_EMULATION) if(ENABLE_EMULATION)
if(APPLE) if(APPLE)
add_definitions("-Wno-deprecated-declarations") add_definitions("-Wno-deprecated-declarations")

View File

@@ -20,7 +20,7 @@
#if defined(DEBUG_APDU) && DEBUG_APDU == 1 #if defined(DEBUG_APDU) && DEBUG_APDU == 1
#define DEBUG_PAYLOAD(_p, _s) { \ #define DEBUG_PAYLOAD(_p, _s) { \
printf("Payload %s (%d bytes):\n", #_p, (int) (_s)); \ printf("Payload %s (%d bytes) [%s:%d]:\n", #_p, (int) (_s), __FILE__, __LINE__); \
for (int _i = 0; _i < _s; _i += 16) { \ for (int _i = 0; _i < _s; _i += 16) { \
printf("%" PRIxPTR "h : ", (uintptr_t) (_i + _p)); \ printf("%" PRIxPTR "h : ", (uintptr_t) (_i + _p)); \
for (int _j = 0; _j < 16; _j++) { \ for (int _j = 0; _j < 16; _j++) { \
@@ -37,7 +37,7 @@
} printf("\n"); \ } printf("\n"); \
} }
#define DEBUG_DATA(_p, _s) { \ #define DEBUG_DATA(_p, _s) { \
printf("Data %s (%d bytes):\n", #_p, (int) (_s)); \ printf("Data %s (%d bytes) [%s:%d]:\n", #_p, (int) (_s), __FILE__, __LINE__); \
char *_tmp = (char *) calloc(1, 2 * _s + 1); \ char *_tmp = (char *) calloc(1, 2 * _s + 1); \
for (int _i = 0; _i < _s; _i++) { \ for (int _i = 0; _i < _s; _i++) { \
sprintf(&_tmp[2 * _i], "%02X", (_p)[_i]); \ sprintf(&_tmp[2 * _i], "%02X", (_p)[_i]); \