ptrace.h revision 1.11
11.11Skamil/*	$NetBSD: ptrace.h,v 1.11 2019/06/18 21:18:13 kamil Exp $	*/
21.2Scgd
31.1Sragge/*
41.1Sragge * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
51.1Sragge * All rights reserved.
61.1Sragge *
71.1Sragge * Redistribution and use in source and binary forms, with or without
81.1Sragge * modification, are permitted provided that the following conditions
91.1Sragge * are met:
101.1Sragge * 1. Redistributions of source code must retain the above copyright
111.1Sragge *    notice, this list of conditions and the following disclaimer.
121.1Sragge * 2. Redistributions in binary form must reproduce the above copyright
131.1Sragge *    notice, this list of conditions and the following disclaimer in the
141.1Sragge *    documentation and/or other materials provided with the distribution.
151.1Sragge *
161.1Sragge * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
171.1Sragge * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
181.1Sragge * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
191.1Sragge * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
201.1Sragge * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
211.1Sragge * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
221.1Sragge * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
231.1Sragge * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
241.1Sragge * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
251.1Sragge * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261.1Sragge */
271.1Sragge
281.1Sragge /* All bugs are subject to removal without further notice */
291.8Sskrll
301.1Sragge
311.3Sragge#define PT_STEP         (PT_FIRSTMACH + 0)
321.3Sragge#define PT_GETREGS      (PT_FIRSTMACH + 1)
331.3Sragge#define PT_SETREGS      (PT_FIRSTMACH + 2)
341.7Skamil#define PT_SETSTEP      (PT_FIRSTMACH + 3)
351.7Skamil#define PT_CLEARSTEP    (PT_FIRSTMACH + 4)
361.1Sragge
371.4Sskrll#define PT_MACHDEP_STRINGS \
381.4Sskrll	"PT_STEP", \
391.4Sskrll	"PT_GETREGS", \
401.7Skamil	"PT_SETREGS", \
411.7Skamil	"PT_SETSTEP", \
421.7Skamil	"PT_CLEARSTEP",
431.5Schristos
441.5Schristos#include <machine/reg.h>
451.5Schristos
461.5Schristos#define PTRACE_REG_PC(r)	(r)->pc
471.11Skamil#define PTRACE_REG_FP(r)	(r)->fp
481.5Schristos#define PTRACE_REG_SET_PC(r, v)	(r)->pc = (v)
491.5Schristos#define PTRACE_REG_SP(r)	(r)->sp
501.5Schristos#define PTRACE_REG_INTRV(r)	(r)->r0
511.6Schristos
521.6Schristos#define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x03 })
531.9Skamil#define PTRACE_BREAKPOINT_ASM	__asm __volatile("bpt")
541.6Schristos#define PTRACE_BREAKPOINT_SIZE	1
55