This commit was generated by cvs2svn to compensate for changes in r160160,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
parent
50074ddd37
commit
870376755a
@ -1,352 +0,0 @@
|
||||
Only in /sys/contrib/ia64/libuwx/src: CVS
|
||||
diff -u ./uwx.h /sys/contrib/ia64/libuwx/src/uwx.h
|
||||
--- ./uwx.h Tue Apr 27 10:42:48 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx.h Thu May 6 18:10:15 2004
|
||||
@@ -25,8 +25,13 @@
|
||||
#ifndef __UWX_INCLUDED
|
||||
#define __UWX_INCLUDED 1
|
||||
|
||||
+#ifndef _KERNEL
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
+#else
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/systm.h>
|
||||
+#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __EXTERN_C extern "C"
|
||||
diff -u ./uwx_bstream.c /sys/contrib/ia64/libuwx/src/uwx_bstream.c
|
||||
--- ./uwx_bstream.c Tue Apr 27 10:42:52 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_bstream.c Thu May 6 18:12:11 2004
|
||||
@@ -64,8 +64,6 @@
|
||||
int len;
|
||||
int n;
|
||||
int b;
|
||||
- uint32_t *wp;
|
||||
- uint64_t *dp;
|
||||
|
||||
if (bstream->peekc >= 0) {
|
||||
b = bstream->peekc;
|
||||
@@ -131,6 +129,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
int uwx_get_uleb128_alt(struct uwx_bstream *bstream, uint64_t *valp)
|
||||
{
|
||||
uint64_t val;
|
||||
@@ -179,3 +178,4 @@
|
||||
*valp = val;
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
diff -u ./uwx_context.c /sys/contrib/ia64/libuwx/src/uwx_context.c
|
||||
--- ./uwx_context.c Tue Apr 27 10:42:52 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_context.c Thu May 6 19:04:36 2004
|
||||
@@ -200,7 +200,6 @@
|
||||
int sor;
|
||||
int rrb_gr;
|
||||
uint64_t bsp;
|
||||
- int n;
|
||||
|
||||
if (env == 0)
|
||||
return UWX_ERR_NOENV;
|
||||
@@ -274,7 +273,6 @@
|
||||
|
||||
int uwx_set_fr(struct uwx_env *env, int regid, uint64_t *val)
|
||||
{
|
||||
- int status;
|
||||
|
||||
if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5))
|
||||
regid -= UWX_REG_FR(2);
|
||||
@@ -340,6 +338,7 @@
|
||||
return bsp + nslots * DWORDSZ;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
int uwx_selftest_bsp_arithmetic()
|
||||
{
|
||||
int i;
|
||||
@@ -398,3 +397,4 @@
|
||||
|
||||
return failed;
|
||||
}
|
||||
+#endif
|
||||
diff -u ./uwx_env.c /sys/contrib/ia64/libuwx/src/uwx_env.c
|
||||
--- ./uwx_env.c Tue Apr 27 10:42:53 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_env.c Thu May 6 21:31:55 2004
|
||||
@@ -22,13 +22,21 @@
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+#ifndef _KERNEL
|
||||
#include <stdlib.h>
|
||||
+#endif
|
||||
|
||||
#include "uwx_env.h"
|
||||
#include "uwx_scoreboard.h"
|
||||
#include "uwx_str.h"
|
||||
#include "uwx_trace.h"
|
||||
|
||||
+#ifdef _KERNEL
|
||||
+static struct uwx_env uwx_env;
|
||||
+#define free(p) /* nullified */
|
||||
+#define malloc(sz) ((sz == sizeof(uwx_env)) ? &uwx_env : NULL)
|
||||
+#endif
|
||||
+
|
||||
alloc_cb uwx_allocate_cb = 0;
|
||||
free_cb uwx_free_cb = 0;
|
||||
|
||||
@@ -64,7 +72,6 @@
|
||||
{
|
||||
int i;
|
||||
struct uwx_env *env;
|
||||
- char *tstr;
|
||||
|
||||
if (uwx_allocate_cb == 0)
|
||||
env = (struct uwx_env *) malloc(sizeof(struct uwx_env));
|
||||
diff -u ./uwx_scoreboard.c /sys/contrib/ia64/libuwx/src/uwx_scoreboard.c
|
||||
--- ./uwx_scoreboard.c Tue Apr 27 10:42:53 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_scoreboard.c Thu May 6 21:29:25 2004
|
||||
@@ -22,12 +22,41 @@
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+#ifndef _KERNEL
|
||||
#include <stdlib.h>
|
||||
+#endif
|
||||
|
||||
#include "uwx_env.h"
|
||||
#include "uwx_scoreboard.h"
|
||||
#include "uwx_trace.h"
|
||||
|
||||
+#ifdef _KERNEL
|
||||
+static unsigned short uwx_allocated;
|
||||
+static struct uwx_scoreboard uwx_scoreboard[sizeof(uwx_allocated) << 3];
|
||||
+
|
||||
+static void
|
||||
+free(struct uwx_scoreboard *p)
|
||||
+{
|
||||
+ int idx = p - uwx_scoreboard;
|
||||
+ uwx_allocated &= ~(1 << idx);
|
||||
+}
|
||||
+
|
||||
+static struct uwx_scoreboard *
|
||||
+malloc(size_t sz)
|
||||
+{
|
||||
+ int idx;
|
||||
+ if (sz != sizeof(struct uwx_scoreboard))
|
||||
+ return (NULL);
|
||||
+ for (idx = 0; idx < (sizeof(uwx_allocated) << 3); idx++) {
|
||||
+ if ((uwx_allocated & (1 << idx)) == 0) {
|
||||
+ uwx_allocated |= 1 << idx;
|
||||
+ return (uwx_scoreboard + idx);
|
||||
+ }
|
||||
+ }
|
||||
+ return (NULL);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
|
||||
struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env)
|
||||
{
|
||||
@@ -66,6 +95,7 @@
|
||||
return sb;
|
||||
}
|
||||
|
||||
+static
|
||||
void uwx_reclaim_scoreboards(struct uwx_env *env)
|
||||
{
|
||||
struct uwx_scoreboard *sb;
|
||||
@@ -140,6 +170,7 @@
|
||||
/* in the "nextstack" field. */
|
||||
|
||||
back = 0;
|
||||
+ new = 0;
|
||||
while (sb != 0) {
|
||||
TRACE_B_LABEL_COPY(sb->id)
|
||||
new = uwx_alloc_scoreboard(env);
|
||||
@@ -223,6 +254,7 @@
|
||||
/* Now copy its stack, storing reverse links in the nextstack field. */
|
||||
|
||||
back = sb;
|
||||
+ new = 0;
|
||||
for (next = lsb->nextstack; next != 0; next = next->nextstack) {
|
||||
TRACE_B_COPY_COPY(next->id)
|
||||
new = uwx_alloc_scoreboard(env);
|
||||
diff -u ./uwx_step.c /sys/contrib/ia64/libuwx/src/uwx_step.c
|
||||
--- ./uwx_step.c Tue Apr 27 10:42:54 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_step.c Thu May 6 18:32:03 2004
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
|
||||
/* uwx_get_frame_info: Gets unwind info for current frame */
|
||||
-
|
||||
+static
|
||||
int uwx_get_frame_info(struct uwx_env *env)
|
||||
{
|
||||
int i;
|
||||
@@ -77,7 +77,6 @@
|
||||
uint64_t *uvec;
|
||||
uint64_t *rstate;
|
||||
struct uwx_utable_entry uentry;
|
||||
- uint64_t uinfop;
|
||||
uint64_t uvecout[UVECSIZE];
|
||||
|
||||
if (env->copyin == 0 || env->lookupip == 0)
|
||||
diff -u ./uwx_step.h /sys/contrib/ia64/libuwx/src/uwx_step.h
|
||||
--- ./uwx_step.h Tue Apr 27 10:42:50 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_step.h Thu May 6 18:45:59 2004
|
||||
@@ -25,4 +25,6 @@
|
||||
#define UVECSIZE 20 /* Size of uvec supplied by unwind engine */
|
||||
/* for callback's use. */
|
||||
|
||||
+extern int uwx_lookupip_hook(int request, uint64_t ip, intptr_t tok,
|
||||
+ uint64_t **vecp, size_t uvecsize);
|
||||
extern int uwx_restore_markers(struct uwx_env *env);
|
||||
diff -u ./uwx_str.c /sys/contrib/ia64/libuwx/src/uwx_str.c
|
||||
--- ./uwx_str.c Tue Apr 27 10:42:55 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_str.c Thu May 6 21:02:58 2004
|
||||
@@ -25,6 +25,12 @@
|
||||
#include "uwx_env.h"
|
||||
#include "uwx_str.h"
|
||||
|
||||
+#ifdef _KERNEL
|
||||
+static struct uwx_str_pool uwx_str_pool;
|
||||
+#define free(p) /* nullified */
|
||||
+#define malloc(sz) ((sz == sizeof(uwx_str_pool)) ? &uwx_str_pool : NULL)
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* uwx_str.c
|
||||
*
|
||||
diff -u ./uwx_trace.c /sys/contrib/ia64/libuwx/src/uwx_trace.c
|
||||
--- ./uwx_trace.c Tue Apr 27 10:42:55 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_trace.c Thu May 6 18:36:02 2004
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "uwx_scoreboard.h"
|
||||
#include "uwx_trace.h"
|
||||
|
||||
+#ifdef UWX_TRACE_ENABLE
|
||||
+
|
||||
void uwx_trace_init(struct uwx_env *env)
|
||||
{
|
||||
char *tstr;
|
||||
@@ -34,7 +36,7 @@
|
||||
tstr = getenv("UWX_TRACE");
|
||||
if (tstr != NULL) {
|
||||
while (*tstr != '\0') {
|
||||
- switch (*tstr++) {
|
||||
+ switch (*tstr) {
|
||||
case 'i': env->trace |= UWX_TRACE_UINFO; break;
|
||||
case 't': env->trace |= UWX_TRACE_UTABLE; break;
|
||||
case 'b': env->trace |= UWX_TRACE_SB; break;
|
||||
@@ -44,6 +46,9 @@
|
||||
case 'C': env->trace |= UWX_TRACE_COPYIN; break;
|
||||
case 'L': env->trace |= UWX_TRACE_LOOKUPIP; break;
|
||||
case '?':
|
||||
+#ifdef _KERNEL
|
||||
+ printf("UWX_TRACE flag `%c' unknown.\n", *tstr);
|
||||
+#else
|
||||
fprintf(stderr, "UWX_TRACE flags:\n");
|
||||
fprintf(stderr, " i: unwind info\n");
|
||||
fprintf(stderr, " t: unwind table searching\n");
|
||||
@@ -54,7 +59,9 @@
|
||||
fprintf(stderr, " C: copyin callback\n");
|
||||
fprintf(stderr, " L: lookup ip callback\n");
|
||||
exit(1);
|
||||
+#endif
|
||||
}
|
||||
+ tstr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +114,7 @@
|
||||
printf(" [reg %d]\n", reg);
|
||||
break;
|
||||
default:
|
||||
- printf(" <%08x>\n", rstate);
|
||||
+ printf(" <%08llx>\n", (unsigned long long)rstate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -133,3 +140,4 @@
|
||||
uwx_dump_rstate(i, scoreboard->rstate[i]);
|
||||
}
|
||||
|
||||
+#endif /* UWX_TRACE_ENABLE */
|
||||
diff -u ./uwx_uinfo.c /sys/contrib/ia64/libuwx/src/uwx_uinfo.c
|
||||
--- ./uwx_uinfo.c Tue Apr 27 10:42:56 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_uinfo.c Thu May 6 18:46:51 2004
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "uwx_scoreboard.h"
|
||||
#include "uwx_bstream.h"
|
||||
#include "uwx_trace.h"
|
||||
+#include "uwx_swap.h"
|
||||
|
||||
int uwx_count_ones(unsigned int mask);
|
||||
|
||||
diff -u ./uwx_utable.c /sys/contrib/ia64/libuwx/src/uwx_utable.c
|
||||
--- ./uwx_utable.c Tue Apr 27 10:42:56 2004
|
||||
+++ /sys/contrib/ia64/libuwx/src/uwx_utable.c Thu May 6 18:58:55 2004
|
||||
@@ -76,7 +76,10 @@
|
||||
/* Make sure all three required values are given. */
|
||||
|
||||
keys = 0;
|
||||
+ text_base = 0;
|
||||
unwind_flags = 0;
|
||||
+ unwind_start = 0;
|
||||
+ unwind_end = 0;
|
||||
while (*uvec != 0) {
|
||||
switch ((int)*uvec++) {
|
||||
case UWX_KEY_TBASE:
|
||||
@@ -139,7 +142,6 @@
|
||||
uint32_t unwind_end,
|
||||
struct uwx_utable_entry *uentry)
|
||||
{
|
||||
- int status;
|
||||
int lb;
|
||||
int ub;
|
||||
int mid;
|
||||
@@ -160,11 +162,13 @@
|
||||
|
||||
lb = 0;
|
||||
ub = (unwind_end - unwind_start) / (3 * WORDSZ);
|
||||
+ mid = 0;
|
||||
while (ub > lb) {
|
||||
mid = (lb + ub) / 2;
|
||||
- len = COPYIN_UINFO_4((char *)&code_start, unwind_start+mid*3*WORDSZ);
|
||||
+ len = COPYIN_UINFO_4((char *)&code_start,
|
||||
+ (uintptr_t)(unwind_start+mid*3*WORDSZ));
|
||||
len += COPYIN_UINFO_4((char *)&code_end,
|
||||
- unwind_start+mid*3*WORDSZ+WORDSZ);
|
||||
+ (uintptr_t)(unwind_start+mid*3*WORDSZ+WORDSZ));
|
||||
if (len != 2 * WORDSZ)
|
||||
return UWX_ERR_COPYIN_UTBL;
|
||||
if (env->byte_swap) {
|
||||
@@ -182,7 +186,7 @@
|
||||
if (ub <= lb)
|
||||
return UWX_ERR_NOUENTRY;
|
||||
len = COPYIN_UINFO_4((char *)&unwind_info,
|
||||
- unwind_start+mid*3*WORDSZ+2*WORDSZ);
|
||||
+ (uintptr_t)(unwind_start+mid*3*WORDSZ+2*WORDSZ));
|
||||
if (len != WORDSZ)
|
||||
return UWX_ERR_COPYIN_UTBL;
|
||||
if (env->byte_swap)
|
||||
@@ -210,7 +214,6 @@
|
||||
uint64_t unwind_end,
|
||||
struct uwx_utable_entry *uentry)
|
||||
{
|
||||
- int status;
|
||||
int lb;
|
||||
int ub;
|
||||
int mid;
|
||||
@@ -229,6 +232,7 @@
|
||||
|
||||
lb = 0;
|
||||
ub = (unwind_end - unwind_start) / (3 * DWORDSZ);
|
||||
+ mid = 0;
|
||||
while (ub > lb) {
|
||||
mid = (lb + ub) / 2;
|
||||
len = COPYIN_UINFO_8((char *)&code_start, unwind_start+mid*3*DWORDSZ);
|
@ -1,336 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <crt0.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/uc_access.h>
|
||||
|
||||
#include "uwx_env.h"
|
||||
#include "uwx_context.h"
|
||||
#include "uwx_trace.h"
|
||||
#include "uwx_self.h"
|
||||
|
||||
#define MODULE_CACHE_SIZE 10
|
||||
|
||||
#define UWX_ABI_HPUX_SIGCONTEXT 0x0101 /* abi = HP-UX, context = 1 */
|
||||
|
||||
struct uwx_self_module_info {
|
||||
uint64_t text_base;
|
||||
uint64_t text_size;
|
||||
uint64_t *unwind_base;
|
||||
uint64_t last_access;
|
||||
char *name;
|
||||
struct uwx_self_module_info *next;
|
||||
};
|
||||
|
||||
struct uwx_self_info {
|
||||
struct uwx_env *env;
|
||||
ucontext_t *ucontext;
|
||||
uint64_t bspstore;
|
||||
uint64_t rvec[10];
|
||||
uint64_t sendsig_start;
|
||||
uint64_t sendsig_end;
|
||||
alloc_cb allocate_cb;
|
||||
free_cb free_cb;
|
||||
int trace;
|
||||
struct load_module_desc desc;
|
||||
struct uwx_self_module_info *module_cache;
|
||||
};
|
||||
|
||||
struct uwx_self_info *uwx_self_init_info(struct uwx_env *env)
|
||||
{
|
||||
struct uwx_self_info *info;
|
||||
struct uwx_self_module_info *modules;
|
||||
size_t size;
|
||||
|
||||
size = sizeof(struct uwx_self_info) +
|
||||
MODULE_CACHE_SIZE * sizeof(struct uwx_self_module_info);
|
||||
|
||||
if (env->allocate_cb == 0)
|
||||
info = (struct uwx_self_info *) malloc(size);
|
||||
else
|
||||
info = (struct uwx_self_info *) (*env->allocate_cb)(size);
|
||||
if (info == 0)
|
||||
return 0;
|
||||
|
||||
modules = (struct uwx_self_module_info *) (info + 1);
|
||||
|
||||
info->env = env;
|
||||
info->ucontext = 0;
|
||||
info->bspstore = 0;
|
||||
info->sendsig_start = __load_info->li_sendsig_txt;
|
||||
info->sendsig_end = __load_info->li_sendsig_txt +
|
||||
__load_info->li_sendsig_tsz;
|
||||
info->allocate_cb = env->allocate_cb;
|
||||
info->free_cb = env->free_cb;
|
||||
info->trace = env->trace;
|
||||
info->module_cache = modules;
|
||||
|
||||
for (i = 0; i < MODULE_CACHE_SIZE; i++) {
|
||||
modules[i].text_base = 0;
|
||||
modules[i].text_size = 0;
|
||||
modules[i].unwind_base = 0;
|
||||
modules[i].last_access = 0;
|
||||
modules[i].name = 0;
|
||||
modules[i].next = 0;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
int uwx_self_free_info(struct uwx_self_info *info)
|
||||
{
|
||||
if (info->free_cb == 0)
|
||||
free((void *)info);
|
||||
else
|
||||
(*info->free_cb)((void *)info);
|
||||
return UWX_OK;
|
||||
}
|
||||
|
||||
int uwx_self_init_from_sigcontext(
|
||||
struct uwx_env *env,
|
||||
struct uwx_self_info *info,
|
||||
ucontext_t *ucontext)
|
||||
{
|
||||
int status;
|
||||
uint16_t reason;
|
||||
uint64_t ip;
|
||||
uint64_t sp;
|
||||
uint64_t bsp;
|
||||
uint64_t cfm;
|
||||
unsigned int nat;
|
||||
uint64_t ec;
|
||||
int adj;
|
||||
|
||||
info->ucontext = ucontext;
|
||||
status = __uc_get_reason(ucontext, &reason);
|
||||
status = __uc_get_ip(ucontext, &ip);
|
||||
status = __uc_get_grs(ucontext, 12, 1, &sp, &nat);
|
||||
status = __uc_get_cfm(ucontext, &cfm);
|
||||
#ifdef NEW_UC_GET_AR
|
||||
status = __uc_get_ar_bsp(ucontext, &bsp);
|
||||
status = __uc_get_ar_bspstore(ucontext, &info->bspstore);
|
||||
status = __uc_get_ar_ec(ucontext, &ec);
|
||||
#else
|
||||
status = __uc_get_ar(ucontext, 17, &bsp);
|
||||
status = __uc_get_ar(ucontext, 18, &info->bspstore);
|
||||
status = __uc_get_ar(ucontext, 66, &ec);
|
||||
#endif
|
||||
/* The returned bsp needs to be adjusted. */
|
||||
/* For interrupt frames, where bsp was advanced by a cover */
|
||||
/* instruction, subtract sof (size of frame). For non-interrupt */
|
||||
/* frames, where bsp was advanced by br.call, subtract sol */
|
||||
/* (size of locals). */
|
||||
if (reason != 0)
|
||||
adj = (unsigned int)cfm & 0x7f; /* interrupt frame */
|
||||
else
|
||||
adj = ((unsigned int)cfm >> 7) & 0x7f; /* non-interrupt frame */
|
||||
bsp = uwx_add_to_bsp(bsp, -adj);
|
||||
cfm |= ec << 52;
|
||||
uwx_init_context(env, ip, sp, bsp, cfm);
|
||||
return UWX_OK;
|
||||
}
|
||||
|
||||
int uwx_self_do_context_frame(
|
||||
struct uwx_env *env,
|
||||
struct uwx_self_info *info)
|
||||
{
|
||||
int abi_context;
|
||||
int status;
|
||||
uint64_t ucontext;
|
||||
|
||||
abi_context = uwx_get_abi_context_code(env);
|
||||
if (abi_context != UWX_ABI_HPUX_SIGCONTEXT)
|
||||
return UWX_SELF_ERR_BADABICONTEXT;
|
||||
status = uwx_get_reg(env, UWX_REG_GR(32), (uint64_t *)&ucontext);
|
||||
if (status != 0)
|
||||
return status;
|
||||
return uwx_self_init_from_sigcontext(env, info, (ucontext_t *)ucontext);
|
||||
}
|
||||
|
||||
int uwx_self_copyin(
|
||||
int request,
|
||||
char *loc,
|
||||
uint64_t rem,
|
||||
int len,
|
||||
intptr_t tok)
|
||||
{
|
||||
int status;
|
||||
int regid;
|
||||
unsigned int nat;
|
||||
struct uwx_self_info *info = (struct uwx_self_info *) tok;
|
||||
unsigned long *wp;
|
||||
uint64_t *dp;
|
||||
|
||||
status = -1;
|
||||
|
||||
dp = (uint64_t *) loc;
|
||||
|
||||
switch (request) {
|
||||
case UWX_COPYIN_UINFO:
|
||||
case UWX_COPYIN_MSTACK:
|
||||
if (len == 4) {
|
||||
wp = (unsigned long *) loc;
|
||||
*wp = *(unsigned long *)rem;
|
||||
TRACE_SELF_COPYIN4(rem, len, wp)
|
||||
status = 0;
|
||||
}
|
||||
else if (len == 8) {
|
||||
*dp = *(uint64_t *)rem;
|
||||
TRACE_SELF_COPYIN8(rem, len, dp)
|
||||
status = 0;
|
||||
}
|
||||
break;
|
||||
case UWX_COPYIN_RSTACK:
|
||||
if (len == 8) {
|
||||
if (info->ucontext == 0 && rem == (info->bspstore | 0x1f8)) {
|
||||
*dp = info->env->context.special[UWX_REG_AR_RNAT];
|
||||
status = 0;
|
||||
}
|
||||
else if (info->ucontext == 0 || rem < info->bspstore) {
|
||||
*dp = *(uint64_t *)rem;
|
||||
TRACE_SELF_COPYIN8(rem, len, dp)
|
||||
status = 0;
|
||||
}
|
||||
else {
|
||||
status = __uc_get_rsebs(info->ucontext,
|
||||
(uint64_t *)rem, 1, dp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UWX_COPYIN_REG:
|
||||
regid = (int)rem;
|
||||
if (info->ucontext != 0) {
|
||||
if (len == 8) {
|
||||
if (rem == UWX_REG_PREDS)
|
||||
status = __uc_get_prs(info->ucontext, dp);
|
||||
else if (rem == UWX_REG_AR_PFS)
|
||||
status = __uc_get_ar(info->ucontext, 64, dp);
|
||||
else if (rem == UWX_REG_AR_RNAT)
|
||||
status = __uc_get_ar(info->ucontext, 19, dp);
|
||||
else if (rem == UWX_REG_AR_UNAT)
|
||||
status = __uc_get_ar(info->ucontext, 36, dp);
|
||||
else if (rem == UWX_REG_AR_FPSR)
|
||||
status = __uc_get_ar(info->ucontext, 40, dp);
|
||||
else if (rem == UWX_REG_AR_LC)
|
||||
status = __uc_get_ar(info->ucontext, 65, dp);
|
||||
else if (regid >= UWX_REG_GR(1) &&
|
||||
regid <= UWX_REG_GR(31))
|
||||
status = __uc_get_grs(info->ucontext,
|
||||
regid - UWX_REG_GR(0), 1, dp, &nat);
|
||||
else if (regid >= UWX_REG_BR(0) &&
|
||||
regid <= UWX_REG_BR(7))
|
||||
status = __uc_get_brs(info->ucontext,
|
||||
regid - UWX_REG_BR(0), 1, dp);
|
||||
}
|
||||
else if (len == 16) {
|
||||
if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) {
|
||||
status = __uc_get_frs(info->ucontext,
|
||||
regid - UWX_REG_FR(0), 1, (fp_regval_t *)dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (status != 0)
|
||||
return 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
int uwx_self_find_module(
|
||||
uint64_t ip,
|
||||
struct uwx_self_info *info,
|
||||
uint64_t *text_base,
|
||||
uint64_t **unwind_base)
|
||||
{
|
||||
UINT64 handle;
|
||||
|
||||
/* Search our cache for the module containing the IP */
|
||||
|
||||
/* Not in the cache -- call dlmodinfo */
|
||||
|
||||
handle = dlmodinfo(ip, &info->desc, sizeof(info->desc), 0, 0, 0);
|
||||
if (handle == 0)
|
||||
return UWX_ERR_IPNOTFOUND;
|
||||
|
||||
/* Store it in the cache */
|
||||
|
||||
*text_base = info->desc.text_base;
|
||||
*unwind_base = (uint64_t *) info->desc.unwind_base;
|
||||
return UWX_OK;
|
||||
}
|
||||
|
||||
int uwx_self_lookupip(
|
||||
int request,
|
||||
uint64_t ip,
|
||||
intptr_t tok,
|
||||
uint64_t **resultp)
|
||||
{
|
||||
struct uwx_self_info *info = (struct uwx_self_info *) tok;
|
||||
uint64_t text_base;
|
||||
uint64_t *unwind_base;
|
||||
uint64_t *rvec;
|
||||
int i;
|
||||
|
||||
if (request == UWX_LKUP_LOOKUP) {
|
||||
TRACE_SELF_LOOKUP(ip)
|
||||
if (ip >= info->sendsig_start && ip < info->sendsig_end) {
|
||||
i = 0;
|
||||
rvec = info->rvec;
|
||||
rvec[i++] = UWX_KEY_CONTEXT;
|
||||
rvec[i++] = UWX_ABI_HPUX_SIGCONTEXT;
|
||||
rvec[i++] = 0;
|
||||
rvec[i++] = 0;
|
||||
*resultp = rvec;
|
||||
return UWX_LKUP_FDESC;
|
||||
}
|
||||
else {
|
||||
if (uwx_self_find_module(ip, info,
|
||||
&text_base, &unwind_base) != UWX_OK)
|
||||
return UWX_LKUP_ERR;
|
||||
TRACE_SELF_LOOKUP_DESC(text_base, unwind_base)
|
||||
i = 0;
|
||||
rvec = info->rvec;
|
||||
rvec[i++] = UWX_KEY_TBASE;
|
||||
rvec[i++] = text_base;
|
||||
rvec[i++] = UWX_KEY_UFLAGS;
|
||||
rvec[i++] = unwind_base[0];
|
||||
rvec[i++] = UWX_KEY_USTART;
|
||||
rvec[i++] = text_base + unwind_base[1];
|
||||
rvec[i++] = UWX_KEY_UEND;
|
||||
rvec[i++] = text_base + unwind_base[2];
|
||||
rvec[i++] = 0;
|
||||
rvec[i++] = 0;
|
||||
*resultp = rvec;
|
||||
return UWX_LKUP_UTABLE;
|
||||
}
|
||||
}
|
||||
else if (request == UWX_LKUP_FREE) {
|
||||
return 0;
|
||||
}
|
||||
else if (request == UWX_LKUP_SYMBOLS) {
|
||||
return UWX_LKUP_ERR;
|
||||
}
|
||||
}
|
@ -1,369 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/ttrace.h>
|
||||
#include <sys/uc_access.h>
|
||||
#include <machine/sys/uregs.h>
|
||||
|
||||
#include "uwx_env.h"
|
||||
#include "uwx_context.h"
|
||||
#include "uwx_trace.h"
|
||||
#include "uwx_ttrace.h"
|
||||
|
||||
struct uwx_ttrace_info {
|
||||
uint64_t bspstore;
|
||||
uint64_t load_map;
|
||||
uint64_t rvec[10];
|
||||
alloc_cb allocate_cb;
|
||||
free_cb free_cb;
|
||||
int have_ucontext;
|
||||
pid_t pid;
|
||||
lwpid_t lwpid;
|
||||
int trace;
|
||||
ucontext_t ucontext;
|
||||
};
|
||||
|
||||
void *uwx_ttrace_memcpy(void *buffer, uint64_t ptr, size_t bufsiz, int ident)
|
||||
{
|
||||
uint64_t *dest;
|
||||
uint64_t val;
|
||||
int status;
|
||||
|
||||
status = ttrace(TT_PROC_RDDATA, (pid_t)ident,
|
||||
0, ptr, bufsiz, (uint64_t)buffer);
|
||||
if (status != 0)
|
||||
return NULL;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
struct uwx_ttrace_info *uwx_ttrace_init_info(
|
||||
struct uwx_env *env,
|
||||
pid_t pid,
|
||||
lwpid_t lwpid,
|
||||
uint64_t load_map)
|
||||
{
|
||||
struct uwx_ttrace_info *info;
|
||||
|
||||
if (env->allocate_cb == 0)
|
||||
info = (struct uwx_ttrace_info *)
|
||||
malloc(sizeof(struct uwx_ttrace_info));
|
||||
else
|
||||
info = (struct uwx_ttrace_info *)
|
||||
(*env->allocate_cb)(sizeof(struct uwx_ttrace_info));
|
||||
if (info == 0)
|
||||
return 0;
|
||||
|
||||
info->bspstore = 0;
|
||||
info->load_map = load_map;
|
||||
info->allocate_cb = env->allocate_cb;
|
||||
info->free_cb = env->free_cb;
|
||||
info->have_ucontext = 0;
|
||||
info->pid = pid;
|
||||
info->lwpid = lwpid;
|
||||
info->trace = env->trace;
|
||||
return info;
|
||||
}
|
||||
|
||||
int uwx_ttrace_free_info(struct uwx_ttrace_info *info)
|
||||
{
|
||||
if (info->free_cb == 0)
|
||||
free((void *)info);
|
||||
else
|
||||
(*info->free_cb)((void *)info);
|
||||
return UWX_OK;
|
||||
}
|
||||
|
||||
int uwx_ttrace_init_context(struct uwx_env *env, struct uwx_ttrace_info *info)
|
||||
{
|
||||
uint64_t reason;
|
||||
uint64_t ip;
|
||||
uint64_t sp;
|
||||
uint64_t bsp;
|
||||
uint64_t cfm;
|
||||
uint64_t ec;
|
||||
int status;
|
||||
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__reason, (uint64_t)8, (uint64_t)&reason);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__ip, (uint64_t)8, (uint64_t)&ip);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__r12, (uint64_t)8, (uint64_t)&sp);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__ar_bsp, (uint64_t)8, (uint64_t)&bsp);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__ar_bspstore, (uint64_t)8, (uint64_t)&info->bspstore);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__cfm, (uint64_t)8, (uint64_t)&cfm);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
status = ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
(uint64_t)__ar_ec, (uint64_t)8, (uint64_t)&ec);
|
||||
if (status != 0)
|
||||
return UWX_TT_ERR_TTRACE;
|
||||
|
||||
cfm |= ec << 52;
|
||||
|
||||
if (reason != 0)
|
||||
bsp = uwx_add_to_bsp(bsp, -((unsigned int)cfm & 0x7f));
|
||||
|
||||
return uwx_init_context(env, ip, sp, bsp, cfm);
|
||||
}
|
||||
|
||||
int uwx_ttrace_init_from_sigcontext(
|
||||
struct uwx_env *env,
|
||||
struct uwx_ttrace_info *info,
|
||||
uint64_t ucontext)
|
||||
{
|
||||
int status;
|
||||
uint16_t reason;
|
||||
uint64_t ip;
|
||||
uint64_t sp;
|
||||
uint64_t bsp;
|
||||
uint64_t cfm;
|
||||
unsigned int nat;
|
||||
uint64_t ec;
|
||||
|
||||
info->have_ucontext = 1;
|
||||
uwx_ttrace_memcpy(&info->ucontext,
|
||||
ucontext,
|
||||
sizeof(__uc_misc_t),
|
||||
info->pid);
|
||||
uwx_ttrace_memcpy(&info->ucontext.__uc_mcontext,
|
||||
(uint64_t) &((ucontext_t *)ucontext)->__uc_mcontext,
|
||||
sizeof(mcontext_t),
|
||||
info->pid);
|
||||
status = __uc_get_reason(&info->ucontext, &reason);
|
||||
status = __uc_get_ip(&info->ucontext, &ip);
|
||||
status = __uc_get_grs(&info->ucontext, 12, 1, &sp, &nat);
|
||||
status = __uc_get_ar(&info->ucontext, 17, &bsp);
|
||||
status = __uc_get_ar(&info->ucontext, 18, &info->bspstore);
|
||||
status = __uc_get_ar(&info->ucontext, 66, &ec);
|
||||
status = __uc_get_cfm(&info->ucontext, &cfm);
|
||||
cfm |= ec << 52;
|
||||
if (reason != 0)
|
||||
bsp = uwx_add_to_bsp(bsp, -((unsigned int)cfm & 0x7f));
|
||||
uwx_init_context(env, ip, sp, bsp, cfm);
|
||||
return UWX_OK;
|
||||
}
|
||||
|
||||
int uwx_ttrace_do_context_frame(
|
||||
struct uwx_env *env,
|
||||
struct uwx_ttrace_info *info)
|
||||
{
|
||||
int abi_context;
|
||||
int status;
|
||||
uint64_t ucontext;
|
||||
|
||||
abi_context = uwx_get_abi_context_code(env);
|
||||
if (abi_context != 0x0101) /* abi = HP-UX, context = 1 */
|
||||
return UWX_TT_ERR_BADABICONTEXT;
|
||||
status = uwx_get_reg(env, UWX_REG_GR(32), &ucontext);
|
||||
if (status != 0)
|
||||
return status;
|
||||
return uwx_ttrace_init_from_sigcontext(env, info, ucontext);
|
||||
}
|
||||
|
||||
int uwx_ttrace_copyin(
|
||||
int request,
|
||||
char *loc,
|
||||
uint64_t rem,
|
||||
int len,
|
||||
intptr_t tok)
|
||||
{
|
||||
int status;
|
||||
int regid;
|
||||
unsigned int nat;
|
||||
struct uwx_ttrace_info *info = (struct uwx_ttrace_info *) tok;
|
||||
unsigned long *wp;
|
||||
uint64_t *dp;
|
||||
int ttreg;
|
||||
|
||||
dp = (uint64_t *) loc;
|
||||
|
||||
if (request == UWX_COPYIN_UINFO) {
|
||||
if (len == 4) {
|
||||
status = ttrace(TT_PROC_RDTEXT, info->pid,
|
||||
0, rem, 4, (uint64_t)loc);
|
||||
wp = (unsigned long *) loc;
|
||||
TRACE_SELF_COPYIN4(rem, len, wp)
|
||||
}
|
||||
else if (len == 8) {
|
||||
status = ttrace(TT_PROC_RDTEXT, info->pid,
|
||||
0, rem, 8, (uint64_t)loc);
|
||||
TRACE_SELF_COPYIN4(rem, len, dp)
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (request == UWX_COPYIN_MSTACK && len == 8) {
|
||||
status = ttrace(TT_PROC_RDDATA, info->pid, 0, rem, 8, (uint64_t)loc);
|
||||
TRACE_SELF_COPYIN4(rem, len, dp)
|
||||
}
|
||||
else if (request == UWX_COPYIN_RSTACK && len == 8) {
|
||||
if (info->have_ucontext == 0 || rem < info->bspstore) {
|
||||
status = ttrace(TT_PROC_RDDATA, info->pid, 0, rem, 8, (uint64_t)loc);
|
||||
TRACE_SELF_COPYIN8(rem, len, dp)
|
||||
}
|
||||
else if (info->have_ucontext == 0) {
|
||||
status = ttrace(TT_LWP_RDRSEBS, info->pid, info->lwpid, rem, 8, (uint64_t)loc);
|
||||
TRACE_SELF_COPYIN8(rem, len, dp)
|
||||
}
|
||||
else {
|
||||
status = __uc_get_rsebs(&info->ucontext, (uint64_t *)rem, 1, dp);
|
||||
if (status != 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (request == UWX_COPYIN_REG && len == 8) {
|
||||
regid = (int)rem;
|
||||
if (info->have_ucontext) {
|
||||
if (regid < UWX_REG_GR(0)) {
|
||||
switch (regid) {
|
||||
case UWX_REG_PREDS:
|
||||
status = __uc_get_prs(&info->ucontext, dp);
|
||||
break;
|
||||
case UWX_REG_AR_PFS:
|
||||
status = __uc_get_ar(&info->ucontext, 64, dp);
|
||||
break;
|
||||
case UWX_REG_AR_RNAT:
|
||||
status = __uc_get_ar(&info->ucontext, 19, dp);
|
||||
break;
|
||||
case UWX_REG_AR_UNAT:
|
||||
status = __uc_get_ar(&info->ucontext, 36, dp);
|
||||
break;
|
||||
case UWX_REG_AR_FPSR:
|
||||
status = __uc_get_ar(&info->ucontext, 40, dp);
|
||||
break;
|
||||
case UWX_REG_AR_LC:
|
||||
status = __uc_get_ar(&info->ucontext, 65, dp);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
|
||||
status = __uc_get_grs(&info->ucontext,
|
||||
regid - UWX_REG_GR(0), 1, dp, &nat);
|
||||
}
|
||||
else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
|
||||
status = __uc_get_brs(&info->ucontext,
|
||||
regid - UWX_REG_BR(0), 1, dp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (regid < UWX_REG_GR(0)) {
|
||||
switch (regid) {
|
||||
case UWX_REG_PREDS:
|
||||
ttreg = __pr;
|
||||
break;
|
||||
case UWX_REG_AR_PFS:
|
||||
ttreg = __ar_pfs;
|
||||
break;
|
||||
case UWX_REG_AR_RNAT:
|
||||
ttreg = __ar_rnat;
|
||||
break;
|
||||
case UWX_REG_AR_UNAT:
|
||||
ttreg = __ar_unat;
|
||||
break;
|
||||
case UWX_REG_AR_FPSR:
|
||||
ttreg = __ar_fpsr;
|
||||
break;
|
||||
case UWX_REG_AR_LC:
|
||||
ttreg = __ar_lc;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
|
||||
ttreg = regid - UWX_REG_GR(1) + __r1;
|
||||
}
|
||||
else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
|
||||
ttreg = regid - UWX_REG_BR(0) + __b0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
status == ttrace(TT_LWP_RUREGS, info->pid, info->lwpid,
|
||||
ttreg, 8, (uint64_t)loc);
|
||||
}
|
||||
if (status != 0)
|
||||
return 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int uwx_ttrace_lookupip(
|
||||
int request,
|
||||
uint64_t ip,
|
||||
intptr_t tok,
|
||||
uint64_t **resultp)
|
||||
{
|
||||
struct uwx_ttrace_info *info = (struct uwx_ttrace_info *) tok;
|
||||
UINT64 handle;
|
||||
struct load_module_desc desc;
|
||||
uint64_t *unwind_base;
|
||||
uint64_t *rvec;
|
||||
int i;
|
||||
|
||||
if (request == UWX_LKUP_LOOKUP) {
|
||||
TRACE_SELF_LOOKUP(ip)
|
||||
handle = dlmodinfo((unsigned long) ip, &desc, sizeof(desc),
|
||||
uwx_ttrace_memcpy, info->pid, info->load_map);
|
||||
if (handle == 0)
|
||||
return UWX_LKUP_ERR;
|
||||
unwind_base = (uint64_t *) desc.unwind_base;
|
||||
TRACE_SELF_LOOKUP_DESC(desc.text_base, unwind_base)
|
||||
i = 0;
|
||||
rvec = info->rvec;
|
||||
rvec[i++] = UWX_KEY_TBASE;
|
||||
rvec[i++] = desc.text_base;
|
||||
rvec[i++] = UWX_KEY_UFLAGS;
|
||||
rvec[i++] = unwind_base[0];
|
||||
rvec[i++] = UWX_KEY_USTART;
|
||||
rvec[i++] = desc.text_base + unwind_base[1];
|
||||
rvec[i++] = UWX_KEY_UEND;
|
||||
rvec[i++] = desc.text_base + unwind_base[2];
|
||||
rvec[i++] = 0;
|
||||
rvec[i++] = 0;
|
||||
*resultp = rvec;
|
||||
return UWX_LKUP_UTABLE;
|
||||
}
|
||||
else if (request == UWX_LKUP_FREE) {
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
struct uwx_ttrace_info;
|
||||
|
||||
extern struct uwx_ttrace_info *uwx_ttrace_init_info(
|
||||
struct uwx_env *env,
|
||||
pid_t pid,
|
||||
lwpid_t lwpid,
|
||||
uint64_t load_map);
|
||||
|
||||
extern int uwx_ttrace_free_info(struct uwx_ttrace_info *info);
|
||||
|
||||
extern int uwx_ttrace_init_context(
|
||||
struct uwx_env *env,
|
||||
struct uwx_ttrace_info *info);
|
||||
|
||||
extern int uwx_ttrace_init_from_sigcontext(
|
||||
struct uwx_env *env,
|
||||
struct uwx_ttrace_info *info,
|
||||
uint64_t ucontext);
|
||||
|
||||
extern int uwx_ttrace_do_context_frame(
|
||||
struct uwx_env *env,
|
||||
struct uwx_ttrace_info *info);
|
||||
|
||||
extern int uwx_ttrace_copyin(
|
||||
int request,
|
||||
char *loc,
|
||||
uint64_t rem,
|
||||
int len,
|
||||
intptr_t tok);
|
||||
|
||||
extern int uwx_ttrace_lookupip(
|
||||
int request,
|
||||
uint64_t ip,
|
||||
intptr_t tok,
|
||||
uint64_t **resultp);
|
||||
|
||||
#define UWX_TT_ERR_BADABICONTEXT (-101)
|
||||
#define UWX_TT_ERR_TTRACE (-102)
|
Loading…
Reference in New Issue
Block a user