idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
20,600 | def hook ( self , debug , pid ) : label = "%s!%s" % ( self . __modName , self . __procName ) try : hook = self . __hook [ pid ] except KeyError : try : aProcess = debug . system . get_process ( pid ) except KeyError : aProcess = Process ( pid ) hook = Hook ( self . __preCB , self . __postCB , self . __paramCount , self . __signature , aProcess . get_arch ( ) ) self . __hook [ pid ] = hook hook . hook ( debug , pid , label ) | Installs the API hook on a given process and module . |
20,601 | def unhook ( self , debug , pid ) : try : hook = self . __hook [ pid ] except KeyError : return label = "%s!%s" % ( self . __modName , self . __procName ) hook . unhook ( debug , pid , label ) del self . __hook [ pid ] | Removes the API hook from the given process and module . |
20,602 | def remove ( self , bw ) : try : self . __ranges . remove ( bw ) except KeyError : if not bw . oneshot : raise | Removes a buffer watch identifier . |
20,603 | def remove_last_match ( self , address , size ) : count = 0 start = address end = address + size - 1 matched = None for item in self . __ranges : if item . match ( start ) and item . match ( end ) : matched = item count += 1 self . __ranges . remove ( matched ) return count | Removes the last buffer from the watch object to match the given address and size . |
20,604 | def define_code_breakpoint ( self , dwProcessId , address , condition = True , action = None ) : process = self . system . get_process ( dwProcessId ) bp = CodeBreakpoint ( address , condition , action ) key = ( dwProcessId , bp . get_address ( ) ) if key in self . __codeBP : msg = "Already exists (PID %d) : %r" raise KeyError ( msg % ( dwProcessId , self . __codeBP [ key ] ) ) self . __codeBP [ key ] = bp return bp | Creates a disabled code breakpoint at the given address . |
20,605 | def define_page_breakpoint ( self , dwProcessId , address , pages = 1 , condition = True , action = None ) : process = self . system . get_process ( dwProcessId ) bp = PageBreakpoint ( address , pages , condition , action ) begin = bp . get_address ( ) end = begin + bp . get_size ( ) address = begin pageSize = MemoryAddresses . pageSize while address < end : key = ( dwProcessId , address ) if key in self . __pageBP : msg = "Already exists (PID %d) : %r" msg = msg % ( dwProcessId , self . __pageBP [ key ] ) raise KeyError ( msg ) address = address + pageSize address = begin while address < end : key = ( dwProcessId , address ) self . __pageBP [ key ] = bp address = address + pageSize return bp | Creates a disabled page breakpoint at the given address . |
20,606 | def define_hardware_breakpoint ( self , dwThreadId , address , triggerFlag = BP_BREAK_ON_ACCESS , sizeFlag = BP_WATCH_DWORD , condition = True , action = None ) : thread = self . system . get_thread ( dwThreadId ) bp = HardwareBreakpoint ( address , triggerFlag , sizeFlag , condition , action ) begin = bp . get_address ( ) end = begin + bp . get_size ( ) if dwThreadId in self . __hardwareBP : bpSet = self . __hardwareBP [ dwThreadId ] for oldbp in bpSet : old_begin = oldbp . get_address ( ) old_end = old_begin + oldbp . get_size ( ) if MemoryAddresses . do_ranges_intersect ( begin , end , old_begin , old_end ) : msg = "Already exists (TID %d) : %r" % ( dwThreadId , oldbp ) raise KeyError ( msg ) else : bpSet = set ( ) self . __hardwareBP [ dwThreadId ] = bpSet bpSet . add ( bp ) return bp | Creates a disabled hardware breakpoint at the given address . |
20,607 | def has_hardware_breakpoint ( self , dwThreadId , address ) : if dwThreadId in self . __hardwareBP : bpSet = self . __hardwareBP [ dwThreadId ] for bp in bpSet : if bp . get_address ( ) == address : return True return False | Checks if a hardware breakpoint is defined at the given address . |
20,608 | def get_page_breakpoint ( self , dwProcessId , address ) : key = ( dwProcessId , address ) if key not in self . __pageBP : msg = "No breakpoint at process %d, address %s" address = HexDump . addresS ( address ) raise KeyError ( msg % ( dwProcessId , address ) ) return self . __pageBP [ key ] | Returns the internally used breakpoint object for the page breakpoint defined at the given address . |
20,609 | def enable_code_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_code_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . enable ( p , None ) | Enables the code breakpoint at the given address . |
20,610 | def enable_page_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_page_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . enable ( p , None ) | Enables the page breakpoint at the given address . |
20,611 | def enable_hardware_breakpoint ( self , dwThreadId , address ) : t = self . system . get_thread ( dwThreadId ) bp = self . get_hardware_breakpoint ( dwThreadId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . enable ( None , t ) | Enables the hardware breakpoint at the given address . |
20,612 | def enable_one_shot_code_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_code_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . one_shot ( p , None ) | Enables the code breakpoint at the given address for only one shot . |
20,613 | def enable_one_shot_page_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_page_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . one_shot ( p , None ) | Enables the page breakpoint at the given address for only one shot . |
20,614 | def enable_one_shot_hardware_breakpoint ( self , dwThreadId , address ) : t = self . system . get_thread ( dwThreadId ) bp = self . get_hardware_breakpoint ( dwThreadId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . one_shot ( None , t ) | Enables the hardware breakpoint at the given address for only one shot . |
20,615 | def disable_code_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_code_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . disable ( p , None ) | Disables the code breakpoint at the given address . |
20,616 | def disable_page_breakpoint ( self , dwProcessId , address ) : p = self . system . get_process ( dwProcessId ) bp = self . get_page_breakpoint ( dwProcessId , address ) if bp . is_running ( ) : self . __del_running_bp_from_all_threads ( bp ) bp . disable ( p , None ) | Disables the page breakpoint at the given address . |
20,617 | def disable_hardware_breakpoint ( self , dwThreadId , address ) : t = self . system . get_thread ( dwThreadId ) p = t . get_process ( ) bp = self . get_hardware_breakpoint ( dwThreadId , address ) if bp . is_running ( ) : self . __del_running_bp ( dwThreadId , bp ) bp . disable ( p , t ) | Disables the hardware breakpoint at the given address . |
20,618 | def erase_code_breakpoint ( self , dwProcessId , address ) : bp = self . get_code_breakpoint ( dwProcessId , address ) if not bp . is_disabled ( ) : self . disable_code_breakpoint ( dwProcessId , address ) del self . __codeBP [ ( dwProcessId , address ) ] | Erases the code breakpoint at the given address . |
20,619 | def erase_page_breakpoint ( self , dwProcessId , address ) : bp = self . get_page_breakpoint ( dwProcessId , address ) begin = bp . get_address ( ) end = begin + bp . get_size ( ) if not bp . is_disabled ( ) : self . disable_page_breakpoint ( dwProcessId , address ) address = begin pageSize = MemoryAddresses . pageSize while address < end : del self . __pageBP [ ( dwProcessId , address ) ] address = address + pageSize | Erases the page breakpoint at the given address . |
20,620 | def erase_hardware_breakpoint ( self , dwThreadId , address ) : bp = self . get_hardware_breakpoint ( dwThreadId , address ) if not bp . is_disabled ( ) : self . disable_hardware_breakpoint ( dwThreadId , address ) bpSet = self . __hardwareBP [ dwThreadId ] bpSet . remove ( bp ) if not bpSet : del self . __hardwareBP [ dwThreadId ] | Erases the hardware breakpoint at the given address . |
20,621 | def get_all_breakpoints ( self ) : bplist = list ( ) for ( pid , bp ) in self . get_all_code_breakpoints ( ) : bplist . append ( ( pid , None , bp ) ) for ( pid , bp ) in self . get_all_page_breakpoints ( ) : bplist . append ( ( pid , None , bp ) ) for ( tid , bp ) in self . get_all_hardware_breakpoints ( ) : pid = self . system . get_thread ( tid ) . get_pid ( ) bplist . append ( ( pid , tid , bp ) ) return bplist | Returns all breakpoint objects as a list of tuples . |
20,622 | def get_process_breakpoints ( self , dwProcessId ) : bplist = list ( ) for bp in self . get_process_code_breakpoints ( dwProcessId ) : bplist . append ( ( dwProcessId , None , bp ) ) for bp in self . get_process_page_breakpoints ( dwProcessId ) : bplist . append ( ( dwProcessId , None , bp ) ) for ( tid , bp ) in self . get_process_hardware_breakpoints ( dwProcessId ) : pid = self . system . get_thread ( tid ) . get_pid ( ) bplist . append ( ( dwProcessId , tid , bp ) ) return bplist | Returns all breakpoint objects for the given process as a list of tuples . |
20,623 | def enable_all_breakpoints ( self ) : for ( pid , bp ) in self . get_all_code_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_code_breakpoint ( pid , bp . get_address ( ) ) for ( pid , bp ) in self . get_all_page_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_page_breakpoint ( pid , bp . get_address ( ) ) for ( tid , bp ) in self . get_all_hardware_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_hardware_breakpoint ( tid , bp . get_address ( ) ) | Enables all disabled breakpoints in all processes . |
20,624 | def enable_one_shot_all_breakpoints ( self ) : for ( pid , bp ) in self . get_all_code_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_one_shot_code_breakpoint ( pid , bp . get_address ( ) ) for ( pid , bp ) in self . get_all_page_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_one_shot_page_breakpoint ( pid , bp . get_address ( ) ) for ( tid , bp ) in self . get_all_hardware_breakpoints ( ) : if bp . is_disabled ( ) : self . enable_one_shot_hardware_breakpoint ( tid , bp . get_address ( ) ) | Enables for one shot all disabled breakpoints in all processes . |
20,625 | def disable_all_breakpoints ( self ) : for ( pid , bp ) in self . get_all_code_breakpoints ( ) : self . disable_code_breakpoint ( pid , bp . get_address ( ) ) for ( pid , bp ) in self . get_all_page_breakpoints ( ) : self . disable_page_breakpoint ( pid , bp . get_address ( ) ) for ( tid , bp ) in self . get_all_hardware_breakpoints ( ) : self . disable_hardware_breakpoint ( tid , bp . get_address ( ) ) | Disables all breakpoints in all processes . |
20,626 | def erase_all_breakpoints ( self ) : for ( pid , bp ) in self . get_all_code_breakpoints ( ) : self . erase_code_breakpoint ( pid , bp . get_address ( ) ) for ( pid , bp ) in self . get_all_page_breakpoints ( ) : self . erase_page_breakpoint ( pid , bp . get_address ( ) ) for ( tid , bp ) in self . get_all_hardware_breakpoints ( ) : self . erase_hardware_breakpoint ( tid , bp . get_address ( ) ) | Erases all breakpoints in all processes . |
20,627 | def enable_process_breakpoints ( self , dwProcessId ) : for bp in self . get_process_code_breakpoints ( dwProcessId ) : if bp . is_disabled ( ) : self . enable_code_breakpoint ( dwProcessId , bp . get_address ( ) ) for bp in self . get_process_page_breakpoints ( dwProcessId ) : if bp . is_disabled ( ) : self . enable_page_breakpoint ( dwProcessId , bp . get_address ( ) ) if self . system . has_process ( dwProcessId ) : aProcess = self . system . get_process ( dwProcessId ) else : aProcess = Process ( dwProcessId ) aProcess . scan_threads ( ) for aThread in aProcess . iter_threads ( ) : dwThreadId = aThread . get_tid ( ) for bp in self . get_thread_hardware_breakpoints ( dwThreadId ) : if bp . is_disabled ( ) : self . enable_hardware_breakpoint ( dwThreadId , bp . get_address ( ) ) | Enables all disabled breakpoints for the given process . |
20,628 | def enable_one_shot_process_breakpoints ( self , dwProcessId ) : for bp in self . get_process_code_breakpoints ( dwProcessId ) : if bp . is_disabled ( ) : self . enable_one_shot_code_breakpoint ( dwProcessId , bp . get_address ( ) ) for bp in self . get_process_page_breakpoints ( dwProcessId ) : if bp . is_disabled ( ) : self . enable_one_shot_page_breakpoint ( dwProcessId , bp . get_address ( ) ) if self . system . has_process ( dwProcessId ) : aProcess = self . system . get_process ( dwProcessId ) else : aProcess = Process ( dwProcessId ) aProcess . scan_threads ( ) for aThread in aProcess . iter_threads ( ) : dwThreadId = aThread . get_tid ( ) for bp in self . get_thread_hardware_breakpoints ( dwThreadId ) : if bp . is_disabled ( ) : self . enable_one_shot_hardware_breakpoint ( dwThreadId , bp . get_address ( ) ) | Enables for one shot all disabled breakpoints for the given process . |
20,629 | def disable_process_breakpoints ( self , dwProcessId ) : for bp in self . get_process_code_breakpoints ( dwProcessId ) : self . disable_code_breakpoint ( dwProcessId , bp . get_address ( ) ) for bp in self . get_process_page_breakpoints ( dwProcessId ) : self . disable_page_breakpoint ( dwProcessId , bp . get_address ( ) ) if self . system . has_process ( dwProcessId ) : aProcess = self . system . get_process ( dwProcessId ) else : aProcess = Process ( dwProcessId ) aProcess . scan_threads ( ) for aThread in aProcess . iter_threads ( ) : dwThreadId = aThread . get_tid ( ) for bp in self . get_thread_hardware_breakpoints ( dwThreadId ) : self . disable_hardware_breakpoint ( dwThreadId , bp . get_address ( ) ) | Disables all breakpoints for the given process . |
20,630 | def erase_process_breakpoints ( self , dwProcessId ) : self . disable_process_breakpoints ( dwProcessId ) for bp in self . get_process_code_breakpoints ( dwProcessId ) : self . erase_code_breakpoint ( dwProcessId , bp . get_address ( ) ) for bp in self . get_process_page_breakpoints ( dwProcessId ) : self . erase_page_breakpoint ( dwProcessId , bp . get_address ( ) ) if self . system . has_process ( dwProcessId ) : aProcess = self . system . get_process ( dwProcessId ) else : aProcess = Process ( dwProcessId ) aProcess . scan_threads ( ) for aThread in aProcess . iter_threads ( ) : dwThreadId = aThread . get_tid ( ) for bp in self . get_thread_hardware_breakpoints ( dwThreadId ) : self . erase_hardware_breakpoint ( dwThreadId , bp . get_address ( ) ) | Erases all breakpoints for the given process . |
20,631 | def _notify_guard_page ( self , event ) : address = event . get_fault_address ( ) pid = event . get_pid ( ) bCallHandler = True mask = ~ ( MemoryAddresses . pageSize - 1 ) address = address & mask key = ( pid , address ) if key in self . __pageBP : bp = self . __pageBP [ key ] if bp . is_enabled ( ) or bp . is_one_shot ( ) : event . continueStatus = win32 . DBG_CONTINUE bp . hit ( event ) if bp . is_running ( ) : tid = event . get_tid ( ) self . __add_running_bp ( tid , bp ) bCondition = bp . eval_condition ( event ) if bCondition and bp . is_automatic ( ) : bp . run_action ( event ) bCallHandler = False else : bCallHandler = bCondition else : event . continueStatus = win32 . DBG_EXCEPTION_NOT_HANDLED return bCallHandler | Notify breakpoints of a guard page exception event . |
20,632 | def _notify_breakpoint ( self , event ) : address = event . get_exception_address ( ) pid = event . get_pid ( ) bCallHandler = True key = ( pid , address ) if key in self . __codeBP : bp = self . __codeBP [ key ] if not bp . is_disabled ( ) : aThread = event . get_thread ( ) aThread . set_pc ( address ) event . continueStatus = win32 . DBG_CONTINUE bp . hit ( event ) if bp . is_running ( ) : tid = event . get_tid ( ) self . __add_running_bp ( tid , bp ) bCondition = bp . eval_condition ( event ) if bCondition and bp . is_automatic ( ) : bCallHandler = bp . run_action ( event ) else : bCallHandler = bCondition elif event . get_process ( ) . is_system_defined_breakpoint ( address ) : event . continueStatus = win32 . DBG_CONTINUE else : if self . in_hostile_mode ( ) : event . continueStatus = win32 . DBG_EXCEPTION_NOT_HANDLED else : event . continueStatus = win32 . DBG_CONTINUE return bCallHandler | Notify breakpoints of a breakpoint exception event . |
20,633 | def __set_deferred_breakpoints ( self , event ) : pid = event . get_pid ( ) try : deferred = self . __deferredBP [ pid ] except KeyError : return aProcess = event . get_process ( ) for ( label , ( action , oneshot ) ) in deferred . items ( ) : try : address = aProcess . resolve_label ( label ) except Exception : continue del deferred [ label ] try : self . __set_break ( pid , address , action , oneshot ) except Exception : msg = "Can't set deferred breakpoint %s at process ID %d" msg = msg % ( label , pid ) warnings . warn ( msg , BreakpointWarning ) | Used internally . Sets all deferred breakpoints for a DLL when it s loaded . |
20,634 | def stalk_at ( self , pid , address , action = None ) : bp = self . __set_break ( pid , address , action , oneshot = True ) return bp is not None | Sets a one shot code breakpoint at the given process and address . |
20,635 | def break_at ( self , pid , address , action = None ) : bp = self . __set_break ( pid , address , action , oneshot = False ) return bp is not None | Sets a code breakpoint at the given process and address . |
20,636 | def hook_function ( self , pid , address , preCB = None , postCB = None , paramCount = None , signature = None ) : try : aProcess = self . system . get_process ( pid ) except KeyError : aProcess = Process ( pid ) arch = aProcess . get_arch ( ) hookObj = Hook ( preCB , postCB , paramCount , signature , arch ) bp = self . break_at ( pid , address , hookObj ) return bp is not None | Sets a function hook at the given address . |
20,637 | def watch_variable ( self , tid , address , size , action = None ) : bp = self . __set_variable_watch ( tid , address , size , action ) if not bp . is_enabled ( ) : self . enable_hardware_breakpoint ( tid , address ) | Sets a hardware breakpoint at the given thread address and size . |
20,638 | def stalk_variable ( self , tid , address , size , action = None ) : bp = self . __set_variable_watch ( tid , address , size , action ) if not bp . is_one_shot ( ) : self . enable_one_shot_hardware_breakpoint ( tid , address ) | Sets a one - shot hardware breakpoint at the given thread address and size . |
20,639 | def watch_buffer ( self , pid , address , size , action = None ) : self . __set_buffer_watch ( pid , address , size , action , False ) | Sets a page breakpoint and notifies when the given buffer is accessed . |
20,640 | def stalk_buffer ( self , pid , address , size , action = None ) : self . __set_buffer_watch ( pid , address , size , action , True ) | Sets a one - shot page breakpoint and notifies when the given buffer is accessed . |
20,641 | def start_tracing ( self , tid ) : if not self . is_tracing ( tid ) : thread = self . system . get_thread ( tid ) self . __start_tracing ( thread ) | Start tracing mode in the given thread . |
20,642 | def stop_tracing ( self , tid ) : if self . is_tracing ( tid ) : thread = self . system . get_thread ( tid ) self . __stop_tracing ( thread ) | Stop tracing mode in the given thread . |
20,643 | def start_tracing_process ( self , pid ) : for thread in self . system . get_process ( pid ) . iter_threads ( ) : self . __start_tracing ( thread ) | Start tracing mode for all threads in the given process . |
20,644 | def stop_tracing_process ( self , pid ) : for thread in self . system . get_process ( pid ) . iter_threads ( ) : self . __stop_tracing ( thread ) | Stop tracing mode for all threads in the given process . |
20,645 | def break_on_error ( self , pid , errorCode ) : aProcess = self . system . get_process ( pid ) address = aProcess . get_break_on_error_ptr ( ) if not address : raise NotImplementedError ( "The functionality is not supported in this system." ) aProcess . write_dword ( address , errorCode ) | Sets or clears the system breakpoint for a given Win32 error code . |
20,646 | def resolve_exported_function ( self , pid , modName , procName ) : aProcess = self . system . get_process ( pid ) aModule = aProcess . get_module_by_name ( modName ) if not aModule : aProcess . scan_modules ( ) aModule = aProcess . get_module_by_name ( modName ) if aModule : address = aModule . resolve ( procName ) return address return None | Resolves the exported DLL function for the given process . |
20,647 | def process_net_command ( self , py_db , cmd_id , seq , text ) : meaning = ID_TO_MEANING [ str ( cmd_id ) ] method_name = meaning . lower ( ) on_command = getattr ( self , method_name . lower ( ) , None ) if on_command is None : cmd = py_db . cmd_factory . make_error_message ( seq , "unexpected command " + str ( cmd_id ) ) py_db . writer . add_command ( cmd ) return py_db . _main_lock . acquire ( ) try : cmd = on_command ( py_db , cmd_id , seq , text ) if cmd is not None : py_db . writer . add_command ( cmd ) except : if traceback is not None and sys is not None and pydev_log_exception is not None : pydev_log_exception ( ) stream = StringIO ( ) traceback . print_exc ( file = stream ) cmd = py_db . cmd_factory . make_error_message ( seq , "Unexpected exception in process_net_command.\nInitial params: %s. Exception: %s" % ( ( ( cmd_id , seq , text ) , stream . getvalue ( ) ) ) ) if cmd is not None : py_db . writer . add_command ( cmd ) finally : py_db . _main_lock . release ( ) | Processes a command received from the Java side |
20,648 | def compile_pattern ( self ) : if self . PATTERN is not None : PC = PatternCompiler ( ) self . pattern , self . pattern_tree = PC . compile_pattern ( self . PATTERN , with_tree = True ) | Compiles self . PATTERN into self . pattern . |
20,649 | def set_filename ( self , filename ) : self . filename = filename self . logger = logging . getLogger ( filename ) | Set the filename and a logger derived from it . |
20,650 | def match ( self , node ) : results = { "node" : node } return self . pattern . match ( node , results ) and results | Returns match for a given parse tree node . |
20,651 | def new_name ( self , template = u"xxx_todo_changeme" ) : name = template while name in self . used_names : name = template + unicode ( self . numbers . next ( ) ) self . used_names . add ( name ) return name | Return a string suitable for use as an identifier |
20,652 | def cannot_convert ( self , node , reason = None ) : lineno = node . get_lineno ( ) for_output = node . clone ( ) for_output . prefix = u"" msg = "Line %d: could not convert: %s" self . log_message ( msg % ( lineno , for_output ) ) if reason : self . log_message ( reason ) | Warn the user that a given chunk of code is not valid Python 3 but that it cannot be converted automatically . |
20,653 | def warning ( self , node , reason ) : lineno = node . get_lineno ( ) self . log_message ( "Line %d: %s" % ( lineno , reason ) ) | Used for warning the user about possible uncertainty in the translation . |
20,654 | def start_tree ( self , tree , filename ) : self . used_names = tree . used_names self . set_filename ( filename ) self . numbers = itertools . count ( 1 ) self . first_log = True | Some fixers need to maintain tree - wide state . This method is called once at the start of tree fix - up . |
20,655 | def do_quit ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if arg : raise CmdError ( "too many arguments" ) if self . confirm_quit : count = self . debug . get_debugee_count ( ) if count > 0 : if count == 1 : msg = "There's a program still running." else : msg = "There are %s programs still running." % count if not self . ask_user ( msg ) : return False self . debuggerExit = True return True | quit - close the debugging session q - close the debugging session |
20,656 | def do_continue ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if arg : raise CmdError ( "too many arguments" ) if self . debug . get_debugee_count ( ) > 0 : return True | continue - continue execution g - continue execution go - continue execution |
20,657 | def do_gh ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if arg : raise CmdError ( "too many arguments" ) if self . lastEvent : self . lastEvent . continueStatus = win32 . DBG_EXCEPTION_HANDLED return self . do_go ( arg ) | gh - go with exception handled |
20,658 | def do_gn ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if arg : raise CmdError ( "too many arguments" ) if self . lastEvent : self . lastEvent . continueStatus = win32 . DBG_EXCEPTION_NOT_HANDLED return self . do_go ( arg ) | gn - go with exception not handled |
20,659 | def do_processlist ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if arg : raise CmdError ( "too many arguments" ) system = self . debug . system pid_list = self . debug . get_debugee_pids ( ) if pid_list : print ( "Process ID File name" ) for pid in pid_list : if pid == 0 : filename = "System Idle Process" elif pid == 4 : filename = "System" else : filename = system . get_process ( pid ) . get_filename ( ) filename = PathOperations . pathname_to_filename ( filename ) print ( "%-12d %s" % ( pid , filename ) ) | pl - show the processes being debugged processlist - show the processes being debugged |
20,660 | def do_threadlist ( self , arg ) : if arg : raise CmdError ( "too many arguments" ) if self . cmdprefix : process = self . get_process_from_prefix ( ) for thread in process . iter_threads ( ) : tid = thread . get_tid ( ) name = thread . get_name ( ) print ( "%-12d %s" % ( tid , name ) ) else : system = self . debug . system pid_list = self . debug . get_debugee_pids ( ) if pid_list : print ( "Thread ID Thread name" ) for pid in pid_list : process = system . get_process ( pid ) for thread in process . iter_threads ( ) : tid = thread . get_tid ( ) name = thread . get_name ( ) print ( "%-12d %s" % ( tid , name ) ) | tl - show the threads being debugged threadlist - show the threads being debugged |
20,661 | def do_step ( self , arg ) : if self . cmdprefix : raise CmdError ( "prefix not allowed" ) if self . lastEvent is None : raise CmdError ( "no current process set" ) if arg : raise CmdError ( "too many arguments" ) pid = self . lastEvent . get_pid ( ) thread = self . lastEvent . get_thread ( ) pc = thread . get_pc ( ) code = thread . disassemble ( pc , 16 ) [ 0 ] size = code [ 1 ] opcode = code [ 2 ] . lower ( ) if ' ' in opcode : opcode = opcode [ : opcode . find ( ' ' ) ] if opcode in self . jump_instructions or opcode in ( 'int' , 'ret' , 'retn' ) : return self . do_trace ( arg ) address = pc + size self . debug . stalk_at ( pid , address ) return True | p - step on the current assembly instruction next - step on the current assembly instruction step - step on the current assembly instruction |
20,662 | def do_trace ( self , arg ) : if arg : raise CmdError ( "too many arguments" ) if self . lastEvent is None : raise CmdError ( "no current thread set" ) self . lastEvent . get_thread ( ) . set_tf ( ) return True | t - trace at the current assembly instruction trace - trace at the current assembly instruction |
20,663 | def integer ( token ) : token = token . strip ( ) neg = False if token . startswith ( compat . b ( '-' ) ) : token = token [ 1 : ] neg = True if token . startswith ( compat . b ( '0x' ) ) : result = int ( token , 16 ) elif token . startswith ( compat . b ( '0b' ) ) : result = int ( token [ 2 : ] , 2 ) elif token . startswith ( compat . b ( '0o' ) ) : result = int ( token , 8 ) else : try : result = int ( token ) except ValueError : result = int ( token , 16 ) if neg : result = - result return result | Convert numeric strings into integers . |
20,664 | def hexadecimal ( token ) : token = '' . join ( [ c for c in token if c . isalnum ( ) ] ) if len ( token ) % 2 != 0 : raise ValueError ( "Missing characters in hex data" ) data = '' for i in compat . xrange ( 0 , len ( token ) , 2 ) : x = token [ i : i + 2 ] d = int ( x , 16 ) s = struct . pack ( '<B' , d ) data += s return data | Convert a strip of hexadecimal numbers into binary data . |
20,665 | def pattern ( token ) : token = '' . join ( [ c for c in token if c == '?' or c . isalnum ( ) ] ) if len ( token ) % 2 != 0 : raise ValueError ( "Missing characters in hex data" ) regexp = '' for i in compat . xrange ( 0 , len ( token ) , 2 ) : x = token [ i : i + 2 ] if x == '??' : regexp += '.' elif x [ 0 ] == '?' : f = '\\x%%.1x%s' % x [ 1 ] x = '' . join ( [ f % c for c in compat . xrange ( 0 , 0x10 ) ] ) regexp = '%s[%s]' % ( regexp , x ) elif x [ 1 ] == '?' : f = '\\x%s%%.1x' % x [ 0 ] x = '' . join ( [ f % c for c in compat . xrange ( 0 , 0x10 ) ] ) regexp = '%s[%s]' % ( regexp , x ) else : regexp = '%s\\x%s' % ( regexp , x ) return regexp | Convert an hexadecimal search pattern into a POSIX regular expression . |
20,666 | def integer_list_file ( cls , filename ) : count = 0 result = list ( ) fd = open ( filename , 'r' ) for line in fd : count = count + 1 if '#' in line : line = line [ : line . find ( '#' ) ] line = line . strip ( ) if line : try : value = cls . integer ( line ) except ValueError : e = sys . exc_info ( ) [ 1 ] msg = "Error in line %d of %s: %s" msg = msg % ( count , filename , str ( e ) ) raise ValueError ( msg ) result . append ( value ) return result | Read a list of integers from a file . |
20,667 | def string_list_file ( cls , filename ) : count = 0 result = list ( ) fd = open ( filename , 'r' ) for line in fd : count = count + 1 if '#' in line : line = line [ : line . find ( '#' ) ] line = line . strip ( ) if line : result . append ( line ) return result | Read a list of string values from a file . |
20,668 | def mixed_list_file ( cls , filename ) : count = 0 result = list ( ) fd = open ( filename , 'r' ) for line in fd : count = count + 1 if '#' in line : line = line [ : line . find ( '#' ) ] line = line . strip ( ) if line : try : value = cls . integer ( line ) except ValueError : value = line result . append ( value ) return result | Read a list of mixed values from a file . |
20,669 | def integer_list_file ( cls , filename , values , bits = None ) : fd = open ( filename , 'w' ) for integer in values : print >> fd , cls . integer ( integer , bits ) fd . close ( ) | Write a list of integers to a file . If a file of the same name exists it s contents are replaced . |
20,670 | def string_list_file ( cls , filename , values ) : fd = open ( filename , 'w' ) for string in values : print >> fd , string fd . close ( ) | Write a list of strings to a file . If a file of the same name exists it s contents are replaced . |
20,671 | def mixed_list_file ( cls , filename , values , bits ) : fd = open ( filename , 'w' ) for original in values : try : parsed = cls . integer ( original , bits ) except TypeError : parsed = repr ( original ) print >> fd , parsed fd . close ( ) | Write a list of mixed values to a file . If a file of the same name exists it s contents are replaced . |
20,672 | def printable ( data ) : result = '' for c in data : if 32 < ord ( c ) < 128 : result += c else : result += '.' return result | Replace unprintable characters with dots . |
20,673 | def hexa_word ( data , separator = ' ' ) : if len ( data ) & 1 != 0 : data += '\0' return separator . join ( [ '%.4x' % struct . unpack ( '<H' , data [ i : i + 2 ] ) [ 0 ] for i in compat . xrange ( 0 , len ( data ) , 2 ) ] ) | Convert binary data to a string of hexadecimal WORDs . |
20,674 | def hexline ( cls , data , separator = ' ' , width = None ) : if width is None : fmt = '%s %s' else : fmt = '%%-%ds %%-%ds' % ( ( len ( separator ) + 2 ) * width - 1 , width ) return fmt % ( cls . hexadecimal ( data , separator ) , cls . printable ( data ) ) | Dump a line of hexadecimal numbers from binary data . |
20,675 | def hexblock ( cls , data , address = None , bits = None , separator = ' ' , width = 8 ) : return cls . hexblock_cb ( cls . hexline , data , address , bits , width , cb_kwargs = { 'width' : width , 'separator' : separator } ) | Dump a block of hexadecimal numbers from binary data . Also show a printable text version of the data . |
20,676 | def hexblock_cb ( cls , callback , data , address = None , bits = None , width = 16 , cb_args = ( ) , cb_kwargs = { } ) : result = '' if address is None : for i in compat . xrange ( 0 , len ( data ) , width ) : result = '%s%s\n' % ( result , callback ( data [ i : i + width ] , * cb_args , ** cb_kwargs ) ) else : for i in compat . xrange ( 0 , len ( data ) , width ) : result = '%s%s: %s\n' % ( result , cls . address ( address , bits ) , callback ( data [ i : i + width ] , * cb_args , ** cb_kwargs ) ) address += width return result | Dump a block of binary data using a callback function to convert each line of text . |
20,677 | def hexblock_byte ( cls , data , address = None , bits = None , separator = ' ' , width = 16 ) : return cls . hexblock_cb ( cls . hexadecimal , data , address , bits , width , cb_kwargs = { 'separator' : separator } ) | Dump a block of hexadecimal BYTEs from binary data . |
20,678 | def hexblock_word ( cls , data , address = None , bits = None , separator = ' ' , width = 8 ) : return cls . hexblock_cb ( cls . hexa_word , data , address , bits , width * 2 , cb_kwargs = { 'separator' : separator } ) | Dump a block of hexadecimal WORDs from binary data . |
20,679 | def hexblock_dword ( cls , data , address = None , bits = None , separator = ' ' , width = 4 ) : return cls . hexblock_cb ( cls . hexa_dword , data , address , bits , width * 4 , cb_kwargs = { 'separator' : separator } ) | Dump a block of hexadecimal DWORDs from binary data . |
20,680 | def hexblock_qword ( cls , data , address = None , bits = None , separator = ' ' , width = 2 ) : return cls . hexblock_cb ( cls . hexa_qword , data , address , bits , width * 8 , cb_kwargs = { 'separator' : separator } ) | Dump a block of hexadecimal QWORDs from binary data . |
20,681 | def default ( cls ) : "Make the current foreground color the default." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_GREY wAttributes &= ~ win32 . FOREGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current foreground color the default . |
20,682 | def light ( cls ) : "Make the current foreground color light." wAttributes = cls . _get_text_attributes ( ) wAttributes |= win32 . FOREGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current foreground color light . |
20,683 | def dark ( cls ) : "Make the current foreground color dark." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current foreground color dark . |
20,684 | def black ( cls ) : "Make the text foreground color black." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK cls . _set_text_attributes ( wAttributes ) | Make the text foreground color black . |
20,685 | def white ( cls ) : "Make the text foreground color white." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_GREY cls . _set_text_attributes ( wAttributes ) | Make the text foreground color white . |
20,686 | def red ( cls ) : "Make the text foreground color red." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_RED cls . _set_text_attributes ( wAttributes ) | Make the text foreground color red . |
20,687 | def green ( cls ) : "Make the text foreground color green." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_GREEN cls . _set_text_attributes ( wAttributes ) | Make the text foreground color green . |
20,688 | def blue ( cls ) : "Make the text foreground color blue." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_BLUE cls . _set_text_attributes ( wAttributes ) | Make the text foreground color blue . |
20,689 | def cyan ( cls ) : "Make the text foreground color cyan." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_CYAN cls . _set_text_attributes ( wAttributes ) | Make the text foreground color cyan . |
20,690 | def magenta ( cls ) : "Make the text foreground color magenta." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_MAGENTA cls . _set_text_attributes ( wAttributes ) | Make the text foreground color magenta . |
20,691 | def yellow ( cls ) : "Make the text foreground color yellow." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . FOREGROUND_MASK wAttributes |= win32 . FOREGROUND_YELLOW cls . _set_text_attributes ( wAttributes ) | Make the text foreground color yellow . |
20,692 | def bk_default ( cls ) : "Make the current background color the default." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK wAttributes &= ~ win32 . BACKGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current background color the default . |
20,693 | def bk_light ( cls ) : "Make the current background color light." wAttributes = cls . _get_text_attributes ( ) wAttributes |= win32 . BACKGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current background color light . |
20,694 | def bk_dark ( cls ) : "Make the current background color dark." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_INTENSITY cls . _set_text_attributes ( wAttributes ) | Make the current background color dark . |
20,695 | def bk_black ( cls ) : "Make the text background color black." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK cls . _set_text_attributes ( wAttributes ) | Make the text background color black . |
20,696 | def bk_white ( cls ) : "Make the text background color white." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK wAttributes |= win32 . BACKGROUND_GREY cls . _set_text_attributes ( wAttributes ) | Make the text background color white . |
20,697 | def bk_red ( cls ) : "Make the text background color red." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK wAttributes |= win32 . BACKGROUND_RED cls . _set_text_attributes ( wAttributes ) | Make the text background color red . |
20,698 | def bk_green ( cls ) : "Make the text background color green." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK wAttributes |= win32 . BACKGROUND_GREEN cls . _set_text_attributes ( wAttributes ) | Make the text background color green . |
20,699 | def bk_blue ( cls ) : "Make the text background color blue." wAttributes = cls . _get_text_attributes ( ) wAttributes &= ~ win32 . BACKGROUND_MASK wAttributes |= win32 . BACKGROUND_BLUE cls . _set_text_attributes ( wAttributes ) | Make the text background color blue . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.