CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: kamil Date: Sat Dec 7 19:38:29 UTC 2019 Modified Files: src/external/bsd/libproc/dist: proc_util.c Log Message: Switch proc_getlwpstatus from PT_LWPINFO to PT_GET_SIGINFO for NetBSD PT_LWPINFO from FreeBSD is almost never intended to be expressed with PT_LWPINFO in NetBSD. PT_GET_SIGINFO reads siginfo_t with the signal information about the event, on FreeBSD siginfo_t is merged into ptrace_lwpinfo and returns the thread that received the event (not the first one in a list like on NetBSD). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/libproc/dist/proc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_util.c diff -u src/external/bsd/libproc/dist/proc_util.c:1.6 src/external/bsd/libproc/dist/proc_util.c:1.7 --- src/external/bsd/libproc/dist/proc_util.c:1.6 Fri Jun 9 01:17:25 2017 +++ src/external/bsd/libproc/dist/proc_util.c Sat Dec 7 19:38:29 2019 @@ -224,42 +224,50 @@ proc_read(struct proc_handle *phdl, void const lwpstatus_t * proc_getlwpstatus(struct proc_handle *phdl) { - struct ptrace_lwpinfo lwpinfo; lwpstatus_t *psp = &phdl->lwps; siginfo_t *siginfo; + +#ifdef PT_GET_SIGINFO + struct ptrace_siginfo si; + + if (ptrace(PT_GET_SIGINFO, phdl->pid, (void *)&si, + sizeof(si)) < 0) + return (NULL); + + siginfo = &si.psi_siginfo; + if (siginfo->si_signo == SIGTRAP && + (siginfo->si_code == TRAP_BRKPT || + siginfo->si_code == TRAP_TRACE)) { + psp->pr_why = PR_FAULTED; + psp->pr_what = FLTBPT; + } else if (siginfo->si_signo == SIGTRAP && + (siginfo->si_code == TRAP_SCE)) { + psp->pr_why = PR_SYSENTRY; + } else if (siginfo->si_signo == SIGTRAP && + (siginfo->si_code == TRAP_SCX)) { + psp->pr_why = PR_SYSEXIT; + } else { + psp->pr_why = PR_SIGNALLED; + psp->pr_what = siginfo->si_signo; + } +#else + struct ptrace_lwpinfo lwpinfo; bool have_siginfo, sysentry, sysexit; if (phdl == NULL) return (NULL); + lwpinfo.pl_lwpid = 0; if (ptrace(PT_LWPINFO, phdl->pid, (void *)&lwpinfo, sizeof(lwpinfo)) < 0) return (NULL); -#ifdef PL_FLAG_SI have_siginfo = (lwpinfo.pl_flags & PL_FLAG_SI) != 0; sysentry = (lwpinfo.pl_flags & PL_FLAG_SCE) != 0; sysexit = (lwpinfo.pl_flags & PL_FLAG_SCX) != 0; -#endif -#ifdef PT_GET_SIGINFO - have_siginfo = 1; - sysentry = 0; - sysexit = 0; -#endif if (lwpinfo.pl_event == PL_EVENT_SIGNAL && have_siginfo) { -#ifdef PL_FLAG_SI siginfo = &lwpinfo.pl_siginfo; -#endif -#ifdef PT_GET_SIGINFO - struct ptrace_siginfo si; - - if (ptrace(PT_GET_SIGINFO, phdl->pid, (void *)&si, - sizeof(si)) < 0) - return (NULL); - - siginfo = &si.psi_siginfo; -#endif if (siginfo->si_signo == SIGTRAP && (siginfo->si_code == TRAP_BRKPT || siginfo->si_code == TRAP_TRACE)) { @@ -274,5 +282,6 @@ proc_getlwpstatus(struct proc_handle *ph } else if (sysexit) { psp->pr_why = PR_SYSEXIT; } +#endif return (psp); }
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: christos Date: Fri Jul 20 20:50:34 UTC 2018 Modified Files: src/external/bsd/libproc/dist: proc_bkpt.c src/external/bsd/libproc/dist/tests: proc_test.c Log Message: unbreak aarch64 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libproc/dist/proc_bkpt.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libproc/dist/tests/proc_test.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_bkpt.c diff -u src/external/bsd/libproc/dist/proc_bkpt.c:1.5 src/external/bsd/libproc/dist/proc_bkpt.c:1.6 --- src/external/bsd/libproc/dist/proc_bkpt.c:1.5 Fri Dec 8 08:36:22 2017 +++ src/external/bsd/libproc/dist/proc_bkpt.c Fri Jul 20 16:50:34 2018 @@ -31,7 +31,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_bkpt.c 287106 2015-08-24 12:17:15Z andrew $"); #else -__RCSID("$NetBSD: proc_bkpt.c,v 1.5 2017/12/08 13:36:22 rin Exp $"); +__RCSID("$NetBSD: proc_bkpt.c,v 1.6 2018/07/20 20:50:34 christos Exp $"); #endif #include @@ -218,10 +218,12 @@ proc_bkptexec(struct proc_handle *phdl, * set up by proc_bkptdel(). */ proc_regset(phdl, REG_PC, pc); +#ifdef PT_STEP if (ptrace(PT_STEP, proc_getpid(phdl), (void *)(intptr_t)1, 0) < 0) { DPRINTFX("ERROR: ptrace step failed"); return (-1); } +#endif proc_wstatus(phdl); status = proc_getwstat(phdl); if (!WIFSTOPPED(status)) { Index: src/external/bsd/libproc/dist/tests/proc_test.c diff -u src/external/bsd/libproc/dist/tests/proc_test.c:1.5 src/external/bsd/libproc/dist/tests/proc_test.c:1.6 --- src/external/bsd/libproc/dist/tests/proc_test.c:1.5 Fri Sep 25 15:08:33 2015 +++ src/external/bsd/libproc/dist/tests/proc_test.c Fri Jul 20 16:50:34 2018 @@ -28,7 +28,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/tests/proc_test.c 286863 2015-08-17 23:19:36Z emaste $"); #endif -__RCSID("$NetBSD: proc_test.c,v 1.5 2015/09/25 19:08:33 christos Exp $"); +__RCSID("$NetBSD: proc_test.c,v 1.6 2018/07/20 20:50:34 christos Exp $"); #include #include @@ -49,13 +49,11 @@ static const char *r_debug_state = "_rtl static const char *r_debug_state = "r_debug_state"; #endif -#if !defined(__aarch64__) #if defined(__NetBSD__) static const char *ldelf_object = "ld.elf_so"; #elif defined(__FreeBSD__) static const char *ldelf_object = "ld-elf.so.1"; #endif -#endif static const char *target_prog_file = "target_prog"; #ifdef __NetBSD__ @@ -100,7 +98,6 @@ start_prog(const struct atf_tc *tc, bool return (phdl); } -#if !defined(__aarch64__) static void set_bkpt(struct proc_handle *phdl, uintptr_t addr, proc_breakpoint_t *saved) { @@ -178,7 +175,6 @@ verify_bkpt(struct proc_handle *phdl, GE ATF_REQUIRE_EQ_MSG(strcmp(mapname, mapbname), 0, "expected map name '%s' doesn't match '%s'", mapname, mapbname); } -#endif ATF_TC(map_alias_obj2map); ATF_TC_HEAD(map_alias_obj2map, tc) @@ -283,7 +279,6 @@ ATF_TC_BODY(map_alias_name2sym, tc) proc_free(phdl); } -#if !defined(__aarch64__) ATF_TC(symbol_lookup); ATF_TC_HEAD(symbol_lookup, tc) { @@ -360,7 +355,6 @@ ATF_TC_BODY(symbol_lookup_fail, tc) proc_free(phdl); } -#endif ATF_TC(signal_forward); ATF_TC_HEAD(signal_forward, tc) @@ -409,11 +403,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, map_alias_obj2map); ATF_TP_ADD_TC(tp, map_alias_name2map); ATF_TP_ADD_TC(tp, map_alias_name2sym); -/* On arm64 triggers panic ARM64TODO: pmap_sync_icache (PR202305). */ -#if !defined(__aarch64__) ATF_TP_ADD_TC(tp, symbol_lookup); ATF_TP_ADD_TC(tp, symbol_lookup_fail); -#endif ATF_TP_ADD_TC(tp, signal_forward); return (atf_no_error());
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: chs Date: Sun Feb 25 18:48:39 UTC 2018 Modified Files: src/external/bsd/libproc/dist: libproc.h Log Message: add some flag definitions from a newer version of FreeBSD's libproc that are needed by the new dtrace. these don't do anything yet, but dtrace doesn't mind. I'll do a full resync to the latest FreeBSD libproc / librtld_db later. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/libproc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/libproc.h diff -u src/external/bsd/libproc/dist/libproc.h:1.3 src/external/bsd/libproc/dist/libproc.h:1.4 --- src/external/bsd/libproc/dist/libproc.h:1.3 Fri Jun 9 01:17:25 2017 +++ src/external/bsd/libproc/dist/libproc.h Sun Feb 25 18:48:39 2018 @@ -51,6 +51,11 @@ typedef void (*proc_child_func)(void *); #define PS_DEAD 5 #define PS_LOST 6 +/* Flags for proc_attach(). */ +#define PATTACH_FORCE 0x01 +#define PATTACH_RDONLY 0x02 +#define PATTACH_NOSTOP 0x04 + /* Reason values for proc_detach(). */ #define PRELEASE_HANG 1 #define PRELEASE_KILL 2
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: rin Date: Fri Dec 8 13:36:22 UTC 2017 Modified Files: src/external/bsd/libproc/dist: proc_bkpt.c Log Message: Use PRIxPTR instead of lx to print pointers. Fix debug build with LLVM. Also use PRIxPTR instead of PRIuPTR, which is apparently misused. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libproc/dist/proc_bkpt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_bkpt.c diff -u src/external/bsd/libproc/dist/proc_bkpt.c:1.4 src/external/bsd/libproc/dist/proc_bkpt.c:1.5 --- src/external/bsd/libproc/dist/proc_bkpt.c:1.4 Fri Sep 25 19:09:38 2015 +++ src/external/bsd/libproc/dist/proc_bkpt.c Fri Dec 8 13:36:22 2017 @@ -31,7 +31,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_bkpt.c 287106 2015-08-24 12:17:15Z andrew $"); #else -__RCSID("$NetBSD: proc_bkpt.c,v 1.4 2015/09/25 19:09:38 christos Exp $"); +__RCSID("$NetBSD: proc_bkpt.c,v 1.5 2017/12/08 13:36:22 rin Exp $"); #endif #include @@ -85,7 +85,7 @@ proc_bkptset(struct proc_handle *phdl, u return (-1); } - DPRINTFX("adding breakpoint at 0x%lx", address); + DPRINTFX("adding breakpoint at 0x%" PRIxPTR, address); stopped = 0; if (phdl->status != PS_STOP) { @@ -105,7 +105,7 @@ proc_bkptset(struct proc_handle *phdl, u piod.piod_len = sizeof(saved->data); if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't read instruction at address 0x%" - PRIuPTR, address); + PRIxPTR, address); ret = -1; goto done; } @@ -119,7 +119,7 @@ proc_bkptset(struct proc_handle *phdl, u piod.piod_len = sizeof(PTRACE_BREAKPOINT); if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" - PRIuPTR, address); + PRIxPTR, address); ret = -1; goto done; } @@ -146,7 +146,7 @@ proc_bkptdel(struct proc_handle *phdl, u return (-1); } - DPRINTFX("removing breakpoint at 0x%lx", address); + DPRINTFX("removing breakpoint at 0x%" PRIxPTR, address); stopped = 0; if (phdl->status != PS_STOP) { @@ -165,7 +165,7 @@ proc_bkptdel(struct proc_handle *phdl, u piod.piod_len = sizeof(saved->data); if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" - PRIuPTR, address); + PRIxPTR, address); ret = -1; }
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: kamil Date: Thu Jun 15 23:44:58 UTC 2017 Modified Files: src/external/bsd/libproc/dist: proc_sym.c Log Message: Don't include on NetBSD in libproc This header in this context is freebsdism. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/proc_sym.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_sym.c diff -u src/external/bsd/libproc/dist/proc_sym.c:1.3 src/external/bsd/libproc/dist/proc_sym.c:1.4 --- src/external/bsd/libproc/dist/proc_sym.c:1.3 Tue Apr 26 14:28:39 2016 +++ src/external/bsd/libproc/dist/proc_sym.c Thu Jun 15 23:44:58 2017 @@ -32,7 +32,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_sym.c 279946 2015-03-13 04:26:48Z stas $"); #else -__RCSID("$NetBSD: proc_sym.c,v 1.3 2016/04/26 14:28:39 chs Exp $"); +__RCSID("$NetBSD: proc_sym.c,v 1.4 2017/06/15 23:44:58 kamil Exp $"); #endif #include @@ -40,7 +40,9 @@ __RCSID("$NetBSD: proc_sym.c,v 1.3 2016/ #include #include #endif +#if defined(__FreeBSD__) #include +#endif #include #include
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: chs Date: Fri Jun 9 01:17:25 UTC 2017 Modified Files: src/external/bsd/libproc/dist: _libproc.h libproc.h proc_create.c proc_util.c Log Message: add a proc_getmodel() interface to return whether a process is a 32-bit or 64-bit process. the interface is from freebsd but the implementation is different. needed by dtrace. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libproc/dist/_libproc.h cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libproc/dist/libproc.h \ src/external/bsd/libproc/dist/proc_create.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libproc/dist/proc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/_libproc.h diff -u src/external/bsd/libproc/dist/_libproc.h:1.1.1.1 src/external/bsd/libproc/dist/_libproc.h:1.2 --- src/external/bsd/libproc/dist/_libproc.h:1.1.1.1 Thu Sep 24 14:05:35 2015 +++ src/external/bsd/libproc/dist/_libproc.h Fri Jun 9 01:17:25 2017 @@ -41,6 +41,7 @@ struct proc_handle { int flags; /* Process flags. */ int status; /* Process status (PS_*). */ int wstat; /* Process wait status. */ + int model; /* Process data model. */ rd_agent_t *rdap; /* librtld_db agent */ rd_loadobj_t *rdobjs; size_t rdobjsz; Index: src/external/bsd/libproc/dist/libproc.h diff -u src/external/bsd/libproc/dist/libproc.h:1.2 src/external/bsd/libproc/dist/libproc.h:1.3 --- src/external/bsd/libproc/dist/libproc.h:1.2 Fri Sep 25 16:07:32 2015 +++ src/external/bsd/libproc/dist/libproc.h Fri Jun 9 01:17:25 2017 @@ -114,6 +114,9 @@ typedef struct lwpstatus { #define FLTBPT -1 } lwpstatus_t; +#define PR_MODEL_ILP32 1 +#define PR_MODEL_LP64 2 + typedef struct { uint8_t data[PTRACE_BREAKPOINT_SIZE]; } proc_breakpoint_t; @@ -143,6 +146,7 @@ int proc_name2sym(struct proc_handle *, struct ctf_file *proc_name2ctf(struct proc_handle *, const char *); int proc_setflags(struct proc_handle *, int); int proc_state(struct proc_handle *); +int proc_getmodel(struct proc_handle *); pid_t proc_getpid(struct proc_handle *); int proc_wstatus(struct proc_handle *); int proc_getwstat(struct proc_handle *); Index: src/external/bsd/libproc/dist/proc_create.c diff -u src/external/bsd/libproc/dist/proc_create.c:1.2 src/external/bsd/libproc/dist/proc_create.c:1.3 --- src/external/bsd/libproc/dist/proc_create.c:1.2 Thu Sep 24 14:12:48 2015 +++ src/external/bsd/libproc/dist/proc_create.c Fri Jun 9 01:17:25 2017 @@ -26,7 +26,7 @@ * $FreeBSD: head/lib/libproc/proc_create.c 265255 2014-05-03 04:44:03Z markj $ */ #include -__RCSID("$NetBSD: proc_create.c,v 1.2 2015/09/24 14:12:48 christos Exp $"); +__RCSID("$NetBSD: proc_create.c,v 1.3 2017/06/09 01:17:25 chs Exp $"); #include #include @@ -47,7 +47,8 @@ static int proc_init(pid_t, int, int, st static int proc_init(pid_t pid, int flags, int status, struct proc_handle *phdl) { - int mib[4], error; + struct kinfo_proc2 kp; + int mib[6], error; size_t len; memset(phdl, 0, sizeof(*phdl)); @@ -68,6 +69,24 @@ proc_init(pid_t pid, int flags, int stat if (len == 0) phdl->execname[0] = '\0'; +#ifdef _LP64 + len = sizeof(kp); + mib[0] = CTL_KERN; + mib[1] = KERN_PROC2; + mib[2] = KERN_PROC_PID; + mib[3] = pid; + mib[4] = len; + mib[5] = 1; + if (sysctl(mib, 6, &kp, &len, NULL, 0) != 0) { + error = errno; + DPRINTF("ERROR: cannot get kinfo_proc2 for pid %d", pid); + return (error); + } + phdl->model = (kp.p_flag & P_32) ? PR_MODEL_ILP32 : PR_MODEL_LP64; +#else + phdl->model = PR_MODEL_ILP32; +#endif + return (0); } Index: src/external/bsd/libproc/dist/proc_util.c diff -u src/external/bsd/libproc/dist/proc_util.c:1.5 src/external/bsd/libproc/dist/proc_util.c:1.6 --- src/external/bsd/libproc/dist/proc_util.c:1.5 Wed Feb 1 20:01:39 2017 +++ src/external/bsd/libproc/dist/proc_util.c Fri Jun 9 01:17:25 2017 @@ -144,6 +144,16 @@ proc_state(struct proc_handle *phdl) return (phdl->status); } +int +proc_getmodel(struct proc_handle *phdl) +{ + + if (phdl == NULL) + return (-1); + + return (phdl->model); +} + pid_t proc_getpid(struct proc_handle *phdl) {
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: chs Date: Wed Feb 1 20:01:40 UTC 2017 Modified Files: src/external/bsd/libproc/dist: proc_util.c Log Message: implement proc_getlwpstatus() for netbsd using PT_GET_SIGINFO. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libproc/dist/proc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_util.c diff -u src/external/bsd/libproc/dist/proc_util.c:1.4 src/external/bsd/libproc/dist/proc_util.c:1.5 --- src/external/bsd/libproc/dist/proc_util.c:1.4 Tue Apr 26 14:29:58 2016 +++ src/external/bsd/libproc/dist/proc_util.c Wed Feb 1 20:01:39 2017 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include "_libproc.h" @@ -216,17 +217,39 @@ proc_getlwpstatus(struct proc_handle *ph struct ptrace_lwpinfo lwpinfo; lwpstatus_t *psp = &phdl->lwps; siginfo_t *siginfo; + bool have_siginfo, sysentry, sysexit; if (phdl == NULL) return (NULL); - lwpinfo.pl_lwpid = 1; + lwpinfo.pl_lwpid = 0; if (ptrace(PT_LWPINFO, phdl->pid, (void *)&lwpinfo, sizeof(lwpinfo)) < 0) return (NULL); + +#ifdef PL_FLAG_SI + have_siginfo = (lwpinfo.pl_flags & PL_FLAG_SI) != 0; + sysentry = (lwpinfo.pl_flags & PL_FLAG_SCE) != 0; + sysexit = (lwpinfo.pl_flags & PL_FLAG_SCX) != 0; +#endif +#ifdef PT_GET_SIGINFO + have_siginfo = 1; + sysentry = 0; + sysexit = 0; +#endif + + if (lwpinfo.pl_event == PL_EVENT_SIGNAL && have_siginfo) { #ifdef PL_FLAG_SI - siginfo = &lwpinfo.pl_siginfo; - if (lwpinfo.pl_event == PL_EVENT_SIGNAL && - (lwpinfo.pl_flags & PL_FLAG_SI) != 0) { + siginfo = &lwpinfo.pl_siginfo; +#endif +#ifdef PT_GET_SIGINFO + struct ptrace_siginfo si; + + if (ptrace(PT_GET_SIGINFO, phdl->pid, (void *)&si, + sizeof(si)) < 0) + return (NULL); + + siginfo = &si.psi_siginfo; +#endif if (siginfo->si_signo == SIGTRAP && (siginfo->si_code == TRAP_BRKPT || siginfo->si_code == TRAP_TRACE)) { @@ -236,12 +259,10 @@ proc_getlwpstatus(struct proc_handle *ph psp->pr_why = PR_SIGNALLED; psp->pr_what = siginfo->si_signo; } - } else if (lwpinfo.pl_flags & PL_FLAG_SCE) { + } else if (sysentry) { psp->pr_why = PR_SYSENTRY; - } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { + } else if (sysexit) { psp->pr_why = PR_SYSEXIT; } -#endif - return (psp); }
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: chs Date: Tue Apr 26 14:29:58 UTC 2016 Modified Files: src/external/bsd/libproc/dist: proc_util.c Log Message: the netbsd version of PT_LWPINFO is different from the freebsd version in that we use lp_lwpid as an input to say which lwp to operate on. freebsd passes the lwpid as the pid, which works fine there since freebsd has globally unique LWP IDs which are also distinct from process IDs. the libproc interface that uses this ptrace() call is only supposed to return info for the process's representative LWP, so just initialize pl_lwpid to 1 before using it. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/proc_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_util.c diff -u src/external/bsd/libproc/dist/proc_util.c:1.3 src/external/bsd/libproc/dist/proc_util.c:1.4 --- src/external/bsd/libproc/dist/proc_util.c:1.3 Fri Sep 25 19:08:32 2015 +++ src/external/bsd/libproc/dist/proc_util.c Tue Apr 26 14:29:58 2016 @@ -219,6 +219,7 @@ proc_getlwpstatus(struct proc_handle *ph if (phdl == NULL) return (NULL); + lwpinfo.pl_lwpid = 1; if (ptrace(PT_LWPINFO, phdl->pid, (void *)&lwpinfo, sizeof(lwpinfo)) < 0) return (NULL);
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: chs Date: Tue Apr 26 14:28:39 UTC 2016 Modified Files: src/external/bsd/libproc/dist: proc_sym.c Log Message: use the netbsd path for separate debuginfo files. only attempt to look up symbols in the dynsym table if the object actually has one, which a separate debuginfo file does not. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libproc/dist/proc_sym.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_sym.c diff -u src/external/bsd/libproc/dist/proc_sym.c:1.2 src/external/bsd/libproc/dist/proc_sym.c:1.3 --- src/external/bsd/libproc/dist/proc_sym.c:1.2 Thu Sep 24 14:12:48 2015 +++ src/external/bsd/libproc/dist/proc_sym.c Tue Apr 26 14:28:39 2016 @@ -32,7 +32,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_sym.c 279946 2015-03-13 04:26:48Z stas $"); #else -__RCSID("$NetBSD: proc_sym.c,v 1.2 2015/09/24 14:12:48 christos Exp $"); +__RCSID("$NetBSD: proc_sym.c,v 1.3 2016/04/26 14:28:39 chs Exp $"); #endif #include @@ -58,6 +58,8 @@ __RCSID("$NetBSD: proc_sym.c,v 1.2 2015/ #include "_libproc.h" +#define DBG_PATH_FMT "/usr/libdata/debug/%s.debug" + #ifdef NO_CTF typedef struct ctf_file ctf_file_t; #endif @@ -105,8 +107,7 @@ find_dbg_obj(const char *path) int fd; char dbg_path[PATH_MAX]; - snprintf(dbg_path, sizeof(dbg_path), - "/usr/lib/debug/%s.debug", path); + snprintf(dbg_path, sizeof(dbg_path), DBG_PATH_FMT, path); fd = open(dbg_path, O_RDONLY); if (fd >= 0) return (fd); @@ -364,9 +365,11 @@ proc_addr2sym(struct proc_handle *p, uin * First look up the symbol in the dynsymtab, and fall back to the * symtab if the lookup fails. */ - error = lookup_addr(e, dynsymscn, dynsymstridx, off, addr, &s, symcopy); - if (error == 0) - goto out; + if (dynsymscn) { + error = lookup_addr(e, dynsymscn, dynsymstridx, off, addr, &s, symcopy); + if (error == 0) + goto out; + } error = lookup_addr(e, symtabscn, symtabstridx, off, addr, &s, symcopy); if (error != 0) @@ -508,9 +511,11 @@ proc_name2sym(struct proc_handle *p, con * First look up the symbol in the dynsymtab, and fall back to the * symtab if the lookup fails. */ - error = lookup_name(e, dynsymscn, dynsymstridx, symbol, symcopy, si); - if (error == 0) - goto out; + if (dynsymscn) { + error = lookup_name(e, dynsymscn, dynsymstridx, symbol, symcopy, si); + if (error == 0) + goto out; + } error = lookup_name(e, symtabscn, symtabstridx, symbol, symcopy, si); if (error == 0)
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: christos Date: Fri Sep 25 19:09:38 UTC 2015 Modified Files: src/external/bsd/libproc/dist: proc_bkpt.c proc_regs.c Log Message: remove caddr_t To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/proc_bkpt.c \ src/external/bsd/libproc/dist/proc_regs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_bkpt.c diff -u src/external/bsd/libproc/dist/proc_bkpt.c:1.3 src/external/bsd/libproc/dist/proc_bkpt.c:1.4 --- src/external/bsd/libproc/dist/proc_bkpt.c:1.3 Fri Sep 25 12:07:32 2015 +++ src/external/bsd/libproc/dist/proc_bkpt.c Fri Sep 25 15:09:38 2015 @@ -31,7 +31,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_bkpt.c 287106 2015-08-24 12:17:15Z andrew $"); #else -__RCSID("$NetBSD: proc_bkpt.c,v 1.3 2015/09/25 16:07:32 christos Exp $"); +__RCSID("$NetBSD: proc_bkpt.c,v 1.4 2015/09/25 19:09:38 christos Exp $"); #endif #include @@ -103,7 +103,7 @@ proc_bkptset(struct proc_handle *phdl, u piod.piod_offs = (void *)caddr; piod.piod_addr = (void *)saved->data; piod.piod_len = sizeof(saved->data); - if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { + if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't read instruction at address 0x%" PRIuPTR, address); ret = -1; @@ -117,7 +117,7 @@ proc_bkptset(struct proc_handle *phdl, u piod.piod_offs = (void *)caddr; piod.piod_addr = (void *)PTRACE_BREAKPOINT; piod.piod_len = sizeof(PTRACE_BREAKPOINT); - if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { + if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" PRIuPTR, address); ret = -1; @@ -163,7 +163,7 @@ proc_bkptdel(struct proc_handle *phdl, u piod.piod_offs = (void *)caddr; piod.piod_addr = (void *)saved->data; piod.piod_len = sizeof(saved->data); - if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { + if (ptrace(PT_IO, proc_getpid(phdl), &piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" PRIuPTR, address); ret = -1; @@ -218,7 +218,7 @@ proc_bkptexec(struct proc_handle *phdl, * set up by proc_bkptdel(). */ proc_regset(phdl, REG_PC, pc); - if (ptrace(PT_STEP, proc_getpid(phdl), (caddr_t)1, 0) < 0) { + if (ptrace(PT_STEP, proc_getpid(phdl), (void *)(intptr_t)1, 0) < 0) { DPRINTFX("ERROR: ptrace step failed"); return (-1); } Index: src/external/bsd/libproc/dist/proc_regs.c diff -u src/external/bsd/libproc/dist/proc_regs.c:1.3 src/external/bsd/libproc/dist/proc_regs.c:1.4 --- src/external/bsd/libproc/dist/proc_regs.c:1.3 Fri Sep 25 12:07:32 2015 +++ src/external/bsd/libproc/dist/proc_regs.c Fri Sep 25 15:09:38 2015 @@ -31,7 +31,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_regs.c 285003 2015-07-01 13:59:26Z br $"); #else -__RCSID("$NetBSD: proc_regs.c,v 1.3 2015/09/25 16:07:32 christos Exp $"); +__RCSID("$NetBSD: proc_regs.c,v 1.4 2015/09/25 19:09:38 christos Exp $"); #endif #include @@ -55,7 +55,7 @@ proc_regget(struct proc_handle *phdl, pr return (-1); } memset(®s, 0, sizeof(regs)); - if (ptrace(PT_GETREGS, proc_getpid(phdl), (caddr_t)®s, 0) < 0) + if (ptrace(PT_GETREGS, proc_getpid(phdl), ®s, 0) < 0) return (-1); switch (reg) { case REG_PC: @@ -90,7 +90,7 @@ proc_regset(struct proc_handle *phdl, pr errno = ENOENT; return (-1); } - if (ptrace(PT_GETREGS, proc_getpid(phdl), (caddr_t)®s, 0) < 0) + if (ptrace(PT_GETREGS, proc_getpid(phdl), ®s, 0) < 0) return (-1); switch (reg) { case REG_PC: @@ -111,7 +111,7 @@ proc_regset(struct proc_handle *phdl, pr DPRINTFX("ERROR: no support for reg number %d", reg); return (-1); } - if (ptrace(PT_SETREGS, proc_getpid(phdl), (caddr_t)®s, 0) < 0) + if (ptrace(PT_SETREGS, proc_getpid(phdl), ®s, 0) < 0) return (-1); return (0);
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: christos Date: Fri Sep 25 19:08:33 UTC 2015 Modified Files: src/external/bsd/libproc/dist: proc_util.c src/external/bsd/libproc/dist/tests: proc_test.c Log Message: Fix the broken detach code and make the proc tests detach instead of continue, so that we don't get kernel diagnostic messages about detaching traced processes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libproc/dist/proc_util.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libproc/dist/tests/proc_test.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/proc_util.c diff -u src/external/bsd/libproc/dist/proc_util.c:1.2 src/external/bsd/libproc/dist/proc_util.c:1.3 --- src/external/bsd/libproc/dist/proc_util.c:1.2 Thu Sep 24 10:12:48 2015 +++ src/external/bsd/libproc/dist/proc_util.c Fri Sep 25 15:08:32 2015 @@ -65,7 +65,7 @@ proc_continue(struct proc_handle *phdl) if (phdl->status == PS_STOP && WSTOPSIG(phdl->wstat) != SIGTRAP) pending = WSTOPSIG(phdl->wstat); - if (ptrace(PT_CONTINUE, phdl->pid, (caddr_t)(uintptr_t)1, pending) != 0) + if (ptrace(PT_CONTINUE, phdl->pid, (void *)(uintptr_t)1, pending) != 0) return (-1); phdl->status = PS_RUN; @@ -79,22 +79,36 @@ proc_detach(struct proc_handle *phdl, in int status; if (phdl == NULL) - return (EINVAL); + return EINVAL; if (reason == PRELEASE_KILL) { + ptrace(PT_DETACH, phdl->pid, (void *)(uintptr_t)1, 0); kill(phdl->pid, SIGKILL); - return (0); + return 0; } - if (ptrace(PT_DETACH, phdl->pid, 0, 0) != 0 && errno == ESRCH) - return (0); - if (errno == EBUSY) { - kill(phdl->pid, SIGSTOP); - waitpid(phdl->pid, &status, WUNTRACED); - ptrace(PT_DETACH, phdl->pid, 0, 0); - kill(phdl->pid, SIGCONT); - return (0); + if (ptrace(PT_DETACH, phdl->pid, (void *)(uintptr_t)1, 0) == 0) + return 0; + + switch (errno) { + case ESRCH: + return 0; + case EBUSY: + break; + default: + return -1; } - return (0); + if (kill(phdl->pid, SIGSTOP) == -1) + return -1; + + waitpid(phdl->pid, &status, WUNTRACED); + + if (ptrace(PT_DETACH, phdl->pid, (void *)(uintptr_t)1, 0) == -1) + return -1; + + if (kill(phdl->pid, SIGCONT) == -1) + return -1; + + return 0; } int @@ -191,7 +205,7 @@ proc_read(struct proc_handle *phdl, void piod.piod_addr = (void *)buf; piod.piod_offs = (void *)addr; - if (ptrace(PT_IO, phdl->pid, (caddr_t)&piod, 0) < 0) + if (ptrace(PT_IO, phdl->pid, (void *)&piod, 0) < 0) return (-1); return (piod.piod_len); } @@ -205,7 +219,7 @@ proc_getlwpstatus(struct proc_handle *ph if (phdl == NULL) return (NULL); - if (ptrace(PT_LWPINFO, phdl->pid, (caddr_t)&lwpinfo, + if (ptrace(PT_LWPINFO, phdl->pid, (void *)&lwpinfo, sizeof(lwpinfo)) < 0) return (NULL); #ifdef PL_FLAG_SI Index: src/external/bsd/libproc/dist/tests/proc_test.c diff -u src/external/bsd/libproc/dist/tests/proc_test.c:1.4 src/external/bsd/libproc/dist/tests/proc_test.c:1.5 --- src/external/bsd/libproc/dist/tests/proc_test.c:1.4 Fri Sep 25 12:07:32 2015 +++ src/external/bsd/libproc/dist/tests/proc_test.c Fri Sep 25 15:08:33 2015 @@ -28,7 +28,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/tests/proc_test.c 286863 2015-08-17 23:19:36Z emaste $"); #endif -__RCSID("$NetBSD: proc_test.c,v 1.4 2015/09/25 16:07:32 christos Exp $"); +__RCSID("$NetBSD: proc_test.c,v 1.5 2015/09/25 19:08:33 christos Exp $"); #include #include @@ -207,7 +207,7 @@ ATF_TC_BODY(map_alias_obj2map, tc) aout_object); ATF_CHECK_EQ(strcmp(map1->pr_mapname, map2->pr_mapname), 0); - ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); + ATF_CHECK_EQ_MSG(proc_detach(phdl, PRELEASE_HANG), 0, "failed to detach"); proc_free(phdl); } @@ -239,7 +239,7 @@ ATF_TC_BODY(map_alias_name2map, tc) aout_object); ATF_CHECK_EQ(strcmp(map1->pr_mapname, map2->pr_mapname), 0); - ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); + ATF_CHECK_EQ_MSG(proc_detach(phdl, PRELEASE_HANG), 0, "failed to detach"); proc_free(phdl); } @@ -278,7 +278,7 @@ ATF_TC_BODY(map_alias_name2sym, tc) ATF_CHECK_EQ(memcmp(&sym1, &sym2, sizeof(sym1)), 0); ATF_CHECK_EQ(si1.prs_id, si2.prs_id); - ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); + ATF_CHECK_EQ_MSG(proc_detach(phdl, PRELEASE_HANG), 0, "failed to detach"); proc_free(phdl); } @@ -319,7 +319,7 @@ ATF_TC_BODY(symbol_lookup, tc) verify_bkpt(phdl, &main_sym, "main", target_prog_file); remove_bkpt(phdl, (uintptr_t)main_sym.st_value, &saved); - ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); + ATF_CHECK_EQ_MSG(proc_detach(phdl, PRELEASE_HANG), 0, "failed to detach"); proc_free(phdl); }
CVS commit: src/external/bsd/libproc/dist
Module Name:src Committed By: christos Date: Fri Sep 25 16:07:32 UTC 2015 Modified Files: src/external/bsd/libproc/dist: libproc.h proc_bkpt.c proc_regs.c src/external/bsd/libproc/dist/tests: proc_test.c Log Message: Add a proc_breakpoint_t and a proc_regval_t to abstract some types. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libproc/dist/libproc.h cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libproc/dist/proc_bkpt.c \ src/external/bsd/libproc/dist/proc_regs.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/tests/proc_test.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/libproc.h diff -u src/external/bsd/libproc/dist/libproc.h:1.1.1.1 src/external/bsd/libproc/dist/libproc.h:1.2 --- src/external/bsd/libproc/dist/libproc.h:1.1.1.1 Thu Sep 24 10:05:35 2015 +++ src/external/bsd/libproc/dist/libproc.h Fri Sep 25 12:07:32 2015 @@ -36,6 +36,7 @@ #include #include #include +#include struct ctf_file; struct proc_handle; @@ -113,6 +114,12 @@ typedef struct lwpstatus { #define FLTBPT -1 } lwpstatus_t; +typedef struct { + uint8_t data[PTRACE_BREAKPOINT_SIZE]; +} proc_breakpoint_t; + +typedef unsigned long proc_regvalue_t; + /* Function prototype definitions. */ __BEGIN_DECLS @@ -145,12 +152,12 @@ const lwpstatus_t *proc_getlwpstatus(str void proc_free(struct proc_handle *); rd_agent_t *proc_rdagent(struct proc_handle *); void proc_updatesyms(struct proc_handle *); -int proc_bkptset(struct proc_handle *, uintptr_t, unsigned long *); -int proc_bkptdel(struct proc_handle *, uintptr_t, unsigned long); +int proc_bkptset(struct proc_handle *, uintptr_t, proc_breakpoint_t *); +int proc_bkptdel(struct proc_handle *, uintptr_t, proc_breakpoint_t *); void proc_bkptregadj(unsigned long *); -int proc_bkptexec(struct proc_handle *, unsigned long); -int proc_regget(struct proc_handle *, proc_reg_t, unsigned long *); -int proc_regset(struct proc_handle *, proc_reg_t, unsigned long); +int proc_bkptexec(struct proc_handle *, proc_breakpoint_t *); +int proc_regget(struct proc_handle *, proc_reg_t, proc_regvalue_t *); +int proc_regset(struct proc_handle *, proc_reg_t, proc_regvalue_t); __END_DECLS Index: src/external/bsd/libproc/dist/proc_bkpt.c diff -u src/external/bsd/libproc/dist/proc_bkpt.c:1.2 src/external/bsd/libproc/dist/proc_bkpt.c:1.3 --- src/external/bsd/libproc/dist/proc_bkpt.c:1.2 Thu Sep 24 10:12:48 2015 +++ src/external/bsd/libproc/dist/proc_bkpt.c Fri Sep 25 12:07:32 2015 @@ -31,7 +31,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/proc_bkpt.c 287106 2015-08-24 12:17:15Z andrew $"); #else -__RCSID("$NetBSD: proc_bkpt.c,v 1.2 2015/09/24 14:12:48 christos Exp $"); +__RCSID("$NetBSD: proc_bkpt.c,v 1.3 2015/09/25 16:07:32 christos Exp $"); #endif #include @@ -39,6 +39,7 @@ __RCSID("$NetBSD: proc_bkpt.c,v 1.2 2015 #include #include +#include #include #include #include @@ -46,26 +47,7 @@ __RCSID("$NetBSD: proc_bkpt.c,v 1.2 2015 #include #include "_libproc.h" -#if defined(__aarch64__) -#define AARCH64_BRK 0xd420 -#define AARCH64_BRK_IMM16_SHIFT 5 -#define AARCH64_BRK_IMM16_VAL (0xd << AARCH64_BRK_IMM16_SHIFT) -#define BREAKPOINT_INSTR (AARCH64_BRK | AARCH64_BRK_IMM16_VAL) -#define BREAKPOINT_INSTR_SZ 4 -#elif defined(__amd64__) || defined(__i386__) -#define BREAKPOINT_INSTR 0xcc /* int 0x3 */ -#define BREAKPOINT_INSTR_SZ 1 -#define BREAKPOINT_ADJUST_SZ BREAKPOINT_INSTR_SZ -#elif defined(__arm__) -#define BREAKPOINT_INSTR 0xe7ff /* bkpt */ -#define BREAKPOINT_INSTR_SZ 4 -#elif defined(__mips__) -#define BREAKPOINT_INSTR 0xd /* break */ -#define BREAKPOINT_INSTR_SZ 4 -#elif defined(__powerpc__) -#define BREAKPOINT_INSTR 0x7fe8 /* trap */ -#define BREAKPOINT_INSTR_SZ 4 -#else +#ifndef PTRACE_BREAKPOINT #error "Add support for your architecture" #endif @@ -90,13 +72,13 @@ proc_stop(struct proc_handle *phdl) int proc_bkptset(struct proc_handle *phdl, uintptr_t address, -unsigned long *saved) +proc_breakpoint_t *saved) { struct ptrace_io_desc piod; unsigned long paddr, caddr; int ret = 0, stopped; + proc_breakpoint_t copy; - *saved = 0; if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD || phdl->status == PS_IDLE) { errno = ENOENT; @@ -119,24 +101,22 @@ proc_bkptset(struct proc_handle *phdl, u paddr = 0; piod.piod_op = PIOD_READ_I; piod.piod_offs = (void *)caddr; - piod.piod_addr = &paddr; - piod.piod_len = BREAKPOINT_INSTR_SZ; + piod.piod_addr = (void *)saved->data; + piod.piod_len = sizeof(saved->data); if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { DPRINTF("ERROR: couldn't read instruction at address 0x%" PRIuPTR, address); ret = -1; goto done; } - *saved = paddr; /* * Write a breakpoint instruction to that address. */ caddr = address; - paddr = BREAKPOINT_INST
CVS commit: src/external/bsd/libproc/dist/tests
Module Name:src Committed By: christos Date: Thu Sep 24 19:25:37 UTC 2015 Modified Files: src/external/bsd/libproc/dist/tests: proc_test.c Log Message: Elf64_Sym.st_value (Elf64_Addr) which is what GElf_Sym using, is wider than uintptr_t on 32 bit machines, so cast to it. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libproc/dist/tests/proc_test.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libproc/dist/tests/proc_test.c diff -u src/external/bsd/libproc/dist/tests/proc_test.c:1.2 src/external/bsd/libproc/dist/tests/proc_test.c:1.3 --- src/external/bsd/libproc/dist/tests/proc_test.c:1.2 Thu Sep 24 10:12:48 2015 +++ src/external/bsd/libproc/dist/tests/proc_test.c Thu Sep 24 15:25:37 2015 @@ -28,7 +28,7 @@ #ifdef __FBSDID __FBSDID("$FreeBSD: head/lib/libproc/tests/proc_test.c 286863 2015-08-17 23:19:36Z emaste $"); #endif -__RCSID("$NetBSD: proc_test.c,v 1.2 2015/09/24 14:12:48 christos Exp $"); +__RCSID("$NetBSD: proc_test.c,v 1.3 2015/09/24 19:25:37 christos Exp $"); #include #include @@ -309,15 +309,15 @@ ATF_TC_BODY(symbol_lookup, tc) &r_debug_state_sym, NULL); ATF_REQUIRE_EQ_MSG(error, 0, "failed to look up '%s'", r_debug_state); - set_bkpt(phdl, r_debug_state_sym.st_value, &saved); + set_bkpt(phdl, (uintptr_t)r_debug_state_sym.st_value, &saved); ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); verify_bkpt(phdl, &r_debug_state_sym, r_debug_state, ldelf_object); - remove_bkpt(phdl, r_debug_state_sym.st_value, saved); + remove_bkpt(phdl, (uintptr_t)r_debug_state_sym.st_value, saved); - set_bkpt(phdl, main_sym.st_value, &saved); + set_bkpt(phdl, (uintptr_t)main_sym.st_value, &saved); ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution"); verify_bkpt(phdl, &main_sym, "main", target_prog_file); - remove_bkpt(phdl, main_sym.st_value, saved); + remove_bkpt(phdl, (uintptr_t)main_sym.st_value, saved); ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution");