ó Q[c@sLddlZddlZddlZddlZdefd„ƒYZd„ZedkrHeej ƒdkp†ej ddd gkr³d GHd GHd ej d GHej d ƒnee ej dƒj ƒe ej dƒj ƒe ej dƒj ƒƒZ e jƒ\ZZZdeefGHd Ze r8dZnej eƒndS(iÿÿÿÿNt ParseSegvcBs\eZed„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z RS( cCs|rbtjdkrCtjdtjdtjtjddƒƒqbtjdtjdtjƒn|j|ƒ|_ d|_ x6ddgD](}||j krŠ|j ||_ qŠqŠW|j |ƒ\|_ |_|_|_|_d|_|j|ƒ|_dS(Nt3tleveltstreamtencodingsUTF-8trsptesp(tsystversiontloggingt basicConfigtDEBUGtiot TextIOWrappertstderrt parse_regstregstNonetsptparse_disassemblytlinetpctinsntsrctdestt stack_vmat parse_mapstmaps(tselft registerst disassemblyRtdebugtreg((s-/usr/share/apport/general-hooks/parse_segv.pyt__init__s - cCs<x5|jD]*}||dkr ||dkr |Sq WdS(Ntstarttend(RR(Rtaddrtvma((s-/usr/share/apport/general-hooks/parse_segv.pytfind_vma's c Cs&g}x|jƒD] }|jƒjƒ}y|dd!\}}}}Wntd|jƒƒ‚nXt|ƒdkrƒd} n |d} g|jdƒD]} t| dƒ^q\} } | dkrÜt|ƒ|_n|ji| d6| d 6|d 6| d 6ƒt j d | | || ƒqW|S( NiisCannot parse maps line: %sit-is[stack]R"R#tpermstnames'start: %s, end: %s, perms: %s, name: %s( t splitlineststriptsplitt ValueErrortlenRtintRtappendR R( Rtmaps_strRRtitemstspanR(tbitstdevR)txR"R#((s-/usr/share/apport/general-hooks/parse_segv.pyR-s   1 )cCsgtƒ}xW|jƒD]I}|jƒdd!\}}t|dƒ||it0xt:is1Could not parse PC "%s" from disassembly line: %ss pc: 0x%08xsCannot access memory at addresstt iÿÿÿÿt>tcCsc|}d}|jdƒr(|d}n||jkrB|j|St|ƒdkr~|jdƒr~|dO}d|d}n||jkr|j||@St|ƒdkrÕ|jdƒrÕ|d O}d |}n||jkrô|j||@St|ƒd kr0|jd ƒr0|d O}d|d}n||jkrO|j||@Std|ƒ‚dS(Nit%iitliÿs%sxR6Iÿÿse%sitelüÿsr%ssCould not resolve register '%s'(RIRR.RJR-(RR treg_origtmask((s-/usr/share/apport/general-hooks/parse_segv.pytregister_value¤s,  ! !  ! cCsFd}|jdƒrUd|krU|jddƒ}|j|dd}|d}n|jdƒ}|d}d}|jdƒr–d}|d}n|jdƒr²|d}nt|ƒdkr'|jdƒrç|j|d}q-|jd ƒs td |dƒ‚nt|d d ƒ|}nd}dd „}d}t|ƒdkr|ddd!} | jdƒ} d} t| ƒdkr¢||| d| ƒ} nd} t| ƒdkrÓ||| d| ƒ} nd} t| ƒd kr||| d | ƒ} n| | | }n|||}d|jkr:|dS|dSdS(NiRgR<it(R'iÿÿÿÿt*R;sUnknown offset literal: %siicSsH|jdƒr#|j|d}n!|dkr8d}n t|ƒ}|S(NRgiR=i(RIRR/(Rttexttval((s-/usr/share/apport/general-hooks/parse_segv.pyt_reg_valçs    t,RIl(RIR,RR.R-R/(RtargtsegmenttpartstoffsettsigntaddRqtvaluetparenstreg_listtbasetindextscale((s-/usr/share/apport/general-hooks/parse_segv.pyt calculate_argÉsN     c Csªt}g}d|jg}|jd|jdƒ\}}}|j|ƒ|sf|j|ƒt}n|jd!krŒ|jd|jƒn]|jrDd|jkrá|jdd"krá|jjd ƒ rá|jd |jƒqD|j |jƒ}|jd|d|jƒ\}}}|j|ƒ|sD|j|ƒt}qDn|j réd|j kr†|j dd#kr†|jd|j ƒqé|j |j ƒ}|jd|d|j ƒ\}}}|j|ƒ|sé|j|ƒt}qén|jd$krB| rB|jd|j |jƒƒ|jd|j |jƒƒt}n|j dk r|jdk r½|j |j|jdkr|jdƒn|j |j|jdkr½|jdƒq½n|s|jd|j dƒ\}}}|j|ƒ|s|j|ƒt}qqn|s‹|j|jƒ}|rn|ddksQ|ddkrn|jdƒ|jdƒq‹|jdƒ|jdƒn|d j|ƒd j|ƒfS(%NsSegfault happened at: %sR6tPCtleatlealsinsn (%s) does not access VMAR<iRgt$Rns*%ssource "%s" okRZs source "%s"sdestination "%s" okR]sdestination "%s"touttins(disallowed I/O port operation on port %dR"s/Stack memory exhausted (SP below stack segment)R#s&Stack pointer not within stack segmenttSPR)s[vdso]s [vsyscall]sSReason could not be automatically determined. (Unhandled exception in kernel code?)s-Reason could not be automatically determined.s (RR‚(RgRƒRn(RgRƒRn(soutsin(R`RRfRR0RaRRRIRRRlRRRRR&RK( Rt understoodtreasontdetailstvalidR„ReR$R%((s-/usr/share/apport/general-hooks/parse_segv.pytreport sh!    5%    "%    !  &  ( t__name__t __module__R`R!R&RRRRfRlRR‹(((s-/usr/share/apport/general-hooks/parse_segv.pyRs     G  % @cCsö|jddƒdkrdSdddddg}x,|D]$}||kr8d||d s$0ÿ?  .