Skip to content

Commit

Permalink
Improved build coverage of DEV_DEBUG_ABI_CPP option and operator dele…
Browse files Browse the repository at this point in the history
…te monitoring.

Made example more instructive on build option error.
  • Loading branch information
mhightower83 committed Oct 24, 2024
1 parent 0574c1a commit 31217f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cores/esp8266/heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ void* _heap_abi_malloc(size_t size, bool unhandled, const void* const caller)
}; // extern "C" {


#if defined(ENABLE_THICK_DEBUG_WRAPPERS)
#if defined(ENABLE_THICK_DEBUG_WRAPPERS) || defined(USE_HEAP_ABI_MEMALIGN) || defined(USE_HEAP_ABI_MALLOC)
///////////////////////////////////////////////////////////////////////////////
// Replacement C++ delete operator to capture callers address
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ void _NOINLINE test_new_try_catch(int& err_count, size_t sz, size_t alignment, i
void print_build_options() {
#if DEV_DEBUG_ABI_CPP
PRINTF_LN(" Built with DEV_DEBUG_ABI_CPP");
#if defined(__cpp_exceptions) && !(defined(DEBUG_ESP_OOM) || defined(DEBUG_ESP_PORT) || defined(DEBUG_ESP_WITHINISR) || defined(MIN_ESP_OOM))
PRINTF_LN("* This build used the LIBC's default operator \"new\"(/\"delete\") handler for C++ Exceptions, which bypassed");
PRINTF_LN("* our monitoring logic. The goal is to confirm the coverage of our added Heap debugging logic.");
PRINTF_LN("* To use the \"new\"/\"delete\" monitoring logic, define a debug option like MIN_ESP_OOM, DEBUG_ESP_PORT, etc.");
#endif
#else
PRINTF_LN("* For complete operation, the test build requires option -DDEV_DEBUG_ABI_CPP=1");
#endif
Expand Down Expand Up @@ -402,8 +407,6 @@ void setup() {

print_build_options();
#if UMM_ENABLE_MEMALIGN
PRINTF_LN(" Built with UMM_ENABLE_MEMALIGN, i.e. memalign present");

void* new_ptr = aligned_alloc(128, 32);
if (new_ptr) {
PRINTF_LN(" %p, function \"aligned_alloc()\" worked", new_ptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// These build options are required for this test program.
-DUMM_ENABLE_MEMALIGN=1
-DDEV_DEBUG_ABI_CPP=1
// -DMIN_ESP_OOM=1
-DMIN_ESP_OOM=1
// Use Arduino IDE "Tools->C++ Exceptions" to enable disable C++ exceptions.
Expand Down

0 comments on commit 31217f6

Please sign in to comment.