Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily update frames of all threads in all-stop mode #6869

Merged

Conversation

sfrylmark
Copy link
Contributor

@sfrylmark sfrylmark commented Jan 13, 2020

What it does

When a breakpoint occurs in a thread in all-stop mode, all other
threads have outdated/missing stackframes which means no variables
show up and can be inspected. This fixes the issue by marking each
thread as potentially having "dirty" frames: frames that need to be
re-fetched when the user selects them.

How to test

Testing is unfortunately quite complex at the moment. This is because @theia/cpp-debug is using an outdated version of a vscode extension. If you test these changes before and after, you'll see that before, you could only access the current thread's frames. After, you'll see that you can play around with all your frames as expected.

Step 1: Build the debugger vscode extension manually

The latest release of our fork is using an outdated adapter.

  1. Clone https://github.com/theia-ide/cdt-gdb-vscode
  2. Build the vscode extension yarn && yarn vsce:package
  3. Launch a simple webserver serving this file.
    Python 2: python -m SimpleHTTPServer
    Python 3: python -m http.server

Step 2: Add the extension to theia

  1. Add "cdt-gdb-vscode": "http://localhost:8000/cdt-gdb-vscode-0.0.90.vsix" to the root package.json under "theiaPlugins".
  2. Make sure you don't have a plugins/cdt-gdb-vscode laying around.
  3. yarn at the root, then yarn start:browser. If you've only updated the plugin, it's fine to just run yarn download:plugins instead of yarn.

Step 3: Get an example workspace

Debug a multi-threaded program with the GDB support, an example is https://github.com/zappala/pthreads-examples-c

  1. Clone https://github.com/zappala/pthreads-examples-c
  2. Compile with make -B CPPFLAGS=-ggdb
  3. Add the following .theia/tasks.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "gdb",
      "request": "launch",
      "name": "Example",
      "program": "${workspaceFolder}/example"
    }
  ]
}

Step 4: Play around with threads, both before and after this PR!

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added the debug issues that related to debug functionality label Jan 13, 2020
Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try using the cdt-gdb-vscode extension directly, see how it goes.

packages/debug/src/browser/debug-session.tsx Outdated Show resolved Hide resolved
@vince-fugnitto
Copy link
Member

Closing for the moment, discussions will be taken offline in the meantime.

@akosyakov
Copy link
Member

akosyakov commented Jan 14, 2020

Please study VS Code code base for such changes as a reference implementation, don't invent here. We should align it.

@paul-marechal
Copy link
Member

@akosyakov the changes look good to me. When you say "we should align [with vscode]", what would you see done differently here? VS Code doesn't use the same model classes as we do, so I see the current change as a minimal way to fix the issue with outdated frames.

@akosyakov
Copy link
Member

akosyakov commented Feb 4, 2020

VS Code doesn't use the same model classes as we do, so I see the current change as a minimal way to fix the issue with outdated frames

model is not but logic should be the same to respect DAP expectations and timing

@paul-marechal paul-marechal self-requested a review February 4, 2020 15:38
When a breakpoint occurs in a thread in all-stop mode, all other
threads have outdated/missing stackframes which means no variables
show up and can be inspected. This fixes the issue by marking each
thread as potentially having "dirty" frames: frames that need to be
re-fetched when the user selects them.

Signed-off-by: Samuel Frylmark <samuel.frylmark@ericsson.com>
@sfrylmark
Copy link
Contributor Author

Bump?

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov
Copy link
Member

@marechal-p let's try, it looks cleaner now, sorry i don't have headspace to think about implications right now or time to try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants