📄 ptrace.2
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:05:50 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def [psize 0 cheight slant sin slant cos div mul cheight 0 0] makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig { /SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /ury exch def /urx exch def /lly exch def /llx exch def /y exch 72 mul resolution div def /x exch 72 mul resolution div def currentpoint /cy exch def /cx exch def /sx x urx llx sub div def /sy y ury lly sub div def sx sy scale cx sx div llx sub cy sy div ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix { DefFigCTM setmatrix } def /defaultmatrix { DefFigCTM exch copy } def /initgraphics { DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix } def /showpage { initgraphics } def}bind def/clipFig { currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto}bind def/doclip { llx lly urx ury clipFig } def/endFig { end SavedState restore}bind def/globalstart { fontnum psize slant height resolution currentpoint pagesave restore gsave }bind def/globalend { grestore moveto /resolution exch def /height exch def /slant exch def /psize exch def /fontnum exch def F /pagesave save def}bind def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne { exch newdict 3 1 roll put } { pop pop } % Ignore FID ifelse} forallnewdict begin/Encoding tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval cvn load def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(PTRACE)S1115(\()S1157(2)S1215(\))S2696(Eighth)S(Edition)296 2989 A4732(PTRACE)S5127(\()S5169(2)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R(ptrace)247 1080 A10 R-11352(-)S10 R1434(process)S(trace)197 1761 A1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(#include)S1482(<sys/types.h>)S1488 V1080(#include)S1482(<sys/signal.h>)S1608 V1080(#include)S1482(<sys/ptrace.h>)S1848 V1080(int)S1236(ptrace\(int)S10 I1701(request)S10 B1997(,)S2060(pid_t)S10 I2322(pid)S10 B2450(,)S2513(long)S10 I(addr)189 2735 A10 B2924(,)S2987(long)S10 I3209(data)S10 B3387(\))S2016 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S2136 V10 B1080(Note:)S1345(This)S1564(manual)S1917(page)S2147(has)S2321(no)S2456(relation)S2822(to)S2936(Minix.)S3273(Someone)S3689(who)S3898(knows)S4202(ptrace\(\))S4575(has)S4750(to)S4864(check,)S5166(or)S2256 V1080(rewrite,)S1445(this)S1627(page.)S1903(\(kjb\))S2424 V1080(Ptrace)S10 R1392(provides)S1769(a)S1845(means)S2133(by)S2264(which)S2541(a)S2617(parent)S2900(process)S3233(may)S3437(control)S3753(the)S3908(execution)S4331(of)S4447(a)S4524(child)S4757(process,)S5116(and)S2544 V1080(examine)S1447(and)S1618(change)S1929(its)S2050(core)S2250(image.)S2572(Its)S2699(primary)S3044(use)S3204(is)S3297(for)S3441(the)S3590(implementation)S4247(of)S(breakpoint)430 4357 A(debugging.)448 4813 A2664 V1080(There)S1351(are)S1510(four)S1713(arguments)S2167(whose)S2459(interpretation)S3037(depends)S3401(on)S3536(a)S10 I3616(request)S10 R3947(argument.)S4412(Generally,)S10 I4871(pid)S10 R5035(is)S5138(the)S2784 V1080(process)S1408(ID)S1541(of)S1651(the)S(traced)247 1800 A2073(process,)S2426(which)S2698(must)S2919(be)S3040(a)S3111(child)S3338(\(no)S3498(more)S3731(distant)S4025(descendant\))S4531(of)S4640(the)S4788(tracing)S5093(pro-)S2904 V1080(cess.)S1327(A)S1429(process)S1760(being)S(traced)247 2012 A2288(behaves)S2641(normally)S(until)184 3033 A3247(it)S(encounters)436 3333 A3799(some)S4041(signal)S4311(whether)S4666(internally)S5082(gen-)S3024 V1080(erated)S1357(like)S(illegal)252 1538 A1820(instruction)S2279(or)S2392(externally)S2824(generated)S3245(like)S3425(interrupt.)S3851(See)S10 B4026(sigaction)S10 R4406(\(2\))S4553(for)S4700(the)S4852(list.)S5054(Then)S3144 V1080(the)S(traced)247 1232 A1508(process)S1839(enters)S2109(a)S(stopped)312 2183 A2524(state)S2738(and)S2912(its)S3036(parent)S3317(is)S3413(noti\256ed)S3749(via)S10 B3901(wait)S10 R4086(\(2\).)S4283(When)S4552(the)S4704(child)S4934(is)S5030(in)S5138(the)S3264 V(stopped)312 1080 A1427(state,)S1672(its)S1802(core)S2010(image)S2290(can)S2464(be)S2593(examined)S3018(and)S3197(modi\256ed)S3588(using)S10 B3839(ptrace)S10 R4114(.)S4198(If)S4300(desired,)S4650(another)S10 B4986(ptrace)S3384 V10 R1080(request)S1396(can)S1561(then)S1759(cause)S2008(the)S2156(child)S2382(either)S2637(to)S2740(terminate)S3146(or)S3255(to)S3358(continue,)S3754(possibly)S(ignoring)340 4113 A4478(the)S4626(signal.)S3552 V1080(The)S1262(value)S1505(of)S1614(the)S10 I1762(request)S10 R2083(argument)S2488(determines)S2955(the)S3103(precise)S3414(action)S3685(of)S3794(the)S(call:)174 3942 A3720 V1080(PT_TRACE_ME)S3840 V1280(This)S1484(request)S1800(is)S1892(the)S2040(only)S2243(one)S2413(used)S2622(by)S2747(the)S2895(child)S3121(process;)S3477(it)S3559(declares)S3916(that)S4093(the)S4242(process)S4570(is)S4663(to)S4767(be)S(traced)247 4888 A5161(by)S3960 V1280(its)S1406(parent.)S1739(All)S1899(the)S2053(other)S2291(arguments)S2741(are)S(ignored.)332 2896 A3284(Peculiar)S3646(results)S(will)157 3940 A4128(ensue)S4388(if)S4481(the)S4635(parent)S4918(does)S5133(not)S4080 V1280(expect)S1568(to)S(trace)197 1671 A1893(the)S2041(child.)S4248 V1080(PT_READ_I,)S1657(PT_READ_D)S4368 V1280(The)S1467(word)S1704(in)S1812(the)S1965(child)S2196(process's)S2601(address)S(space)224 2933 A3187(at)S10 I(addr)189 3291 A10 R3511(is)S3609(returned.)S4026(If)S4125(I)S4190(and)S4366(D)S(space)224 4470 A4725(are)S4880(separated)S4488 V1280(\(e.g.)S1502(historically)S1998(on)S2141(a)S(pdp-11\),)343 2229 A2615(request)S2949(PT_READ_I)S3519(indicates)S3920(I)S(space,)249 3997 A4289(PT_READ_D)S4897(D)S(space.)249 5012 A4608 V10 I1280(Addr)S10 R1506(must)S1726(be)S1846(even)S2061(on)S2186(some)S2423(machines.)S2878(The)S3060(child)S3286(must)S3506(be)S(stopped.)337 3626 A4013(The)S(input)206 4195 A10 I4426(data)S10 R4629(is)S(ignored.)332 4721 A4776 V1080(PT_READ_U)S4896 V1280(The)S1468(word)S1706(of)S1821(the)S1975(system's)S2358(per-process)S2854(data)S3053(area)S(corresponding)575 3253 A3859(to)S10 I(addr)189 3968 A10 R4189(is)S4288(returned.)S10 I4706(Addr)S10 R4939(must)S5166(be)S5016 V1280(even)S1497(on)S1624(some)S1863(machines)S2270(and)S2442(less)S2620(than)S(512.)175 2820 A3047(This)S(space)224 3253 A3504(contains)S3865(the)S4014(registers)S4382(and)S4553(other)S4786(information)S5136 V(about)223 1280 A1528(the)S1676(process;)S2031(its)S(layout)251 2151 A(corresponds)486 2427 A2938(to)S3041(the)S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -