HyperDbg Debugger
Loading...
Searching...
No Matches
LbrApi.h File Reference

Header for LBR tracing routines for HyperTrace module (Intel Last Branch Record). More...

Go to the source code of this file.

Functions

VOID HyperTraceLbrExamplePerformTrace ()
 Example of performing LBR trace.
BOOLEAN HyperTraceLbrDisable (HYPERTRACE_LBR_OPERATION_PACKETS *HyperTraceOperationRequest)
 Disable LBR tracing for HyperTrace.

Detailed Description

Header for LBR tracing routines for HyperTrace module (Intel Last Branch Record).

Author
Hari Mishal (harim.nosp@m.isha.nosp@m.l6@gm.nosp@m.ail..nosp@m.com)
Version
0.18
Date
2025-12-02

Function Documentation

◆ HyperTraceLbrDisable()

BOOLEAN HyperTraceLbrDisable ( HYPERTRACE_LBR_OPERATION_PACKETS * HyperTraceOperationRequest)

Disable LBR tracing for HyperTrace.

Parameters
HyperTraceOperationRequest
Returns
BOOLEAN
279{
280 //
281 // Check if LBR is already disabled or not
282 //
284 {
286 return FALSE;
287 }
288
289 //
290 // Disabling LBR
291 //
293
294 //
295 // Broadcast disabling LBR on all cores
296 //
298
299 //
300 // Set successful status
301 //
303
304 return TRUE;
305}
VOID HyperTraceLbrSetKernelStatus(HYPERTRACE_LBR_OPERATION_PACKETS *HyperTraceLbrOperationRequest, UINT32 Status)
Set the kernel status in the HyperTrace LBR operation request structure.
Definition LbrApi.c:69
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
#define DEBUGGER_ERROR_LBR_ALREADY_DISABLED
error, LBR is already disabled
Definition ErrorCodes.h:606
#define DEBUGGER_OPERATION_WAS_SUCCESSFUL
General value to indicate that the operation or request was successful.
Definition ErrorCodes.h:23
VOID BroadcastDisableLbrOnAllCores()
Routines to disable LBR on all cores.
Definition Broadcast.c:34
BOOLEAN g_LastBranchRecordEnabled
The flag indicating whether the hypertrace LBR tracing is initialized or not.
Definition GlobalVariables.h:48

◆ HyperTraceLbrExamplePerformTrace()

VOID HyperTraceLbrExamplePerformTrace ( )

Example of performing LBR trace.

Returns
VOID
21{
23 {
24 for (volatile int i = 0; i < 50; i++)
25 {
26 if (i % 2)
27 {
28 INT A = i * 2;
29 A += 5;
30 }
31 else
32 {
33 CpuNop();
34 CpuNop();
35 }
36 }
37
38 LogInfo("Dumping LBR Buffer...\n");
39
40 LbrStop();
41 LbrPrint(); // This will print the collected LBR branches to the log
42 }
43}
BOOLEAN LbrStart(UINT64 FilterOptions)
Start collecting LBR branches.
Definition Lbr.c:903
VOID LbrStop()
Stop collecting LBR branches.
Definition Lbr.c:983
VOID LbrPrint()
Print collected LBR branches.
Definition Lbr.c:1194
#define LBR_SELECT_WITHOUT_FILTER
Definition Lbr.h:27
VOID CpuNop(VOID)
Execute NOP.
Definition PlatformIntrinsics.c:508
int INT
Definition BasicTypes.h:43
#define LogInfo(format,...)
Define log variables.
Definition HyperDbgHyperLogIntrinsics.h:71