I want to analyse a C++ application which compiled as a Python extension. A Python script feeds data and executes the application. I am wondering how can I analyse the C++ module via Inspector.
For example, I had the same issue with GDB in Eclipse, but when I made another application which executes the Python file from C++, it can get the breakpoint, when the control goes to Python and turns to the extension. But, this trick is not working for Inspector.
I appreciate any clue.
Inspector XE can only monitor one (target) process, cannot monitor multiple process. In general speaking, target process is launching process, but some cases it is not. If you use python to launch application, I suppose to use:
"inspxe-cl -collect mi3 -executable-of-interest c++application -- python script.py" - for example. Also you can filter all non-interest of module like this, "inspxe-cl -collect mi3 -module-filter-mode=include -module-filter=c++module -executable-of-interest c++application -- python script.py" . Thus, only your interest of module in C++ application will be monitored.
For debugging to stop when meet errors detected by Inspector, use:
"inspxe-cl -collect mi3 -appdebug=on-error -executable-of-interest c++application -- python script.py" - for example.
Thank you Peter,
I have tried as you described, but it seems that collector can not gather information. I have tried to change some parameters and in any case I see the below error message:
Error: Cannot find analysis results. Suggestion: Make sure that the application launched your executable of interest c++application.
I do not know what is the reason. Do you think the python should support something to let the Inspector get information?
It seemed a real problem when I used python to launch. My test cases are simple:
# inspxe-cl -collect mi3 -executable-of-interest test_memory -- python a.py
Error: Cannot find analysis results. Suggestion: Make sure that application launched your executable of interest test_memory
However, shell script works and it generated expected result.
#inspxe-cl -collect mi3 -executable-of-interest test_memory -- ./a.sh
So using shell script is a workaround, let me check with developer to know if this is a limitation.
The developer told me a workaround, that is to use the subprocess module instead of using os.system, for example:
The root-cause is that launched python script and target application should stay same layer of shell.
For example, b.sh - doesn't work when using Inspector.
"#!/bin/sh" should be removed as a workaround.