Skip to content

Commit e0bf74f

Browse files
Copilotxusheng6
andcommitted
Fix compilation error: add TTDHeapEvent to core namespace
Co-authored-by: xusheng6 <[email protected]>
1 parent f68822c commit e0bf74f

File tree

2 files changed

+51
-25
lines changed

2 files changed

+51
-25
lines changed

api/debuggerapi.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,31 @@ namespace BinaryNinjaDebuggerAPI {
518518
TTDCallEvent() : threadId(0), uniqueThreadId(0), functionAddress(0), returnAddress(0), returnValue(0), hasReturnValue(false) {}
519519
};
520520

521+
struct TTDHeapEvent
522+
{
523+
std::string eventType; // Event type (always "Heap" for TTD.Heap objects)
524+
std::string action; // Heap action: Alloc, ReAlloc, Free, Create, Protect, Lock, Unlock, Destroy
525+
uint32_t threadId; // OS thread ID of thread that made the heap call
526+
uint32_t uniqueThreadId; // Unique ID for the thread across the trace
527+
uint64_t heap; // Handle for the Win32 heap
528+
uint64_t address; // Address of the allocated object (if applicable)
529+
uint64_t previousAddress; // Address before reallocation (for ReAlloc)
530+
uint64_t size; // Size of allocated object (if applicable)
531+
uint64_t baseAddress; // Base address of allocated object (if applicable)
532+
uint64_t flags; // Heap API flags (meaning depends on API)
533+
uint64_t result; // Result of heap API call (non-zero = success)
534+
uint64_t reserveSize; // Amount of memory to reserve (for Create)
535+
uint64_t commitSize; // Initial committed size (for Create)
536+
uint64_t makeReadOnly; // Non-zero = make heap read-only (for Protect)
537+
std::vector<std::string> parameters; // Raw parameters from the heap call
538+
TTDPosition timeStart; // Position when heap operation started
539+
TTDPosition timeEnd; // Position when heap operation ended
540+
541+
TTDHeapEvent() : threadId(0), uniqueThreadId(0), heap(0), address(0), previousAddress(0),
542+
size(0), baseAddress(0), flags(0), result(0), reserveSize(0),
543+
commitSize(0), makeReadOnly(0) {}
544+
};
545+
521546
// TTD Event Types - bitfield flags for filtering events
522547
enum TTDEventType
523548
{
@@ -590,31 +615,6 @@ namespace BinaryNinjaDebuggerAPI {
590615
TTDEvent(TTDEventType eventType) : type(eventType) {}
591616
};
592617

593-
struct TTDHeapEvent
594-
{
595-
std::string eventType; // Event type (always "Heap" for TTD.Heap objects)
596-
std::string action; // Heap action: Alloc, ReAlloc, Free, Create, Protect, Lock, Unlock, Destroy
597-
uint32_t threadId; // OS thread ID of thread that made the heap call
598-
uint32_t uniqueThreadId; // Unique ID for the thread across the trace
599-
uint64_t heap; // Handle for the Win32 heap
600-
uint64_t address; // Address of the allocated object (if applicable)
601-
uint64_t previousAddress; // Address before reallocation (for ReAlloc)
602-
uint64_t size; // Size of allocated object (if applicable)
603-
uint64_t baseAddress; // Base address of allocated object (if applicable)
604-
uint64_t flags; // Heap API flags (meaning depends on API)
605-
uint64_t result; // Result of heap API call (non-zero = success)
606-
uint64_t reserveSize; // Amount of memory to reserve (for Create)
607-
uint64_t commitSize; // Initial committed size (for Create)
608-
uint64_t makeReadOnly; // Non-zero = make heap read-only (for Protect)
609-
std::vector<std::string> parameters; // Raw parameters from the heap call
610-
TTDPosition timeStart; // Position when heap operation started
611-
TTDPosition timeEnd; // Position when heap operation ended
612-
613-
TTDHeapEvent() : threadId(0), uniqueThreadId(0), heap(0), address(0), previousAddress(0),
614-
size(0), baseAddress(0), flags(0), result(0), reserveSize(0),
615-
commitSize(0), makeReadOnly(0) {}
616-
};
617-
618618

619619
typedef BNDebugAdapterConnectionStatus DebugAdapterConnectionStatus;
620620
typedef BNDebugAdapterTargetStatus DebugAdapterTargetStatus;

core/debuggercommon.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,32 @@ namespace BinaryNinjaDebugger {
154154
TTDCallEvent() : threadId(0), uniqueThreadId(0), functionAddress(0), returnAddress(0), returnValue(0), hasReturnValue(false) {}
155155
};
156156

157+
// TTD Heap Event - complete set of fields from Microsoft documentation for TTD.Heap
158+
struct TTDHeapEvent
159+
{
160+
std::string eventType; // Event type (always "Heap" for TTD.Heap objects)
161+
std::string action; // Heap action: Alloc, ReAlloc, Free, Create, Protect, Lock, Unlock, Destroy
162+
uint32_t threadId; // OS thread ID of thread that made the heap call
163+
uint32_t uniqueThreadId; // Unique ID for the thread across the trace
164+
uint64_t heap; // Handle for the Win32 heap
165+
uint64_t address; // Address of the allocated object (if applicable)
166+
uint64_t previousAddress; // Address before reallocation (for ReAlloc)
167+
uint64_t size; // Size of allocated object (if applicable)
168+
uint64_t baseAddress; // Base address of allocated object (if applicable)
169+
uint64_t flags; // Heap API flags (meaning depends on API)
170+
uint64_t result; // Result of heap API call (non-zero = success)
171+
uint64_t reserveSize; // Amount of memory to reserve (for Create)
172+
uint64_t commitSize; // Initial committed size (for Create)
173+
uint64_t makeReadOnly; // Non-zero = make heap read-only (for Protect)
174+
std::vector<std::string> parameters; // Raw parameters from the heap call
175+
TTDPosition timeStart; // Position when heap operation started
176+
TTDPosition timeEnd; // Position when heap operation ended
177+
178+
TTDHeapEvent() : threadId(0), uniqueThreadId(0), heap(0), address(0), previousAddress(0),
179+
size(0), baseAddress(0), flags(0), result(0), reserveSize(0),
180+
commitSize(0), makeReadOnly(0) {}
181+
};
182+
157183
// TTD Event Types - bitfield flags for filtering events
158184
enum TTDEventType
159185
{

0 commit comments

Comments
 (0)