Comments (5)
One workaround is to set PyCharm's variable loading policy to "On demand" (Gear Icon on the left edge of the debugger panel). At least with my quick test just now this gets rid of all the errors in the ghidra_bridge server log. But at the obvious price of having to request the value for a variable if you want to see it in the debugger.
from ghidra_bridge.
Hi, @mechgt - can you post the script you're running, including how you're starting the bridge? That'll help me see if I can reproduce the problem.
from ghidra_bridge.
See below. When I 'run' the code from PyCharm it behaves normally. When I debug and it hits a breakpoint (e.g. at name = func.getName() ) it spits out the errors at the end of this post.
I made a simple demo script and can now see the first errors mentioning django missing. Is this maybe at the root of the issue?
# Ghidra Bridge Issue 53 Test
# @author mechgt
# @category _NEW_
# @keybinding
# @menupath
# @toolbar
try:
import ghidra_bridge
b = ghidra_bridge.GhidraBridge(namespace=globals(), hook_import=True) # creates the bridge and loads the flat API into the global namespace
except:
pass
try:
# import pydevd
# pydevd.settrace("127.0.0.1", port=5678, stdoutToServer=True, stderrToServer=True)
from ghidra_builtins import *
except:
pass
def someFun(func):
name = func.getName()
return name
# Iterate through functions, parsing and printing each
function = getFirstFunction()
while function is not None:
name = someFun(function)
println(name)
function = getFunctionAfter(function)
Ghidra Console output:
ghidra_bridge_server_background.py> Running...
INFO:jfx_bridge.bridge:Server launching in background - will continue to run after launch script finishes...
INFO:jfx_bridge.bridge:serving! (jfx_bridge v0.8.0, Python 2.7.1)
ghidra_bridge_server_background.py> Finished!
WARNING:jfx_bridge.bridge:Handling connection from ('127.0.0.1', 3960)
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 1129, in local_import
result = importlib.import_module(name)
File "C:\Ghidra\ghidra_9.1.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.1\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 1129, in local_import
result = importlib.import_module(name)
File "C:\Ghidra\ghidra_9.1.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.1\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
WARNING:jfx_bridge.bridge:Closing connection from ('127.0.0.1', 3960)
WARNING:jfx_bridge.bridge:Handling connection from ('127.0.0.1', 3966)
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 1129, in local_import
result = importlib.import_module(name)
File "C:\Ghidra\ghidra_9.1.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.1\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named ghidra_builtins
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 1129, in local_import
result = importlib.import_module(name)
File "C:\Ghidra\ghidra_9.1.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.1\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 1129, in local_import
result = importlib.import_module(name)
File "C:\Ghidra\ghidra_9.1.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.1\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
ghidra_bridge_server_background.py> FUN_StatusObjConstructor
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
ghidra_bridge_server_background.py> FUN_ReleaseMemory
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
Traceback (most recent call last):
File "C:\Users\user\ghidra_scripts\jfx_bridge\bridge.py", line 974, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.function.FunctionDB' object has no attribute '__len__'
WARNING:jfx_bridge.bridge:Closing connection from ('127.0.0.1', 3966)
from ghidra_bridge.
Ahh, okay. So this looks like it's something to do with the PyCharm debugger (I've managed to replicate it by debugging in PyCharm). It looks like it's querying every Python object to see if it's got a __len__, probably so it can fill out some info or represent it in a handy way for debugging.
GhidraBridge will just blindly proxy the attribute requests across - on the server side, the error is caught and handled, and the message that appears is just a warning; everything should still be operating just fine.
Since this is only going to occur while debugging, and even then it doesn't really break things, I'm not going to be super-motivated to change this behaviour. Let me know if it is actually breaking things for you, though, and I can re-evaluate.
from ghidra_bridge.
Gotcha.
For a single user datapoint, my primary motivator for checking out ghidra_bridge was exclusively for debugging. I'm having trouble getting other debug mechanisms working, so this is currently THE solution that's working for me. Point being that debugging can be a primary use case for ghidra_bridge.
Thx for taking the time to check it the error messages and providing feedback!
from ghidra_bridge.
Related Issues (20)
- Memory.getBytes returns empty array HOT 3
- PyPI description has three sequential steps all numbered "1" HOT 2
- Timeout value is not configurable in `ghidra_bridge_server.py` HOT 1
- Are you able to write to a ghidra project? HOT 1
- findBytes return an empty Array HOT 1
- Unable to stop auto-analysis for script connected via ghidra_bridge HOT 1
- Expose other IPC channels HOT 1
- How to put arguments in remote_eval?
- setComment causes BridgeException HOT 2
- Cannot inherit bridged classes HOT 1
- Unhashable type _bridged_ghidra.program.database.function.FunctionDB HOT 2
- Bad file descriptor HOT 1
- Socket not closed, when GhidraBridge Object gets out of scope HOT 5
- Timeout Condition HOT 6
- How to remote debug with VSCode? HOT 4
- Windows: Binding on low port blocked by firewall HOT 3
- How to pass arguments to the post script HOT 1
- Question: how does the RPC bridge handle class callbacks? HOT 3
- using in IDE with proper auto completion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghidra_bridge.