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
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
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)
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
endfunction()
if(${USB_ITF_HID})
set(SOURCES ${SOURCES}
${CMAKE_CURRENT_LIST_DIR}/src/usb/hid/hid.c
@ -246,6 +247,9 @@ if(${USB_ITF_HID})
${CMAKE_CURRENT_LIST_DIR}/src/usb/hid
)
endif()
add_definitions("-fmacro-prefix-map=${CMAKE_CURRENT_LIST_DIR}/=")
if(ENABLE_EMULATION)
if(APPLE)
add_definitions("-Wno-deprecated-declarations")

View file

@ -20,7 +20,7 @@
#if defined(DEBUG_APDU) && DEBUG_APDU == 1
#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) { \
printf("%" PRIxPTR "h : ", (uintptr_t) (_i + _p)); \
for (int _j = 0; _j < 16; _j++) { \
@ -37,7 +37,7 @@
} printf("\n"); \
}
#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); \
for (int _i = 0; _i < _s; _i++) { \
sprintf(&_tmp[2 * _i], "%02X", (_p)[_i]); \