Ńň §ÚęLc @sčdZddkZddkZddkTddklZddddgeZ[eieieiei e fZ dd „Z dd „Zdd „Zddddd „ZeZd „Zd„Zd„Zedjo eƒndS(s0Disassembler of Python byte code into mnemonics.i˙˙˙˙N(t*(t__all__tdist disassembletdistbtdiscocCs]|djo tƒdSt|ƒtijo |i}nt|dƒo |i}nt|dƒo |i}nt|dƒo|i i ƒ}|i ƒxˇ|D]Y\}}t |t ƒo=d|GHyt|ƒWntj o}dG|GHnXHqŚqŚWnSt|dƒot|ƒn5t |tƒot|ƒntdt|ƒi‚dS( snDisassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. Ntim_funct func_codet__dict__sDisassembly of %s:sSorry:tco_codes(don't know how to disassemble %s objects(tNoneRttypettypest InstanceTypet __class__thasattrRRRtitemstsortt isinstancet _have_codeRt TypeErrorRtstrtdisassemble_stringt__name__(txRtnametx1tmsg((s/usr/lib64/python2.6/dis.pyRs8        cCsr|djoKy ti}Wntj otd‚nXx|io |i}q<Wnt|ii|i ƒdS(s2Disassemble a traceback (default: last traceback).s no last traceback to disassembleN( R tsystlast_tracebacktAttributeErrort RuntimeErrorttb_nextRttb_frametf_codettb_lasti(ttb((s/usr/lib64/python2.6/dis.pyR2s   c Cs}|i}t|ƒ}tt|ƒƒ}t|ƒ}d}d}d}x1||jo#||} t| ƒ} ||jo"|djoHnd||GndG||jodGndG||jodGndGt|ƒidƒGt | i dƒG|d }| t joht||ƒt||d ƒd |} d}|d }| t jo| d }nt| ƒid ƒG| t jodt|i| ƒdGqs| tjod|i| dGqs| tjodt|| ƒdGqs| tjod|i| dGqs| tjodt| dGqs| tjo5|djo|i|i}nd|| dGqsnHqHWdS(sDisassemble a code object.is%3ds s-->s>>s iiiiilit(t)s(to N(R t findlabelstdicttfindlinestartstlenR tordtreprtrjusttopnametljustt HAVE_ARGUMENTt EXTENDED_ARGthasconstt co_conststhasnametco_namesthasjrelthaslocalt co_varnamest hascomparetcmp_opthasfreet co_cellvarst co_freevars( tcotlastitcodetlabelst linestartstntit extended_argtfreetctoptoparg((s/usr/lib64/python2.6/dis.pyR<s^            *         c Csňt|ƒ}t|ƒ}d}xÍ||joż||}t|ƒ} ||jodGndG||jodGndGt|ƒidƒGt| idƒG|d}| tjo7t||ƒt||dƒd } |d }t| ƒid ƒG| tjo-|od t|| ƒd Gqäd| Gqč| t jo-|dj od || d Gqäd| Gqč| t jodt|| ƒd Gqč| t jo'|od || d Gqäd| Gqč| t jod t| d GqčnHq!WdS(Nis-->s s>>s iiiiiiR%R&s(%d)s(to (R'R*R+R,R-R.R/R0R2R4R R6R7R9R:( R@R?tvarnamestnamest constantsRARCRDRGRHRI((s/usr/lib64/python2.6/dis.pyRmsJ         &          cCsůg}t|ƒ}d}xÚ||joĚ||}t|ƒ}|d}|tjo›t||ƒt||dƒd}|d}d}|tjo||}n|tjo |}n|djo"||jo|i|ƒqěqđqqW|S(s`Detect all offsets in a byte code which are jump targets. Return the list of offsets. iiiii˙˙˙˙(R*R+R0R6thasjabstappend(R@RARCRDRGRHRItlabel((s/usr/lib64/python2.6/dis.pyR'—s(      &      c csg}|iddd…D]}|t|ƒq~}g}|iddd…D]}|t|ƒqR~}d}|i}d}x^t||ƒD]M\} } | o0||jo||fV|}n|| 7}n|| 7}q“W||jo||fVndS(s”Find the offsets in a byte code which are start of lines in the source. Generate pairs (offset, lineno) as described in Python/compile.c. iNii(t co_lnotabR+R tco_firstlinenotzip( R@t_[1]RGtbyte_incrementst_[2]tline_incrementst lastlinenotlinenotaddrt byte_incrt line_incr((s/usr/lib64/python2.6/dis.pyR)ąs77      cCsćtido_tido!tiidƒtidƒntid}| p |djo d}qsnd}|djo ti}n t|ƒ}|iƒ}|dj o|i ƒnd}t ||dƒ}t |ƒdS(s*Simple test program to disassemble a file.iisusage: python dis.py [-|file] t-stexecN( RtargvtstderrtwritetexitR tstdintopentreadtclosetcompileR(tfntftsourceR@((s/usr/lib64/python2.6/dis.pyt_testÇs"      t__main__(t__doc__RR topcodeRt _opcodes_allt MethodTypet FunctionTypetCodeTypet ClassTypeR RR RRRRRR'R)RjR(((s/usr/lib64/python2.6/dis.pyts&    # 1  '