1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2015 Joyent, Inc.
  13 .\"
  14 .Dd May 11, 2016
  15 .Dt PDELBKPT 3PROC
  16 .Os
  17 .Sh NAME
  18 .Nm Pdelbkpt
  19 .Nd clear a breakpoint in a process
  20 .Sh LIBRARY
  21 .Lb libproc
  22 .Sh SYNOPSIS
  23 .In libproc.h
  24 .Ft int
  25 .Fo Pdelbkpt
  26 .Fa "struct ps_prochandle *P"
  27 .Fa "uintptr_t address"
  28 .Fa "ulong_t saved"
  29 .Fc
  30 .Sh DESCRIPTION
  31 The
  32 .Fn Pdelbkpt
  33 function removes the breakpoint installed at
  34 .Fa address
  35 from process
  36 .Fa P .
  37 Restoring the instruction present in
  38 .Fa saved .
  39 .Pp
  40 If the instruction at
  41 .Fa address
  42 is no longer the architecture-specific breakpoint instruction, then
  43 .Fa saved
  44 is not restored, but the function still returns successfully.
  45 This behavior is done due to the presence of setting breakpoints in
  46 self-modifying code, e.g. procedure linkage tables.
  47 .Pp
  48 The
  49 .Fn Pdelbkpt
  50 function only works on running processes, such as those created through
  51 .Xr Pgrab 3PROC
  52 and
  53 .Xr Pcreate 3PROC .
  54 Attempting to remove a breakpoint from process handles to core files,
  55 zombie processes, or ELF objects will fail.
  56 .Sh RETURN VALUES
  57 Upon successful completion, the
  58 .Fn Pdelbkpt
  59 function removes the breakpoint and
  60 returns
  61 .Sy 0 .
  62 Otherwise,
  63 .Sy -1
  64 is returned, and
  65 .Sy errno
  66 is set to indicate the error.
  67 .Sh ERRORS
  68 For a full list of possible errors see the
  69 .Sy DIAGNOSTICS
  70 section in
  71 .Xr proc 4 .
  72 .Pp
  73 The
  74 .Fn Pdelbkpt
  75 function will fail with:
  76 .Bl -tag -width Er
  77 .It Er ENOENT
  78 The handle
  79 .Fa P
  80 refers to a grabbed core file, a zombie process, or an ELF object.
  81 .El
  82 .Sh INTERFACE STABILITY
  83 .Sy Uncommitted
  84 .Sh MT-LEVEL
  85 See
  86 .Sy LOCKING
  87 in
  88 .Xr libproc 3LIB .
  89 .Sh SEE ALSO
  90 .Xr libproc 3LIB ,
  91 .Xr Pcreate 3PROC ,
  92 .Xr Pgrab 3PROC ,
  93 .Xr Pgrab_core 3PROC ,
  94 .Xr Pgrab_file 3PROC ,
  95 .Xr Psetbkpt 3PROC ,
  96 .Xr proc 4