Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breakpoints and debugging statements open "read-only inlined content"

Context:

I am working on a React.js app that uses Webpack, and I'm using VS Code as my editor.

The Webpack config is specifying inline-source-map as its devtool option. but I am using hot reloading, too. So, source maps actually come into the browser via this webpack:// protocol.

I am using the following launch.json config:

{
    "name": "Launch in Chrome",
    "type": "chrome",
    "request": "launch",
    "url" : "https://myapp.local/", // This is not the real app URL
    "trace" : true,
    "sourceMaps": true,
    "webRoot": "${workspaceRoot}/build",
    "sourceMapPathOverrides": {
        "webpack:///*" : "${webRoot}/*"
    },
    "preLaunchTask" : "development",
    "internalConsoleOptions": "openOnSessionStart",
    "smartStep": true,
    "skipFiles": [
        "node_modules/**",
        "extensions:"
    ]
}

and I'm using this tasks.json.


Problem

So this mostly works well, except when I put a breakpoint somewhere, it opens the tab in a new tab marked as read-only inlined content from source map:

read-only inlined content from source map

I just want to be able to debug and work on my files directly!

like image 871
Martin Avatar asked May 09 '17 22:05

Martin


People also ask

What are breakpoints for in debugging?

Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint.

How many types of breakpoints are there?

There are two types of breakpoints: hardware breakpoints based on the processor hardware capabilities and software breakpoints.

Why are my breakpoints not working?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

What are code breakpoints?

When a programmer creates code they can add what is known as a breakpoint. A breakpoint is a point in the program where the code will stop executing.


1 Answers

I was running into the same issue remote debugging Python, thanks the two above answers I was able to solve it.

  1. as SimbalCoder suggested I saved the workspace. I suppose this is needed to set your workspace folder path.
  1. I then modified my launch.json as such:
{
            "name": "Python: Remote Attach",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}/Scripts/MyScripts/"
                }
            ],            
        }

Now the pathMappings are pointing to the correct file and upon debugger entry it is opening the correct file.

like image 116
largehadroncollider Avatar answered Oct 31 '22 04:10

largehadroncollider