Comments (19)
if it works on the CLI, it should work the same in vscode - what issues are you experiencing?
from code-debug.
if it works on the CLI, it should work the same in vscode - what issues are you experiencing?
hi, I am newer with native-debugger, and python/c++ mix debug,I following the tutoiral(that based on cpptools which I dont want to use) and I found It looks like code-debug cannot recogonize command "processId": "${command:pickProcess}",
so I stucked here...
from code-debug.
ah pickProcess is not implemented in code-debug, you'll need to manually put in the PID, see README
"request": "attach",
"executable": "./bin/python", <-- taken and translated from your tutorial link
"target": "4285" <-- your PID here
from code-debug.
in my mind, the process of python is launched by the configue in launch.json
:
So, I think I Cannot get the PID before start debug, do you have good idea to work around this?
from code-debug.
pickProcess doesn't take the PID before starting, it also only works with running processes, so just insert a long sleep or something in your python script to give you time to pick it.
from code-debug.
but the python debug process is launched by launch.json
right?
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceRoot}/bin/python", /* My virtual env */
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
from code-debug.
yes, once it's launched you look up the PID of the python process that was just launched
from code-debug.
so, my question is " launch the python debug process through the vscode launch.json
then record the PID to the lauch.json
maunally and it can worked?"
from code-debug.
yes that should work, give it a try
from code-debug.
my launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"python": "/usr/bin/python",
"name": "Python: model_deploy",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/../test/workspace",
"env": {
"INSTALL_PATH": "/workspace/tpu-mlir/install",
"PYTHONPATH": "/workspace/tpu-mlir/third_party/customlayer/python:/workspace/tpu-mlir/python:/usr/local/python_packages/:/workspace/tpu-mlir/install/python",
"REGRESSION_PATH": "/workspace/tpu-mlir/regression",
"LD_LIBRARY_PATH": "/workspace/tpu-mlir/install/lib:/workspace/tpu-mlir/capi/lib",
"TPUC_ROOT": "/workspace/tpu-mlir/install",
"MODEL_ZOO_PATH": "/workspace/tpu-mlir/../model-zoo",
"NNMODELS_PATH": "/workspace/tpu-mlir/../nnmodels",
"CMODEL_LD_LIBRARY_PATH": "/workspace/tpu-mlir/install/lib:/workspace/tpu-mlir/capi/lib",
"PROJECT_ROOT": "/workspace/tpu-mlir",
"PATH": "/workspace/tpu-mlir/third_party/customlayer/python:/workspace/tpu-mlir/python/samples:/workspace/tpu-mlir/python/test:/workspace/tpu-mlir/python/utils:/workspace/tpu-mlir/python/tools:/workspace/tpu-mlir/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"CHIP_LD_LIBRARY_PATH": "/opt/sophon/libsophon-current/lib/:/workspace/tpu-mlir/install/lib:/workspace/tpu-mlir/capi/lib",
},
"args": [
"--mlir",
"yolov5s.mlir",
"--quantize",
"F16",
"--processor",
"bm1684x",
"--test_input",
"yolov5s_in_f32.npz",
"--test_reference",
"yolov5s_top_outputs.npz",
"--model",
"yolov5s_1684x_f16.bmodel"
]
},
{
"name": "Debug",
"type": "gdb",
"request": "attach",
"executable": "/usr/bin/python",
"target": "",
"cwd": "${workspaceFolder}/../test/workspace",
"stopAtEntry": true,
}
]
}
from code-debug.
vscode error is: Failed ro attach: Argument required(process-id to attach).(from target-attach)
from code-debug.
you need to insert the PID in the target
argument, the extension won't just magically know which python process to debug
from code-debug.
yes, but the python process is launched by the start debugging
button with the configuration in launch.json
from code-debug.
so I cant know the process id before I click the start debugging
right?
from code-debug.
you need to be starting two debugging processes, you need to start the python debugger first, then take the PID of it, then start the native debug debugger
In the tutorial you posted it's the same, just taking the PID of it will present you with a list of processes instead of needing to manually copy it from a command
from code-debug.
see Step 5 in your tutorial, it's almost exactly the same procedure
from code-debug.
thanks for help!
from code-debug.
from code-debug.
good idea, I wanted it for a while myself, although I have mostly been using CodeLLDB recently, which worked better for my environment than GDB and also already has a pickProcess command in it.
Still occasionally using this extension and also supporting it in another extension that generates debug configurations automatically, would enable feature parity with CodeLLDB in that regard.
from code-debug.
Related Issues (20)
- support input variables `gdbpath` setting HOT 3
- Debug this plugin HOT 3
- [enhancement] Support source file browsing HOT 5
- bad error message if `cwd` points to non-existing directory HOT 2
- UI out of sync with gdb status HOT 11
- Dynamically choose PID to attach HOT 2
- not finding the source files despite setting the sourceFileMap correctly HOT 5
- missing checks for debug attributes lead to TypeErrors on Execution
- F10(step over) end of main function, 'crtexe.c' The editor could not be opened because the file was not found. HOT 1
- Variables Evaluate is NOT Working for Struct Pointer of Function Variable HOT 2
- How pass multiple args to debug_args?
- My breakpoints are completely ignored HOT 4
- Ignore unfetchable registers HOT 6
- ssh2 dependency does not seem to support older KEX algorithms
- Hardware breakpoint support for embedded development HOT 1
- Popup error on hovering.
- (Microcontrollers) Is it possible to utilize .svd file to view target registers? HOT 2
- Failed to attach: Remote target doesn't support qGetTIBAddr packet
- Standard output parsing changes lines with `@` (at) symbol in them to "undefined"
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 code-debug.