diff options
author | Jim Blandy <jimb@redhat.com> | 2005-03-11 00:01:05 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 2005-03-11 00:01:05 +0000 |
commit | c87868b6c480c577c54361bf54faaa2b6f4a973a (patch) | |
tree | d209aaed09483d53788968d6f6a45d3d8f19ccb4 | |
parent | dff37ce11766dbfccab358923e6c308c508bf96f (diff) | |
download | gdb-c87868b6c480c577c54361bf54faaa2b6f4a973a.tar.gz |
Merge changes from trunk, to make progressive branch-vs.-trunk
diffs easier to generate.
2005-02-08 Kevin Buettner <kevinb@redhat.com
* td_thr_tls_get_addr_p): New static global.
(thread_db_dlopen): Initialize ``td_thr_tls_get_addr_p''.
(thread_db_get_gen): Add support for qGetTLSAddr packet.
2004-12-13 Kevin Buettner <kevinb@redhat.com>
* thread-db.c (thread_db_get_thread_reg): Don't allow a successful
return without first initializing ``reg''.
(thread_db_set_thread_reg): Remove code intended to for
thread_db_get_thread_reg().
2004-11-18 Kevin Buettner <kevinb@redhat.com>
* thread-db.c (thread_db_set_thread_reg): Don't allow a successful
return without first initializing ``reg''.
-rw-r--r-- | rda/unix/ChangeLog | 23 | ||||
-rw-r--r-- | rda/unix/thread-db.c | 69 |
2 files changed, 91 insertions, 1 deletions
diff --git a/rda/unix/ChangeLog b/rda/unix/ChangeLog index 301f43a1447..d90eb660d68 100644 --- a/rda/unix/ChangeLog +++ b/rda/unix/ChangeLog @@ -1,5 +1,28 @@ 2005-03-10 Jim Blandy <jimb@redhat.com> + Merge changes from trunk, to make progressive branch-vs.-trunk + diffs easier to generate. + + 2005-02-08 Kevin Buettner <kevinb@redhat.com + + * td_thr_tls_get_addr_p): New static global. + (thread_db_dlopen): Initialize ``td_thr_tls_get_addr_p''. + (thread_db_get_gen): Add support for qGetTLSAddr packet. + + 2004-12-13 Kevin Buettner <kevinb@redhat.com> + + * thread-db.c (thread_db_get_thread_reg): Don't allow a successful + return without first initializing ``reg''. + (thread_db_set_thread_reg): Remove code intended to for + thread_db_get_thread_reg(). + + 2004-11-18 Kevin Buettner <kevinb@redhat.com> + + * thread-db.c (thread_db_set_thread_reg): Don't allow a successful + return without first initializing ``reg''. + +2005-03-10 Jim Blandy <jimb@redhat.com> + * linux-target.c (stock_table_to_frv, frv_table_to_stock, stock_bp_to_frv, frv_bp_to_stock, frv_make_bp_table, frv_set_bp, frv_delete_bp, frv_bp_hit_p): New functions. diff --git a/rda/unix/thread-db.c b/rda/unix/thread-db.c index 3b977d6cb1d..b33608c95bf 100644 --- a/rda/unix/thread-db.c +++ b/rda/unix/thread-db.c @@ -418,6 +418,9 @@ static td_err_e (*td_thr_setxregs_p) (const td_thrhandle_t *th, static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, int event); static const char **(*td_symbol_list_p) (void); +static td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th, + void *map_address, + size_t offset, void **address); /* Function: thread_db_state_str @@ -1279,6 +1282,7 @@ thread_db_dlopen (void) td_thr_getxregs_p = dlsym (dlhandle, "td_thr_getxregs"); td_thr_setxregs_p = dlsym (dlhandle, "td_thr_setxregs"); td_symbol_list_p = dlsym (dlhandle, "td_symbol_list"); + td_thr_tls_get_addr_p = dlsym (dlhandle, "td_thr_tls_get_addr"); return 0; /* success */ } @@ -1518,7 +1522,7 @@ thread_db_thread_next (struct gdbserv *serv, struct gdbserv_thread *thread) /* Function: thread_db_get_gen Handle 'q' requests: - qSymbol + qSymbol and qGetTLSAddr */ static void @@ -1630,6 +1634,65 @@ thread_db_get_gen (struct gdbserv *serv) gdbserv_output_bytes (serv, symbol_query, strlen (symbol_query)); } } + else if (gdbserv_input_string_match (serv, "GetTLSAddr:") >= 0) + { + /* Message qGetTLSAddr:thread-id,offset,link-map-addr */ + unsigned long thread_id, offset, link_map_addr; + + if (thread_agent == NULL + || td_thr_tls_get_addr_p == 0) + { + /* Not supported by thread library. */ + gdbserv_output_string (serv, "E01"); + } + else if (gdbserv_input_hex_ulong (serv, &thread_id) >= 0 + && gdbserv_input_string_match (serv, ",") >= 0 + && gdbserv_input_hex_ulong (serv, &offset) >= 0 + && gdbserv_input_string_match (serv, ",") >= 0 + && gdbserv_input_hex_ulong (serv, &link_map_addr) >= 0) + { + td_err_e ret; + td_thrhandle_t thread_handle; + ret = thread_db_map_id2thr (thread_agent, + (thread_t) thread_id, + &thread_handle); + + if (ret == TD_OK) + { + void *addr; + + ret = td_thr_tls_get_addr_p (&thread_handle, + (void *) link_map_addr, + (size_t) offset, + &addr); + if (ret == TD_OK) + { + struct gdbserv_reg addr_as_reg; + + gdbserv_ulonglong_to_reg (serv, + (unsigned long long) + (unsigned long) addr, + &addr_as_reg); + gdbserv_output_reg_beb (serv, &addr_as_reg, 0); + } + else + { + /* Can't find TLS address. */ + gdbserv_output_string (serv, "E04"); + } + } + else + { + /* Unable to find thread. */ + gdbserv_output_string (serv, "E03"); + } + } + else + { + /* Malformed qGetTLSAddr packet. */ + gdbserv_output_string (serv, "E02"); + } + } else if (parentvec.process_get_gen) parentvec.process_get_gen (serv); } @@ -2296,6 +2359,10 @@ thread_db_set_thread_reg (struct gdbserv *serv, GREGSET_T gregset; td_err_e ret; + /* Initialize reg to 0 in the event that we return early due to a + register being unsupported. */ + gdbserv_ulonglong_to_reg (serv, 0LL, reg); + if (thread == NULL) thread = process->event_thread; /* Default to the event thread. */ |