Git Product home page Git Product logo

deprecated_python_debugger's People

Contributors

bpotchik avatar couleeapps avatar fabianfreyer avatar jonpalmisc avatar joshwatson avatar lwerdna avatar marpie avatar mechanicalnull avatar plafosse avatar psifertex avatar shaneworkinl avatar velocityra avatar vijfhoek avatar xusheng6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deprecated_python_debugger's Issues

Initialization in DllMain

I noticed here that you are initializing a COM interface inside of DllMain, which is likely to cause issues and is not good practice.

https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain says:

There are significant limits on what you can safely do in a DLL entry point. See General Best Practices for specific Windows APIs that are unsafe to call in DllMain. If you need anything but the simplest initialization then do that in an initialization function for the DLL. You can require applications to call the initialization function after DllMain has run and before they call any other functions in the DLL.

See https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices for more information about the potential issues.

Debugger doesn't work unless you go to View>Debugger first.

Bug where the debugger doesn't let you run it form the Tools>Debugger>Process>Run, you must go to the View>Debugger first.

This is on Windows 10. Tried it with both Python 3.7 and 3.8 with the same results.

It also freezes randomly with some binaries and gets an "Exception: Cannot resolve relative address:" with others.

image

Standard input

Need a mechanism to send data to the stdin of the running process

Navigating debug view

Related to #21, currently the debug view does not respond when the user tries to navigate to functions. Need some way to determine if they are navigating to code (show in the left view) or local data (linear view in the left view?) or memory (show in the right view).

Also need to figure out how history works

Add "IL mode" for stepping

When stepping, if the user is in LLIL or MLIL view, add a setting so that the debugger can step over optimized-away disassembly and just step between each LLIL/MLIL instruction, similar to "source mode" in WinDbg

opening a raw svg (or other non-executable file) as a hex editor triggers a python exception

  File "/Applications/Binary Ninja-dev.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 227, in _default_is_valid
    return is_valid(view_obj)
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ui.py", line 248, in require_adapter
    debug_state = binjaplug.get_state(bv)
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/binjaplug.py", line 31, in get_state
    state = DebuggerState(bv)
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/binjaplug.py", line 115, in __init__
    self.memory_view = ProcessView.DebugProcessView(bv)
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 26, in __init__
    length = self.memory.perform_get_length()
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 134, in perform_get_length
    return (2 ** (self.perform_get_address_size() * 8)) - 1
  File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 126, in perform_get_address_size
    return self.parent_view.arch.address_size
AttributeError: 'NoneType' object has no attribute 'address_size'

Console widget

Needs the following features:

  • Show program output
  • Accept user input
  • (Potentially) Accept debugger commands

Cannot write to some registers

At least on x86_64, I cannot set r10-r15, cs, fs, or any of the eax, ebx, etc registers.
Sometimes rip/rflags/gs are writable and sometimes not.

I would at least expect r10-r15 to be writable. rip/rflags/fs/gs potentially could be. cs is fine being immutable.

Environment: macOS + lldb

Thread list widget

List active threads. Double click to navigate to the location the clicked thread is at. Right-click to follow that thread.

'Raw' Disassembly View widget

When code is being executed outside the current BinaryView (or inside but not at a code aligned address) the raw disassembly view will be shown.

automatic code discovery

Two important features we plan:

  1. when single stepping through a call and the call-target is a function in the current view's segments that we do not have a function for, create the function
  2. likewise for discovering other indirect control flow such as jump targets (though obviously not creating a function but using set_user_indirect_branches

Debugger UI breaks with version 1.2

The function binaryninja.binaryview.BinaryView.get_functions_containing in version 1.2 (tested on 1.2.1921) returns None in some cases and thus breaks the debugger's UI.update_highlights function:
Traceback (most recent call last):
File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 227, in _default_is_valid
return is_valid(view_obj)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 601, in valid_control_pause
debug_state = binjaplug.get_state(bv)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/binjaplug.py", line 35, in get_state
state = DebuggerState(bv)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/binjaplug.py", line 409, in init
self.ui = ui.DebuggerUI(self)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 37, in init
self.update_highlights()
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 315, in update_highlights
for func in self.state.bv.get_functions_containing(self.last_ip):
TypeError: 'NoneType' object is not iterable

Potential fix for older versions is verify that the returned value is not None.

Memory view widget

Should be able to examine memory at arbitrary addresses. It would probably make sense for this to be a LinearView. Potential feature: follow register (i.e. each time the debugger stops navigate to rax)

StackWidget crashes when trying to change a value

image

In dockwidgets/StackWidget.py:116 you have

		old_val = info['value']
		new_val = int(value, 16) # <------
		address = info['address']

		# Tell the debugger to update
		adapter = binjaplug.get_state(self.bv).adapter
		adapter.mem_write(address, new_val) # <------

but adapter.mem_write expects bytes and not an int resulting in the crash.


Also you could check if old_val == new_val to avoid doing the write if the value didn't actually change. In my use case, I was just copying the value for example.

Debugger control widget

Simple buttons to

  • single step
  • step over
  • continue (Play Button)
  • break (Pause Button)
  • terminate (Stop Button)
  • step out (continue executing until current function returns)

Improve error if user does not have lldb installed

Currently, if a user does not have lldb installed, the debugger will throw lots of exceptions. To better handle this, we should:

  • Destruct the adapter if execution failed
  • Show the user a prompt to install Xcode

Threading of the adapter / ui

Currently there are some cases where two threads send messages to the adapter at the same time. This causes race conditions when the adapter returns data. There are a few solutions to this:

  • Guard all adapter functions with a mutex
  • Guard access to the adapter itself with a mutex
  • Maintain a mutex-guarded queue of pending adapter functions and run all adapter code on one thread

Clean up use of tags

Currently the breakpoint tags are piggybacking off the default "Crashes" tag type. We should instead create our own tag type and create tags for it. Also may want to investigate alternate tags when we have additional line-data (eg as in #36)

Persistent storage

Currently all debugger configuration is cleared on reload. Here is a tentative list of data we need to save:

  • Breakpoints (location and enabled)
  • Command line arguments
  • (when implemented) adapter address/port

Button icons

Already have the svgs, just need to integrate them

Modules/Maps widget

We need a way to view mapped regions of memory. Essentially /proc/<pid>/maps

breakpoint failed in debugger

Not sure if linux specific or not, but with current dev and latest debugger master:

  1. open /bin/ls
  2. "run"
  3. "resume" since the initial breakpoint is in the libc loader?
  4. from _start, double click main, then right-click anywhere any select "set breakopint"
Traceback (most recent call last):
  File "/home/williamg/binaryninja/plugins/../python/binaryninja/plugin.py", line 144, in _default_action
    action(view_obj)
TypeError: cb_bp_set() missing 1 required positional argument: 'local_address'

Populate Widgets

Each of the widgets need to be dynamically populated with current state from the debugger

  • Breakpoints
  • Stackview
  • Registers
  • Console

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.