@@ -292,7 +292,8 @@ NativeProcessWindows::GetAuxvData() const {
292
292
293
293
llvm::Expected<llvm::ArrayRef<uint8_t >>
294
294
NativeProcessWindows::GetSoftwareBreakpointTrapOpcode (size_t size_hint) {
295
- static const uint8_t g_aarch64_opcode[] = {0x00 , 0x00 , 0x3e , 0xd4 }; // brk #0xf000
295
+ static const uint8_t g_aarch64_opcode[] = {0x00 , 0x00 , 0x3e ,
296
+ 0xd4 }; // brk #0xf000
296
297
static const uint8_t g_thumb_opcode[] = {0xfe , 0xde }; // udf #0xfe
297
298
298
299
switch (GetArchitecture ().GetMachine ()) {
@@ -309,9 +310,9 @@ NativeProcessWindows::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
309
310
}
310
311
311
312
size_t NativeProcessWindows::GetSoftwareBreakpointPCOffset () {
312
- // Windows always reports an incremented PC after a breakpoint is hit,
313
- // even on ARM.
314
- return cantFail (GetSoftwareBreakpointTrapOpcode (0 )).size ();
313
+ // Windows always reports an incremented PC after a breakpoint is hit,
314
+ // even on ARM.
315
+ return cantFail (GetSoftwareBreakpointTrapOpcode (0 )).size ();
315
316
}
316
317
317
318
bool NativeProcessWindows::FindSoftwareBreakpoint (lldb::addr_t addr) {
@@ -463,6 +464,7 @@ NativeProcessWindows::OnDebugException(bool first_chance,
463
464
switch (record.GetExceptionCode ()) {
464
465
case DWORD (STATUS_SINGLE_STEP):
465
466
case STATUS_WX86_SINGLE_STEP: {
467
+ #ifndef __aarch64__
466
468
uint32_t wp_id = LLDB_INVALID_INDEX32;
467
469
if (NativeThreadWindows *thread = GetThreadByID (record.GetThreadID ())) {
468
470
NativeRegisterContextWindows ®_ctx = thread->GetRegisterContext ();
@@ -483,6 +485,7 @@ NativeProcessWindows::OnDebugException(bool first_chance,
483
485
}
484
486
}
485
487
if (wp_id == LLDB_INVALID_INDEX32)
488
+ #endif
486
489
StopThread (record.GetThreadID (), StopReason::eStopReasonTrace);
487
490
488
491
SetState (eStateStopped, true );
@@ -508,18 +511,28 @@ NativeProcessWindows::OnDebugException(bool first_chance,
508
511
SetState (eStateStopped, true );
509
512
return ExceptionResult::MaskException;
510
513
} else {
514
+ // This block of code will only be entered in case of a hardware
515
+ // watchpoint or breakpoint hit on AArch64. However, we only handle
516
+ // hardware watchpoints below as breakpoints are not yet supported.
511
517
const std::vector<ULONG_PTR> &args = record.GetExceptionArguments ();
512
518
// Check that the ExceptionInformation array of EXCEPTION_RECORD
513
519
// contains at least two elements: the first is a read-write flag
514
520
// indicating the type of data access operation (read or write) while
515
521
// the second contains the virtual address of the accessed data.
516
522
if (args.size () >= 2 ) {
517
523
uint32_t hw_id = LLDB_INVALID_INDEX32;
518
- reg_ctx.GetWatchpointHitIndex (hw_id, args[1 ]);
524
+ Status error = reg_ctx.GetWatchpointHitIndex (hw_id, args[1 ]);
525
+ if (error.Fail ())
526
+ LLDB_LOG (log,
527
+ " received error while checking for watchpoint hits, pid = "
528
+ " {0}, error = {1}" ,
529
+ thread_id, error);
519
530
520
531
if (hw_id != LLDB_INVALID_INDEX32) {
521
532
std::string desc =
522
- formatv (" {0} {1} {2}" , args[1 ], hw_id, exception_addr).str ();
533
+ formatv (" {0} {1} {2}" , reg_ctx.GetWatchpointAddress (hw_id),
534
+ hw_id, exception_addr)
535
+ .str ();
523
536
StopThread (thread_id, StopReason::eStopReasonWatchpoint, desc);
524
537
SetState (eStateStopped, true );
525
538
return ExceptionResult::MaskException;
0 commit comments