Skip to content

Commit 31217f6

Browse files
committed
Improved build coverage of DEV_DEBUG_ABI_CPP option and operator delete monitoring.
Made example more instructive on build option error.
1 parent 0574c1a commit 31217f6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cores/esp8266/heap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ void* _heap_abi_malloc(size_t size, bool unhandled, const void* const caller)
918918
}; // extern "C" {
919919

920920

921-
#if defined(ENABLE_THICK_DEBUG_WRAPPERS)
921+
#if defined(ENABLE_THICK_DEBUG_WRAPPERS) || defined(USE_HEAP_ABI_MEMALIGN) || defined(USE_HEAP_ABI_MALLOC)
922922
///////////////////////////////////////////////////////////////////////////////
923923
// Replacement C++ delete operator to capture callers address
924924
//

libraries/esp8266/examples/HeapNewDeleteTest/HeapNewDeleteTest.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ void _NOINLINE test_new_try_catch(int& err_count, size_t sz, size_t alignment, i
326326
void print_build_options() {
327327
#if DEV_DEBUG_ABI_CPP
328328
PRINTF_LN(" Built with DEV_DEBUG_ABI_CPP");
329+
#if defined(__cpp_exceptions) && !(defined(DEBUG_ESP_OOM) || defined(DEBUG_ESP_PORT) || defined(DEBUG_ESP_WITHINISR) || defined(MIN_ESP_OOM))
330+
PRINTF_LN("* This build used the LIBC's default operator \"new\"(/\"delete\") handler for C++ Exceptions, which bypassed");
331+
PRINTF_LN("* our monitoring logic. The goal is to confirm the coverage of our added Heap debugging logic.");
332+
PRINTF_LN("* To use the \"new\"/\"delete\" monitoring logic, define a debug option like MIN_ESP_OOM, DEBUG_ESP_PORT, etc.");
333+
#endif
329334
#else
330335
PRINTF_LN("* For complete operation, the test build requires option -DDEV_DEBUG_ABI_CPP=1");
331336
#endif
@@ -402,8 +407,6 @@ void setup() {
402407

403408
print_build_options();
404409
#if UMM_ENABLE_MEMALIGN
405-
PRINTF_LN(" Built with UMM_ENABLE_MEMALIGN, i.e. memalign present");
406-
407410
void* new_ptr = aligned_alloc(128, 32);
408411
if (new_ptr) {
409412
PRINTF_LN(" %p, function \"aligned_alloc()\" worked", new_ptr);

libraries/esp8266/examples/HeapNewDeleteTest/HeapNewDeleteTest.ino.globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// These build options are required for this test program.
1919
-DUMM_ENABLE_MEMALIGN=1
2020
-DDEV_DEBUG_ABI_CPP=1
21-
// -DMIN_ESP_OOM=1
21+
-DMIN_ESP_OOM=1
2222
// Use Arduino IDE "Tools->C++ Exceptions" to enable disable C++ exceptions.
2323
2424

0 commit comments

Comments
 (0)