Date: Sun, 4 Jul 2010 12:08:04 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r209689 - head/lib/libthread_db Message-ID: <201007041208.o64C84SH023919@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Jul 4 12:08:04 2010 New Revision: 209689 URL: http://svn.freebsd.org/changeset/base/209689 Log: Extend the td_thrinfo_t to include siginfo for the signal that stopped the target. Take care of ABI. Suggested by: davidxu MFC after: 2 weeks Modified: head/lib/libthread_db/Symbol.map head/lib/libthread_db/libpthread_db.c head/lib/libthread_db/libthr_db.c head/lib/libthread_db/thread_db.c head/lib/libthread_db/thread_db.h head/lib/libthread_db/thread_db_int.h Modified: head/lib/libthread_db/Symbol.map ============================================================================== --- head/lib/libthread_db/Symbol.map Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/Symbol.map Sun Jul 4 12:08:04 2010 (r209689) @@ -19,7 +19,6 @@ FBSD_1.0 { td_thr_dbsuspend; td_thr_event_enable; td_thr_event_getmsg; - td_thr_get_info; td_thr_getfpregs; td_thr_getgregs; #if defined(i386) @@ -33,3 +32,7 @@ FBSD_1.0 { td_thr_tls_get_addr; td_thr_validate; }; + +FBSD_1.2 { + td_thr_get_info; +}; Modified: head/lib/libthread_db/libpthread_db.c ============================================================================== --- head/lib/libthread_db/libpthread_db.c Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/libpthread_db.c Sun Jul 4 12:08:04 2010 (r209689) @@ -570,7 +570,7 @@ pt_thr_validate(const td_thrhandle_t *th } static td_err_e -pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) +pt_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info) { const td_thragent_t *ta = th->th_ta; struct ptrace_lwpinfo linfo; @@ -659,6 +659,16 @@ pt_thr_get_info(const td_thrhandle_t *th return (0); } +static td_err_e +pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) +{ + td_err_e e; + + e = pt_thr_old_get_info(th, (td_old_thrinfo_t *)info); + bzero(&info->ti_siginfo, sizeof(info->ti_siginfo)); + return (e); +} + #ifdef __i386__ static td_err_e pt_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave) @@ -1114,6 +1124,7 @@ struct ta_ops libpthread_db_ops = { .to_thr_dbsuspend = pt_thr_dbsuspend, .to_thr_event_enable = pt_thr_event_enable, .to_thr_event_getmsg = pt_thr_event_getmsg, + .to_thr_old_get_info = pt_thr_old_get_info, .to_thr_get_info = pt_thr_get_info, .to_thr_getfpregs = pt_thr_getfpregs, .to_thr_getgregs = pt_thr_getgregs, Modified: head/lib/libthread_db/libthr_db.c ============================================================================== --- head/lib/libthread_db/libthr_db.c Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/libthr_db.c Sun Jul 4 12:08:04 2010 (r209689) @@ -453,7 +453,7 @@ pt_thr_validate(const td_thrhandle_t *th } static td_err_e -pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) +pt_thr_get_info_common(const td_thrhandle_t *th, td_thrinfo_t *info, int old) { const td_thragent_t *ta = th->th_ta; struct ptrace_lwpinfo linfo; @@ -489,6 +489,13 @@ pt_thr_get_info(const td_thrhandle_t *th if (ret == PS_OK) { info->ti_sigmask = linfo.pl_sigmask; info->ti_pending = linfo.pl_siglist; + if (!old) { + if ((linfo.pl_flags & PL_FLAG_SI) != 0) + info->ti_siginfo = linfo.pl_siginfo; + else + bzero(&info->ti_siginfo, + sizeof(info->ti_siginfo)); + } } else return (ret); if (state == ta->thread_state_running) @@ -501,6 +508,20 @@ pt_thr_get_info(const td_thrhandle_t *th return (0); } +static td_err_e +pt_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info) +{ + + return (pt_thr_get_info_common(th, (td_thrinfo_t *)info, 1)); +} + +static td_err_e +pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) +{ + + return (pt_thr_get_info_common(th, info, 0)); +} + #ifdef __i386__ static td_err_e pt_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave) @@ -761,6 +782,7 @@ struct ta_ops libthr_db_ops = { .to_thr_dbsuspend = pt_thr_dbsuspend, .to_thr_event_enable = pt_thr_event_enable, .to_thr_event_getmsg = pt_thr_event_getmsg, + .to_thr_old_get_info = pt_thr_old_get_info, .to_thr_get_info = pt_thr_get_info, .to_thr_getfpregs = pt_thr_getfpregs, .to_thr_getgregs = pt_thr_getgregs, Modified: head/lib/libthread_db/thread_db.c ============================================================================== --- head/lib/libthread_db/thread_db.c Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/thread_db.c Sun Jul 4 12:08:04 2010 (r209689) @@ -176,6 +176,14 @@ td_thr_event_getmsg(const td_thrhandle_t } td_err_e +td_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info) +{ + const td_thragent_t *ta = th->th_ta; + return (ta->ta_ops->to_thr_old_get_info(th, info)); +} +__sym_compat(td_thr_get_info, td_thr_old_get_info, FBSD_1.0); + +td_err_e td_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) { const td_thragent_t *ta = th->th_ta; Modified: head/lib/libthread_db/thread_db.h ============================================================================== --- head/lib/libthread_db/thread_db.h Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/thread_db.h Sun Jul 4 12:08:04 2010 (r209689) @@ -191,6 +191,7 @@ typedef struct { psaddr_t ti_startfunc; psaddr_t ti_stkbase; size_t ti_stksize; + siginfo_t ti_siginfo; } td_thrinfo_t; /* Modified: head/lib/libthread_db/thread_db_int.h ============================================================================== --- head/lib/libthread_db/thread_db_int.h Sun Jul 4 11:48:30 2010 (r209688) +++ head/lib/libthread_db/thread_db_int.h Sun Jul 4 12:08:04 2010 (r209689) @@ -32,6 +32,25 @@ #include <sys/types.h> #include <sys/queue.h> +typedef struct { + const td_thragent_t *ti_ta_p; + thread_t ti_tid; + psaddr_t ti_thread; + td_thr_state_e ti_state; + td_thr_type_e ti_type; + td_thr_events_t ti_events; + int ti_pri; + lwpid_t ti_lid; + char ti_db_suspended; + char ti_traceme; + sigset_t ti_sigmask; + sigset_t ti_pending; + psaddr_t ti_tls; + psaddr_t ti_startfunc; + psaddr_t ti_stkbase; + size_t ti_stksize; +} td_old_thrinfo_t; + #define TD_THRAGENT_FIELDS \ struct ta_ops *ta_ops; \ TAILQ_ENTRY(td_thragent) ta_next; \ @@ -65,6 +84,8 @@ struct ta_ops { td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int); td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *, td_event_msg_t *); + td_err_e (*to_thr_old_get_info)(const td_thrhandle_t *, + td_old_thrinfo_t *); td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *); td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *); td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t); @@ -103,4 +124,6 @@ int thr_pwrite_int(const struct td_thrag int thr_pwrite_long(const struct td_thragent *, psaddr_t, uint64_t); int thr_pwrite_ptr(const struct td_thragent *, psaddr_t, psaddr_t); +td_err_e td_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info); + #endif /* _THREAD_DB_INT_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007041208.o64C84SH023919>