Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Breakpoints not working with remote debugging with handled exceptions #581

Closed
DonJayamanne opened this issue Jul 3, 2018 · 3 comments
Closed

Comments

@DonJayamanne
Copy link
Contributor

Environment data

  • PTVSD version: Master
  • OS and version: N/A (but tested on Windows)
  • Python version (& distribution if applicable, e.g. Anaconda): XXX
  • Using VS Code or Visual Studio: VSC
  • Though this is remote debugging, everything is local, both debugger and program

Actual behavior

Debugger does not break at breakpoints when there's a handled exception.

Expected behavior

Debugger should break at breakpoints.

This used to work in 4.1.1a5

Steps to reproduce:

  • Start the following code for remote debugging:
import time

import ptvsd
ptvsd.enable_attach()

for i in range(1000):
    time.sleep(1)
	print(i)
	try:
		raise ArithmeticError()
	except Exception:
		pass
  • Go into VSC
  • Ensure the settings in Breakpoints of VSC are as follows (default):
    [ ] Raised Exceptions
    [x] Uncaught Exceptions
  • Attach the debugger (for remote debugging)
  • Observe how debugger breaks on the exception (issue reported Debugger always breaks into handled exceptions in remote debugging #580)
  • Add a breakpoint to the line time.sleep(1)
  • Hit continue button
  • Breakpoint is not hit

This seems to reproduce only when we have handled exceptions. So please look into this after resolving #580

@karthiknadig
Copy link
Member

Does not repro on Windows or Linux.

@karthiknadig karthiknadig removed their assignment Jul 9, 2018
@DonJayamanne
Copy link
Contributor Author

Please confirm that you can replicate it on Windows

@fabioz
Copy link
Contributor

fabioz commented Jul 11, 2018

This is the same thing as #580 (that exception is considered unhandled even though it's handled because it's in the topmost frame during a remote attach), which is also probably why @karthiknadig is not being able to reproduce (it depends on whether it was started with the -m switch or not).

You can confirm that by putting the code inside a method:

import time

import ptvsd
ptvsd.enable_attach()

def main():
    for i in range(1000):
        time.sleep(1)
        print(i)
        try:
            raise ArithmeticError()
        except Exception:
            pass

main()

fabioz added a commit to fabioz/ptvsd that referenced this issue Sep 20, 2018
fabioz added a commit to fabioz/ptvsd that referenced this issue Sep 20, 2018
fabioz added a commit to fabioz/ptvsd that referenced this issue Sep 20, 2018
fabioz added a commit to fabioz/ptvsd that referenced this issue Sep 20, 2018
karthiknadig pushed a commit that referenced this issue Sep 24, 2018
…n a remote attach. Fixes #580, #581 (#827)

* Properly deal with handled/unhandled exceptions on top-level frames on a remote attach. Fixes #580, #581

* Remove leftover print.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants