ó ›à Rc@s^dZddlZddlZddlmZddlmZddlZddlZdej fd„ƒYZ dej fd„ƒYZ d ej fd „ƒYZ d „Z d „Zd „Zd„Zdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZe ƒe ƒe ƒeƒeƒeƒeƒdS(s,GDB commands for working with frame-filters.iÿÿÿÿN(t FrameIterator(tFrameDecoratortSetFilterPrefixCmdcBseZdZd„ZRS(s9Prefix command for 'set' frame-filter related operations.cCs)tt|ƒjdtjtjtƒdS(Nsset frame-filter(tsuperRt__init__tgdbtCOMMAND_OBSCUREt COMPLETE_NONEtTrue(tself((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRs(t__name__t __module__t__doc__R(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRstShowFilterPrefixCmdcBseZdZd„ZRS(s:Prefix command for 'show' frame-filter related operations.cCs)tt|ƒjdtjtjtƒdS(Nsshow frame-filter(RR RRRRR(R ((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR%s(R R R R(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR #stInfoFrameFiltercBsAeZdZd„Zed„ƒZd„Zd„Zd„ZRS(sMList all registered Python frame-filters. Usage: info frame-filters cCs tt|ƒjdtjƒdS(Nsinfo frame-filter(RRRRt COMMAND_DATA(R ((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR/scCs|r dSdSdS(s2Return "Yes" if filter is enabled, otherwise "No".tYestNoN((tstate((s2/usr/share/gdb/python/gdb/command/frame_filters.pytenabled_string2scCsït|jƒdd„dtƒ}t|ƒdkr;dGHn°dGHx¨|D] }|d}yQdjttjj|dƒƒƒ}d j|j tjj |dƒƒƒ}Wn*t k rÔ}d |d t|ƒGHqGXd |||fGHqGWd S(sÓ Internal worker function to list and print frame filters in a dictionary. Arguments: frame_filters: The name of the dictionary, as specified by GDB user commands. tkeycSstjj|dƒS(Ni(Rtframest get_priority(ti((s2/usr/share/gdb/python/gdb/command/frame_filters.pytDstreverseis No frame filters registered.s Priority Enabled Names{:<8}is{:<7}s Error printing filter 's': s %s %s %sN( tsortedtitemsRtlentformattstrRRRRt get_enabledt Exception(R t frame_filterstsorted_frame_filterst frame_filtertnametprioritytenabledte((s2/usr/share/gdb/python/gdb/command/frame_filters.pytlist_frame_filters:s     &cCs$|GH|j|ƒ|r dGHndS(Nt(R((R ttitlet filter_listt blank_line((s2/usr/share/gdb/python/gdb/command/frame_filters.pyt print_listWs cCsw|jdtjtƒtjƒ}|jd|j|jtƒx1tjƒD]#}|jd|j|jtƒqLWdS(Nsglobal frame-filters:sprogspace %s frame-filters:sobjfile %s frame-filters:(R-RR!Rtcurrent_progspacetfilenametobjfilestFalse(R targtfrom_ttytcptobjfile((s2/usr/share/gdb/python/gdb/command/frame_filters.pytinvoke]s  ( R R R Rt staticmethodRR(R-R6(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR)s    cCsƒtj|ƒ}t|ƒ}|ddkrM|dkrMtj|dƒ‚n2|ddkr|dkrtj|dƒ‚n|S(sa Internal worker function to take an argument from enable/disable and return a tuple of arguments. Arguments: cmd_name: Name of the command invoking this function. args: The argument as a string. Returns: A tuple containing the dictionary, and the argument, or just the dictionary in the case of "all". itallis*: with 'all' you may not specify a filter.is takes exactly two arguments.(Rtstring_to_argvRtGdbError(tcmd_nameR2targvtargc((s2/usr/share/gdb/python/gdb/command/frame_filters.pyt_enable_parse_argjs  cCsµ|d}tjj|ƒ}|dkrOx†|D]}tjj||ƒq/Wnb|d}y||}Wn4tk rdttƒd}tj|ƒ‚nXtjj||ƒdS(s#Worker for enabling/disabling frame_filters. Arguments: command_type: A tuple with the first element being the frame filter dictionary, and the second being the frame filter name. flag: True for Enable, False for Disable. iR8isframe-filter 's ' not found.N(RRt return_listt set_enabledtKeyErrorRR$R:(t command_tupletflagtlist_optop_listtitemR#tfftmsg((s2/usr/share/gdb/python/gdb/command/frame_filters.pyt_do_enable_frame_filter‚s     cCs±|tkrdddg}n ddg}x$tjƒD]}|j|jƒq7W|dkra|St|d„|ƒ}t|ƒdkr­|dt|ƒt|ƒ|dRIR(R R2R3RB((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR6ós(R R R RRaR6(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR[×s  tDisableFrameFiltercBs)eZdZd„Zd„Zd„ZRS(sGDB command to disable the specified frame-filter. Usage: disable frame-filter disable DICTIONARY [NAME] DICTIONARY is the name of the frame filter dictionary on which to operate. If dictionary is set to "all", perform operations on all dictionaries. Named dictionaries are: "global" for the global frame filter dictionary, "progspace" for the program space's frame filter dictionary. If either all, or the two named dictionaries are not specified, the dictionary name is assumed to be the name of the object-file name. NAME matches the name of the frame-filter to operate on. If DICTIONARY is "all", NAME is ignored. cCs tt|ƒjdtjƒdS(Nsdisable frame-filter(RRbRRR(R ((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRscCsX|jdƒdkr%t||tƒStjj|jƒdjƒƒ}t||ƒSdS(sTCompletion function for both frame filter dictionary, and frame filter name.R\iN( R]RVRRRR?R^R_RZ(R RQRRR`((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRa s"cCs td|ƒ}t|tƒdS(Nsdisable frame-filter(R>RIR1(R R2R3RB((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR6s(R R R RRaR6(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRbøs  tSetFrameFilterPrioritycBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(slGDB command to set the priority of the specified frame-filter. Usage: set frame-filter priority DICTIONARY NAME PRIORITY DICTIONARY is the name of the frame filter dictionary on which to operate. Named dictionaries are: "global" for the global frame filter dictionary, "progspace" for the program space's framefilter dictionary. If either of these two are not specified, the dictionary name is assumed to be the name of the object-file name. NAME matches the name of the frame filter to operate on. PRIORITY is the an integer to assign the new priority to the frame filter. cCs tt|ƒjdtjƒdS(Nsset frame-filter priority(RRcRRR(R ((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR*scCs4tj|ƒ}t|ƒ}|dkr0dGHdS|S(sRInternal worker to parse a priority from a tuple. Arguments: arg: Tuple which contains the arguments from the command. Returns: A tuple containing the dictionary, name and priority from the arguments. Raises: gdb.GdbError: An error parsing the arguments. is8set frame-filter priority takes exactly three arguments.N(RR9RtNone(R R2R<R=((s2/usr/share/gdb/python/gdb/command/frame_filters.pyt_parse_pri_arg/s   cCsŒ|d}|d}|d}tjj|ƒ}y||}Wn4tk rtdttƒd}tj|ƒ‚nXtjj||ƒdS(sInternal worker for setting priority of frame-filters, by parsing a tuple and calling _set_priority with the parsed tuple. Arguments: command_tuple: Tuple which contains the arguments from the command. iiisframe-filter 's ' not found.N(RRR?RARR$R:t set_priority(R RBRDR#R%RERGRH((s2/usr/share/gdb/python/gdb/command/frame_filters.pyt_set_filter_priorityFs    cCsX|jdƒdkr%t||tƒStjj|jƒdjƒƒ}t||ƒSdS(sTCompletion function for both frame filter dictionary, and frame filter name.R\iN( R]RVR1RRR?R^R_RZ(R RQRRR`((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRa^s"cCs/|j|ƒ}|dkr+|j|ƒndS(N(ReRdRg(R R2R3RB((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR6gs (R R R RReRgRaR6(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRcs     tShowFrameFilterPrioritycBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sGDB command to show the priority of the specified frame-filter. Usage: show frame-filter priority DICTIONARY NAME DICTIONARY is the name of the frame filter dictionary on which to operate. Named dictionaries are: "global" for the global frame filter dictionary, "progspace" for the program space's framefilter dictionary. If either of these two are not specified, the dictionary name is assumed to be the name of the object-file name. NAME matches the name of the frame-filter to operate on. cCs tt|ƒjdtjƒdS(Nsshow frame-filter priority(RRhRRR(R ((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRzscCs4tj|ƒ}t|ƒ}|dkr0dGHdS|S(sKInternal worker to parse a dictionary and name from a tuple. Arguments: arg: Tuple which contains the arguments from the command. Returns: A tuple containing the dictionary, and frame filter name. Raises: gdb.GdbError: An error parsing the arguments. is7show frame-filter priority takes exactly two arguments.N(RR9RRd(R R2R<R=((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRes   cCsgtjj|ƒ}y||}Wn4tk rVdt|ƒd}tj|ƒ‚nXtjj|ƒS(sEWorker for retrieving the priority of frame_filters. Arguments: frame_filters: Name of frame filter dictionary. name: object to select printers. Returns: The priority of the frame filter. Raises: gdb.GdbError: A frame filter cannot be found. sframe-filter 's ' not found.(RRR?RARR:R(R R!R$RERGRH((s2/usr/share/gdb/python/gdb/command/frame_filters.pytget_filter_priority–s cCsU|jdƒdkr%t||tƒStj|jƒdjƒƒ}t||ƒSdS(sTCompletion function for both frame filter dictionary, and frame filter name.R\iN(R]RVR1tframet _return_listR^R_RZ(R RQRRR`((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRa®scCs™|j|ƒ}|dkrdS|d}|d}y|j||ƒ}Wn*tk ru}dtdt|ƒGHn Xd|d|dt|ƒGHdS(Niis$Error printing filter priority for 's':sPriority of filter 's ' in list 's' is: (ReRdRiR R$R(R R2R3RBt filter_namet list_nameR%R'((s2/usr/share/gdb/python/gdb/command/frame_filters.pyR6¸s   (R R R RReRiRaR6(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyRhls      (R Rtcopytgdb.FrameIteratorRtgdb.FrameDecoratorRt gdb.framest itertoolstCommandRR RR>RIRVRZR[RbRcRh(((s2/usr/share/gdb/python/gdb/command/frame_filters.pyts0    A   % !!S[