Skip to content

Commit

Permalink
Improve BufferManager assertion context args
Browse files Browse the repository at this point in the history
Previously, in some cases, no information or context was provided when
this assertion tripped, which made it harder to identify the cause.
Include more information in several cases.
  • Loading branch information
celskeggs committed Feb 13, 2025
1 parent a2a0f39 commit c372ec0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Svc/BufferManager/BufferManagerComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ namespace Svc {
// allocate memory
void *memory = allocator.allocate(memId,allocatedSize,recoverable);
// make sure the memory returns was non-zero and the size requested
FW_ASSERT(memory);
FW_ASSERT(
memorySize == allocatedSize,
FW_ASSERT(memory != nullptr && memorySize == allocatedSize,
mgrId, memId,
static_cast<FwAssertArgType>(reinterpret_cast<FwSizeType>(memory)),
static_cast<FwAssertArgType>(memorySize),
static_cast<FwAssertArgType>(allocatedSize));
// structs will be at beginning of memory
Expand Down Expand Up @@ -225,11 +225,13 @@ namespace Svc {
U8* const CURR_PTR = bufferMem;
U8* const END_PTR = static_cast<U8*>(memory) + memorySize;
FW_ASSERT(CURR_PTR == END_PTR,
mgrId, memId,
static_cast<FwAssertArgType>(reinterpret_cast<POINTER_CAST>(CURR_PTR)),
static_cast<FwAssertArgType>(reinterpret_cast<POINTER_CAST>(END_PTR)));
// secondary init verification
FW_ASSERT(
currStruct == this->m_numStructs,
mgrId, memId,
static_cast<FwAssertArgType>(currStruct),
static_cast<FwAssertArgType>(this->m_numStructs));
// indicate setup is done
Expand Down

0 comments on commit c372ec0

Please sign in to comment.