This patch implements hardware breakpoint functionality in LLDB for AArch64 targets. AArch64 targets supports hardware breakpoints via ptrace interface similar to hardware watchpoints. Hardware breakpoints provide fast way to stop target not requiring any memory read/write like software breakpoints.
This patch fixes areas which required tweaking to put hardware breakpoints implementation in place via process gdb remote. We are able to test these breakpoints via a simple application on Android Nexux5x devices.
I am in process of testing on various other platforms and also writing lldb testsuite test cases.
Also added in final revision.
- LLDB Testsuite testcases for hardware breakpoints testing. (Done)
- Similar implementation for Arm targets.
Looking forward to upstream comments on this.
Test code in case someone wants to test:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define THREAD_COUNT 8
void *thread_function( void *ptr )
{
int *argument = (int *) ptr; printf("Thread #%i \n", *argument);
}
int main()
{
int argument[THREAD_COUNT]; pthread_t thread_handle[THREAD_COUNT]; int i; for (i = 0; i < THREAD_COUNT; i++) { argument[i] = i; if (pthread_create( &thread_handle[i], NULL, thread_function, (void*) &argument[i])) { printf("Error - pthread_create() failed\n"); exit(EXIT_FAILURE); } } for (i = 0; i < THREAD_COUNT; i++) pthread_join( thread_handle[i], NULL); exit(EXIT_SUCCESS); return 0;
}