committed by
Christian Helmuth
parent
5774a864b1
commit
cc04ffcf42
@@ -181,6 +181,23 @@ void genode_continue_thread(unsigned long lwpid, int single_step)
|
||||
}
|
||||
|
||||
|
||||
unsigned long genode_find_segfault_lwpid()
|
||||
{
|
||||
Cpu_session_component *csc = gdb_stub_thread()->cpu_session_component();
|
||||
|
||||
Thread_capability thread_cap = csc->first();
|
||||
|
||||
while (thread_cap.valid()) {
|
||||
Thread_state thread_state = csc->state(thread_cap);
|
||||
if (thread_state.unresolved_page_fault)
|
||||
return csc->lwpid(thread_cap);
|
||||
thread_cap = csc->next(thread_cap);
|
||||
}
|
||||
|
||||
PDBG("could not determine thread which caused the page fault");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
class Memory_model
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@ void genode_resume_all_threads();
|
||||
ptid_t genode_wait_for_signal_or_gdb_interrupt(struct target_waitstatus *status);
|
||||
void genode_continue_thread(unsigned long lwpid, int single_step);
|
||||
|
||||
unsigned long genode_find_segfault_lwpid();
|
||||
|
||||
int genode_fetch_register(int regno, unsigned long *reg_content);
|
||||
void genode_store_register(int regno, unsigned long reg_content);
|
||||
unsigned char genode_read_memory_byte(void *addr);
|
||||
|
||||
@@ -651,7 +651,7 @@ index 69c6b57..cffa803 100644
|
||||
x86_supports_tracepoints,
|
||||
x86_get_thread_area,
|
||||
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
|
||||
index 650ddf8..046dd2e 100644
|
||||
index 650ddf8..728da30 100644
|
||||
--- a/gdb/gdbserver/remote-utils.c
|
||||
+++ b/gdb/gdbserver/remote-utils.c
|
||||
@@ -18,11 +18,14 @@
|
||||
@@ -756,11 +756,11 @@ index 650ddf8..046dd2e 100644
|
||||
+ genode_stop_all_threads();
|
||||
+
|
||||
+ if (sig > 0) {
|
||||
+ event_ptid.lwp = sig;
|
||||
+ event_ptid.lwp = sig;
|
||||
+ status->kind = TARGET_WAITKIND_STOPPED;
|
||||
+ status->value.sig = TARGET_SIGNAL_TRAP;
|
||||
+ } else {
|
||||
+ event_ptid.lwp = 1;
|
||||
+ event_ptid.lwp = genode_find_segfault_lwpid();
|
||||
+ status->kind = TARGET_WAITKIND_STOPPED;
|
||||
+ status->value.sig = TARGET_SIGNAL_SEGV;
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user