debugpy 1.8.3__zip → 1.8.6__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {debugpy-1.8.3/src/debugpy.egg-info → debugpy-1.8.6}/PKG-INFO +1 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_calltip_util.py +19 -21
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_completer.py +30 -30
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_execfile.py +3 -1
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_filesystem_encoding.py +43 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_getopt.py +35 -32
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_imports_tipper.py +83 -84
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_jy_imports_tipper.py +92 -99
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_log.py +2 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_saved_modules.py +51 -27
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_sys_patch.py +11 -7
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_tipper_common.py +6 -5
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/fsnotify/__init__.py +34 -38
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_console_utils.py +71 -69
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_import_hook.py +1 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_imports.py +0 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_ipython_console.py +14 -16
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_ipython_console_011.py +81 -93
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_is_thread_alive.py +3 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_localhost.py +9 -8
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_log.py +33 -25
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py +183 -170
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey_qt.py +33 -29
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_override.py +6 -4
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_umd.py +19 -18
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_versioncheck.py +3 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles.py +165 -138
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py +77 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_nose.py +35 -36
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_parallel.py +22 -23
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py +37 -57
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py +54 -52
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_unittest.py +28 -37
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py +56 -53
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__main__pydevd_gen_debug_adapter_protocol.py +604 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/debugProtocol.json +551 -445
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_base_schema.py +25 -29
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py +17458 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema_log.py +11 -12
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevconsole_code.py +18 -19
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py +41 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py +327 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_api.py +263 -214
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_breakpoints.py +7 -10
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_bytecode_utils.py +187 -92
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_bytecode_utils_py311.py +105 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_code_to_source.py +46 -51
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_collect_bytecode_info.py +239 -176
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py +370 -297
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm_constants.py +78 -86
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_command_line_handling.py +55 -59
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/pydevd_concurrency_logger.py +194 -58
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/pydevd_thread_wrappers.py +2 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_console.py +18 -23
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py +157 -127
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_custom_frames.py +10 -12
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.c +35217 -23106
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.pxd +15 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.pyx +802 -511
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py +18 -7
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py +32 -24
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_defaults.py +11 -13
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_dont_trace.py +16 -16
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_dont_trace_files.py +27 -2
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_exec2.py +1 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_extension_api.py +4 -5
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_extension_utils.py +8 -10
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py +50 -45
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py +462 -407
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame_utils.py +63 -61
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_gevent_integration.py +14 -16
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_import_class.py +27 -25
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_io.py +40 -42
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_json_debug_options.py +200 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py +20 -19
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py +199 -108
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_xml.py +121 -73
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_plugin_utils.py +208 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command.py +206 -159
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py +346 -334
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_referrers.py +75 -80
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_reload.py +35 -35
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py +116 -124
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py +44 -58
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py +51 -55
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_save_locals.py +4 -2
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_signature.py +24 -24
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_source_mapping.py +19 -20
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_stackless.py +45 -49
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_suspended_frames.py +61 -58
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_thread_lifecycle.py +23 -13
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_timeout.py +29 -31
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_dispatch.py +41 -11
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py +117 -55
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_traceproperty.py +11 -14
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py +90 -89
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py +106 -97
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vm_type.py +40 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_xml.py +56 -46
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py +5 -5
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py +71 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c +11165 -5326
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py +5 -6
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py +53 -56
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/__init__.py +1 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/bytecode.py +4 -6
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/cfg.py +6 -26
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/concrete.py +7 -21
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/flags.py +5 -24
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/instr.py +10 -34
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/peephole_opt.py +1 -4
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/__init__.py +2 -6
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_bytecode.py +3 -5
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_cfg.py +11 -31
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_code.py +2 -2
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_concrete.py +14 -41
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_flags.py +2 -4
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_instr.py +7 -18
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_misc.py +6 -18
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_peephole_opt.py +7 -18
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/util_annotation.py +1 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/pydevd_fix_code.py +14 -19
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring.py +1927 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.c +43058 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.pxd +46 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.pyx +1934 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/pydevd_sys_monitoring.py +16 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_app_engine_debug_startup.py +12 -11
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_coverage.py +30 -32
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py +58 -54
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookglut.py +20 -24
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookgtk.py +8 -7
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookgtk3.py +8 -6
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookpyglet.py +11 -8
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt4.py +21 -18
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt5.py +17 -15
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt6.py +17 -15
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhooktk.py +6 -4
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookwx.py +14 -10
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py +30 -26
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_ipython/qt.py +24 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/qt_for_kernel.py +37 -34
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/qt_loaders.py +86 -73
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/version.py +7 -7
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_pysrc.py +1 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_run_in_console.py +23 -24
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_sitecustomize/sitecustomize.py +267 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevconsole.py +55 -47
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd.py +732 -508
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_always_live_program.py +40 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_check.py +1 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process.py +11 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py +75 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py +130 -125
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_pydevd.py +89 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_script.py +41 -32
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_utils.hpp +1 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp +9 -1
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/lldb_prepare.py +10 -9
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll +0 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/__init__.py +103 -119
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py +457 -516
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/compat.py +33 -15
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/crash.py +336 -281
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/debug.py +101 -131
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/disasm.py +148 -153
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/event.py +310 -302
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/interactive.py +235 -208
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/module.py +185 -218
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/process.py +428 -564
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/registry.py +54 -53
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/search.py +69 -73
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/sql.py +158 -170
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/system.py +143 -213
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/textio.py +302 -333
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py +220 -239
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/util.py +198 -177
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/__init__.py +11 -11
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/advapi32.py +1191 -713
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/context_amd64.py +248 -194
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/context_i386.py +132 -120
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/dbghelp.py +450 -346
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/defines.py +305 -286
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/gdi32.py +526 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/kernel32.py +1479 -1097
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/ntdll.py +579 -0
- debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/peb_teb.py +3517 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/psapi.py +54 -31
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/shell32.py +170 -149
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/shlwapi.py +190 -108
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/user32.py +542 -437
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/version.py +489 -442
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/wtsapi32.py +83 -65
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py +70 -76
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/attach.cpp +17 -9
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat +1 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_file_utils.py +141 -120
- {debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types → debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_plugins}/__init__.py +1 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/django_debug.py +175 -149
- {debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_plugins → debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions}/__init__.py +1 -0
- {debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions → debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types}/__init__.py +1 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_helpers.py +5 -5
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py +28 -28
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugin_pandas_types.py +22 -30
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugins_django_form_str.py +3 -2
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/jinja2_debug.py +130 -108
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/pydevd_line_validation.py +27 -14
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_tracing.py +85 -66
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/setup_pydevd_cython.py +96 -59
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_version.py +3 -3
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/messaging.py +2 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/server/cli.py +32 -17
- {debugpy-1.8.3 → debugpy-1.8.6/src/debugpy.egg-info}/PKG-INFO +1 -1
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy.egg-info/SOURCES.txt +6 -9
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_filesystem_encoding.py +0 -41
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py +0 -76
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__main__pydevd_gen_debug_adapter_protocol.py +0 -592
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py +0 -19514
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py +0 -19
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py +0 -153
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_json_debug_options.py +0 -204
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_plugin_utils.py +0 -91
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_api.py +0 -62
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vm_type.py +0 -41
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py +0 -48
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/COPYING +0 -21
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/INSTALLER +0 -1
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/METADATA +0 -77
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/RECORD +0 -42
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/REQUESTED +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/WHEEL +0 -5
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/direct_url.json +0 -1
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/top_level.txt +0 -1
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydev_ipython/qt.py +0 -23
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydev_pysrc.py +0 -1
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydev_sitecustomize/sitecustomize.py +0 -237
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_always_live_program.py +0 -32
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process.py +0 -9
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py +0 -74
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_pydevd.py +0 -79
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb +0 -0
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/gdi32.py +0 -507
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/ntdll.py +0 -539
- debugpy-1.8.3/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/peb_teb.py +0 -3435
- {debugpy-1.8.3 → debugpy-1.8.6}/DESCRIPTION.md +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/LICENSE +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/MANIFEST.in +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/README.md +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/pyproject.toml +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/setup.cfg +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/setup.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/ThirdPartyNotices.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/__main__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/_pydevd_packaging.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/_util.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/force_pydevd.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/debugProtocolCustom.json +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/.gitignore +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.template.pyx +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/release_mem.h +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/README.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/README +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/README.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_310.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_311.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_common.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/python.h +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/ref_utils.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/.gitignore +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/attach.cpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_manylinux.cmd +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/attach.h +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/inject_dll.cpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/py_win_helpers.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/run_code_in_memory.hpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/run_code_on_dllmain.cpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/stdafx.cpp +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/stdafx.h +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/targetver.h +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/README.md +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/__main__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/clients.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/components.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/launchers.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/servers.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/adapter/sessions.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/json.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/log.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/singleton.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/sockets.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/stacks.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/timestamp.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/common/util.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/__main__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/debuggee.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/handlers.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/output.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/launcher/winapi.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/public_api.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/server/__init__.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/server/api.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy/server/attach_pid_injected.py +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy.egg-info/dependency_links.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy.egg-info/entry_points.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/src/debugpy.egg-info/top_level.txt +0 -0
- {debugpy-1.8.3 → debugpy-1.8.6}/versioneer.py +0 -0
|
@@ -42,25 +42,20 @@ Breakpoints.
|
|
|
42
42
|
__revision__ = "$Id$"
|
|
43
43
|
|
|
44
44
|
__all__ = [
|
|
45
|
-
|
|
46
45
|
# Base class for breakpoints
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
"Breakpoint",
|
|
49
47
|
# Breakpoint implementations
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
"CodeBreakpoint",
|
|
49
|
+
"PageBreakpoint",
|
|
50
|
+
"HardwareBreakpoint",
|
|
54
51
|
# Hooks and watches
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
"Hook",
|
|
53
|
+
"ApiHook",
|
|
54
|
+
"BufferWatch",
|
|
59
55
|
# Warnings
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]
|
|
56
|
+
"BreakpointWarning",
|
|
57
|
+
"BreakpointCallbackWarning",
|
|
58
|
+
]
|
|
64
59
|
|
|
65
60
|
from winappdbg import win32
|
|
66
61
|
from winappdbg import compat
|
|
@@ -73,23 +68,27 @@ import ctypes
|
|
|
73
68
|
import warnings
|
|
74
69
|
import traceback
|
|
75
70
|
|
|
76
|
-
|
|
71
|
+
# ==============================================================================
|
|
72
|
+
|
|
77
73
|
|
|
78
|
-
class BreakpointWarning
|
|
74
|
+
class BreakpointWarning(UserWarning):
|
|
79
75
|
"""
|
|
80
76
|
This warning is issued when a non-fatal error occurs that's related to
|
|
81
77
|
breakpoints.
|
|
82
78
|
"""
|
|
83
79
|
|
|
84
|
-
|
|
80
|
+
|
|
81
|
+
class BreakpointCallbackWarning(RuntimeWarning):
|
|
85
82
|
"""
|
|
86
83
|
This warning is issued when an uncaught exception was raised by a
|
|
87
84
|
breakpoint's user-defined callback.
|
|
88
85
|
"""
|
|
89
86
|
|
|
90
|
-
#==============================================================================
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
# ==============================================================================
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class Breakpoint(object):
|
|
93
92
|
"""
|
|
94
93
|
Base class for breakpoints.
|
|
95
94
|
Here's the breakpoints state machine.
|
|
@@ -131,21 +130,21 @@ class Breakpoint (object):
|
|
|
131
130
|
# I don't think transitions Enabled <-> OneShot should be allowed... plus
|
|
132
131
|
# it would require special handling to avoid setting the same bp twice
|
|
133
132
|
|
|
134
|
-
DISABLED
|
|
135
|
-
ENABLED
|
|
136
|
-
ONESHOT
|
|
137
|
-
RUNNING
|
|
133
|
+
DISABLED = 0
|
|
134
|
+
ENABLED = 1
|
|
135
|
+
ONESHOT = 2
|
|
136
|
+
RUNNING = 3
|
|
138
137
|
|
|
139
|
-
typeName
|
|
138
|
+
typeName = "breakpoint"
|
|
140
139
|
|
|
141
|
-
stateNames
|
|
142
|
-
DISABLED
|
|
143
|
-
ENABLED
|
|
144
|
-
ONESHOT
|
|
145
|
-
RUNNING
|
|
140
|
+
stateNames = {
|
|
141
|
+
DISABLED: "disabled",
|
|
142
|
+
ENABLED: "enabled",
|
|
143
|
+
ONESHOT: "one shot",
|
|
144
|
+
RUNNING: "running",
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
def __init__(self, address, size
|
|
147
|
+
def __init__(self, address, size=1, condition=True, action=None):
|
|
149
148
|
"""
|
|
150
149
|
Breakpoint object.
|
|
151
150
|
|
|
@@ -179,37 +178,37 @@ class Breakpoint (object):
|
|
|
179
178
|
|
|
180
179
|
Where B{event} is an L{Event} object.
|
|
181
180
|
"""
|
|
182
|
-
self.__address
|
|
183
|
-
self.__size
|
|
184
|
-
self.__state
|
|
181
|
+
self.__address = address
|
|
182
|
+
self.__size = size
|
|
183
|
+
self.__state = self.DISABLED
|
|
185
184
|
|
|
186
185
|
self.set_condition(condition)
|
|
187
186
|
self.set_action(action)
|
|
188
187
|
|
|
189
188
|
def __repr__(self):
|
|
190
189
|
if self.is_disabled():
|
|
191
|
-
state =
|
|
190
|
+
state = "Disabled"
|
|
192
191
|
else:
|
|
193
|
-
state =
|
|
192
|
+
state = "Active (%s)" % self.get_state_name()
|
|
194
193
|
if self.is_conditional():
|
|
195
|
-
condition =
|
|
194
|
+
condition = "conditional"
|
|
196
195
|
else:
|
|
197
|
-
condition =
|
|
196
|
+
condition = "unconditional"
|
|
198
197
|
name = self.typeName
|
|
199
198
|
size = self.get_size()
|
|
200
199
|
if size == 1:
|
|
201
|
-
address = HexDump.address(
|
|
200
|
+
address = HexDump.address(self.get_address())
|
|
202
201
|
else:
|
|
203
|
-
begin
|
|
204
|
-
end
|
|
205
|
-
begin
|
|
206
|
-
end
|
|
202
|
+
begin = self.get_address()
|
|
203
|
+
end = begin + size
|
|
204
|
+
begin = HexDump.address(begin)
|
|
205
|
+
end = HexDump.address(end)
|
|
207
206
|
address = "range %s-%s" % (begin, end)
|
|
208
207
|
msg = "<%s %s %s at remote address %s>"
|
|
209
208
|
msg = msg % (state, condition, name, address)
|
|
210
209
|
return msg
|
|
211
210
|
|
|
212
|
-
|
|
211
|
+
# ------------------------------------------------------------------------------
|
|
213
212
|
|
|
214
213
|
def is_disabled(self):
|
|
215
214
|
"""
|
|
@@ -245,7 +244,7 @@ class Breakpoint (object):
|
|
|
245
244
|
@return: C{True} if the address is within the range of the breakpoint.
|
|
246
245
|
"""
|
|
247
246
|
begin = self.get_address()
|
|
248
|
-
end
|
|
247
|
+
end = begin + self.get_size()
|
|
249
248
|
return begin <= address < end
|
|
250
249
|
|
|
251
250
|
def get_address(self):
|
|
@@ -270,8 +269,8 @@ class Breakpoint (object):
|
|
|
270
269
|
covered by the breakpoint.
|
|
271
270
|
"""
|
|
272
271
|
address = self.get_address()
|
|
273
|
-
size
|
|
274
|
-
return (
|
|
272
|
+
size = self.get_size()
|
|
273
|
+
return (address, address + size)
|
|
275
274
|
|
|
276
275
|
def get_state(self):
|
|
277
276
|
"""
|
|
@@ -286,9 +285,9 @@ class Breakpoint (object):
|
|
|
286
285
|
@rtype: str
|
|
287
286
|
@return: The name of the current state of the breakpoint.
|
|
288
287
|
"""
|
|
289
|
-
return self.stateNames[
|
|
288
|
+
return self.stateNames[self.get_state()]
|
|
290
289
|
|
|
291
|
-
|
|
290
|
+
# ------------------------------------------------------------------------------
|
|
292
291
|
|
|
293
292
|
def is_conditional(self):
|
|
294
293
|
"""
|
|
@@ -315,7 +314,7 @@ class Breakpoint (object):
|
|
|
315
314
|
"""
|
|
316
315
|
return self.__condition
|
|
317
316
|
|
|
318
|
-
def set_condition(self, condition
|
|
317
|
+
def set_condition(self, condition=True):
|
|
319
318
|
"""
|
|
320
319
|
Sets a new condition callback for the breakpoint.
|
|
321
320
|
|
|
@@ -340,21 +339,20 @@ class Breakpoint (object):
|
|
|
340
339
|
@return: C{True} to dispatch the event, C{False} otherwise.
|
|
341
340
|
"""
|
|
342
341
|
condition = self.get_condition()
|
|
343
|
-
if condition is True:
|
|
342
|
+
if condition is True: # shortcut for unconditional breakpoints
|
|
344
343
|
return True
|
|
345
344
|
if callable(condition):
|
|
346
345
|
try:
|
|
347
|
-
return bool(
|
|
346
|
+
return bool(condition(event))
|
|
348
347
|
except Exception:
|
|
349
348
|
e = sys.exc_info()[1]
|
|
350
|
-
msg =
|
|
351
|
-
" raised an exception: %s")
|
|
349
|
+
msg = "Breakpoint condition callback %r" " raised an exception: %s"
|
|
352
350
|
msg = msg % (condition, traceback.format_exc(e))
|
|
353
351
|
warnings.warn(msg, BreakpointCallbackWarning)
|
|
354
352
|
return False
|
|
355
|
-
return bool(
|
|
353
|
+
return bool(condition) # force evaluation now
|
|
356
354
|
|
|
357
|
-
|
|
355
|
+
# ------------------------------------------------------------------------------
|
|
358
356
|
|
|
359
357
|
def is_automatic(self):
|
|
360
358
|
"""
|
|
@@ -379,7 +377,7 @@ class Breakpoint (object):
|
|
|
379
377
|
"""
|
|
380
378
|
return self.__action
|
|
381
379
|
|
|
382
|
-
def set_action(self, action
|
|
380
|
+
def set_action(self, action=None):
|
|
383
381
|
"""
|
|
384
382
|
Sets a new action callback for the breakpoint.
|
|
385
383
|
|
|
@@ -398,17 +396,16 @@ class Breakpoint (object):
|
|
|
398
396
|
action = self.get_action()
|
|
399
397
|
if action is not None:
|
|
400
398
|
try:
|
|
401
|
-
return bool(
|
|
399
|
+
return bool(action(event))
|
|
402
400
|
except Exception:
|
|
403
401
|
e = sys.exc_info()[1]
|
|
404
|
-
msg =
|
|
405
|
-
" raised an exception: %s")
|
|
402
|
+
msg = "Breakpoint action callback %r" " raised an exception: %s"
|
|
406
403
|
msg = msg % (action, traceback.format_exc(e))
|
|
407
404
|
warnings.warn(msg, BreakpointCallbackWarning)
|
|
408
405
|
return False
|
|
409
406
|
return True
|
|
410
407
|
|
|
411
|
-
|
|
408
|
+
# ------------------------------------------------------------------------------
|
|
412
409
|
|
|
413
410
|
def __bad_transition(self, state):
|
|
414
411
|
"""
|
|
@@ -422,10 +419,9 @@ class Breakpoint (object):
|
|
|
422
419
|
@raise Exception: Always.
|
|
423
420
|
"""
|
|
424
421
|
statemsg = ""
|
|
425
|
-
oldState = self.stateNames[
|
|
426
|
-
newState = self.stateNames[
|
|
427
|
-
msg = "Invalid state transition (%s -> %s)"
|
|
428
|
-
" for breakpoint at address %s"
|
|
422
|
+
oldState = self.stateNames[self.get_state()]
|
|
423
|
+
newState = self.stateNames[state]
|
|
424
|
+
msg = "Invalid state transition (%s -> %s)" " for breakpoint at address %s"
|
|
429
425
|
msg = msg % (oldState, newState, HexDump.address(self.get_address()))
|
|
430
426
|
raise AssertionError(msg)
|
|
431
427
|
|
|
@@ -443,8 +439,8 @@ class Breakpoint (object):
|
|
|
443
439
|
@type aThread: L{Thread}
|
|
444
440
|
@param aThread: Thread object.
|
|
445
441
|
"""
|
|
446
|
-
## if self.__state not in (self.ENABLED, self.ONESHOT, self.RUNNING):
|
|
447
|
-
## self.__bad_transition(self.DISABLED)
|
|
442
|
+
## if self.__state not in (self.ENABLED, self.ONESHOT, self.RUNNING):
|
|
443
|
+
## self.__bad_transition(self.DISABLED)
|
|
448
444
|
self.__state = self.DISABLED
|
|
449
445
|
|
|
450
446
|
def enable(self, aProcess, aThread):
|
|
@@ -461,8 +457,8 @@ class Breakpoint (object):
|
|
|
461
457
|
@type aThread: L{Thread}
|
|
462
458
|
@param aThread: Thread object.
|
|
463
459
|
"""
|
|
464
|
-
## if self.__state not in (self.DISABLED, self.RUNNING):
|
|
465
|
-
## self.__bad_transition(self.ENABLED)
|
|
460
|
+
## if self.__state not in (self.DISABLED, self.RUNNING):
|
|
461
|
+
## self.__bad_transition(self.ENABLED)
|
|
466
462
|
self.__state = self.ENABLED
|
|
467
463
|
|
|
468
464
|
def one_shot(self, aProcess, aThread):
|
|
@@ -476,8 +472,8 @@ class Breakpoint (object):
|
|
|
476
472
|
@type aThread: L{Thread}
|
|
477
473
|
@param aThread: Thread object.
|
|
478
474
|
"""
|
|
479
|
-
## if self.__state != self.DISABLED:
|
|
480
|
-
## self.__bad_transition(self.ONESHOT)
|
|
475
|
+
## if self.__state != self.DISABLED:
|
|
476
|
+
## self.__bad_transition(self.ONESHOT)
|
|
481
477
|
self.__state = self.ONESHOT
|
|
482
478
|
|
|
483
479
|
def running(self, aProcess, aThread):
|
|
@@ -510,8 +506,8 @@ class Breakpoint (object):
|
|
|
510
506
|
@raise AssertionError: Disabled breakpoints can't be hit.
|
|
511
507
|
"""
|
|
512
508
|
aProcess = event.get_process()
|
|
513
|
-
aThread
|
|
514
|
-
state
|
|
509
|
+
aThread = event.get_thread()
|
|
510
|
+
state = self.get_state()
|
|
515
511
|
|
|
516
512
|
event.breakpoint = self
|
|
517
513
|
|
|
@@ -527,16 +523,18 @@ class Breakpoint (object):
|
|
|
527
523
|
elif state == self.DISABLED:
|
|
528
524
|
# this should not happen
|
|
529
525
|
msg = "Hit a disabled breakpoint at address %s"
|
|
530
|
-
msg = msg % HexDump.address(
|
|
526
|
+
msg = msg % HexDump.address(self.get_address())
|
|
531
527
|
warnings.warn(msg, BreakpointWarning)
|
|
532
528
|
|
|
533
|
-
|
|
529
|
+
|
|
530
|
+
# ==============================================================================
|
|
534
531
|
|
|
535
532
|
# XXX TODO
|
|
536
533
|
# Check if the user is trying to set a code breakpoint on a memory mapped file,
|
|
537
534
|
# so we don't end up writing the int3 instruction in the file by accident.
|
|
538
535
|
|
|
539
|
-
|
|
536
|
+
|
|
537
|
+
class CodeBreakpoint(Breakpoint):
|
|
540
538
|
"""
|
|
541
539
|
Code execution breakpoints (using an int3 opcode).
|
|
542
540
|
|
|
@@ -546,12 +544,12 @@ class CodeBreakpoint (Breakpoint):
|
|
|
546
544
|
@cvar bpInstruction: Breakpoint instruction for the current processor.
|
|
547
545
|
"""
|
|
548
546
|
|
|
549
|
-
typeName =
|
|
547
|
+
typeName = "code breakpoint"
|
|
550
548
|
|
|
551
549
|
if win32.arch in (win32.ARCH_I386, win32.ARCH_AMD64):
|
|
552
|
-
bpInstruction =
|
|
550
|
+
bpInstruction = "\xCC" # int 3
|
|
553
551
|
|
|
554
|
-
def __init__(self, address, condition
|
|
552
|
+
def __init__(self, address, condition=True, action=None):
|
|
555
553
|
"""
|
|
556
554
|
Code breakpoint object.
|
|
557
555
|
|
|
@@ -569,8 +567,7 @@ class CodeBreakpoint (Breakpoint):
|
|
|
569
567
|
if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
|
|
570
568
|
msg = "Code breakpoints not supported for %s" % win32.arch
|
|
571
569
|
raise NotImplementedError(msg)
|
|
572
|
-
Breakpoint.__init__(self, address, len(self.bpInstruction),
|
|
573
|
-
condition, action)
|
|
570
|
+
Breakpoint.__init__(self, address, len(self.bpInstruction), condition, action)
|
|
574
571
|
self.__previousValue = self.bpInstruction
|
|
575
572
|
|
|
576
573
|
def __set_bp(self, aProcess):
|
|
@@ -632,7 +629,8 @@ class CodeBreakpoint (Breakpoint):
|
|
|
632
629
|
aThread.set_tf()
|
|
633
630
|
super(CodeBreakpoint, self).running(aProcess, aThread)
|
|
634
631
|
|
|
635
|
-
|
|
632
|
+
|
|
633
|
+
# ==============================================================================
|
|
636
634
|
|
|
637
635
|
# TODO:
|
|
638
636
|
# * If the original page was already a guard page, the exception should be
|
|
@@ -647,7 +645,8 @@ class CodeBreakpoint (Breakpoint):
|
|
|
647
645
|
# protect bits (for example the pages where the PEB and TEB reside). Maybe
|
|
648
646
|
# a more descriptive error message could be shown in this case.
|
|
649
647
|
|
|
650
|
-
|
|
648
|
+
|
|
649
|
+
class PageBreakpoint(Breakpoint):
|
|
651
650
|
"""
|
|
652
651
|
Page access breakpoint (using guard pages).
|
|
653
652
|
|
|
@@ -657,11 +656,11 @@ class PageBreakpoint (Breakpoint):
|
|
|
657
656
|
get_size_in_pages
|
|
658
657
|
"""
|
|
659
658
|
|
|
660
|
-
typeName =
|
|
659
|
+
typeName = "page breakpoint"
|
|
661
660
|
|
|
662
|
-
|
|
661
|
+
# ------------------------------------------------------------------------------
|
|
663
662
|
|
|
664
|
-
def __init__(self, address, pages
|
|
663
|
+
def __init__(self, address, pages=1, condition=True, action=None):
|
|
665
664
|
"""
|
|
666
665
|
Page breakpoint object.
|
|
667
666
|
|
|
@@ -679,15 +678,12 @@ class PageBreakpoint (Breakpoint):
|
|
|
679
678
|
@type action: function
|
|
680
679
|
@param action: (Optional) Action callback function.
|
|
681
680
|
"""
|
|
682
|
-
Breakpoint.__init__(self, address, pages * MemoryAddresses.pageSize,
|
|
683
|
-
|
|
684
|
-
## if (address & 0x00000FFF) != 0:
|
|
681
|
+
Breakpoint.__init__(self, address, pages * MemoryAddresses.pageSize, condition, action)
|
|
682
|
+
## if (address & 0x00000FFF) != 0:
|
|
685
683
|
floordiv_align = long(address) // long(MemoryAddresses.pageSize)
|
|
686
|
-
truediv_align
|
|
684
|
+
truediv_align = float(address) / float(MemoryAddresses.pageSize)
|
|
687
685
|
if floordiv_align != truediv_align:
|
|
688
|
-
msg
|
|
689
|
-
"must be aligned to a page size boundary " \
|
|
690
|
-
"(value %s received)" % HexDump.address(address)
|
|
686
|
+
msg = "Address of page breakpoint " "must be aligned to a page size boundary " "(value %s received)" % HexDump.address(address)
|
|
691
687
|
raise ValueError(msg)
|
|
692
688
|
|
|
693
689
|
def get_size_in_pages(self):
|
|
@@ -705,8 +701,8 @@ class PageBreakpoint (Breakpoint):
|
|
|
705
701
|
@type aProcess: L{Process}
|
|
706
702
|
@param aProcess: Process object.
|
|
707
703
|
"""
|
|
708
|
-
lpAddress
|
|
709
|
-
dwSize
|
|
704
|
+
lpAddress = self.get_address()
|
|
705
|
+
dwSize = self.get_size()
|
|
710
706
|
flNewProtect = aProcess.mquery(lpAddress).Protect
|
|
711
707
|
flNewProtect = flNewProtect | win32.PAGE_GUARD
|
|
712
708
|
aProcess.mprotect(lpAddress, dwSize, flNewProtect)
|
|
@@ -718,9 +714,9 @@ class PageBreakpoint (Breakpoint):
|
|
|
718
714
|
@type aProcess: L{Process}
|
|
719
715
|
@param aProcess: Process object.
|
|
720
716
|
"""
|
|
721
|
-
lpAddress
|
|
717
|
+
lpAddress = self.get_address()
|
|
722
718
|
flNewProtect = aProcess.mquery(lpAddress).Protect
|
|
723
|
-
flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD)
|
|
719
|
+
flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD
|
|
724
720
|
aProcess.mprotect(lpAddress, self.get_size(), flNewProtect)
|
|
725
721
|
|
|
726
722
|
def disable(self, aProcess, aThread):
|
|
@@ -745,9 +741,11 @@ class PageBreakpoint (Breakpoint):
|
|
|
745
741
|
aThread.set_tf()
|
|
746
742
|
super(PageBreakpoint, self).running(aProcess, aThread)
|
|
747
743
|
|
|
748
|
-
#==============================================================================
|
|
749
744
|
|
|
750
|
-
|
|
745
|
+
# ==============================================================================
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
class HardwareBreakpoint(Breakpoint):
|
|
751
749
|
"""
|
|
752
750
|
Hardware breakpoint (using debug registers).
|
|
753
751
|
|
|
@@ -790,14 +788,14 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
790
788
|
@cvar validWatchSizes: Valid watch flag values.
|
|
791
789
|
"""
|
|
792
790
|
|
|
793
|
-
typeName =
|
|
791
|
+
typeName = "hardware breakpoint"
|
|
794
792
|
|
|
795
|
-
BREAK_ON_EXECUTION
|
|
796
|
-
BREAK_ON_WRITE
|
|
797
|
-
BREAK_ON_ACCESS
|
|
793
|
+
BREAK_ON_EXECUTION = DebugRegister.BREAK_ON_EXECUTION
|
|
794
|
+
BREAK_ON_WRITE = DebugRegister.BREAK_ON_WRITE
|
|
795
|
+
BREAK_ON_ACCESS = DebugRegister.BREAK_ON_ACCESS
|
|
798
796
|
|
|
799
|
-
WATCH_BYTE
|
|
800
|
-
WATCH_WORD
|
|
797
|
+
WATCH_BYTE = DebugRegister.WATCH_BYTE
|
|
798
|
+
WATCH_WORD = DebugRegister.WATCH_WORD
|
|
801
799
|
WATCH_DWORD = DebugRegister.WATCH_DWORD
|
|
802
800
|
WATCH_QWORD = DebugRegister.WATCH_QWORD
|
|
803
801
|
|
|
@@ -814,10 +812,7 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
814
812
|
WATCH_QWORD,
|
|
815
813
|
)
|
|
816
814
|
|
|
817
|
-
def __init__(self, address,
|
|
818
|
-
sizeFlag = WATCH_DWORD,
|
|
819
|
-
condition = True,
|
|
820
|
-
action = None):
|
|
815
|
+
def __init__(self, address, triggerFlag=BREAK_ON_ACCESS, sizeFlag=WATCH_DWORD, condition=True, action=None):
|
|
821
816
|
"""
|
|
822
817
|
Hardware breakpoint object.
|
|
823
818
|
|
|
@@ -869,7 +864,7 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
869
864
|
if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
|
|
870
865
|
msg = "Hardware breakpoints not supported for %s" % win32.arch
|
|
871
866
|
raise NotImplementedError(msg)
|
|
872
|
-
if
|
|
867
|
+
if sizeFlag == self.WATCH_BYTE:
|
|
873
868
|
size = 1
|
|
874
869
|
elif sizeFlag == self.WATCH_WORD:
|
|
875
870
|
size = 2
|
|
@@ -888,9 +883,9 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
888
883
|
raise ValueError(msg)
|
|
889
884
|
|
|
890
885
|
Breakpoint.__init__(self, address, size, condition, action)
|
|
891
|
-
self.__trigger
|
|
892
|
-
self.__watch
|
|
893
|
-
self.__slot
|
|
886
|
+
self.__trigger = triggerFlag
|
|
887
|
+
self.__watch = sizeFlag
|
|
888
|
+
self.__slot = None
|
|
894
889
|
|
|
895
890
|
def __clear_bp(self, aThread):
|
|
896
891
|
"""
|
|
@@ -925,8 +920,7 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
925
920
|
msg = "No available hardware breakpoint slots for thread ID %d"
|
|
926
921
|
msg = msg % aThread.get_tid()
|
|
927
922
|
raise RuntimeError(msg)
|
|
928
|
-
DebugRegister.set_bp(ctx, self.__slot, self.get_address(),
|
|
929
|
-
self.__trigger, self.__watch)
|
|
923
|
+
DebugRegister.set_bp(ctx, self.__slot, self.get_address(), self.__trigger, self.__watch)
|
|
930
924
|
aThread.set_context(ctx)
|
|
931
925
|
finally:
|
|
932
926
|
aThread.resume()
|
|
@@ -975,7 +969,8 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
975
969
|
super(HardwareBreakpoint, self).running(aProcess, aThread)
|
|
976
970
|
aThread.set_tf()
|
|
977
971
|
|
|
978
|
-
|
|
972
|
+
|
|
973
|
+
# ==============================================================================
|
|
979
974
|
|
|
980
975
|
# XXX FIXME
|
|
981
976
|
#
|
|
@@ -1010,7 +1005,8 @@ class HardwareBreakpoint (Breakpoint):
|
|
|
1010
1005
|
|
|
1011
1006
|
# TODO: an API to modify the hooked function's arguments
|
|
1012
1007
|
|
|
1013
|
-
|
|
1008
|
+
|
|
1009
|
+
class Hook(object):
|
|
1014
1010
|
"""
|
|
1015
1011
|
Factory class to produce hook objects. Used by L{Debug.hook_function} and
|
|
1016
1012
|
L{Debug.stalk_function}.
|
|
@@ -1034,8 +1030,8 @@ class Hook (object):
|
|
|
1034
1030
|
# the architecture specific implementation.
|
|
1035
1031
|
def __new__(cls, *argv, **argd):
|
|
1036
1032
|
try:
|
|
1037
|
-
arch = argd[
|
|
1038
|
-
del argd[
|
|
1033
|
+
arch = argd["arch"]
|
|
1034
|
+
del argd["arch"]
|
|
1039
1035
|
except KeyError:
|
|
1040
1036
|
try:
|
|
1041
1037
|
arch = argv[4]
|
|
@@ -1063,9 +1059,7 @@ class Hook (object):
|
|
|
1063
1059
|
#
|
|
1064
1060
|
useHardwareBreakpoints = False
|
|
1065
1061
|
|
|
1066
|
-
def __init__(self, preCB
|
|
1067
|
-
paramCount = None, signature = None,
|
|
1068
|
-
arch = None):
|
|
1062
|
+
def __init__(self, preCB=None, postCB=None, paramCount=None, signature=None, arch=None):
|
|
1069
1063
|
"""
|
|
1070
1064
|
@type preCB: function
|
|
1071
1065
|
@param preCB: (Optional) Callback triggered on function entry.
|
|
@@ -1122,9 +1116,9 @@ class Hook (object):
|
|
|
1122
1116
|
@param arch: (Optional) Target architecture. Defaults to the current
|
|
1123
1117
|
architecture. See: L{win32.arch}
|
|
1124
1118
|
"""
|
|
1125
|
-
self.__preCB
|
|
1126
|
-
self.__postCB
|
|
1127
|
-
self.__paramStack = dict()
|
|
1119
|
+
self.__preCB = preCB
|
|
1120
|
+
self.__postCB = postCB
|
|
1121
|
+
self.__paramStack = dict() # tid -> list of tuple( arg, arg, arg... )
|
|
1128
1122
|
|
|
1129
1123
|
self._paramCount = paramCount
|
|
1130
1124
|
|
|
@@ -1140,30 +1134,25 @@ class Hook (object):
|
|
|
1140
1134
|
self._signature = None
|
|
1141
1135
|
|
|
1142
1136
|
def _cast_signature_pointers_to_void(self, signature):
|
|
1143
|
-
c_void_p
|
|
1144
|
-
c_char_p
|
|
1137
|
+
c_void_p = ctypes.c_void_p
|
|
1138
|
+
c_char_p = ctypes.c_char_p
|
|
1145
1139
|
c_wchar_p = ctypes.c_wchar_p
|
|
1146
|
-
_Pointer
|
|
1147
|
-
cast
|
|
1140
|
+
_Pointer = ctypes._Pointer
|
|
1141
|
+
cast = ctypes.cast
|
|
1148
1142
|
for i in compat.xrange(len(signature)):
|
|
1149
1143
|
t = signature[i]
|
|
1150
|
-
if t is not c_void_p and (issubclass(t, _Pointer)
|
|
1151
|
-
or t in [c_char_p, c_wchar_p]):
|
|
1144
|
+
if t is not c_void_p and (issubclass(t, _Pointer) or t in [c_char_p, c_wchar_p]):
|
|
1152
1145
|
signature[i] = cast(t, c_void_p)
|
|
1153
1146
|
|
|
1154
1147
|
def _calc_signature(self, signature):
|
|
1155
|
-
raise NotImplementedError(
|
|
1156
|
-
"Hook signatures are not supported for architecture: %s" \
|
|
1157
|
-
% win32.arch)
|
|
1148
|
+
raise NotImplementedError("Hook signatures are not supported for architecture: %s" % win32.arch)
|
|
1158
1149
|
|
|
1159
1150
|
def _get_return_address(self, aProcess, aThread):
|
|
1160
1151
|
return None
|
|
1161
1152
|
|
|
1162
1153
|
def _get_function_arguments(self, aProcess, aThread):
|
|
1163
1154
|
if self._signature or self._paramCount:
|
|
1164
|
-
raise NotImplementedError(
|
|
1165
|
-
"Hook signatures are not supported for architecture: %s" \
|
|
1166
|
-
% win32.arch)
|
|
1155
|
+
raise NotImplementedError("Hook signatures are not supported for architecture: %s" % win32.arch)
|
|
1167
1156
|
return ()
|
|
1168
1157
|
|
|
1169
1158
|
def _get_return_value(self, aThread):
|
|
@@ -1188,12 +1177,12 @@ class Hook (object):
|
|
|
1188
1177
|
debug = event.debug
|
|
1189
1178
|
|
|
1190
1179
|
dwProcessId = event.get_pid()
|
|
1191
|
-
dwThreadId
|
|
1192
|
-
aProcess
|
|
1193
|
-
aThread
|
|
1180
|
+
dwThreadId = event.get_tid()
|
|
1181
|
+
aProcess = event.get_process()
|
|
1182
|
+
aThread = event.get_thread()
|
|
1194
1183
|
|
|
1195
1184
|
# Get the return address and function arguments.
|
|
1196
|
-
ra
|
|
1185
|
+
ra = self._get_return_address(aProcess, aThread)
|
|
1197
1186
|
params = self._get_function_arguments(aProcess, aThread)
|
|
1198
1187
|
|
|
1199
1188
|
# Keep the function arguments for later use.
|
|
@@ -1202,39 +1191,30 @@ class Hook (object):
|
|
|
1202
1191
|
# If we need to hook the return from the function...
|
|
1203
1192
|
bHookedReturn = False
|
|
1204
1193
|
if ra is not None and self.__postCB is not None:
|
|
1205
|
-
|
|
1206
1194
|
# Try to set a one shot hardware breakpoint at the return address.
|
|
1207
1195
|
useHardwareBreakpoints = self.useHardwareBreakpoints
|
|
1208
1196
|
if useHardwareBreakpoints:
|
|
1209
1197
|
try:
|
|
1210
1198
|
debug.define_hardware_breakpoint(
|
|
1211
|
-
dwThreadId,
|
|
1212
|
-
|
|
1213
|
-
event.debug.BP_BREAK_ON_EXECUTION,
|
|
1214
|
-
event.debug.BP_WATCH_BYTE,
|
|
1215
|
-
True,
|
|
1216
|
-
self.__postCallAction_hwbp
|
|
1217
|
-
)
|
|
1199
|
+
dwThreadId, ra, event.debug.BP_BREAK_ON_EXECUTION, event.debug.BP_WATCH_BYTE, True, self.__postCallAction_hwbp
|
|
1200
|
+
)
|
|
1218
1201
|
debug.enable_one_shot_hardware_breakpoint(dwThreadId, ra)
|
|
1219
1202
|
bHookedReturn = True
|
|
1220
1203
|
except Exception:
|
|
1221
1204
|
e = sys.exc_info()[1]
|
|
1222
1205
|
useHardwareBreakpoints = False
|
|
1223
|
-
msg =
|
|
1224
|
-
" at address %s for thread ID %d")
|
|
1206
|
+
msg = "Failed to set hardware breakpoint" " at address %s for thread ID %d"
|
|
1225
1207
|
msg = msg % (HexDump.address(ra), dwThreadId)
|
|
1226
1208
|
warnings.warn(msg, BreakpointWarning)
|
|
1227
1209
|
|
|
1228
1210
|
# If not possible, set a code breakpoint instead.
|
|
1229
1211
|
if not useHardwareBreakpoints:
|
|
1230
1212
|
try:
|
|
1231
|
-
debug.break_at(dwProcessId, ra,
|
|
1232
|
-
self.__postCallAction_codebp)
|
|
1213
|
+
debug.break_at(dwProcessId, ra, self.__postCallAction_codebp)
|
|
1233
1214
|
bHookedReturn = True
|
|
1234
1215
|
except Exception:
|
|
1235
1216
|
e = sys.exc_info()[1]
|
|
1236
|
-
msg =
|
|
1237
|
-
" at address %s for process ID %d")
|
|
1217
|
+
msg = "Failed to set code breakpoint" " at address %s for process ID %d"
|
|
1238
1218
|
msg = msg % (HexDump.address(ra), dwProcessId)
|
|
1239
1219
|
warnings.warn(msg, BreakpointWarning)
|
|
1240
1220
|
|
|
@@ -1257,7 +1237,7 @@ class Hook (object):
|
|
|
1257
1237
|
|
|
1258
1238
|
# Remove the one shot hardware breakpoint
|
|
1259
1239
|
# at the return address location in the stack.
|
|
1260
|
-
tid
|
|
1240
|
+
tid = event.get_tid()
|
|
1261
1241
|
address = event.breakpoint.get_address()
|
|
1262
1242
|
event.debug.erase_hardware_breakpoint(tid, address)
|
|
1263
1243
|
|
|
@@ -1288,7 +1268,7 @@ class Hook (object):
|
|
|
1288
1268
|
return True
|
|
1289
1269
|
|
|
1290
1270
|
# Remove the code breakpoint at the return address.
|
|
1291
|
-
pid
|
|
1271
|
+
pid = event.get_pid()
|
|
1292
1272
|
address = event.breakpoint.get_address()
|
|
1293
1273
|
event.debug.dont_break_at(pid, address)
|
|
1294
1274
|
|
|
@@ -1308,7 +1288,7 @@ class Hook (object):
|
|
|
1308
1288
|
@param event: Breakpoint hit event.
|
|
1309
1289
|
"""
|
|
1310
1290
|
aThread = event.get_thread()
|
|
1311
|
-
retval
|
|
1291
|
+
retval = self._get_return_value(aThread)
|
|
1312
1292
|
self.__callHandler(self.__postCB, event, retval)
|
|
1313
1293
|
|
|
1314
1294
|
def __callHandler(self, callback, event, *params):
|
|
@@ -1339,7 +1319,7 @@ class Hook (object):
|
|
|
1339
1319
|
@type params: tuple( arg, arg, arg... )
|
|
1340
1320
|
@param params: Tuple of arguments.
|
|
1341
1321
|
"""
|
|
1342
|
-
stack = self.__paramStack.get(
|
|
1322
|
+
stack = self.__paramStack.get(tid, [])
|
|
1343
1323
|
stack.append(params)
|
|
1344
1324
|
self.__paramStack[tid] = stack
|
|
1345
1325
|
|
|
@@ -1430,7 +1410,8 @@ class Hook (object):
|
|
|
1430
1410
|
"""
|
|
1431
1411
|
return debug.dont_break_at(pid, address)
|
|
1432
1412
|
|
|
1433
|
-
|
|
1413
|
+
|
|
1414
|
+
class _Hook_i386(Hook):
|
|
1434
1415
|
"""
|
|
1435
1416
|
Implementation details for L{Hook} on the L{win32.ARCH_I386} architecture.
|
|
1436
1417
|
"""
|
|
@@ -1440,30 +1421,30 @@ class _Hook_i386 (Hook):
|
|
|
1440
1421
|
|
|
1441
1422
|
def _calc_signature(self, signature):
|
|
1442
1423
|
self._cast_signature_pointers_to_void(signature)
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1424
|
+
|
|
1425
|
+
class Arguments(ctypes.Structure):
|
|
1426
|
+
_fields_ = [("arg_%s" % i, signature[i]) for i in compat.xrange(len(signature) - 1, -1, -1)]
|
|
1427
|
+
|
|
1446
1428
|
return Arguments
|
|
1447
1429
|
|
|
1448
1430
|
def _get_return_address(self, aProcess, aThread):
|
|
1449
|
-
return aProcess.read_pointer(
|
|
1431
|
+
return aProcess.read_pointer(aThread.get_sp())
|
|
1450
1432
|
|
|
1451
1433
|
def _get_function_arguments(self, aProcess, aThread):
|
|
1452
1434
|
if self._signature:
|
|
1453
|
-
params = aThread.read_stack_structure(self._signature,
|
|
1454
|
-
offset = win32.sizeof(win32.LPVOID))
|
|
1435
|
+
params = aThread.read_stack_structure(self._signature, offset=win32.sizeof(win32.LPVOID))
|
|
1455
1436
|
elif self._paramCount:
|
|
1456
|
-
params = aThread.read_stack_dwords(self._paramCount,
|
|
1457
|
-
offset = win32.sizeof(win32.LPVOID))
|
|
1437
|
+
params = aThread.read_stack_dwords(self._paramCount, offset=win32.sizeof(win32.LPVOID))
|
|
1458
1438
|
else:
|
|
1459
1439
|
params = ()
|
|
1460
1440
|
return params
|
|
1461
1441
|
|
|
1462
1442
|
def _get_return_value(self, aThread):
|
|
1463
1443
|
ctx = aThread.get_context(win32.CONTEXT_INTEGER)
|
|
1464
|
-
return ctx[
|
|
1444
|
+
return ctx["Eax"]
|
|
1465
1445
|
|
|
1466
|
-
|
|
1446
|
+
|
|
1447
|
+
class _Hook_amd64(Hook):
|
|
1467
1448
|
"""
|
|
1468
1449
|
Implementation details for L{Hook} on the L{win32.ARCH_AMD64} architecture.
|
|
1469
1450
|
"""
|
|
@@ -1486,67 +1467,60 @@ class _Hook_amd64 (Hook):
|
|
|
1486
1467
|
self._cast_signature_pointers_to_void(signature)
|
|
1487
1468
|
|
|
1488
1469
|
float_types = self.__float_types
|
|
1489
|
-
c_sizeof
|
|
1490
|
-
reg_size
|
|
1470
|
+
c_sizeof = ctypes.sizeof
|
|
1471
|
+
reg_size = c_sizeof(ctypes.c_size_t)
|
|
1491
1472
|
|
|
1492
|
-
reg_int_sig
|
|
1473
|
+
reg_int_sig = []
|
|
1493
1474
|
reg_float_sig = []
|
|
1494
|
-
stack_sig
|
|
1475
|
+
stack_sig = []
|
|
1495
1476
|
|
|
1496
1477
|
for i in compat.xrange(len(signature)):
|
|
1497
|
-
arg
|
|
1478
|
+
arg = signature[i]
|
|
1498
1479
|
name = "arg_%d" % i
|
|
1499
|
-
stack_sig.insert(
|
|
1480
|
+
stack_sig.insert(0, (name, arg))
|
|
1500
1481
|
if i < 4:
|
|
1501
1482
|
if type(arg) in float_types:
|
|
1502
|
-
reg_float_sig.append(
|
|
1483
|
+
reg_float_sig.append((name, arg))
|
|
1503
1484
|
elif c_sizeof(arg) <= reg_size:
|
|
1504
|
-
reg_int_sig.append(
|
|
1485
|
+
reg_int_sig.append((name, arg))
|
|
1505
1486
|
else:
|
|
1506
|
-
msg = (
|
|
1507
|
-
|
|
1508
|
-
|
|
1487
|
+
msg = (
|
|
1488
|
+
"Hook signatures don't support structures" " within the first 4 arguments of a function" " for the %s architecture"
|
|
1489
|
+
) % win32.arch
|
|
1509
1490
|
raise NotImplementedError(msg)
|
|
1510
1491
|
|
|
1511
1492
|
if reg_int_sig:
|
|
1512
|
-
|
|
1493
|
+
|
|
1494
|
+
class RegisterArguments(ctypes.Structure):
|
|
1513
1495
|
_fields_ = reg_int_sig
|
|
1514
1496
|
else:
|
|
1515
1497
|
RegisterArguments = None
|
|
1516
1498
|
if reg_float_sig:
|
|
1517
|
-
|
|
1499
|
+
|
|
1500
|
+
class FloatArguments(ctypes.Structure):
|
|
1518
1501
|
_fields_ = reg_float_sig
|
|
1519
1502
|
else:
|
|
1520
1503
|
FloatArguments = None
|
|
1521
1504
|
if stack_sig:
|
|
1522
|
-
|
|
1505
|
+
|
|
1506
|
+
class StackArguments(ctypes.Structure):
|
|
1523
1507
|
_fields_ = stack_sig
|
|
1524
1508
|
else:
|
|
1525
1509
|
StackArguments = None
|
|
1526
1510
|
|
|
1527
|
-
return (len(signature),
|
|
1528
|
-
RegisterArguments,
|
|
1529
|
-
FloatArguments,
|
|
1530
|
-
StackArguments)
|
|
1511
|
+
return (len(signature), RegisterArguments, FloatArguments, StackArguments)
|
|
1531
1512
|
|
|
1532
1513
|
def _get_return_address(self, aProcess, aThread):
|
|
1533
|
-
return aProcess.read_pointer(
|
|
1514
|
+
return aProcess.read_pointer(aThread.get_sp())
|
|
1534
1515
|
|
|
1535
1516
|
def _get_function_arguments(self, aProcess, aThread):
|
|
1536
1517
|
if self._signature:
|
|
1537
|
-
(args_count,
|
|
1538
|
-
RegisterArguments,
|
|
1539
|
-
FloatArguments,
|
|
1540
|
-
StackArguments) = self._signature
|
|
1518
|
+
(args_count, RegisterArguments, FloatArguments, StackArguments) = self._signature
|
|
1541
1519
|
arguments = {}
|
|
1542
1520
|
if StackArguments:
|
|
1543
1521
|
address = aThread.get_sp() + win32.sizeof(win32.LPVOID)
|
|
1544
|
-
stack_struct = aProcess.read_structure(address,
|
|
1545
|
-
|
|
1546
|
-
stack_args = dict(
|
|
1547
|
-
[ (name, stack_struct.__getattribute__(name))
|
|
1548
|
-
for (name, type) in stack_struct._fields_ ]
|
|
1549
|
-
)
|
|
1522
|
+
stack_struct = aProcess.read_structure(address, StackArguments)
|
|
1523
|
+
stack_args = dict([(name, stack_struct.__getattribute__(name)) for (name, type) in stack_struct._fields_])
|
|
1550
1524
|
arguments.update(stack_args)
|
|
1551
1525
|
flags = 0
|
|
1552
1526
|
if RegisterArguments:
|
|
@@ -1556,43 +1530,37 @@ class _Hook_amd64 (Hook):
|
|
|
1556
1530
|
if flags:
|
|
1557
1531
|
ctx = aThread.get_context(flags)
|
|
1558
1532
|
if RegisterArguments:
|
|
1559
|
-
buffer = (win32.QWORD * 4)(ctx[
|
|
1560
|
-
|
|
1561
|
-
reg_args = self._get_arguments_from_buffer(buffer,
|
|
1562
|
-
RegisterArguments)
|
|
1533
|
+
buffer = (win32.QWORD * 4)(ctx["Rcx"], ctx["Rdx"], ctx["R8"], ctx["R9"])
|
|
1534
|
+
reg_args = self._get_arguments_from_buffer(buffer, RegisterArguments)
|
|
1563
1535
|
arguments.update(reg_args)
|
|
1564
1536
|
if FloatArguments:
|
|
1565
|
-
buffer = (win32.M128A * 4)(ctx[
|
|
1566
|
-
|
|
1567
|
-
float_args = self._get_arguments_from_buffer(buffer,
|
|
1568
|
-
FloatArguments)
|
|
1537
|
+
buffer = (win32.M128A * 4)(ctx["XMM0"], ctx["XMM1"], ctx["XMM2"], ctx["XMM3"])
|
|
1538
|
+
float_args = self._get_arguments_from_buffer(buffer, FloatArguments)
|
|
1569
1539
|
arguments.update(float_args)
|
|
1570
|
-
params = tuple(
|
|
1571
|
-
for i in compat.xrange(args_count) ] )
|
|
1540
|
+
params = tuple([arguments["arg_%d" % i] for i in compat.xrange(args_count)])
|
|
1572
1541
|
else:
|
|
1573
1542
|
params = ()
|
|
1574
1543
|
return params
|
|
1575
1544
|
|
|
1576
1545
|
def _get_arguments_from_buffer(self, buffer, structure):
|
|
1577
|
-
b_ptr
|
|
1578
|
-
v_ptr
|
|
1579
|
-
s_ptr
|
|
1546
|
+
b_ptr = ctypes.pointer(buffer)
|
|
1547
|
+
v_ptr = ctypes.cast(b_ptr, ctypes.c_void_p)
|
|
1548
|
+
s_ptr = ctypes.cast(v_ptr, ctypes.POINTER(structure))
|
|
1580
1549
|
struct = s_ptr.contents
|
|
1581
|
-
return dict(
|
|
1582
|
-
[ (name, struct.__getattribute__(name))
|
|
1583
|
-
for (name, type) in struct._fields_ ]
|
|
1584
|
-
)
|
|
1550
|
+
return dict([(name, struct.__getattribute__(name)) for (name, type) in struct._fields_])
|
|
1585
1551
|
|
|
1586
1552
|
def _get_return_value(self, aThread):
|
|
1587
1553
|
ctx = aThread.get_context(win32.CONTEXT_INTEGER)
|
|
1588
|
-
return ctx[
|
|
1554
|
+
return ctx["Rax"]
|
|
1555
|
+
|
|
1589
1556
|
|
|
1590
|
-
|
|
1557
|
+
# ------------------------------------------------------------------------------
|
|
1591
1558
|
|
|
1592
1559
|
# This class acts as a factory of Hook objects, one per target process.
|
|
1593
1560
|
# Said objects are deleted by the unhook() method.
|
|
1594
1561
|
|
|
1595
|
-
|
|
1562
|
+
|
|
1563
|
+
class ApiHook(object):
|
|
1596
1564
|
"""
|
|
1597
1565
|
Used by L{EventHandler}.
|
|
1598
1566
|
|
|
@@ -1610,8 +1578,7 @@ class ApiHook (object):
|
|
|
1610
1578
|
@ivar procName: Procedure name.
|
|
1611
1579
|
"""
|
|
1612
1580
|
|
|
1613
|
-
def __init__(self, eventHandler, modName, procName, paramCount =
|
|
1614
|
-
signature = None):
|
|
1581
|
+
def __init__(self, eventHandler, modName, procName, paramCount=None, signature=None):
|
|
1615
1582
|
"""
|
|
1616
1583
|
@type eventHandler: L{EventHandler}
|
|
1617
1584
|
@param eventHandler: Event handler instance. This is where the hook
|
|
@@ -1670,13 +1637,13 @@ class ApiHook (object):
|
|
|
1670
1637
|
be used to parse the arguments from the stack. Overrides the
|
|
1671
1638
|
C{paramCount} argument.
|
|
1672
1639
|
"""
|
|
1673
|
-
self.__modName
|
|
1674
|
-
self.__procName
|
|
1640
|
+
self.__modName = modName
|
|
1641
|
+
self.__procName = procName
|
|
1675
1642
|
self.__paramCount = paramCount
|
|
1676
|
-
self.__signature
|
|
1677
|
-
self.__preCB
|
|
1678
|
-
self.__postCB
|
|
1679
|
-
self.__hook
|
|
1643
|
+
self.__signature = signature
|
|
1644
|
+
self.__preCB = getattr(eventHandler, "pre_%s" % procName, None)
|
|
1645
|
+
self.__postCB = getattr(eventHandler, "post_%s" % procName, None)
|
|
1646
|
+
self.__hook = dict()
|
|
1680
1647
|
|
|
1681
1648
|
def __call__(self, event):
|
|
1682
1649
|
"""
|
|
@@ -1691,9 +1658,7 @@ class ApiHook (object):
|
|
|
1691
1658
|
try:
|
|
1692
1659
|
hook = self.__hook[pid]
|
|
1693
1660
|
except KeyError:
|
|
1694
|
-
hook = Hook(self.__preCB, self.__postCB,
|
|
1695
|
-
self.__paramCount, self.__signature,
|
|
1696
|
-
event.get_process().get_arch() )
|
|
1661
|
+
hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, event.get_process().get_arch())
|
|
1697
1662
|
self.__hook[pid] = hook
|
|
1698
1663
|
return hook(event)
|
|
1699
1664
|
|
|
@@ -1725,9 +1690,7 @@ class ApiHook (object):
|
|
|
1725
1690
|
aProcess = debug.system.get_process(pid)
|
|
1726
1691
|
except KeyError:
|
|
1727
1692
|
aProcess = Process(pid)
|
|
1728
|
-
hook = Hook(self.__preCB, self.__postCB,
|
|
1729
|
-
self.__paramCount, self.__signature,
|
|
1730
|
-
aProcess.get_arch() )
|
|
1693
|
+
hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, aProcess.get_arch())
|
|
1731
1694
|
self.__hook[pid] = hook
|
|
1732
1695
|
hook.hook(debug, pid, label)
|
|
1733
1696
|
|
|
@@ -1751,9 +1714,11 @@ class ApiHook (object):
|
|
|
1751
1714
|
hook.unhook(debug, pid, label)
|
|
1752
1715
|
del self.__hook[pid]
|
|
1753
1716
|
|
|
1754
|
-
#==============================================================================
|
|
1755
1717
|
|
|
1756
|
-
|
|
1718
|
+
# ==============================================================================
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
class BufferWatch(object):
|
|
1757
1722
|
"""
|
|
1758
1723
|
Returned by L{Debug.watch_buffer}.
|
|
1759
1724
|
|
|
@@ -1776,11 +1741,11 @@ class BufferWatch (object):
|
|
|
1776
1741
|
@ivar oneshot: C{True} for one shot breakpoints, C{False} otherwise.
|
|
1777
1742
|
"""
|
|
1778
1743
|
|
|
1779
|
-
def __init__(self, pid, start, end, action
|
|
1780
|
-
self.__pid
|
|
1781
|
-
self.__start
|
|
1782
|
-
self.__end
|
|
1783
|
-
self.__action
|
|
1744
|
+
def __init__(self, pid, start, end, action=None, oneshot=False):
|
|
1745
|
+
self.__pid = pid
|
|
1746
|
+
self.__start = start
|
|
1747
|
+
self.__end = end
|
|
1748
|
+
self.__action = action
|
|
1784
1749
|
self.__oneshot = oneshot
|
|
1785
1750
|
|
|
1786
1751
|
@property
|
|
@@ -1813,9 +1778,11 @@ class BufferWatch (object):
|
|
|
1813
1778
|
"""
|
|
1814
1779
|
return self.__start <= address < self.__end
|
|
1815
1780
|
|
|
1816
|
-
#==============================================================================
|
|
1817
1781
|
|
|
1818
|
-
|
|
1782
|
+
# ==============================================================================
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
class _BufferWatchCondition(object):
|
|
1819
1786
|
"""
|
|
1820
1787
|
Used by L{Debug.watch_buffer}.
|
|
1821
1788
|
|
|
@@ -1873,7 +1840,7 @@ class _BufferWatchCondition (object):
|
|
|
1873
1840
|
"""
|
|
1874
1841
|
count = 0
|
|
1875
1842
|
start = address
|
|
1876
|
-
end
|
|
1843
|
+
end = address + size - 1
|
|
1877
1844
|
matched = None
|
|
1878
1845
|
for item in self.__ranges:
|
|
1879
1846
|
if item.match(start) and item.match(end):
|
|
@@ -1904,7 +1871,7 @@ class _BufferWatchCondition (object):
|
|
|
1904
1871
|
to at least one of the buffers that was being watched
|
|
1905
1872
|
and had no action callback.
|
|
1906
1873
|
"""
|
|
1907
|
-
address
|
|
1874
|
+
address = event.get_exception_information(1)
|
|
1908
1875
|
bCondition = False
|
|
1909
1876
|
for bw in self.__ranges:
|
|
1910
1877
|
bMatched = bw.match(address)
|
|
@@ -1915,8 +1882,7 @@ class _BufferWatchCondition (object):
|
|
|
1915
1882
|
action(event)
|
|
1916
1883
|
except Exception:
|
|
1917
1884
|
e = sys.exc_info()[1]
|
|
1918
|
-
msg =
|
|
1919
|
-
" raised an exception: %s")
|
|
1885
|
+
msg = "Breakpoint action callback %r" " raised an exception: %s"
|
|
1920
1886
|
msg = msg % (action, traceback.format_exc(e))
|
|
1921
1887
|
warnings.warn(msg, BreakpointCallbackWarning)
|
|
1922
1888
|
else:
|
|
@@ -1926,9 +1892,11 @@ class _BufferWatchCondition (object):
|
|
|
1926
1892
|
event.debug.dont_watch_buffer(bw)
|
|
1927
1893
|
return bCondition
|
|
1928
1894
|
|
|
1929
|
-
#==============================================================================
|
|
1930
1895
|
|
|
1931
|
-
|
|
1896
|
+
# ==============================================================================
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
class _BreakpointContainer(object):
|
|
1932
1900
|
"""
|
|
1933
1901
|
Encapsulates the capability to contain Breakpoint objects.
|
|
1934
1902
|
|
|
@@ -2034,37 +2002,37 @@ class _BreakpointContainer (object):
|
|
|
2034
2002
|
"""
|
|
2035
2003
|
|
|
2036
2004
|
# Breakpoint types
|
|
2037
|
-
BP_TYPE_ANY
|
|
2038
|
-
BP_TYPE_CODE
|
|
2039
|
-
BP_TYPE_PAGE
|
|
2040
|
-
BP_TYPE_HARDWARE
|
|
2005
|
+
BP_TYPE_ANY = 0 # to get all breakpoints
|
|
2006
|
+
BP_TYPE_CODE = 1
|
|
2007
|
+
BP_TYPE_PAGE = 2
|
|
2008
|
+
BP_TYPE_HARDWARE = 3
|
|
2041
2009
|
|
|
2042
2010
|
# Breakpoint states
|
|
2043
|
-
BP_STATE_DISABLED
|
|
2044
|
-
BP_STATE_ENABLED
|
|
2045
|
-
BP_STATE_ONESHOT
|
|
2046
|
-
BP_STATE_RUNNING
|
|
2011
|
+
BP_STATE_DISABLED = Breakpoint.DISABLED
|
|
2012
|
+
BP_STATE_ENABLED = Breakpoint.ENABLED
|
|
2013
|
+
BP_STATE_ONESHOT = Breakpoint.ONESHOT
|
|
2014
|
+
BP_STATE_RUNNING = Breakpoint.RUNNING
|
|
2047
2015
|
|
|
2048
2016
|
# Memory breakpoint trigger flags
|
|
2049
|
-
BP_BREAK_ON_EXECUTION
|
|
2050
|
-
BP_BREAK_ON_WRITE
|
|
2051
|
-
BP_BREAK_ON_ACCESS
|
|
2017
|
+
BP_BREAK_ON_EXECUTION = HardwareBreakpoint.BREAK_ON_EXECUTION
|
|
2018
|
+
BP_BREAK_ON_WRITE = HardwareBreakpoint.BREAK_ON_WRITE
|
|
2019
|
+
BP_BREAK_ON_ACCESS = HardwareBreakpoint.BREAK_ON_ACCESS
|
|
2052
2020
|
|
|
2053
2021
|
# Memory breakpoint size flags
|
|
2054
|
-
BP_WATCH_BYTE
|
|
2055
|
-
BP_WATCH_WORD
|
|
2056
|
-
BP_WATCH_QWORD
|
|
2057
|
-
BP_WATCH_DWORD
|
|
2022
|
+
BP_WATCH_BYTE = HardwareBreakpoint.WATCH_BYTE
|
|
2023
|
+
BP_WATCH_WORD = HardwareBreakpoint.WATCH_WORD
|
|
2024
|
+
BP_WATCH_QWORD = HardwareBreakpoint.WATCH_QWORD
|
|
2025
|
+
BP_WATCH_DWORD = HardwareBreakpoint.WATCH_DWORD
|
|
2058
2026
|
|
|
2059
2027
|
def __init__(self):
|
|
2060
|
-
self.__codeBP
|
|
2061
|
-
self.__pageBP
|
|
2062
|
-
self.__hardwareBP
|
|
2063
|
-
self.__runningBP
|
|
2064
|
-
self.__tracing
|
|
2065
|
-
self.__deferredBP
|
|
2028
|
+
self.__codeBP = dict() # (pid, address) -> CodeBreakpoint
|
|
2029
|
+
self.__pageBP = dict() # (pid, address) -> PageBreakpoint
|
|
2030
|
+
self.__hardwareBP = dict() # tid -> [ HardwareBreakpoint ]
|
|
2031
|
+
self.__runningBP = dict() # tid -> set( Breakpoint )
|
|
2032
|
+
self.__tracing = set() # set( tid )
|
|
2033
|
+
self.__deferredBP = dict() # pid -> label -> (action, oneshot)
|
|
2066
2034
|
|
|
2067
|
-
|
|
2035
|
+
# ------------------------------------------------------------------------------
|
|
2068
2036
|
|
|
2069
2037
|
# This operates on the dictionary of running breakpoints.
|
|
2070
2038
|
# Since the bps are meant to stay alive no cleanup is done here.
|
|
@@ -2087,12 +2055,12 @@ class _BreakpointContainer (object):
|
|
|
2087
2055
|
|
|
2088
2056
|
def __del_running_bp_from_all_threads(self, bp):
|
|
2089
2057
|
"Auxiliary method."
|
|
2090
|
-
for
|
|
2058
|
+
for tid, bpset in compat.iteritems(self.__runningBP):
|
|
2091
2059
|
if bp in bpset:
|
|
2092
2060
|
bpset.remove(bp)
|
|
2093
2061
|
self.system.get_thread(tid).clear_tf()
|
|
2094
2062
|
|
|
2095
|
-
|
|
2063
|
+
# ------------------------------------------------------------------------------
|
|
2096
2064
|
|
|
2097
2065
|
# This is the cleanup code. Mostly called on response to exit/unload debug
|
|
2098
2066
|
# events. If possible it shouldn't raise exceptions on runtime errors.
|
|
@@ -2102,12 +2070,12 @@ class _BreakpointContainer (object):
|
|
|
2102
2070
|
"Auxiliary method."
|
|
2103
2071
|
try:
|
|
2104
2072
|
process = event.get_process()
|
|
2105
|
-
thread
|
|
2106
|
-
bp.disable(process, thread)
|
|
2073
|
+
thread = event.get_thread()
|
|
2074
|
+
bp.disable(process, thread) # clear the debug regs / trap flag
|
|
2107
2075
|
except Exception:
|
|
2108
2076
|
pass
|
|
2109
2077
|
bp.set_condition(True) # break possible circular reference
|
|
2110
|
-
bp.set_action(None)
|
|
2078
|
+
bp.set_action(None) # break possible circular reference
|
|
2111
2079
|
|
|
2112
2080
|
def __cleanup_thread(self, event):
|
|
2113
2081
|
"""
|
|
@@ -2140,22 +2108,22 @@ class _BreakpointContainer (object):
|
|
|
2140
2108
|
"""
|
|
2141
2109
|
Auxiliary method for L{_notify_exit_process}.
|
|
2142
2110
|
"""
|
|
2143
|
-
pid
|
|
2111
|
+
pid = event.get_pid()
|
|
2144
2112
|
process = event.get_process()
|
|
2145
2113
|
|
|
2146
2114
|
# Cleanup code breakpoints
|
|
2147
|
-
for
|
|
2115
|
+
for bp_pid, bp_address in compat.keys(self.__codeBP):
|
|
2148
2116
|
if bp_pid == pid:
|
|
2149
|
-
bp = self.__codeBP[
|
|
2117
|
+
bp = self.__codeBP[(bp_pid, bp_address)]
|
|
2150
2118
|
self.__cleanup_breakpoint(event, bp)
|
|
2151
|
-
del self.__codeBP[
|
|
2119
|
+
del self.__codeBP[(bp_pid, bp_address)]
|
|
2152
2120
|
|
|
2153
2121
|
# Cleanup page breakpoints
|
|
2154
|
-
for
|
|
2122
|
+
for bp_pid, bp_address in compat.keys(self.__pageBP):
|
|
2155
2123
|
if bp_pid == pid:
|
|
2156
|
-
bp = self.__pageBP[
|
|
2124
|
+
bp = self.__pageBP[(bp_pid, bp_address)]
|
|
2157
2125
|
self.__cleanup_breakpoint(event, bp)
|
|
2158
|
-
del self.__pageBP[
|
|
2126
|
+
del self.__pageBP[(bp_pid, bp_address)]
|
|
2159
2127
|
|
|
2160
2128
|
# Cleanup deferred code breakpoints
|
|
2161
2129
|
try:
|
|
@@ -2167,9 +2135,9 @@ class _BreakpointContainer (object):
|
|
|
2167
2135
|
"""
|
|
2168
2136
|
Auxiliary method for L{_notify_unload_dll}.
|
|
2169
2137
|
"""
|
|
2170
|
-
pid
|
|
2138
|
+
pid = event.get_pid()
|
|
2171
2139
|
process = event.get_process()
|
|
2172
|
-
module
|
|
2140
|
+
module = event.get_module()
|
|
2173
2141
|
|
|
2174
2142
|
# Cleanup thread breakpoints on this module
|
|
2175
2143
|
for tid in process.iter_thread_ids():
|
|
@@ -2194,28 +2162,27 @@ class _BreakpointContainer (object):
|
|
|
2194
2162
|
self.__hardwareBP[tid].remove(bp)
|
|
2195
2163
|
|
|
2196
2164
|
# Cleanup code breakpoints on this module
|
|
2197
|
-
for
|
|
2165
|
+
for bp_pid, bp_address in compat.keys(self.__codeBP):
|
|
2198
2166
|
if bp_pid == pid:
|
|
2199
2167
|
if process.get_module_at_address(bp_address) == module:
|
|
2200
|
-
bp = self.__codeBP[
|
|
2168
|
+
bp = self.__codeBP[(bp_pid, bp_address)]
|
|
2201
2169
|
self.__cleanup_breakpoint(event, bp)
|
|
2202
|
-
del self.__codeBP[
|
|
2170
|
+
del self.__codeBP[(bp_pid, bp_address)]
|
|
2203
2171
|
|
|
2204
2172
|
# Cleanup page breakpoints on this module
|
|
2205
|
-
for
|
|
2173
|
+
for bp_pid, bp_address in compat.keys(self.__pageBP):
|
|
2206
2174
|
if bp_pid == pid:
|
|
2207
2175
|
if process.get_module_at_address(bp_address) == module:
|
|
2208
|
-
bp = self.__pageBP[
|
|
2176
|
+
bp = self.__pageBP[(bp_pid, bp_address)]
|
|
2209
2177
|
self.__cleanup_breakpoint(event, bp)
|
|
2210
|
-
del self.__pageBP[
|
|
2178
|
+
del self.__pageBP[(bp_pid, bp_address)]
|
|
2211
2179
|
|
|
2212
|
-
|
|
2180
|
+
# ------------------------------------------------------------------------------
|
|
2213
2181
|
|
|
2214
2182
|
# Defining breakpoints.
|
|
2215
2183
|
|
|
2216
2184
|
# Code breakpoints.
|
|
2217
|
-
def define_code_breakpoint(self, dwProcessId, address,
|
|
2218
|
-
action = None):
|
|
2185
|
+
def define_code_breakpoint(self, dwProcessId, address, condition=True, action=None):
|
|
2219
2186
|
"""
|
|
2220
2187
|
Creates a disabled code breakpoint at the given address.
|
|
2221
2188
|
|
|
@@ -2273,9 +2240,7 @@ class _BreakpointContainer (object):
|
|
|
2273
2240
|
return bp
|
|
2274
2241
|
|
|
2275
2242
|
# Page breakpoints.
|
|
2276
|
-
def define_page_breakpoint(self, dwProcessId, address,
|
|
2277
|
-
condition = True,
|
|
2278
|
-
action = None):
|
|
2243
|
+
def define_page_breakpoint(self, dwProcessId, address, pages=1, condition=True, action=None):
|
|
2279
2244
|
"""
|
|
2280
2245
|
Creates a disabled page breakpoint at the given address.
|
|
2281
2246
|
|
|
@@ -2326,11 +2291,11 @@ class _BreakpointContainer (object):
|
|
|
2326
2291
|
@return: The page breakpoint object.
|
|
2327
2292
|
"""
|
|
2328
2293
|
process = self.system.get_process(dwProcessId)
|
|
2329
|
-
bp
|
|
2330
|
-
begin
|
|
2331
|
-
end
|
|
2294
|
+
bp = PageBreakpoint(address, pages, condition, action)
|
|
2295
|
+
begin = bp.get_address()
|
|
2296
|
+
end = begin + bp.get_size()
|
|
2332
2297
|
|
|
2333
|
-
address
|
|
2298
|
+
address = begin
|
|
2334
2299
|
pageSize = MemoryAddresses.pageSize
|
|
2335
2300
|
while address < end:
|
|
2336
2301
|
key = (dwProcessId, address)
|
|
@@ -2348,11 +2313,9 @@ class _BreakpointContainer (object):
|
|
|
2348
2313
|
return bp
|
|
2349
2314
|
|
|
2350
2315
|
# Hardware breakpoints.
|
|
2351
|
-
def define_hardware_breakpoint(
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
condition = True,
|
|
2355
|
-
action = None):
|
|
2316
|
+
def define_hardware_breakpoint(
|
|
2317
|
+
self, dwThreadId, address, triggerFlag=BP_BREAK_ON_ACCESS, sizeFlag=BP_WATCH_DWORD, condition=True, action=None
|
|
2318
|
+
):
|
|
2356
2319
|
"""
|
|
2357
2320
|
Creates a disabled hardware breakpoint at the given address.
|
|
2358
2321
|
|
|
@@ -2437,19 +2400,17 @@ class _BreakpointContainer (object):
|
|
|
2437
2400
|
@rtype: L{HardwareBreakpoint}
|
|
2438
2401
|
@return: The hardware breakpoint object.
|
|
2439
2402
|
"""
|
|
2440
|
-
thread
|
|
2441
|
-
bp
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
end = begin + bp.get_size()
|
|
2403
|
+
thread = self.system.get_thread(dwThreadId)
|
|
2404
|
+
bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition, action)
|
|
2405
|
+
begin = bp.get_address()
|
|
2406
|
+
end = begin + bp.get_size()
|
|
2445
2407
|
|
|
2446
2408
|
if dwThreadId in self.__hardwareBP:
|
|
2447
2409
|
bpSet = self.__hardwareBP[dwThreadId]
|
|
2448
2410
|
for oldbp in bpSet:
|
|
2449
2411
|
old_begin = oldbp.get_address()
|
|
2450
|
-
old_end
|
|
2451
|
-
if MemoryAddresses.do_ranges_intersect(begin, end, old_begin,
|
|
2452
|
-
old_end):
|
|
2412
|
+
old_end = old_begin + oldbp.get_size()
|
|
2413
|
+
if MemoryAddresses.do_ranges_intersect(begin, end, old_begin, old_end):
|
|
2453
2414
|
msg = "Already exists (TID %d) : %r" % (dwThreadId, oldbp)
|
|
2454
2415
|
raise KeyError(msg)
|
|
2455
2416
|
else:
|
|
@@ -2458,7 +2419,7 @@ class _BreakpointContainer (object):
|
|
|
2458
2419
|
bpSet.add(bp)
|
|
2459
2420
|
return bp
|
|
2460
2421
|
|
|
2461
|
-
|
|
2422
|
+
# ------------------------------------------------------------------------------
|
|
2462
2423
|
|
|
2463
2424
|
# Checking breakpoint definitions.
|
|
2464
2425
|
|
|
@@ -2536,7 +2497,7 @@ class _BreakpointContainer (object):
|
|
|
2536
2497
|
return True
|
|
2537
2498
|
return False
|
|
2538
2499
|
|
|
2539
|
-
|
|
2500
|
+
# ------------------------------------------------------------------------------
|
|
2540
2501
|
|
|
2541
2502
|
# Getting breakpoints.
|
|
2542
2503
|
|
|
@@ -2639,7 +2600,7 @@ class _BreakpointContainer (object):
|
|
|
2639
2600
|
msg = "No hardware breakpoint at thread %d, address %s"
|
|
2640
2601
|
raise KeyError(msg % (dwThreadId, HexDump.address(address)))
|
|
2641
2602
|
|
|
2642
|
-
|
|
2603
|
+
# ------------------------------------------------------------------------------
|
|
2643
2604
|
|
|
2644
2605
|
# Enabling and disabling breakpoints.
|
|
2645
2606
|
|
|
@@ -2660,11 +2621,11 @@ class _BreakpointContainer (object):
|
|
|
2660
2621
|
@type address: int
|
|
2661
2622
|
@param address: Memory address of breakpoint.
|
|
2662
2623
|
"""
|
|
2663
|
-
p
|
|
2624
|
+
p = self.system.get_process(dwProcessId)
|
|
2664
2625
|
bp = self.get_code_breakpoint(dwProcessId, address)
|
|
2665
2626
|
if bp.is_running():
|
|
2666
2627
|
self.__del_running_bp_from_all_threads(bp)
|
|
2667
|
-
bp.enable(p, None)
|
|
2628
|
+
bp.enable(p, None) # XXX HACK thread is not used
|
|
2668
2629
|
|
|
2669
2630
|
def enable_page_breakpoint(self, dwProcessId, address):
|
|
2670
2631
|
"""
|
|
@@ -2684,11 +2645,11 @@ class _BreakpointContainer (object):
|
|
|
2684
2645
|
@type address: int
|
|
2685
2646
|
@param address: Memory address of breakpoint.
|
|
2686
2647
|
"""
|
|
2687
|
-
p
|
|
2648
|
+
p = self.system.get_process(dwProcessId)
|
|
2688
2649
|
bp = self.get_page_breakpoint(dwProcessId, address)
|
|
2689
2650
|
if bp.is_running():
|
|
2690
2651
|
self.__del_running_bp_from_all_threads(bp)
|
|
2691
|
-
bp.enable(p, None)
|
|
2652
|
+
bp.enable(p, None) # XXX HACK thread is not used
|
|
2692
2653
|
|
|
2693
2654
|
def enable_hardware_breakpoint(self, dwThreadId, address):
|
|
2694
2655
|
"""
|
|
@@ -2711,11 +2672,11 @@ class _BreakpointContainer (object):
|
|
|
2711
2672
|
@type address: int
|
|
2712
2673
|
@param address: Memory address of breakpoint.
|
|
2713
2674
|
"""
|
|
2714
|
-
t
|
|
2675
|
+
t = self.system.get_thread(dwThreadId)
|
|
2715
2676
|
bp = self.get_hardware_breakpoint(dwThreadId, address)
|
|
2716
2677
|
if bp.is_running():
|
|
2717
2678
|
self.__del_running_bp_from_all_threads(bp)
|
|
2718
|
-
bp.enable(None, t)
|
|
2679
|
+
bp.enable(None, t) # XXX HACK process is not used
|
|
2719
2680
|
|
|
2720
2681
|
def enable_one_shot_code_breakpoint(self, dwProcessId, address):
|
|
2721
2682
|
"""
|
|
@@ -2735,11 +2696,11 @@ class _BreakpointContainer (object):
|
|
|
2735
2696
|
@type address: int
|
|
2736
2697
|
@param address: Memory address of breakpoint.
|
|
2737
2698
|
"""
|
|
2738
|
-
p
|
|
2699
|
+
p = self.system.get_process(dwProcessId)
|
|
2739
2700
|
bp = self.get_code_breakpoint(dwProcessId, address)
|
|
2740
2701
|
if bp.is_running():
|
|
2741
2702
|
self.__del_running_bp_from_all_threads(bp)
|
|
2742
|
-
bp.one_shot(p, None)
|
|
2703
|
+
bp.one_shot(p, None) # XXX HACK thread is not used
|
|
2743
2704
|
|
|
2744
2705
|
def enable_one_shot_page_breakpoint(self, dwProcessId, address):
|
|
2745
2706
|
"""
|
|
@@ -2759,11 +2720,11 @@ class _BreakpointContainer (object):
|
|
|
2759
2720
|
@type address: int
|
|
2760
2721
|
@param address: Memory address of breakpoint.
|
|
2761
2722
|
"""
|
|
2762
|
-
p
|
|
2723
|
+
p = self.system.get_process(dwProcessId)
|
|
2763
2724
|
bp = self.get_page_breakpoint(dwProcessId, address)
|
|
2764
2725
|
if bp.is_running():
|
|
2765
2726
|
self.__del_running_bp_from_all_threads(bp)
|
|
2766
|
-
bp.one_shot(p, None)
|
|
2727
|
+
bp.one_shot(p, None) # XXX HACK thread is not used
|
|
2767
2728
|
|
|
2768
2729
|
def enable_one_shot_hardware_breakpoint(self, dwThreadId, address):
|
|
2769
2730
|
"""
|
|
@@ -2783,11 +2744,11 @@ class _BreakpointContainer (object):
|
|
|
2783
2744
|
@type address: int
|
|
2784
2745
|
@param address: Memory address of breakpoint.
|
|
2785
2746
|
"""
|
|
2786
|
-
t
|
|
2747
|
+
t = self.system.get_thread(dwThreadId)
|
|
2787
2748
|
bp = self.get_hardware_breakpoint(dwThreadId, address)
|
|
2788
2749
|
if bp.is_running():
|
|
2789
2750
|
self.__del_running_bp_from_all_threads(bp)
|
|
2790
|
-
bp.one_shot(None, t)
|
|
2751
|
+
bp.one_shot(None, t) # XXX HACK process is not used
|
|
2791
2752
|
|
|
2792
2753
|
def disable_code_breakpoint(self, dwProcessId, address):
|
|
2793
2754
|
"""
|
|
@@ -2807,11 +2768,11 @@ class _BreakpointContainer (object):
|
|
|
2807
2768
|
@type address: int
|
|
2808
2769
|
@param address: Memory address of breakpoint.
|
|
2809
2770
|
"""
|
|
2810
|
-
p
|
|
2771
|
+
p = self.system.get_process(dwProcessId)
|
|
2811
2772
|
bp = self.get_code_breakpoint(dwProcessId, address)
|
|
2812
2773
|
if bp.is_running():
|
|
2813
2774
|
self.__del_running_bp_from_all_threads(bp)
|
|
2814
|
-
bp.disable(p, None)
|
|
2775
|
+
bp.disable(p, None) # XXX HACK thread is not used
|
|
2815
2776
|
|
|
2816
2777
|
def disable_page_breakpoint(self, dwProcessId, address):
|
|
2817
2778
|
"""
|
|
@@ -2831,11 +2792,11 @@ class _BreakpointContainer (object):
|
|
|
2831
2792
|
@type address: int
|
|
2832
2793
|
@param address: Memory address of breakpoint.
|
|
2833
2794
|
"""
|
|
2834
|
-
p
|
|
2795
|
+
p = self.system.get_process(dwProcessId)
|
|
2835
2796
|
bp = self.get_page_breakpoint(dwProcessId, address)
|
|
2836
2797
|
if bp.is_running():
|
|
2837
2798
|
self.__del_running_bp_from_all_threads(bp)
|
|
2838
|
-
bp.disable(p, None)
|
|
2799
|
+
bp.disable(p, None) # XXX HACK thread is not used
|
|
2839
2800
|
|
|
2840
2801
|
def disable_hardware_breakpoint(self, dwThreadId, address):
|
|
2841
2802
|
"""
|
|
@@ -2855,14 +2816,14 @@ class _BreakpointContainer (object):
|
|
|
2855
2816
|
@type address: int
|
|
2856
2817
|
@param address: Memory address of breakpoint.
|
|
2857
2818
|
"""
|
|
2858
|
-
t
|
|
2859
|
-
p
|
|
2819
|
+
t = self.system.get_thread(dwThreadId)
|
|
2820
|
+
p = t.get_process()
|
|
2860
2821
|
bp = self.get_hardware_breakpoint(dwThreadId, address)
|
|
2861
2822
|
if bp.is_running():
|
|
2862
2823
|
self.__del_running_bp(dwThreadId, bp)
|
|
2863
2824
|
bp.disable(p, t)
|
|
2864
2825
|
|
|
2865
|
-
|
|
2826
|
+
# ------------------------------------------------------------------------------
|
|
2866
2827
|
|
|
2867
2828
|
# Undefining (erasing) breakpoints.
|
|
2868
2829
|
|
|
@@ -2887,7 +2848,7 @@ class _BreakpointContainer (object):
|
|
|
2887
2848
|
bp = self.get_code_breakpoint(dwProcessId, address)
|
|
2888
2849
|
if not bp.is_disabled():
|
|
2889
2850
|
self.disable_code_breakpoint(dwProcessId, address)
|
|
2890
|
-
del self.__codeBP[
|
|
2851
|
+
del self.__codeBP[(dwProcessId, address)]
|
|
2891
2852
|
|
|
2892
2853
|
def erase_page_breakpoint(self, dwProcessId, address):
|
|
2893
2854
|
"""
|
|
@@ -2907,15 +2868,15 @@ class _BreakpointContainer (object):
|
|
|
2907
2868
|
@type address: int
|
|
2908
2869
|
@param address: Memory address of breakpoint.
|
|
2909
2870
|
"""
|
|
2910
|
-
bp
|
|
2871
|
+
bp = self.get_page_breakpoint(dwProcessId, address)
|
|
2911
2872
|
begin = bp.get_address()
|
|
2912
|
-
end
|
|
2873
|
+
end = begin + bp.get_size()
|
|
2913
2874
|
if not bp.is_disabled():
|
|
2914
2875
|
self.disable_page_breakpoint(dwProcessId, address)
|
|
2915
|
-
address
|
|
2876
|
+
address = begin
|
|
2916
2877
|
pageSize = MemoryAddresses.pageSize
|
|
2917
2878
|
while address < end:
|
|
2918
|
-
del self.__pageBP[
|
|
2879
|
+
del self.__pageBP[(dwProcessId, address)]
|
|
2919
2880
|
address = address + pageSize
|
|
2920
2881
|
|
|
2921
2882
|
def erase_hardware_breakpoint(self, dwThreadId, address):
|
|
@@ -2944,7 +2905,7 @@ class _BreakpointContainer (object):
|
|
|
2944
2905
|
if not bpSet:
|
|
2945
2906
|
del self.__hardwareBP[dwThreadId]
|
|
2946
2907
|
|
|
2947
|
-
|
|
2908
|
+
# ------------------------------------------------------------------------------
|
|
2948
2909
|
|
|
2949
2910
|
# Listing breakpoints.
|
|
2950
2911
|
|
|
@@ -2974,17 +2935,17 @@ class _BreakpointContainer (object):
|
|
|
2974
2935
|
bplist = list()
|
|
2975
2936
|
|
|
2976
2937
|
# Get the code breakpoints.
|
|
2977
|
-
for
|
|
2978
|
-
bplist.append(
|
|
2938
|
+
for pid, bp in self.get_all_code_breakpoints():
|
|
2939
|
+
bplist.append((pid, None, bp))
|
|
2979
2940
|
|
|
2980
2941
|
# Get the page breakpoints.
|
|
2981
|
-
for
|
|
2982
|
-
bplist.append(
|
|
2942
|
+
for pid, bp in self.get_all_page_breakpoints():
|
|
2943
|
+
bplist.append((pid, None, bp))
|
|
2983
2944
|
|
|
2984
2945
|
# Get the hardware breakpoints.
|
|
2985
|
-
for
|
|
2946
|
+
for tid, bp in self.get_all_hardware_breakpoints():
|
|
2986
2947
|
pid = self.system.get_thread(tid).get_pid()
|
|
2987
|
-
bplist.append(
|
|
2948
|
+
bplist.append((pid, tid, bp))
|
|
2988
2949
|
|
|
2989
2950
|
# Return the list of breakpoints.
|
|
2990
2951
|
return bplist
|
|
@@ -2994,17 +2955,17 @@ class _BreakpointContainer (object):
|
|
|
2994
2955
|
@rtype: list of tuple( int, L{CodeBreakpoint} )
|
|
2995
2956
|
@return: All code breakpoints as a list of tuples (pid, bp).
|
|
2996
2957
|
"""
|
|
2997
|
-
return [
|
|
2958
|
+
return [(pid, bp) for ((pid, address), bp) in compat.iteritems(self.__codeBP)]
|
|
2998
2959
|
|
|
2999
2960
|
def get_all_page_breakpoints(self):
|
|
3000
2961
|
"""
|
|
3001
2962
|
@rtype: list of tuple( int, L{PageBreakpoint} )
|
|
3002
2963
|
@return: All page breakpoints as a list of tuples (pid, bp).
|
|
3003
2964
|
"""
|
|
3004
|
-
## return list( set( [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__pageBP) ] ) )
|
|
2965
|
+
## return list( set( [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__pageBP) ] ) )
|
|
3005
2966
|
result = set()
|
|
3006
|
-
for (
|
|
3007
|
-
result.add(
|
|
2967
|
+
for (pid, address), bp in compat.iteritems(self.__pageBP):
|
|
2968
|
+
result.add((pid, bp))
|
|
3008
2969
|
return list(result)
|
|
3009
2970
|
|
|
3010
2971
|
def get_all_hardware_breakpoints(self):
|
|
@@ -3013,9 +2974,9 @@ class _BreakpointContainer (object):
|
|
|
3013
2974
|
@return: All hardware breakpoints as a list of tuples (tid, bp).
|
|
3014
2975
|
"""
|
|
3015
2976
|
result = list()
|
|
3016
|
-
for
|
|
2977
|
+
for tid, bplist in compat.iteritems(self.__hardwareBP):
|
|
3017
2978
|
for bp in bplist:
|
|
3018
|
-
result.append(
|
|
2979
|
+
result.append((tid, bp))
|
|
3019
2980
|
return result
|
|
3020
2981
|
|
|
3021
2982
|
def get_process_breakpoints(self, dwProcessId):
|
|
@@ -3048,16 +3009,16 @@ class _BreakpointContainer (object):
|
|
|
3048
3009
|
|
|
3049
3010
|
# Get the code breakpoints.
|
|
3050
3011
|
for bp in self.get_process_code_breakpoints(dwProcessId):
|
|
3051
|
-
bplist.append(
|
|
3012
|
+
bplist.append((dwProcessId, None, bp))
|
|
3052
3013
|
|
|
3053
3014
|
# Get the page breakpoints.
|
|
3054
3015
|
for bp in self.get_process_page_breakpoints(dwProcessId):
|
|
3055
|
-
bplist.append(
|
|
3016
|
+
bplist.append((dwProcessId, None, bp))
|
|
3056
3017
|
|
|
3057
3018
|
# Get the hardware breakpoints.
|
|
3058
|
-
for
|
|
3019
|
+
for tid, bp in self.get_process_hardware_breakpoints(dwProcessId):
|
|
3059
3020
|
pid = self.system.get_thread(tid).get_pid()
|
|
3060
|
-
bplist.append(
|
|
3021
|
+
bplist.append((dwProcessId, tid, bp))
|
|
3061
3022
|
|
|
3062
3023
|
# Return the list of breakpoints.
|
|
3063
3024
|
return bplist
|
|
@@ -3070,8 +3031,7 @@ class _BreakpointContainer (object):
|
|
|
3070
3031
|
@rtype: list of L{CodeBreakpoint}
|
|
3071
3032
|
@return: All code breakpoints for the given process.
|
|
3072
3033
|
"""
|
|
3073
|
-
return [
|
|
3074
|
-
if pid == dwProcessId ]
|
|
3034
|
+
return [bp for ((pid, address), bp) in compat.iteritems(self.__codeBP) if pid == dwProcessId]
|
|
3075
3035
|
|
|
3076
3036
|
def get_process_page_breakpoints(self, dwProcessId):
|
|
3077
3037
|
"""
|
|
@@ -3081,8 +3041,7 @@ class _BreakpointContainer (object):
|
|
|
3081
3041
|
@rtype: list of L{PageBreakpoint}
|
|
3082
3042
|
@return: All page breakpoints for the given process.
|
|
3083
3043
|
"""
|
|
3084
|
-
return [
|
|
3085
|
-
if pid == dwProcessId ]
|
|
3044
|
+
return [bp for ((pid, address), bp) in compat.iteritems(self.__pageBP) if pid == dwProcessId]
|
|
3086
3045
|
|
|
3087
3046
|
def get_thread_hardware_breakpoints(self, dwThreadId):
|
|
3088
3047
|
"""
|
|
@@ -3095,7 +3054,7 @@ class _BreakpointContainer (object):
|
|
|
3095
3054
|
@return: All hardware breakpoints for the given thread.
|
|
3096
3055
|
"""
|
|
3097
3056
|
result = list()
|
|
3098
|
-
for
|
|
3057
|
+
for tid, bplist in compat.iteritems(self.__hardwareBP):
|
|
3099
3058
|
if tid == dwThreadId:
|
|
3100
3059
|
for bp in bplist:
|
|
3101
3060
|
result.append(bp)
|
|
@@ -3118,35 +3077,35 @@ class _BreakpointContainer (object):
|
|
|
3118
3077
|
if dwThreadId in self.__hardwareBP:
|
|
3119
3078
|
bplist = self.__hardwareBP[dwThreadId]
|
|
3120
3079
|
for bp in bplist:
|
|
3121
|
-
result.append(
|
|
3080
|
+
result.append((dwThreadId, bp))
|
|
3122
3081
|
return result
|
|
3123
3082
|
|
|
3124
|
-
## def get_all_hooks(self):
|
|
3125
|
-
## """
|
|
3126
|
-
## @see: L{get_process_hooks}
|
|
3127
|
-
##
|
|
3128
|
-
## @rtype: list of tuple( int, int, L{Hook} )
|
|
3129
|
-
## @return: All defined hooks as a list of tuples (pid, address, hook).
|
|
3130
|
-
## """
|
|
3131
|
-
## return [ (pid, address, hook) \
|
|
3132
|
-
## for ((pid, address), hook) in self.__hook_objects ]
|
|
3133
|
-
##
|
|
3134
|
-
## def get_process_hooks(self, dwProcessId):
|
|
3135
|
-
## """
|
|
3136
|
-
## @see: L{get_all_hooks}
|
|
3137
|
-
##
|
|
3138
|
-
## @type dwProcessId: int
|
|
3139
|
-
## @param dwProcessId: Process global ID.
|
|
3140
|
-
##
|
|
3141
|
-
## @rtype: list of tuple( int, int, L{Hook} )
|
|
3142
|
-
## @return: All hooks for the given process as a list of tuples
|
|
3143
|
-
## (pid, address, hook).
|
|
3144
|
-
## """
|
|
3145
|
-
## return [ (pid, address, hook) \
|
|
3146
|
-
## for ((pid, address), hook) in self.__hook_objects \
|
|
3147
|
-
## if pid == dwProcessId ]
|
|
3148
|
-
|
|
3149
|
-
|
|
3083
|
+
## def get_all_hooks(self):
|
|
3084
|
+
## """
|
|
3085
|
+
## @see: L{get_process_hooks}
|
|
3086
|
+
##
|
|
3087
|
+
## @rtype: list of tuple( int, int, L{Hook} )
|
|
3088
|
+
## @return: All defined hooks as a list of tuples (pid, address, hook).
|
|
3089
|
+
## """
|
|
3090
|
+
## return [ (pid, address, hook) \
|
|
3091
|
+
## for ((pid, address), hook) in self.__hook_objects ]
|
|
3092
|
+
##
|
|
3093
|
+
## def get_process_hooks(self, dwProcessId):
|
|
3094
|
+
## """
|
|
3095
|
+
## @see: L{get_all_hooks}
|
|
3096
|
+
##
|
|
3097
|
+
## @type dwProcessId: int
|
|
3098
|
+
## @param dwProcessId: Process global ID.
|
|
3099
|
+
##
|
|
3100
|
+
## @rtype: list of tuple( int, int, L{Hook} )
|
|
3101
|
+
## @return: All hooks for the given process as a list of tuples
|
|
3102
|
+
## (pid, address, hook).
|
|
3103
|
+
## """
|
|
3104
|
+
## return [ (pid, address, hook) \
|
|
3105
|
+
## for ((pid, address), hook) in self.__hook_objects \
|
|
3106
|
+
## if pid == dwProcessId ]
|
|
3107
|
+
|
|
3108
|
+
# ------------------------------------------------------------------------------
|
|
3150
3109
|
|
|
3151
3110
|
# Batch operations on all breakpoints.
|
|
3152
3111
|
|
|
@@ -3161,17 +3120,17 @@ class _BreakpointContainer (object):
|
|
|
3161
3120
|
"""
|
|
3162
3121
|
|
|
3163
3122
|
# disable code breakpoints
|
|
3164
|
-
for
|
|
3123
|
+
for pid, bp in self.get_all_code_breakpoints():
|
|
3165
3124
|
if bp.is_disabled():
|
|
3166
3125
|
self.enable_code_breakpoint(pid, bp.get_address())
|
|
3167
3126
|
|
|
3168
3127
|
# disable page breakpoints
|
|
3169
|
-
for
|
|
3128
|
+
for pid, bp in self.get_all_page_breakpoints():
|
|
3170
3129
|
if bp.is_disabled():
|
|
3171
3130
|
self.enable_page_breakpoint(pid, bp.get_address())
|
|
3172
3131
|
|
|
3173
3132
|
# disable hardware breakpoints
|
|
3174
|
-
for
|
|
3133
|
+
for tid, bp in self.get_all_hardware_breakpoints():
|
|
3175
3134
|
if bp.is_disabled():
|
|
3176
3135
|
self.enable_hardware_breakpoint(tid, bp.get_address())
|
|
3177
3136
|
|
|
@@ -3186,17 +3145,17 @@ class _BreakpointContainer (object):
|
|
|
3186
3145
|
"""
|
|
3187
3146
|
|
|
3188
3147
|
# disable code breakpoints for one shot
|
|
3189
|
-
for
|
|
3148
|
+
for pid, bp in self.get_all_code_breakpoints():
|
|
3190
3149
|
if bp.is_disabled():
|
|
3191
3150
|
self.enable_one_shot_code_breakpoint(pid, bp.get_address())
|
|
3192
3151
|
|
|
3193
3152
|
# disable page breakpoints for one shot
|
|
3194
|
-
for
|
|
3153
|
+
for pid, bp in self.get_all_page_breakpoints():
|
|
3195
3154
|
if bp.is_disabled():
|
|
3196
3155
|
self.enable_one_shot_page_breakpoint(pid, bp.get_address())
|
|
3197
3156
|
|
|
3198
3157
|
# disable hardware breakpoints for one shot
|
|
3199
|
-
for
|
|
3158
|
+
for tid, bp in self.get_all_hardware_breakpoints():
|
|
3200
3159
|
if bp.is_disabled():
|
|
3201
3160
|
self.enable_one_shot_hardware_breakpoint(tid, bp.get_address())
|
|
3202
3161
|
|
|
@@ -3211,15 +3170,15 @@ class _BreakpointContainer (object):
|
|
|
3211
3170
|
"""
|
|
3212
3171
|
|
|
3213
3172
|
# disable code breakpoints
|
|
3214
|
-
for
|
|
3173
|
+
for pid, bp in self.get_all_code_breakpoints():
|
|
3215
3174
|
self.disable_code_breakpoint(pid, bp.get_address())
|
|
3216
3175
|
|
|
3217
3176
|
# disable page breakpoints
|
|
3218
|
-
for
|
|
3177
|
+
for pid, bp in self.get_all_page_breakpoints():
|
|
3219
3178
|
self.disable_page_breakpoint(pid, bp.get_address())
|
|
3220
3179
|
|
|
3221
3180
|
# disable hardware breakpoints
|
|
3222
|
-
for
|
|
3181
|
+
for tid, bp in self.get_all_hardware_breakpoints():
|
|
3223
3182
|
self.disable_hardware_breakpoint(tid, bp.get_address())
|
|
3224
3183
|
|
|
3225
3184
|
def erase_all_breakpoints(self):
|
|
@@ -3240,23 +3199,23 @@ class _BreakpointContainer (object):
|
|
|
3240
3199
|
# self.__runningBP = dict()
|
|
3241
3200
|
# self.__hook_objects = dict()
|
|
3242
3201
|
|
|
3243
|
-
## # erase hooks
|
|
3244
|
-
## for (pid, address, hook) in self.get_all_hooks():
|
|
3245
|
-
## self.dont_hook_function(pid, address)
|
|
3202
|
+
## # erase hooks
|
|
3203
|
+
## for (pid, address, hook) in self.get_all_hooks():
|
|
3204
|
+
## self.dont_hook_function(pid, address)
|
|
3246
3205
|
|
|
3247
3206
|
# erase code breakpoints
|
|
3248
|
-
for
|
|
3207
|
+
for pid, bp in self.get_all_code_breakpoints():
|
|
3249
3208
|
self.erase_code_breakpoint(pid, bp.get_address())
|
|
3250
3209
|
|
|
3251
3210
|
# erase page breakpoints
|
|
3252
|
-
for
|
|
3211
|
+
for pid, bp in self.get_all_page_breakpoints():
|
|
3253
3212
|
self.erase_page_breakpoint(pid, bp.get_address())
|
|
3254
3213
|
|
|
3255
3214
|
# erase hardware breakpoints
|
|
3256
|
-
for
|
|
3215
|
+
for tid, bp in self.get_all_hardware_breakpoints():
|
|
3257
3216
|
self.erase_hardware_breakpoint(tid, bp.get_address())
|
|
3258
3217
|
|
|
3259
|
-
|
|
3218
|
+
# ------------------------------------------------------------------------------
|
|
3260
3219
|
|
|
3261
3220
|
# Batch operations on breakpoints per process.
|
|
3262
3221
|
|
|
@@ -3359,9 +3318,9 @@ class _BreakpointContainer (object):
|
|
|
3359
3318
|
# if an error occurs, no breakpoint is erased
|
|
3360
3319
|
self.disable_process_breakpoints(dwProcessId)
|
|
3361
3320
|
|
|
3362
|
-
## # erase hooks
|
|
3363
|
-
## for address, hook in self.get_process_hooks(dwProcessId):
|
|
3364
|
-
## self.dont_hook_function(dwProcessId, address)
|
|
3321
|
+
## # erase hooks
|
|
3322
|
+
## for address, hook in self.get_process_hooks(dwProcessId):
|
|
3323
|
+
## self.dont_hook_function(dwProcessId, address)
|
|
3365
3324
|
|
|
3366
3325
|
# erase code breakpoints
|
|
3367
3326
|
for bp in self.get_process_code_breakpoints(dwProcessId):
|
|
@@ -3382,7 +3341,7 @@ class _BreakpointContainer (object):
|
|
|
3382
3341
|
for bp in self.get_thread_hardware_breakpoints(dwThreadId):
|
|
3383
3342
|
self.erase_hardware_breakpoint(dwThreadId, bp.get_address())
|
|
3384
3343
|
|
|
3385
|
-
|
|
3344
|
+
# ------------------------------------------------------------------------------
|
|
3386
3345
|
|
|
3387
3346
|
# Internal handlers of debug events.
|
|
3388
3347
|
|
|
@@ -3396,9 +3355,9 @@ class _BreakpointContainer (object):
|
|
|
3396
3355
|
@rtype: bool
|
|
3397
3356
|
@return: C{True} to call the user-defined handle, C{False} otherwise.
|
|
3398
3357
|
"""
|
|
3399
|
-
address
|
|
3400
|
-
pid
|
|
3401
|
-
bCallHandler
|
|
3358
|
+
address = event.get_fault_address()
|
|
3359
|
+
pid = event.get_pid()
|
|
3360
|
+
bCallHandler = True
|
|
3402
3361
|
|
|
3403
3362
|
# Align address to page boundary.
|
|
3404
3363
|
mask = ~(MemoryAddresses.pageSize - 1)
|
|
@@ -3409,10 +3368,9 @@ class _BreakpointContainer (object):
|
|
|
3409
3368
|
if key in self.__pageBP:
|
|
3410
3369
|
bp = self.__pageBP[key]
|
|
3411
3370
|
if bp.is_enabled() or bp.is_one_shot():
|
|
3412
|
-
|
|
3413
3371
|
# Breakpoint is ours.
|
|
3414
3372
|
event.continueStatus = win32.DBG_CONTINUE
|
|
3415
|
-
## event.continueStatus = win32.DBG_EXCEPTION_HANDLED
|
|
3373
|
+
## event.continueStatus = win32.DBG_EXCEPTION_HANDLED
|
|
3416
3374
|
|
|
3417
3375
|
# Hit the breakpoint.
|
|
3418
3376
|
bp.hit(event)
|
|
@@ -3450,16 +3408,15 @@ class _BreakpointContainer (object):
|
|
|
3450
3408
|
@rtype: bool
|
|
3451
3409
|
@return: C{True} to call the user-defined handle, C{False} otherwise.
|
|
3452
3410
|
"""
|
|
3453
|
-
address
|
|
3454
|
-
pid
|
|
3455
|
-
bCallHandler
|
|
3411
|
+
address = event.get_exception_address()
|
|
3412
|
+
pid = event.get_pid()
|
|
3413
|
+
bCallHandler = True
|
|
3456
3414
|
|
|
3457
3415
|
# Do we have an active code breakpoint there?
|
|
3458
3416
|
key = (pid, address)
|
|
3459
3417
|
if key in self.__codeBP:
|
|
3460
3418
|
bp = self.__codeBP[key]
|
|
3461
3419
|
if not bp.is_disabled():
|
|
3462
|
-
|
|
3463
3420
|
# Change the program counter (PC) to the exception address.
|
|
3464
3421
|
# This accounts for the change in PC caused by
|
|
3465
3422
|
# executing the breakpoint instruction, no matter
|
|
@@ -3516,12 +3473,12 @@ class _BreakpointContainer (object):
|
|
|
3516
3473
|
@rtype: bool
|
|
3517
3474
|
@return: C{True} to call the user-defined handle, C{False} otherwise.
|
|
3518
3475
|
"""
|
|
3519
|
-
pid
|
|
3520
|
-
tid
|
|
3521
|
-
aThread
|
|
3522
|
-
aProcess
|
|
3523
|
-
bCallHandler
|
|
3524
|
-
bIsOurs
|
|
3476
|
+
pid = event.get_pid()
|
|
3477
|
+
tid = event.get_tid()
|
|
3478
|
+
aThread = event.get_thread()
|
|
3479
|
+
aProcess = event.get_process()
|
|
3480
|
+
bCallHandler = True
|
|
3481
|
+
bIsOurs = False
|
|
3525
3482
|
|
|
3526
3483
|
# In hostile mode set the default to pass the exception to the debugee.
|
|
3527
3484
|
# If we later determine the exception is ours, hide it instead.
|
|
@@ -3545,24 +3502,24 @@ class _BreakpointContainer (object):
|
|
|
3545
3502
|
# the trap flag.
|
|
3546
3503
|
# bNextIsPopFlags: Don't let popf instructions clear the trap flag.
|
|
3547
3504
|
#
|
|
3548
|
-
bFakeSingleStep
|
|
3505
|
+
bFakeSingleStep = False
|
|
3549
3506
|
bLastIsPushFlags = False
|
|
3550
|
-
bNextIsPopFlags
|
|
3507
|
+
bNextIsPopFlags = False
|
|
3551
3508
|
if self.in_hostile_mode():
|
|
3552
3509
|
pc = aThread.get_pc()
|
|
3553
3510
|
c = aProcess.read_char(pc - 1)
|
|
3554
|
-
if c == 0xF1:
|
|
3555
|
-
bFakeSingleStep
|
|
3556
|
-
elif c == 0x9C:
|
|
3511
|
+
if c == 0xF1: # int1
|
|
3512
|
+
bFakeSingleStep = True
|
|
3513
|
+
elif c == 0x9C: # pushf
|
|
3557
3514
|
bLastIsPushFlags = True
|
|
3558
3515
|
c = aProcess.peek_char(pc)
|
|
3559
|
-
if c == 0x66:
|
|
3516
|
+
if c == 0x66: # the only valid prefix for popf
|
|
3560
3517
|
c = aProcess.peek_char(pc + 1)
|
|
3561
|
-
if c == 0x9D:
|
|
3518
|
+
if c == 0x9D: # popf
|
|
3562
3519
|
if bLastIsPushFlags:
|
|
3563
3520
|
bLastIsPushFlags = False # they cancel each other out
|
|
3564
3521
|
else:
|
|
3565
|
-
bNextIsPopFlags
|
|
3522
|
+
bNextIsPopFlags = True
|
|
3566
3523
|
|
|
3567
3524
|
# When the thread is in tracing mode,
|
|
3568
3525
|
# don't pass the exception to the debugee
|
|
@@ -3580,7 +3537,7 @@ class _BreakpointContainer (object):
|
|
|
3580
3537
|
flags = aProcess.read_dword(sp)
|
|
3581
3538
|
if bLastIsPushFlags:
|
|
3582
3539
|
flags &= ~Thread.Flags.Trap
|
|
3583
|
-
else:
|
|
3540
|
+
else: # if bNextIsPopFlags:
|
|
3584
3541
|
flags |= Thread.Flags.Trap
|
|
3585
3542
|
aProcess.write_dword(sp, flags)
|
|
3586
3543
|
|
|
@@ -3600,20 +3557,19 @@ class _BreakpointContainer (object):
|
|
|
3600
3557
|
|
|
3601
3558
|
# Handle hardware breakpoints.
|
|
3602
3559
|
if tid in self.__hardwareBP:
|
|
3603
|
-
ctx
|
|
3604
|
-
Dr6
|
|
3605
|
-
ctx[
|
|
3560
|
+
ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
|
|
3561
|
+
Dr6 = ctx["Dr6"]
|
|
3562
|
+
ctx["Dr6"] = Dr6 & DebugRegister.clearHitMask
|
|
3606
3563
|
aThread.set_context(ctx)
|
|
3607
3564
|
bFoundBreakpoint = False
|
|
3608
|
-
bCondition
|
|
3609
|
-
hwbpList = [
|
|
3565
|
+
bCondition = False
|
|
3566
|
+
hwbpList = [bp for bp in self.__hardwareBP[tid]]
|
|
3610
3567
|
for bp in hwbpList:
|
|
3611
3568
|
if not bp in self.__hardwareBP[tid]:
|
|
3612
|
-
continue
|
|
3569
|
+
continue # it was removed by a user-defined callback
|
|
3613
3570
|
slot = bp.get_slot()
|
|
3614
|
-
if (slot is not None) and
|
|
3615
|
-
|
|
3616
|
-
if not bFoundBreakpoint: #set before actions are called
|
|
3571
|
+
if (slot is not None) and (Dr6 & DebugRegister.hitMask[slot]):
|
|
3572
|
+
if not bFoundBreakpoint: # set before actions are called
|
|
3617
3573
|
if not bFakeSingleStep:
|
|
3618
3574
|
event.continueStatus = win32.DBG_CONTINUE
|
|
3619
3575
|
bFoundBreakpoint = True
|
|
@@ -3700,7 +3656,7 @@ class _BreakpointContainer (object):
|
|
|
3700
3656
|
self.__cleanup_thread(event)
|
|
3701
3657
|
return True
|
|
3702
3658
|
|
|
3703
|
-
|
|
3659
|
+
# ------------------------------------------------------------------------------
|
|
3704
3660
|
|
|
3705
3661
|
# This is the high level breakpoint interface. Here we don't have to care
|
|
3706
3662
|
# about defining or enabling breakpoints, and many errors are ignored
|
|
@@ -3709,7 +3665,7 @@ class _BreakpointContainer (object):
|
|
|
3709
3665
|
# and more intuitive, if less detailed. It also allows the use of deferred
|
|
3710
3666
|
# breakpoints.
|
|
3711
3667
|
|
|
3712
|
-
|
|
3668
|
+
# ------------------------------------------------------------------------------
|
|
3713
3669
|
|
|
3714
3670
|
# Code breakpoints
|
|
3715
3671
|
|
|
@@ -3759,7 +3715,7 @@ class _BreakpointContainer (object):
|
|
|
3759
3715
|
return None
|
|
3760
3716
|
if self.has_code_breakpoint(pid, address):
|
|
3761
3717
|
bp = self.get_code_breakpoint(pid, address)
|
|
3762
|
-
if bp.get_action() != action:
|
|
3718
|
+
if bp.get_action() != action: # can't use "is not", fails for bound methods
|
|
3763
3719
|
bp.set_action(action)
|
|
3764
3720
|
msg = "Redefined code breakpoint at %s in process ID %d"
|
|
3765
3721
|
msg = msg % (label, pid)
|
|
@@ -3796,7 +3752,7 @@ class _BreakpointContainer (object):
|
|
|
3796
3752
|
del deferred[label]
|
|
3797
3753
|
unknown = False
|
|
3798
3754
|
except KeyError:
|
|
3799
|
-
## traceback.print_last() # XXX DEBUG
|
|
3755
|
+
## traceback.print_last() # XXX DEBUG
|
|
3800
3756
|
pass
|
|
3801
3757
|
aProcess = self.system.get_process(pid)
|
|
3802
3758
|
try:
|
|
@@ -3804,10 +3760,9 @@ class _BreakpointContainer (object):
|
|
|
3804
3760
|
if not address:
|
|
3805
3761
|
raise Exception()
|
|
3806
3762
|
except Exception:
|
|
3807
|
-
## traceback.print_last() # XXX DEBUG
|
|
3763
|
+
## traceback.print_last() # XXX DEBUG
|
|
3808
3764
|
if unknown:
|
|
3809
|
-
msg =
|
|
3810
|
-
" at %s in process ID %d")
|
|
3765
|
+
msg = "Can't clear unknown code breakpoint" " at %s in process ID %d"
|
|
3811
3766
|
msg = msg % (label, pid)
|
|
3812
3767
|
warnings.warn(msg, BreakpointWarning)
|
|
3813
3768
|
return
|
|
@@ -3828,7 +3783,7 @@ class _BreakpointContainer (object):
|
|
|
3828
3783
|
except KeyError:
|
|
3829
3784
|
return
|
|
3830
3785
|
aProcess = event.get_process()
|
|
3831
|
-
for
|
|
3786
|
+
for label, (action, oneshot) in deferred.items():
|
|
3832
3787
|
try:
|
|
3833
3788
|
address = aProcess.resolve_label(label)
|
|
3834
3789
|
except Exception:
|
|
@@ -3854,8 +3809,8 @@ class _BreakpointContainer (object):
|
|
|
3854
3809
|
"""
|
|
3855
3810
|
result = []
|
|
3856
3811
|
for pid, deferred in compat.iteritems(self.__deferredBP):
|
|
3857
|
-
for
|
|
3858
|
-
result.add(
|
|
3812
|
+
for label, (action, oneshot) in compat.iteritems(deferred):
|
|
3813
|
+
result.add((pid, label, action, oneshot))
|
|
3859
3814
|
return result
|
|
3860
3815
|
|
|
3861
3816
|
def get_process_deferred_code_breakpoints(self, dwProcessId):
|
|
@@ -3871,11 +3826,9 @@ class _BreakpointContainer (object):
|
|
|
3871
3826
|
- Action callback for the breakpoint.
|
|
3872
3827
|
- C{True} of the breakpoint is one-shot, C{False} otherwise.
|
|
3873
3828
|
"""
|
|
3874
|
-
return [ (label, action, oneshot)
|
|
3875
|
-
for (label, (action, oneshot))
|
|
3876
|
-
in compat.iteritems(self.__deferredBP.get(dwProcessId, {})) ]
|
|
3829
|
+
return [(label, action, oneshot) for (label, (action, oneshot)) in compat.iteritems(self.__deferredBP.get(dwProcessId, {}))]
|
|
3877
3830
|
|
|
3878
|
-
def stalk_at(self, pid, address, action
|
|
3831
|
+
def stalk_at(self, pid, address, action=None):
|
|
3879
3832
|
"""
|
|
3880
3833
|
Sets a one shot code breakpoint at the given process and address.
|
|
3881
3834
|
|
|
@@ -3902,10 +3855,10 @@ class _BreakpointContainer (object):
|
|
|
3902
3855
|
@return: C{True} if the breakpoint was set immediately, or C{False} if
|
|
3903
3856
|
it was deferred.
|
|
3904
3857
|
"""
|
|
3905
|
-
bp = self.__set_break(pid, address, action, oneshot
|
|
3858
|
+
bp = self.__set_break(pid, address, action, oneshot=True)
|
|
3906
3859
|
return bp is not None
|
|
3907
3860
|
|
|
3908
|
-
def break_at(self, pid, address, action
|
|
3861
|
+
def break_at(self, pid, address, action=None):
|
|
3909
3862
|
"""
|
|
3910
3863
|
Sets a code breakpoint at the given process and address.
|
|
3911
3864
|
|
|
@@ -3932,7 +3885,7 @@ class _BreakpointContainer (object):
|
|
|
3932
3885
|
@return: C{True} if the breakpoint was set immediately, or C{False} if
|
|
3933
3886
|
it was deferred.
|
|
3934
3887
|
"""
|
|
3935
|
-
bp = self.__set_break(pid, address, action, oneshot
|
|
3888
|
+
bp = self.__set_break(pid, address, action, oneshot=False)
|
|
3936
3889
|
return bp is not None
|
|
3937
3890
|
|
|
3938
3891
|
def dont_break_at(self, pid, address):
|
|
@@ -3965,13 +3918,11 @@ class _BreakpointContainer (object):
|
|
|
3965
3918
|
"""
|
|
3966
3919
|
self.__clear_break(pid, address)
|
|
3967
3920
|
|
|
3968
|
-
|
|
3921
|
+
# ------------------------------------------------------------------------------
|
|
3969
3922
|
|
|
3970
3923
|
# Function hooks
|
|
3971
3924
|
|
|
3972
|
-
def hook_function(self, pid, address,
|
|
3973
|
-
preCB = None, postCB = None,
|
|
3974
|
-
paramCount = None, signature = None):
|
|
3925
|
+
def hook_function(self, pid, address, preCB=None, postCB=None, paramCount=None, signature=None):
|
|
3975
3926
|
"""
|
|
3976
3927
|
Sets a function hook at the given address.
|
|
3977
3928
|
|
|
@@ -4051,9 +4002,7 @@ class _BreakpointContainer (object):
|
|
|
4051
4002
|
bp = self.break_at(pid, address, hookObj)
|
|
4052
4003
|
return bp is not None
|
|
4053
4004
|
|
|
4054
|
-
def stalk_function(self, pid, address,
|
|
4055
|
-
preCB = None, postCB = None,
|
|
4056
|
-
paramCount = None, signature = None):
|
|
4005
|
+
def stalk_function(self, pid, address, preCB=None, postCB=None, paramCount=None, signature=None):
|
|
4057
4006
|
"""
|
|
4058
4007
|
Sets a one-shot function hook at the given address.
|
|
4059
4008
|
|
|
@@ -4166,7 +4115,7 @@ class _BreakpointContainer (object):
|
|
|
4166
4115
|
"""
|
|
4167
4116
|
self.dont_stalk_at(pid, address)
|
|
4168
4117
|
|
|
4169
|
-
|
|
4118
|
+
# ------------------------------------------------------------------------------
|
|
4170
4119
|
|
|
4171
4120
|
# Variable watches
|
|
4172
4121
|
|
|
@@ -4211,22 +4160,19 @@ class _BreakpointContainer (object):
|
|
|
4211
4160
|
|
|
4212
4161
|
if self.has_hardware_breakpoint(tid, address):
|
|
4213
4162
|
warnings.warn(
|
|
4214
|
-
"Hardware breakpoint in thread %d at address %s was overwritten!"
|
|
4215
|
-
% (tid, HexDump.address(address,
|
|
4216
|
-
|
|
4217
|
-
|
|
4163
|
+
"Hardware breakpoint in thread %d at address %s was overwritten!"
|
|
4164
|
+
% (tid, HexDump.address(address, self.system.get_thread(tid).get_bits())),
|
|
4165
|
+
BreakpointWarning,
|
|
4166
|
+
)
|
|
4218
4167
|
|
|
4219
4168
|
bp = self.get_hardware_breakpoint(tid, address)
|
|
4220
|
-
if
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
|
|
4225
|
-
bp = self.get_hardware_breakpoint(tid, address)
|
|
4169
|
+
if bp.get_trigger() != self.BP_BREAK_ON_ACCESS or bp.get_watch() != sizeFlag:
|
|
4170
|
+
self.erase_hardware_breakpoint(tid, address)
|
|
4171
|
+
self.define_hardware_breakpoint(tid, address, self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
|
|
4172
|
+
bp = self.get_hardware_breakpoint(tid, address)
|
|
4226
4173
|
|
|
4227
4174
|
else:
|
|
4228
|
-
self.define_hardware_breakpoint(tid, address,
|
|
4229
|
-
self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
|
|
4175
|
+
self.define_hardware_breakpoint(tid, address, self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
|
|
4230
4176
|
bp = self.get_hardware_breakpoint(tid, address)
|
|
4231
4177
|
|
|
4232
4178
|
return bp
|
|
@@ -4244,7 +4190,7 @@ class _BreakpointContainer (object):
|
|
|
4244
4190
|
if self.has_hardware_breakpoint(tid, address):
|
|
4245
4191
|
self.erase_hardware_breakpoint(tid, address)
|
|
4246
4192
|
|
|
4247
|
-
def watch_variable(self, tid, address, size, action
|
|
4193
|
+
def watch_variable(self, tid, address, size, action=None):
|
|
4248
4194
|
"""
|
|
4249
4195
|
Sets a hardware breakpoint at the given thread, address and size.
|
|
4250
4196
|
|
|
@@ -4269,7 +4215,7 @@ class _BreakpointContainer (object):
|
|
|
4269
4215
|
if not bp.is_enabled():
|
|
4270
4216
|
self.enable_hardware_breakpoint(tid, address)
|
|
4271
4217
|
|
|
4272
|
-
def stalk_variable(self, tid, address, size, action
|
|
4218
|
+
def stalk_variable(self, tid, address, size, action=None):
|
|
4273
4219
|
"""
|
|
4274
4220
|
Sets a one-shot hardware breakpoint at the given thread,
|
|
4275
4221
|
address and size.
|
|
@@ -4319,7 +4265,7 @@ class _BreakpointContainer (object):
|
|
|
4319
4265
|
"""
|
|
4320
4266
|
self.__clear_variable_watch(tid, address)
|
|
4321
4267
|
|
|
4322
|
-
|
|
4268
|
+
# ------------------------------------------------------------------------------
|
|
4323
4269
|
|
|
4324
4270
|
# Buffer watches
|
|
4325
4271
|
|
|
@@ -4355,31 +4301,29 @@ class _BreakpointContainer (object):
|
|
|
4355
4301
|
bw = BufferWatch(pid, address, address + size, action, bOneShot)
|
|
4356
4302
|
|
|
4357
4303
|
# Get the base address and size in pages required for this buffer.
|
|
4358
|
-
base
|
|
4304
|
+
base = MemoryAddresses.align_address_to_page_start(address)
|
|
4359
4305
|
limit = MemoryAddresses.align_address_to_page_end(address + size)
|
|
4360
4306
|
pages = MemoryAddresses.get_buffer_size_in_pages(address, size)
|
|
4361
4307
|
|
|
4362
4308
|
try:
|
|
4363
|
-
|
|
4364
4309
|
# For each page:
|
|
4365
4310
|
# + if a page breakpoint exists reuse it
|
|
4366
4311
|
# + if it doesn't exist define it
|
|
4367
4312
|
|
|
4368
|
-
bset = set()
|
|
4369
|
-
nset = set()
|
|
4370
|
-
cset = set()
|
|
4313
|
+
bset = set() # all breakpoints used
|
|
4314
|
+
nset = set() # newly defined breakpoints
|
|
4315
|
+
cset = set() # condition objects
|
|
4371
4316
|
|
|
4372
4317
|
page_addr = base
|
|
4373
|
-
pageSize
|
|
4318
|
+
pageSize = MemoryAddresses.pageSize
|
|
4374
4319
|
while page_addr < limit:
|
|
4375
|
-
|
|
4376
4320
|
# If a breakpoints exists, reuse it.
|
|
4377
4321
|
if self.has_page_breakpoint(pid, page_addr):
|
|
4378
4322
|
bp = self.get_page_breakpoint(pid, page_addr)
|
|
4379
4323
|
if bp not in bset:
|
|
4380
4324
|
condition = bp.get_condition()
|
|
4381
4325
|
if not condition in cset:
|
|
4382
|
-
if not isinstance(condition,_BufferWatchCondition):
|
|
4326
|
+
if not isinstance(condition, _BufferWatchCondition):
|
|
4383
4327
|
# this shouldn't happen unless you tinkered
|
|
4384
4328
|
# with it or defined your own page breakpoints
|
|
4385
4329
|
# manually.
|
|
@@ -4392,8 +4336,7 @@ class _BreakpointContainer (object):
|
|
|
4392
4336
|
# If it doesn't, define it.
|
|
4393
4337
|
else:
|
|
4394
4338
|
condition = _BufferWatchCondition()
|
|
4395
|
-
bp = self.define_page_breakpoint(pid, page_addr, 1,
|
|
4396
|
-
condition = condition)
|
|
4339
|
+
bp = self.define_page_breakpoint(pid, page_addr, 1, condition=condition)
|
|
4397
4340
|
bset.add(bp)
|
|
4398
4341
|
nset.add(bp)
|
|
4399
4342
|
cset.add(condition)
|
|
@@ -4409,7 +4352,6 @@ class _BreakpointContainer (object):
|
|
|
4409
4352
|
|
|
4410
4353
|
# On error...
|
|
4411
4354
|
except:
|
|
4412
|
-
|
|
4413
4355
|
# Erase the newly defined breakpoints.
|
|
4414
4356
|
for bp in nset:
|
|
4415
4357
|
try:
|
|
@@ -4446,14 +4388,14 @@ class _BreakpointContainer (object):
|
|
|
4446
4388
|
raise ValueError("Bad size for buffer watch: %r" % size)
|
|
4447
4389
|
|
|
4448
4390
|
# Get the base address and size in pages required for this buffer.
|
|
4449
|
-
base
|
|
4391
|
+
base = MemoryAddresses.align_address_to_page_start(address)
|
|
4450
4392
|
limit = MemoryAddresses.align_address_to_page_end(address + size)
|
|
4451
4393
|
pages = MemoryAddresses.get_buffer_size_in_pages(address, size)
|
|
4452
4394
|
|
|
4453
4395
|
# For each page, get the breakpoint and it's condition object.
|
|
4454
4396
|
# For each condition, remove the buffer.
|
|
4455
4397
|
# For each breakpoint, if no buffers are on watch, erase it.
|
|
4456
|
-
cset = set()
|
|
4398
|
+
cset = set() # condition objects
|
|
4457
4399
|
page_addr = base
|
|
4458
4400
|
pageSize = MemoryAddresses.pageSize
|
|
4459
4401
|
while page_addr < limit:
|
|
@@ -4483,19 +4425,19 @@ class _BreakpointContainer (object):
|
|
|
4483
4425
|
"""
|
|
4484
4426
|
|
|
4485
4427
|
# Get the PID and the start and end addresses of the buffer.
|
|
4486
|
-
pid
|
|
4428
|
+
pid = bw.pid
|
|
4487
4429
|
start = bw.start
|
|
4488
|
-
end
|
|
4430
|
+
end = bw.end
|
|
4489
4431
|
|
|
4490
4432
|
# Get the base address and size in pages required for the buffer.
|
|
4491
|
-
base
|
|
4433
|
+
base = MemoryAddresses.align_address_to_page_start(start)
|
|
4492
4434
|
limit = MemoryAddresses.align_address_to_page_end(end)
|
|
4493
4435
|
pages = MemoryAddresses.get_buffer_size_in_pages(start, end - start)
|
|
4494
4436
|
|
|
4495
4437
|
# For each page, get the breakpoint and it's condition object.
|
|
4496
4438
|
# For each condition, remove the buffer.
|
|
4497
4439
|
# For each breakpoint, if no buffers are on watch, erase it.
|
|
4498
|
-
cset = set()
|
|
4440
|
+
cset = set() # condition objects
|
|
4499
4441
|
page_addr = base
|
|
4500
4442
|
pageSize = MemoryAddresses.pageSize
|
|
4501
4443
|
while page_addr < limit:
|
|
@@ -4514,11 +4456,11 @@ class _BreakpointContainer (object):
|
|
|
4514
4456
|
self.erase_page_breakpoint(pid, bp.get_address())
|
|
4515
4457
|
except WindowsError:
|
|
4516
4458
|
msg = "Cannot remove page breakpoint at address %s"
|
|
4517
|
-
msg = msg % HexDump.address(
|
|
4459
|
+
msg = msg % HexDump.address(bp.get_address())
|
|
4518
4460
|
warnings.warn(msg, BreakpointWarning)
|
|
4519
4461
|
page_addr = page_addr + pageSize
|
|
4520
4462
|
|
|
4521
|
-
def watch_buffer(self, pid, address, size, action
|
|
4463
|
+
def watch_buffer(self, pid, address, size, action=None):
|
|
4522
4464
|
"""
|
|
4523
4465
|
Sets a page breakpoint and notifies when the given buffer is accessed.
|
|
4524
4466
|
|
|
@@ -4543,7 +4485,7 @@ class _BreakpointContainer (object):
|
|
|
4543
4485
|
"""
|
|
4544
4486
|
self.__set_buffer_watch(pid, address, size, action, False)
|
|
4545
4487
|
|
|
4546
|
-
def stalk_buffer(self, pid, address, size, action
|
|
4488
|
+
def stalk_buffer(self, pid, address, size, action=None):
|
|
4547
4489
|
"""
|
|
4548
4490
|
Sets a one-shot page breakpoint and notifies
|
|
4549
4491
|
when the given buffer is accessed.
|
|
@@ -4586,12 +4528,12 @@ class _BreakpointContainer (object):
|
|
|
4586
4528
|
else:
|
|
4587
4529
|
argv = list(argv)
|
|
4588
4530
|
argv.insert(0, bw)
|
|
4589
|
-
if
|
|
4590
|
-
argv.insert(0, argd.pop(
|
|
4591
|
-
if
|
|
4592
|
-
argv.insert(1, argd.pop(
|
|
4593
|
-
if
|
|
4594
|
-
argv.insert(2, argd.pop(
|
|
4531
|
+
if "pid" in argd:
|
|
4532
|
+
argv.insert(0, argd.pop("pid"))
|
|
4533
|
+
if "address" in argd:
|
|
4534
|
+
argv.insert(1, argd.pop("address"))
|
|
4535
|
+
if "size" in argd:
|
|
4536
|
+
argv.insert(2, argd.pop("size"))
|
|
4595
4537
|
if argd:
|
|
4596
4538
|
raise TypeError("Wrong arguments for dont_watch_buffer()")
|
|
4597
4539
|
try:
|
|
@@ -4610,12 +4552,12 @@ class _BreakpointContainer (object):
|
|
|
4610
4552
|
"""
|
|
4611
4553
|
self.dont_watch_buffer(bw, *argv, **argd)
|
|
4612
4554
|
|
|
4613
|
-
|
|
4555
|
+
# ------------------------------------------------------------------------------
|
|
4614
4556
|
|
|
4615
4557
|
# Tracing
|
|
4616
4558
|
|
|
4617
|
-
# XXX TODO
|
|
4618
|
-
# Add "action" parameter to tracing mode
|
|
4559
|
+
# XXX TODO
|
|
4560
|
+
# Add "action" parameter to tracing mode
|
|
4619
4561
|
|
|
4620
4562
|
def __start_tracing(self, thread):
|
|
4621
4563
|
"""
|
|
@@ -4715,7 +4657,7 @@ class _BreakpointContainer (object):
|
|
|
4715
4657
|
for pid in self.get_debugee_pids():
|
|
4716
4658
|
self.stop_tracing_process(pid)
|
|
4717
4659
|
|
|
4718
|
-
|
|
4660
|
+
# ------------------------------------------------------------------------------
|
|
4719
4661
|
|
|
4720
4662
|
# Break on LastError values (only available since Windows Server 2003)
|
|
4721
4663
|
|
|
@@ -4751,10 +4693,9 @@ class _BreakpointContainer (object):
|
|
|
4751
4693
|
An error occurred while processing this request.
|
|
4752
4694
|
"""
|
|
4753
4695
|
aProcess = self.system.get_process(pid)
|
|
4754
|
-
address
|
|
4696
|
+
address = aProcess.get_break_on_error_ptr()
|
|
4755
4697
|
if not address:
|
|
4756
|
-
raise NotImplementedError(
|
|
4757
|
-
"The functionality is not supported in this system.")
|
|
4698
|
+
raise NotImplementedError("The functionality is not supported in this system.")
|
|
4758
4699
|
aProcess.write_dword(address, errorCode)
|
|
4759
4700
|
|
|
4760
4701
|
def dont_break_on_error(self, pid):
|
|
@@ -4772,7 +4713,7 @@ class _BreakpointContainer (object):
|
|
|
4772
4713
|
"""
|
|
4773
4714
|
self.break_on_error(pid, 0)
|
|
4774
4715
|
|
|
4775
|
-
|
|
4716
|
+
# ------------------------------------------------------------------------------
|
|
4776
4717
|
|
|
4777
4718
|
# Simplified symbol resolving, useful for hooking functions
|
|
4778
4719
|
|