Giter VIP home page Giter VIP logo

Comments (19)

WebFreak001 avatar WebFreak001 commented on August 25, 2024

if it works on the CLI, it should work the same in vscode - what issues are you experiencing?

from code-debug.

lordrebel avatar lordrebel commented on August 25, 2024

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.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

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.

lordrebel avatar lordrebel commented on August 25, 2024

in my mind, the process of python is launched by the configue in launch.json:
image
So, I think I Cannot get the PID before start debug, do you have good idea to work around this?

from code-debug.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

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.

lordrebel avatar lordrebel commented on August 25, 2024

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.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

yes, once it's launched you look up the PID of the python process that was just launched

from code-debug.

lordrebel avatar lordrebel commented on August 25, 2024

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.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

yes that should work, give it a try

from code-debug.

lordrebel avatar lordrebel commented on August 25, 2024

I got error from vscode:
image

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.

lordrebel avatar lordrebel commented on August 25, 2024

vscode error is: Failed ro attach: Argument required(process-id to attach).(from target-attach)

from code-debug.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

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.

lordrebel avatar lordrebel commented on August 25, 2024

yes, but the python process is launched by the start debugging button with the configuration in launch.json

from code-debug.

lordrebel avatar lordrebel commented on August 25, 2024

so I cant know the process id before I click the start debugging right?

from code-debug.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

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.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

see Step 5 in your tutorial, it's almost exactly the same procedure

from code-debug.

lordrebel avatar lordrebel commented on August 25, 2024

thanks for help!

from code-debug.

GitMensch avatar GitMensch commented on August 25, 2024

from code-debug.

WebFreak001 avatar WebFreak001 commented on August 25, 2024

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)

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.