ihgnddlTddlTddlZddlZddlZddlZGddeZGddeZ dS))*NcHeZdZdZd fd ZdZdZdZdZdZ d Z xZ S) ProbeaD Probe that dumps the context, and some stream content (peeks into it) to the screen to aid the debugging process. It can optionally limit itself to a single context entry, instead of printing entire context. :param into: optional, None by default, or context lambda :param lookahead: optional, integer, number of bytes to dump from the stream Example:: >>> d = Struct( ... "count" / Byte, ... "items" / Byte[this.count], ... Probe(lookahead=32), ... ) >>> d.parse(b"\x05abcde\x01\x02\x03") -------------------------------------------------- Probe, path is (parsing), into is None Stream peek: (hexlified) b'010203'... Container: count = 5 items = ListContainer: 97 98 99 100 101 -------------------------------------------------- :: >>> d = Struct( ... "count" / Byte, ... "items" / Byte[this.count], ... Probe(this.count), ... ) >>> d.parse(b"\x05abcde\x01\x02\x03") -------------------------------------------------- Probe, path is (parsing), into is this.count 5 -------------------------------------------------- Nctt|d|_||_||_dS)NT)superr__init__ flagbuildnoneinto lookahead)selfr r __class__s _/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/construct/debug.pyrzProbe.__init__3s9 eT##%%%! "c4||||dSNprintoutr streamcontextpaths r_parsez Probe._parse9 fgt,,,,,rc4||||dSrrr objrrrs r_buildz Probe._build<rrc4|d||dS)Nrrr rrs r_sizeofz Probe._sizeof?s dGT***qrc*|jr d|jdndSNzprint()z print(this)r r codes r _emitparsezProbe._emitparseC"(, D$ $$$$}Drc*|jr d|jdndSr"r$r%s r _emitbuildzProbe._emitbuildFr(rcBtdtd|d|j|jrw|u|}||j}|||r!tdt |dntd|f|jrP ||}t|n9#t$rtd|jd|YnwxYwt|tddS) N2--------------------------------------------------zProbe, path is z , into is zStream peek: (hexlified) z...zStream peek: EOF reachedzFailed to compute z on the context )printr r tellreadseekhexlify Exception)r rrrfallback datafollows subcontexts rrzProbe.printoutIsH BCCC tyyCDDD > 2f0{{}}H ++dn55K KK ! ! ! 2'+:N:N:N:NQRRRR0111  y ]!%7!3!3J*%%%% ]]]EdiiiQXQX[\\\\\]g BCCCCCs2$C$C>=C>)NN) __name__ __module__ __qualname____doc__rrrr r'r*r __classcell__)r s@rrrs**X###### ------EEEEEEDDDDDDDrrc8eZdZdZdZdZdZdZdZd dZ dS) Debuggera PDB-based debugger. When an exception occurs in the subcon, a debugger will appear and allow you to debug the error (and even fix it on-the-fly). :param subcon: Construct instance, subcon to debug Example:: >>> Debugger(Byte[3]).build([]) -------------------------------------------------- Debugging exception of path is (building) File "/media/arkadiusz/MAIN/GitHub/construct/construct/debug.py", line 192, in _build return self.subcon._build(obj, stream, context, path) File "/media/arkadiusz/MAIN/GitHub/construct/construct/core.py", line 2149, in _build raise RangeError("expected %d elements, found %d" % (count, len(obj))) construct.core.RangeError: expected 3 elements, found 0 > /media/arkadiusz/MAIN/GitHub/construct/construct/core.py(2149)_build() -> raise RangeError("expected %d elements, found %d" % (count, len(obj))) (Pdb) q -------------------------------------------------- c |j|||S#t$r<t|_||d|jtur|jcYSwxYw)Nz=(you can set self.retval, which will be returned from method))msg)subconrr2NotImplementedretval handle_excrs rrzDebugger._parse{sx #;%%fgt<< < # # #(DK OOD&eO f f f{n,,{"""  #sAA$#A$c |j||||S#t$r||YdSwxYwr)r?rr2rBrs rrzDebugger._buildsY ";%%c67DAA A " " " OOD ! ! ! ! ! ! "sAAc |j||S#t$r||YdSwxYwr)r?r r2rBrs rr zDebugger._sizeofsU ";&&w55 5 " " " OOD ! ! ! ! ! ! "sAAc6|j|Sr)r? _compileparser%s rr'zDebugger._emitparse{((...rc6|j|Sr)r? _compilebuildr%s rr*zDebugger._emitbuildrGrNctdtd|jtd|tdtjt jdd|rt|tjt jdtddS)Nr,zDebugging exception of zpath is ) r-r?join tracebackformat_exceptionsysexc_infopdb post_mortem)r rr>s rrBzDebugger.handle_excs BCCC T[[;<<< dd%&&& bggi0#,..A!""EFFGGG   #JJJ  q)*** BCCCCCrr) r6r7r8r9rrr r'r*rBrrr<r<bs0 # # #""" """ //////DDDDDDrr<) construct construct.librQrOrSinspect Constructr Subconstructr<rUrrr[s################YDYDYDYDYDIYDYDYDx>D>D>D>D>D|>D>D>D>D>Dr