File: TestVSCode_setExceptionBreakpoints.py

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (52 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Test lldb-vscode setBreakpoints request
"""

from __future__ import print_function

import pprint
import unittest2
import vscode
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import lldbvscode_testcase
import os


class TestVSCode_setExceptionBreakpoints(
        lldbvscode_testcase.VSCodeTestCaseBase):

    mydir = TestBase.compute_mydir(__file__)

    @skipIfWindows
    @skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
    @expectedFailureNetBSD
    @no_debug_info_test
    def test_functionality(self):
        '''Tests setting and clearing exception breakpoints.
           This packet is a bit tricky on the debug adaptor side since there
           is no "clear exception breakpoints" packet. Exception breakpoints
           are set by sending a "setExceptionBreakpoints" packet with zero or
           more exception filters. If exception breakpoints have been set
           before, any exising breakpoints must remain set, and any new
           breakpoints must be created, and any breakpoints that were in
           previous requests and are not in the current request must be
           removed. This exception tests this setting and clearing and makes
           sure things happen correctly. It doesn't test hitting breakpoints
           and the functionality of each breakpoint, like 'conditions' and
           x'hitCondition' settings.
        '''
        # Visual Studio Code Debug Adaptors have no way to specify the file
        # without launching or attaching to a process, so we must start a
        # process in order to be able to set breakpoints.
        program = self.getBuildArtifact("a.out")
        self.build_and_launch(program)

        filters = ['cpp_throw', 'cpp_catch']
        response = self.vscode.request_setExceptionBreakpoints(filters)
        if response:
            self.assertTrue(response['success'])

        self.continue_to_exception_breakpoint('C++ Throw')
        self.continue_to_exception_breakpoint('C++ Catch')