H. Frystyk Nielsen
+# Expires September 8, 1995 March 8, 1995
+#
+# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
+#
+# and
+#
+# Network Working Group R. Fielding
+# Request for Comments: 2616 et al
+# Obsoletes: 2068 June 1999
+# Category: Standards Track
+#
+# URL: http://www.faqs.org/rfcs/rfc2616.html
+
+# Log files
+# ---------
+#
+# Here's a quote from the NCSA httpd docs about log file format.
+#
+# | The logfile format is as follows. Each line consists of:
+# |
+# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
+# |
+# | host: Either the DNS name or the IP number of the remote client
+# | rfc931: Any information returned by identd for this person,
+# | - otherwise.
+# | authuser: If user sent a userid for authentication, the user name,
+# | - otherwise.
+# | DD: Day
+# | Mon: Month (calendar name)
+# | YYYY: Year
+# | hh: hour (24-hour format, the machine's timezone)
+# | mm: minutes
+# | ss: seconds
+# | request: The first line of the HTTP request as sent by the client.
+# | ddd: the status code returned by the server, - if not available.
+# | bbbb: the total number of bytes sent,
+# | *not including the HTTP/1.0 header*, - if not available
+# |
+# | You can determine the name of the file accessed through request.
+#
+# (Actually, the latter is only true if you know the server configuration
+# at the time the request was made!)
+
+__version__ = "0.3"
+
+__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
+
+import sys
+from _pydev_imps._pydev_saved_modules import time
+from _pydev_imps._pydev_saved_modules import socket
+from warnings import filterwarnings, catch_warnings
+with catch_warnings():
+ if sys.py3kwarning:
+ filterwarnings("ignore", ".*mimetools has been removed",
+ DeprecationWarning)
+ import mimetools
+
+from _pydev_imps import _pydev_SocketServer as SocketServer
+
+# Default error message template
+DEFAULT_ERROR_MESSAGE = """\
+
+Error response
+
+
+Error response
+Error code %(code)d.
+
Message: %(message)s.
+
Error code explanation: %(code)s = %(explain)s.
+
+"""
+
+DEFAULT_ERROR_CONTENT_TYPE = "text/html"
+
+def _quote_html(html):
+ return html.replace("&", "&").replace("<", "<").replace(">", ">")
+
+class HTTPServer(SocketServer.TCPServer):
+
+ allow_reuse_address = 1 # Seems to make sense in testing environment
+
+ def server_bind(self):
+ """Override server_bind to store the server name."""
+ SocketServer.TCPServer.server_bind(self)
+ host, port = self.socket.getsockname()[:2]
+ self.server_name = socket.getfqdn(host)
+ self.server_port = port
+
+
+class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
+
+ """HTTP request handler base class.
+
+ The following explanation of HTTP serves to guide you through the
+ code as well as to expose any misunderstandings I may have about
+ HTTP (so you don't need to read the code to figure out I'm wrong
+ :-).
+
+ HTTP (HyperText Transfer Protocol) is an extensible protocol on
+ top of a reliable stream transport (e.g. TCP/IP). The protocol
+ recognizes three parts to a request:
+
+ 1. One line identifying the request type and path
+ 2. An optional set of RFC-822-style headers
+ 3. An optional data part
+
+ The headers and data are separated by a blank line.
+
+ The first line of the request has the form
+
+
+
+ where is a (case-sensitive) keyword such as GET or POST,
+ is a string containing path information for the request,
+ and should be the string "HTTP/1.0" or "HTTP/1.1".
+ is encoded using the URL encoding scheme (using %xx to signify
+ the ASCII character with hex code xx).
+
+ The specification specifies that lines are separated by CRLF but
+ for compatibility with the widest range of clients recommends
+ servers also handle LF. Similarly, whitespace in the request line
+ is treated sensibly (allowing multiple spaces between components
+ and allowing trailing whitespace).
+
+ Similarly, for output, lines ought to be separated by CRLF pairs
+ but most clients grok LF characters just fine.
+
+ If the first line of the request has the form
+
+
+
+ (i.e. is left out) then this is assumed to be an HTTP
+ 0.9 request; this form has no optional headers and data part and
+ the reply consists of just the data.
+
+ The reply form of the HTTP 1.x protocol again has three parts:
+
+ 1. One line giving the response code
+ 2. An optional set of RFC-822-style headers
+ 3. The data
+
+ Again, the headers and data are separated by a blank line.
+
+ The response code line has the form
+
+
+
+ where is the protocol version ("HTTP/1.0" or "HTTP/1.1"),
+ is a 3-digit response code indicating success or
+ failure of the request, and is an optional
+ human-readable string explaining what the response code means.
+
+ This server parses the request and the headers, and then calls a
+ function specific to the request type (). Specifically,
+ a request SPAM will be handled by a method do_SPAM(). If no
+ such method exists the server sends an error response to the
+ client. If it exists, it is called with no arguments:
+
+ do_SPAM()
+
+ Note that the request name is case sensitive (i.e. SPAM and spam
+ are different requests).
+
+ The various request details are stored in instance variables:
+
+ - client_address is the client IP address in the form (host,
+ port);
+
+ - command, path and version are the broken-down request line;
+
+ - headers is an instance of mimetools.Message (or a derived
+ class) containing the header information;
+
+ - rfile is a file object open for reading positioned at the
+ start of the optional input data part;
+
+ - wfile is a file object open for writing.
+
+ IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!
+
+ The first thing to be written must be the response line. Then
+ follow 0 or more header lines, then a blank line, and then the
+ actual data (if any). The meaning of the header lines depends on
+ the command executed by the server; in most cases, when data is
+ returned, there should be at least one header line of the form
+
+ Content-type: /
+
+ where and should be registered MIME types,
+ e.g. "text/html" or "text/plain".
+
+ """
+
+ # The Python system version, truncated to its first component.
+ sys_version = "Python/" + sys.version.split()[0]
+
+ # The server software version. You may want to override this.
+ # The format is multiple whitespace-separated strings,
+ # where each string is of the form name[/version].
+ server_version = "BaseHTTP/" + __version__
+
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
+ def parse_request(self):
+ """Parse a request (internal).
+
+ The request should be stored in self.raw_requestline; the results
+ are in self.command, self.path, self.request_version and
+ self.headers.
+
+ Return True for success, False for failure; on failure, an
+ error is sent back.
+
+ """
+ self.command = None # set in case of error on the first line
+ self.request_version = version = self.default_request_version
+ self.close_connection = 1
+ requestline = self.raw_requestline
+ requestline = requestline.rstrip('\r\n')
+ self.requestline = requestline
+ words = requestline.split()
+ if len(words) == 3:
+ command, path, version = words
+ if version[:5] != 'HTTP/':
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ try:
+ base_version_number = version.split('/', 1)[1]
+ version_number = base_version_number.split(".")
+ # RFC 2145 section 3.1 says there can be only one "." and
+ # - major and minor numbers MUST be treated as
+ # separate integers;
+ # - HTTP/2.4 is a lower version than HTTP/2.13, which in
+ # turn is lower than HTTP/12.3;
+ # - Leading zeros MUST be ignored by recipients.
+ if len(version_number) != 2:
+ raise ValueError
+ version_number = int(version_number[0]), int(version_number[1])
+ except (ValueError, IndexError):
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
+ self.close_connection = 0
+ if version_number >= (2, 0):
+ self.send_error(505,
+ "Invalid HTTP Version (%s)" % base_version_number)
+ return False
+ elif len(words) == 2:
+ command, path = words
+ self.close_connection = 1
+ if command != 'GET':
+ self.send_error(400,
+ "Bad HTTP/0.9 request type (%r)" % command)
+ return False
+ elif not words:
+ return False
+ else:
+ self.send_error(400, "Bad request syntax (%r)" % requestline)
+ return False
+ self.command, self.path, self.request_version = command, path, version
+
+ # Examine the headers and look for a Connection directive
+ self.headers = self.MessageClass(self.rfile, 0)
+
+ conntype = self.headers.get('Connection', "")
+ if conntype.lower() == 'close':
+ self.close_connection = 1
+ elif (conntype.lower() == 'keep-alive' and
+ self.protocol_version >= "HTTP/1.1"):
+ self.close_connection = 0
+ return True
+
+ def handle_one_request(self):
+ """Handle a single HTTP request.
+
+ You normally don't need to override this method; see the class
+ __doc__ string for information on how to handle specific HTTP
+ commands such as GET and POST.
+
+ """
+ try:
+ self.raw_requestline = self.rfile.readline(65537)
+ if len(self.raw_requestline) > 65536:
+ self.requestline = ''
+ self.request_version = ''
+ self.command = ''
+ self.send_error(414)
+ return
+ if not self.raw_requestline:
+ self.close_connection = 1
+ return
+ if not self.parse_request():
+ # An error code has been sent, just exit
+ return
+ mname = 'do_' + self.command
+ if not hasattr(self, mname):
+ self.send_error(501, "Unsupported method (%r)" % self.command)
+ return
+ method = getattr(self, mname)
+ method()
+ self.wfile.flush() #actually send the response if not already done.
+ except socket.timeout:
+ #a read or a write timed out. Discard this connection
+ self.log_error("Request timed out: %r", sys.exc_info()[1])
+ self.close_connection = 1
+ return
+
+ def handle(self):
+ """Handle multiple requests if necessary."""
+ self.close_connection = 1
+
+ self.handle_one_request()
+ while not self.close_connection:
+ self.handle_one_request()
+
+ def send_error(self, code, message=None):
+ """Send and log an error reply.
+
+ Arguments are the error code, and a detailed message.
+ The detailed message defaults to the short entry matching the
+ response code.
+
+ This sends an error response (so it must be called before any
+ output has been generated), logs the error, and finally sends
+ a piece of HTML explaining the error to the user.
+
+ """
+
+ try:
+ short, long = self.responses[code]
+ except KeyError:
+ short, long = '???', '???'
+ if message is None:
+ message = short
+ explain = long
+ self.log_error("code %d, message %s", code, message)
+ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
+ content = (self.error_message_format %
+ {'code': code, 'message': _quote_html(message), 'explain': explain})
+ self.send_response(code, message)
+ self.send_header("Content-Type", self.error_content_type)
+ self.send_header('Connection', 'close')
+ self.end_headers()
+ if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ self.wfile.write(content)
+
+ error_message_format = DEFAULT_ERROR_MESSAGE
+ error_content_type = DEFAULT_ERROR_CONTENT_TYPE
+
+ def send_response(self, code, message=None):
+ """Send the response header and log the response code.
+
+ Also send two standard headers with the server software
+ version and the current date.
+
+ """
+ self.log_request(code)
+ if message is None:
+ if code in self.responses:
+ message = self.responses[code][0]
+ else:
+ message = ''
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("%s %d %s\r\n" %
+ (self.protocol_version, code, message))
+ # print (self.protocol_version, code, message)
+ self.send_header('Server', self.version_string())
+ self.send_header('Date', self.date_time_string())
+
+ def send_header(self, keyword, value):
+ """Send a MIME header."""
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("%s: %s\r\n" % (keyword, value))
+
+ if keyword.lower() == 'connection':
+ if value.lower() == 'close':
+ self.close_connection = 1
+ elif value.lower() == 'keep-alive':
+ self.close_connection = 0
+
+ def end_headers(self):
+ """Send the blank line ending the MIME headers."""
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("\r\n")
+
+ def log_request(self, code='-', size='-'):
+ """Log an accepted request.
+
+ This is called by send_response().
+
+ """
+
+ self.log_message('"%s" %s %s',
+ self.requestline, str(code), str(size))
+
+ def log_error(self, format, *args):
+ """Log an error.
+
+ This is called when a request cannot be fulfilled. By
+ default it passes the message on to log_message().
+
+ Arguments are the same as for log_message().
+
+ XXX This should go to the separate error log.
+
+ """
+
+ self.log_message(format, *args)
+
+ def log_message(self, format, *args):
+ """Log an arbitrary message.
+
+ This is used by all other logging functions. Override
+ it if you have specific logging wishes.
+
+ The first argument, FORMAT, is a format string for the
+ message to be logged. If the format string contains
+ any % escapes requiring parameters, they should be
+ specified as subsequent arguments (it's just like
+ printf!).
+
+ The client host and current date/time are prefixed to
+ every message.
+
+ """
+
+ sys.stderr.write("%s - - [%s] %s\n" %
+ (self.address_string(),
+ self.log_date_time_string(),
+ format%args))
+
+ def version_string(self):
+ """Return the server software version string."""
+ return self.server_version + ' ' + self.sys_version
+
+ def date_time_string(self, timestamp=None):
+ """Return the current date and time formatted for a message header."""
+ if timestamp is None:
+ timestamp = time.time()
+ year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+ s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+ self.weekdayname[wd],
+ day, self.monthname[month], year,
+ hh, mm, ss)
+ return s
+
+ def log_date_time_string(self):
+ """Return the current time formatted for logging."""
+ now = time.time()
+ year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
+ s = "%02d/%3s/%04d %02d:%02d:%02d" % (
+ day, self.monthname[month], year, hh, mm, ss)
+ return s
+
+ weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+ monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+ def address_string(self):
+ """Return the client address formatted for logging.
+
+ This version looks up the full hostname using gethostbyaddr(),
+ and tries to find a name that contains at least one dot.
+
+ """
+
+ host, port = self.client_address[:2]
+ return socket.getfqdn(host)
+
+ # Essentially static class variables
+
+ # The version of the HTTP protocol we support.
+ # Set this to HTTP/1.1 to enable automatic keepalive
+ protocol_version = "HTTP/1.0"
+
+ # The Message-like class used to parse headers
+ MessageClass = mimetools.Message
+
+ # Table mapping response codes to messages; entries have the
+ # form {code: (shortmessage, longmessage)}.
+ # See RFC 2616.
+ responses = {
+ 100: ('Continue', 'Request received, please continue'),
+ 101: ('Switching Protocols',
+ 'Switching to new protocol; obey Upgrade header'),
+
+ 200: ('OK', 'Request fulfilled, document follows'),
+ 201: ('Created', 'Document created, URL follows'),
+ 202: ('Accepted',
+ 'Request accepted, processing continues off-line'),
+ 203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
+ 204: ('No Content', 'Request fulfilled, nothing follows'),
+ 205: ('Reset Content', 'Clear input form for further input.'),
+ 206: ('Partial Content', 'Partial content follows.'),
+
+ 300: ('Multiple Choices',
+ 'Object has several resources -- see URI list'),
+ 301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
+ 302: ('Found', 'Object moved temporarily -- see URI list'),
+ 303: ('See Other', 'Object moved -- see Method and URL list'),
+ 304: ('Not Modified',
+ 'Document has not changed since given time'),
+ 305: ('Use Proxy',
+ 'You must use proxy specified in Location to access this '
+ 'resource.'),
+ 307: ('Temporary Redirect',
+ 'Object moved temporarily -- see URI list'),
+
+ 400: ('Bad Request',
+ 'Bad request syntax or unsupported method'),
+ 401: ('Unauthorized',
+ 'No permission -- see authorization schemes'),
+ 402: ('Payment Required',
+ 'No payment -- see charging schemes'),
+ 403: ('Forbidden',
+ 'Request forbidden -- authorization will not help'),
+ 404: ('Not Found', 'Nothing matches the given URI'),
+ 405: ('Method Not Allowed',
+ 'Specified method is invalid for this resource.'),
+ 406: ('Not Acceptable', 'URI not available in preferred format.'),
+ 407: ('Proxy Authentication Required', 'You must authenticate with '
+ 'this proxy before proceeding.'),
+ 408: ('Request Timeout', 'Request timed out; try again later.'),
+ 409: ('Conflict', 'Request conflict.'),
+ 410: ('Gone',
+ 'URI no longer exists and has been permanently removed.'),
+ 411: ('Length Required', 'Client must specify Content-Length.'),
+ 412: ('Precondition Failed', 'Precondition in headers is false.'),
+ 413: ('Request Entity Too Large', 'Entity is too large.'),
+ 414: ('Request-URI Too Long', 'URI is too long.'),
+ 415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
+ 416: ('Requested Range Not Satisfiable',
+ 'Cannot satisfy request range.'),
+ 417: ('Expectation Failed',
+ 'Expect condition could not be satisfied.'),
+
+ 500: ('Internal Server Error', 'Server got itself in trouble'),
+ 501: ('Not Implemented',
+ 'Server does not support this operation'),
+ 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
+ 503: ('Service Unavailable',
+ 'The server cannot process the request due to a high load'),
+ 504: ('Gateway Timeout',
+ 'The gateway server did not receive a timely response'),
+ 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
+ }
+
+
+def test(HandlerClass = BaseHTTPRequestHandler,
+ ServerClass = HTTPServer, protocol="HTTP/1.0"):
+ """Test the HTTP request handler class.
+
+ This runs an HTTP server on port 8000 (or the first command line
+ argument).
+
+ """
+
+ if sys.argv[1:]:
+ port = int(sys.argv[1])
+ else:
+ port = 8000
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print ("Serving HTTP on", sa[0], "port", sa[1], "...")
+ httpd.serve_forever()
+
+
+if __name__ == '__main__':
+ test()
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_SimpleXMLRPCServer.py b/ptvsd/pydevd/_pydev_imps/_pydev_SimpleXMLRPCServer.py
new file mode 100644
index 00000000..c5f77426
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_SimpleXMLRPCServer.py
@@ -0,0 +1,601 @@
+#Just a copy of the version in python 2.5 to be used if it's not available in jython 2.1
+
+"""Simple XML-RPC Server.
+
+This module can be used to create simple XML-RPC servers
+by creating a server and either installing functions, a
+class instance, or by extending the SimpleXMLRPCServer
+class.
+
+It can also be used to handle XML-RPC requests in a CGI
+environment using CGIXMLRPCRequestHandler.
+
+A list of possible usage patterns follows:
+
+1. Install functions:
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_function(pow)
+server.register_function(lambda x,y: x+y, 'add')
+server.serve_forever()
+
+2. Install an instance:
+
+class MyFuncs:
+ def __init__(self):
+ # make all of the string functions available through
+ # string.func_name
+ import string
+ self.string = string
+ def _listMethods(self):
+ # implement this method so that system.listMethods
+ # knows to advertise the strings methods
+ return list_public_methods(self) + \
+ ['string.' + method for method in list_public_methods(self.string)]
+ def pow(self, x, y): return pow(x, y)
+ def add(self, x, y) : return x + y
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(MyFuncs())
+server.serve_forever()
+
+3. Install an instance with custom dispatch method:
+
+class Math:
+ def _listMethods(self):
+ # this method must be present for system.listMethods
+ # to work
+ return ['add', 'pow']
+ def _methodHelp(self, method):
+ # this method must be present for system.methodHelp
+ # to work
+ if method == 'add':
+ return "add(2,3) => 5"
+ elif method == 'pow':
+ return "pow(x, y[, z]) => number"
+ else:
+ # By convention, return empty
+ # string if no help is available
+ return ""
+ def _dispatch(self, method, params):
+ if method == 'pow':
+ return pow(*params)
+ elif method == 'add':
+ return params[0] + params[1]
+ else:
+ raise 'bad method'
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(Math())
+server.serve_forever()
+
+4. Subclass SimpleXMLRPCServer:
+
+class MathServer(SimpleXMLRPCServer):
+ def _dispatch(self, method, params):
+ try:
+ # We are forcing the 'export_' prefix on methods that are
+ # callable through XML-RPC to prevent potential security
+ # problems
+ func = getattr(self, 'export_' + method)
+ except AttributeError:
+ raise Exception('method "%s" is not supported' % method)
+ else:
+ return func(*params)
+
+ def export_add(self, x, y):
+ return x + y
+
+server = MathServer(("localhost", 8000))
+server.serve_forever()
+
+5. CGI script:
+
+server = CGIXMLRPCRequestHandler()
+server.register_function(pow)
+server.handle_request()
+"""
+
+# Written by Brian Quinlan (brian@sweetapp.com).
+# Based on code written by Fredrik Lundh.
+
+from _pydev_imps import _pydev_xmlrpclib as xmlrpclib
+from _pydev_imps._pydev_xmlrpclib import Fault
+from _pydev_imps import _pydev_SocketServer as SocketServer
+from _pydev_imps import _pydev_BaseHTTPServer as BaseHTTPServer
+import sys
+import os
+try:
+ import fcntl
+except ImportError:
+ fcntl = None
+
+def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
+ """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
+
+ Resolves a dotted attribute name to an object. Raises
+ an AttributeError if any attribute in the chain starts with a '_'.
+
+ If the optional allow_dotted_names argument is false, dots are not
+ supported and this function operates similar to getattr(obj, attr).
+ """
+
+ if allow_dotted_names:
+ attrs = attr.split('.')
+ else:
+ attrs = [attr]
+
+ for i in attrs:
+ if i.startswith('_'):
+ raise AttributeError(
+ 'attempt to access private attribute "%s"' % i
+ )
+ else:
+ obj = getattr(obj, i)
+ return obj
+
+def list_public_methods(obj):
+ """Returns a list of attribute strings, found in the specified
+ object, which represent callable attributes"""
+
+ return [member for member in dir(obj)
+ if not member.startswith('_') and
+ callable(getattr(obj, member))]
+
+def remove_duplicates(lst):
+ """remove_duplicates([2,2,2,1,3,3]) => [3,1,2]
+
+ Returns a copy of a list without duplicates. Every list
+ item must be hashable and the order of the items in the
+ resulting list is not defined.
+ """
+ u = {}
+ for x in lst:
+ u[x] = 1
+
+ return u.keys()
+
+class SimpleXMLRPCDispatcher:
+ """Mix-in class that dispatches XML-RPC requests.
+
+ This class is used to register XML-RPC method handlers
+ and then to dispatch them. There should never be any
+ reason to instantiate this class directly.
+ """
+
+ def __init__(self, allow_none, encoding):
+ self.funcs = {}
+ self.instance = None
+ self.allow_none = allow_none
+ self.encoding = encoding
+
+ def register_instance(self, instance, allow_dotted_names=False):
+ """Registers an instance to respond to XML-RPC requests.
+
+ Only one instance can be installed at a time.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called. Methods beginning with an '_'
+ are considered private and will not be called by
+ SimpleXMLRPCServer.
+
+ If a registered function matches a XML-RPC request, then it
+ will be called instead of the registered instance.
+
+ If the optional allow_dotted_names argument is true and the
+ instance does not have a _dispatch method, method names
+ containing dots are supported and resolved, as long as none of
+ the name segments start with an '_'.
+
+ *** SECURITY WARNING: ***
+
+ Enabling the allow_dotted_names options allows intruders
+ to access your module's global variables and may allow
+ intruders to execute arbitrary code on your machine. Only
+ use this option on a secure, closed network.
+
+ """
+
+ self.instance = instance
+ self.allow_dotted_names = allow_dotted_names
+
+ def register_function(self, function, name=None):
+ """Registers a function to respond to XML-RPC requests.
+
+ The optional name argument can be used to set a Unicode name
+ for the function.
+ """
+
+ if name is None:
+ name = function.__name__
+ self.funcs[name] = function
+
+ def register_introspection_functions(self):
+ """Registers the XML-RPC introspection methods in the system
+ namespace.
+
+ see http://xmlrpc.usefulinc.com/doc/reserved.html
+ """
+
+ self.funcs.update({'system.listMethods' : self.system_listMethods,
+ 'system.methodSignature' : self.system_methodSignature,
+ 'system.methodHelp' : self.system_methodHelp})
+
+ def register_multicall_functions(self):
+ """Registers the XML-RPC multicall method in the system
+ namespace.
+
+ see http://www.xmlrpc.com/discuss/msgReader$1208"""
+
+ self.funcs.update({'system.multicall' : self.system_multicall})
+
+ def _marshaled_dispatch(self, data, dispatch_method=None):
+ """Dispatches an XML-RPC method from marshalled (XML) data.
+
+ XML-RPC methods are dispatched from the marshalled (XML) data
+ using the _dispatch method and the result is returned as
+ marshalled data. For backwards compatibility, a dispatch
+ function can be provided as an argument (see comment in
+ SimpleXMLRPCRequestHandler.do_POST) but overriding the
+ existing method through subclassing is the prefered means
+ of changing method dispatch behavior.
+ """
+ try:
+ params, method = xmlrpclib.loads(data)
+
+ # generate response
+ if dispatch_method is not None:
+ response = dispatch_method(method, params)
+ else:
+ response = self._dispatch(method, params)
+ # wrap response in a singleton tuple
+ response = (response,)
+ response = xmlrpclib.dumps(response, methodresponse=1,
+ allow_none=self.allow_none, encoding=self.encoding)
+ except Fault, fault:
+ response = xmlrpclib.dumps(fault, allow_none=self.allow_none,
+ encoding=self.encoding)
+ except:
+ # report exception back to server
+ response = xmlrpclib.dumps(
+ xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)), #@UndefinedVariable exc_value only available when we actually have an exception
+ encoding=self.encoding, allow_none=self.allow_none,
+ )
+
+ return response
+
+ def system_listMethods(self):
+ """system.listMethods() => ['add', 'subtract', 'multiple']
+
+ Returns a list of the methods supported by the server."""
+
+ methods = self.funcs.keys()
+ if self.instance is not None:
+ # Instance can implement _listMethod to return a list of
+ # methods
+ if hasattr(self.instance, '_listMethods'):
+ methods = remove_duplicates(
+ methods + self.instance._listMethods()
+ )
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide a list
+ # of methods
+ elif not hasattr(self.instance, '_dispatch'):
+ methods = remove_duplicates(
+ methods + list_public_methods(self.instance)
+ )
+ methods.sort()
+ return methods
+
+ def system_methodSignature(self, method_name):
+ """system.methodSignature('add') => [double, int, int]
+
+ Returns a list describing the signature of the method. In the
+ above example, the add method takes two integers as arguments
+ and returns a double result.
+
+ This server does NOT support system.methodSignature."""
+
+ # See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
+
+ return 'signatures not supported'
+
+ def system_methodHelp(self, method_name):
+ """system.methodHelp('add') => "Adds two integers together"
+
+ Returns a string containing documentation for the specified method."""
+
+ method = None
+ if self.funcs.has_key(method_name):
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ # Instance can implement _methodHelp to return help for a method
+ if hasattr(self.instance, '_methodHelp'):
+ return self.instance._methodHelp(method_name)
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide help
+ elif not hasattr(self.instance, '_dispatch'):
+ try:
+ method = resolve_dotted_attribute(
+ self.instance,
+ method_name,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ # Note that we aren't checking that the method actually
+ # be a callable object of some kind
+ if method is None:
+ return ""
+ else:
+ try:
+ import pydoc
+ except ImportError:
+ return "" #not there for jython
+ else:
+ return pydoc.getdoc(method)
+
+ def system_multicall(self, call_list):
+ """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
+[[4], ...]
+
+ Allows the caller to package multiple XML-RPC calls into a single
+ request.
+
+ See http://www.xmlrpc.com/discuss/msgReader$1208
+ """
+
+ results = []
+ for call in call_list:
+ method_name = call['methodName']
+ params = call['params']
+
+ try:
+ # XXX A marshalling error in any response will fail the entire
+ # multicall. If someone cares they should fix this.
+ results.append([self._dispatch(method_name, params)])
+ except Fault, fault:
+ results.append(
+ {'faultCode' : fault.faultCode,
+ 'faultString' : fault.faultString}
+ )
+ except:
+ results.append(
+ {'faultCode' : 1,
+ 'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)} #@UndefinedVariable exc_value only available when we actually have an exception
+ )
+ return results
+
+ def _dispatch(self, method, params):
+ """Dispatches the XML-RPC method.
+
+ XML-RPC calls are forwarded to a registered function that
+ matches the called XML-RPC method name. If no such function
+ exists then the call is forwarded to the registered instance,
+ if available.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called.
+
+ Methods beginning with an '_' are considered private and will
+ not be called.
+ """
+
+ func = None
+ try:
+ # check to see if a matching function has been registered
+ func = self.funcs[method]
+ except KeyError:
+ if self.instance is not None:
+ # check for a _dispatch method
+ if hasattr(self.instance, '_dispatch'):
+ return self.instance._dispatch(method, params)
+ else:
+ # call instance method directly
+ try:
+ func = resolve_dotted_attribute(
+ self.instance,
+ method,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ if func is not None:
+ return func(*params)
+ else:
+ raise Exception('method "%s" is not supported' % method)
+
+class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+ """Simple XML-RPC request handler class.
+
+ Handles all HTTP POST requests and attempts to decode them as
+ XML-RPC requests.
+ """
+
+ # Class attribute listing the accessible path components;
+ # paths not on this list will result in a 404 error.
+ rpc_paths = ('/', '/RPC2')
+
+ def is_rpc_path_valid(self):
+ if self.rpc_paths:
+ return self.path in self.rpc_paths
+ else:
+ # If .rpc_paths is empty, just assume all paths are legal
+ return True
+
+ def do_POST(self):
+ """Handles the HTTP POST request.
+
+ Attempts to interpret all HTTP POST requests as XML-RPC calls,
+ which are forwarded to the server's _dispatch method for handling.
+ """
+
+ # Check that the path is legal
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ try:
+ # Get arguments by reading body of request.
+ # We read this in chunks to avoid straining
+ # socket.read(); around the 10 or 15Mb mark, some platforms
+ # begin to have problems (bug #792570).
+ max_chunk_size = 10 * 1024 * 1024
+ size_remaining = int(self.headers["content-length"])
+ L = []
+ while size_remaining:
+ chunk_size = min(size_remaining, max_chunk_size)
+ L.append(self.rfile.read(chunk_size))
+ size_remaining -= len(L[-1])
+ data = ''.join(L)
+
+ # In previous versions of SimpleXMLRPCServer, _dispatch
+ # could be overridden in this class, instead of in
+ # SimpleXMLRPCDispatcher. To maintain backwards compatibility,
+ # check to see if a subclass implements _dispatch and dispatch
+ # using that method if present.
+ response = self.server._marshaled_dispatch(
+ data, getattr(self, '_dispatch', None)
+ )
+ except: # This should only happen if the module is buggy
+ # internal error, report as HTTP server error
+ self.send_response(500)
+ self.end_headers()
+ else:
+ # got a valid XML RPC response
+ self.send_response(200)
+ self.send_header("Content-type", "text/xml")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+ # shut down the connection
+ self.wfile.flush()
+ self.connection.shutdown(1)
+
+ def report_404 (self):
+ # Report a 404 error
+ self.send_response(404)
+ response = 'No such page'
+ self.send_header("Content-type", "text/plain")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+ # shut down the connection
+ self.wfile.flush()
+ self.connection.shutdown(1)
+
+ def log_request(self, code='-', size='-'):
+ """Selectively log an accepted request."""
+
+ if self.server.logRequests:
+ BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
+
+class SimpleXMLRPCServer(SocketServer.TCPServer,
+ SimpleXMLRPCDispatcher):
+ """Simple XML-RPC server.
+
+ Simple XML-RPC server that allows functions and a single instance
+ to be installed to handle requests. The default implementation
+ attempts to dispatch XML-RPC calls to the functions or instance
+ installed in the server. Override the _dispatch method inhereted
+ from SimpleXMLRPCDispatcher to change this behavior.
+ """
+
+ allow_reuse_address = True
+
+ def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None):
+ self.logRequests = logRequests
+
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
+ SocketServer.TCPServer.__init__(self, addr, requestHandler)
+
+ # [Bug #1222790] If possible, set close-on-exec flag; if a
+ # method spawns a subprocess, the subprocess shouldn't have
+ # the listening socket open.
+ if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
+ flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
+ """Simple handler for XML-RPC data passed through CGI."""
+
+ def __init__(self, allow_none=False, encoding=None):
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
+
+ def handle_xmlrpc(self, request_text):
+ """Handle a single XML-RPC request"""
+
+ response = self._marshaled_dispatch(request_text)
+
+ sys.stdout.write('Content-Type: text/xml\n')
+ sys.stdout.write('Content-Length: %d\n' % len(response))
+ sys.stdout.write('\n')
+
+ sys.stdout.write(response)
+
+ def handle_get(self):
+ """Handle a single HTTP GET request.
+
+ Default implementation indicates an error because
+ XML-RPC uses the POST method.
+ """
+
+ code = 400
+ message, explain = \
+ BaseHTTPServer.BaseHTTPRequestHandler.responses[code]
+
+ response = BaseHTTPServer.DEFAULT_ERROR_MESSAGE % { #@UndefinedVariable
+ 'code' : code,
+ 'message' : message,
+ 'explain' : explain
+ }
+ sys.stdout.write('Status: %d %s\n' % (code, message))
+ sys.stdout.write('Content-Type: text/html\n')
+ sys.stdout.write('Content-Length: %d\n' % len(response))
+ sys.stdout.write('\n')
+
+ sys.stdout.write(response)
+
+ def handle_request(self, request_text=None):
+ """Handle a single XML-RPC request passed through a CGI post method.
+
+ If no XML data is given then it is read from stdin. The resulting
+ XML-RPC response is printed to stdout along with the correct HTTP
+ headers.
+ """
+
+ if request_text is None and \
+ os.environ.get('REQUEST_METHOD', None) == 'GET':
+ self.handle_get()
+ else:
+ # POST data is normally available through stdin
+ if request_text is None:
+ request_text = sys.stdin.read()
+
+ self.handle_xmlrpc(request_text)
+
+if __name__ == '__main__':
+ sys.stdout.write('Running XML-RPC server on port 8000\n')
+ server = SimpleXMLRPCServer(("localhost", 8000))
+ server.register_function(pow)
+ server.register_function(lambda x, y: x + y, 'add')
+ server.serve_forever()
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_SocketServer.py b/ptvsd/pydevd/_pydev_imps/_pydev_SocketServer.py
new file mode 100644
index 00000000..7af2777a
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_SocketServer.py
@@ -0,0 +1,715 @@
+"""Generic socket server classes.
+
+This module tries to capture the various aspects of defining a server:
+
+For socket-based servers:
+
+- address family:
+ - AF_INET{,6}: IP (Internet Protocol) sockets (default)
+ - AF_UNIX: Unix domain sockets
+ - others, e.g. AF_DECNET are conceivable (see
+- socket type:
+ - SOCK_STREAM (reliable stream, e.g. TCP)
+ - SOCK_DGRAM (datagrams, e.g. UDP)
+
+For request-based servers (including socket-based):
+
+- client address verification before further looking at the request
+ (This is actually a hook for any processing that needs to look
+ at the request before anything else, e.g. logging)
+- how to handle multiple requests:
+ - synchronous (one request is handled at a time)
+ - forking (each request is handled by a new process)
+ - threading (each request is handled by a new thread)
+
+The classes in this module favor the server type that is simplest to
+write: a synchronous TCP/IP server. This is bad class design, but
+save some typing. (There's also the issue that a deep class hierarchy
+slows down method lookups.)
+
+There are five classes in an inheritance diagram, four of which represent
+synchronous servers of four types:
+
+ +------------+
+ | BaseServer |
+ +------------+
+ |
+ v
+ +-----------+ +------------------+
+ | TCPServer |------->| UnixStreamServer |
+ +-----------+ +------------------+
+ |
+ v
+ +-----------+ +--------------------+
+ | UDPServer |------->| UnixDatagramServer |
+ +-----------+ +--------------------+
+
+Note that UnixDatagramServer derives from UDPServer, not from
+UnixStreamServer -- the only difference between an IP and a Unix
+stream server is the address family, which is simply repeated in both
+unix server classes.
+
+Forking and threading versions of each type of server can be created
+using the ForkingMixIn and ThreadingMixIn mix-in classes. For
+instance, a threading UDP server class is created as follows:
+
+ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+
+The Mix-in class must come first, since it overrides a method defined
+in UDPServer! Setting the various member variables also changes
+the behavior of the underlying server mechanism.
+
+To implement a service, you must derive a class from
+BaseRequestHandler and redefine its handle() method. You can then run
+various versions of the service by combining one of the server classes
+with your request handler class.
+
+The request handler class must be different for datagram or stream
+services. This can be hidden by using the request handler
+subclasses StreamRequestHandler or DatagramRequestHandler.
+
+Of course, you still have to use your head!
+
+For instance, it makes no sense to use a forking server if the service
+contains state in memory that can be modified by requests (since the
+modifications in the child process would never reach the initial state
+kept in the parent process and passed to each child). In this case,
+you can use a threading server, but you will probably have to use
+locks to avoid two requests that come in nearly simultaneous to apply
+conflicting changes to the server state.
+
+On the other hand, if you are building e.g. an HTTP server, where all
+data is stored externally (e.g. in the file system), a synchronous
+class will essentially render the service "deaf" while one request is
+being handled -- which may be for a very long time if a client is slow
+to read all the data it has requested. Here a threading or forking
+server is appropriate.
+
+In some cases, it may be appropriate to process part of a request
+synchronously, but to finish processing in a forked child depending on
+the request data. This can be implemented by using a synchronous
+server and doing an explicit fork in the request handler class
+handle() method.
+
+Another approach to handling multiple simultaneous requests in an
+environment that supports neither threads nor fork (or where these are
+too expensive or inappropriate for the service) is to maintain an
+explicit table of partially finished requests and to use select() to
+decide which request to work on next (or whether to handle a new
+incoming request). This is particularly important for stream services
+where each client can potentially be connected for a long time (if
+threads or subprocesses cannot be used).
+
+Future work:
+- Standard classes for Sun RPC (which uses either UDP or TCP)
+- Standard mix-in classes to implement various authentication
+ and encryption schemes
+- Standard framework for select-based multiplexing
+
+XXX Open problems:
+- What to do with out-of-band data?
+
+BaseServer:
+- split generic "request" functionality out into BaseServer class.
+ Copyright (C) 2000 Luke Kenneth Casson Leighton
+
+ example: read entries from a SQL database (requires overriding
+ get_request() to return a table entry from the database).
+ entry is processed by a RequestHandlerClass.
+
+"""
+
+# Author of the BaseServer patch: Luke Kenneth Casson Leighton
+
+# XXX Warning!
+# There is a test suite for this module, but it cannot be run by the
+# standard regression test.
+# To run it manually, run Lib/test/test_socketserver.py.
+
+__version__ = "0.4"
+
+
+from _pydev_imps._pydev_saved_modules import socket
+from _pydev_imps._pydev_saved_modules import select
+import sys
+import os
+try:
+ from _pydev_imps._pydev_saved_modules import threading
+except ImportError:
+ import dummy_threading as threading
+
+__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
+ "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
+ "StreamRequestHandler","DatagramRequestHandler",
+ "ThreadingMixIn", "ForkingMixIn"]
+if hasattr(socket, "AF_UNIX"):
+ __all__.extend(["UnixStreamServer","UnixDatagramServer",
+ "ThreadingUnixStreamServer",
+ "ThreadingUnixDatagramServer"])
+
+class BaseServer:
+
+ """Base class for server classes.
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you do not use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - server_close()
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - allow_reuse_address
+
+ Instance variables:
+
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ timeout = None
+
+ def __init__(self, server_address, RequestHandlerClass):
+ """Constructor. May be extended, do not override."""
+ self.server_address = server_address
+ self.RequestHandlerClass = RequestHandlerClass
+ self.__is_shut_down = threading.Event() # @UndefinedVariable
+ self.__shutdown_request = False
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def serve_forever(self, poll_interval=0.5):
+ """Handle one request at a time until shutdown.
+
+ Polls for shutdown every poll_interval seconds. Ignores
+ self.timeout. If you need to do periodic tasks, do them in
+ another thread.
+ """
+ self.__is_shut_down.clear()
+ try:
+ while not self.__shutdown_request:
+ # XXX: Consider using another file descriptor or
+ # connecting to the socket to wake this up instead of
+ # polling. Polling reduces our responsiveness to a
+ # shutdown request and wastes cpu at all other times.
+ r, w, e = select.select([self], [], [], poll_interval)
+ if self in r:
+ self._handle_request_noblock()
+ finally:
+ self.__shutdown_request = False
+ self.__is_shut_down.set()
+
+ def shutdown(self):
+ """Stops the serve_forever loop.
+
+ Blocks until the loop has finished. This must be called while
+ serve_forever() is running in another thread, or it will
+ deadlock.
+ """
+ self.__shutdown_request = True
+ self.__is_shut_down.wait()
+
+ # The distinction between handling, getting, processing and
+ # finishing a request is fairly arbitrary. Remember:
+ #
+ # - handle_request() is the top-level call. It calls
+ # select, get_request(), verify_request() and process_request()
+ # - get_request() is different for stream or datagram sockets
+ # - process_request() is the place that may fork a new process
+ # or create a new thread to finish the request
+ # - finish_request() instantiates the request handler class;
+ # this constructor will handle the request all by itself
+
+ def handle_request(self):
+ """Handle one request, possibly blocking.
+
+ Respects self.timeout.
+ """
+ # Support people who used socket.settimeout() to escape
+ # handle_request before self.timeout was available.
+ timeout = self.socket.gettimeout()
+ if timeout is None:
+ timeout = self.timeout
+ elif self.timeout is not None:
+ timeout = min(timeout, self.timeout)
+ fd_sets = select.select([self], [], [], timeout)
+ if not fd_sets[0]:
+ self.handle_timeout()
+ return
+ self._handle_request_noblock()
+
+ def _handle_request_noblock(self):
+ """Handle one request, without blocking.
+
+ I assume that select.select has returned that the socket is
+ readable before this function was called, so there should be
+ no risk of blocking in get_request().
+ """
+ try:
+ request, client_address = self.get_request()
+ except socket.error:
+ return
+ if self.verify_request(request, client_address):
+ try:
+ self.process_request(request, client_address)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def handle_timeout(self):
+ """Called if no new request arrives within self.timeout.
+
+ Overridden by ForkingMixIn.
+ """
+ pass
+
+ def verify_request(self, request, client_address):
+ """Verify the request. May be overridden.
+
+ Return True if we should proceed with this request.
+
+ """
+ return True
+
+ def process_request(self, request, client_address):
+ """Call finish_request.
+
+ Overridden by ForkingMixIn and ThreadingMixIn.
+
+ """
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def finish_request(self, request, client_address):
+ """Finish one request by instantiating RequestHandlerClass."""
+ self.RequestHandlerClass(request, client_address, self)
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ pass
+
+ def handle_error(self, request, client_address):
+ """Handle an error gracefully. May be overridden.
+
+ The default is to print a traceback and continue.
+
+ """
+ print '-'*40
+ print 'Exception happened during processing of request from',
+ print client_address
+ import traceback
+ traceback.print_exc() # XXX But this goes to stderr!
+ print '-'*40
+
+
+class TCPServer(BaseServer):
+
+ """Base class for various socket-based server classes.
+
+ Defaults to synchronous IP stream (i.e., TCP).
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you don't use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - request_queue_size (only for stream sockets)
+ - allow_reuse_address
+
+ Instance variables:
+
+ - server_address
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ address_family = socket.AF_INET
+
+ socket_type = socket.SOCK_STREAM
+
+ request_queue_size = 5
+
+ allow_reuse_address = False
+
+ def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
+ """Constructor. May be extended, do not override."""
+ BaseServer.__init__(self, server_address, RequestHandlerClass)
+ self.socket = socket.socket(self.address_family,
+ self.socket_type)
+ if bind_and_activate:
+ self.server_bind()
+ self.server_activate()
+
+ def server_bind(self):
+ """Called by constructor to bind the socket.
+
+ May be overridden.
+
+ """
+ if self.allow_reuse_address:
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.socket.bind(self.server_address)
+ self.server_address = self.socket.getsockname()
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ self.socket.listen(self.request_queue_size)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ self.socket.close()
+
+ def fileno(self):
+ """Return socket file number.
+
+ Interface required by select().
+
+ """
+ return self.socket.fileno()
+
+ def get_request(self):
+ """Get the request and client address from the socket.
+
+ May be overridden.
+
+ """
+ return self.socket.accept()
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ try:
+ #explicitly shutdown. socket.close() merely releases
+ #the socket and waits for GC to perform the actual close.
+ request.shutdown(socket.SHUT_WR)
+ except socket.error:
+ pass #some platforms may raise ENOTCONN here
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ request.close()
+
+
+class UDPServer(TCPServer):
+
+ """UDP server class."""
+
+ allow_reuse_address = False
+
+ socket_type = socket.SOCK_DGRAM
+
+ max_packet_size = 8192
+
+ def get_request(self):
+ data, client_addr = self.socket.recvfrom(self.max_packet_size)
+ return (data, self.socket), client_addr
+
+ def server_activate(self):
+ # No need to call listen() for UDP.
+ pass
+
+ def shutdown_request(self, request):
+ # No need to shutdown anything.
+ self.close_request(request)
+
+ def close_request(self, request):
+ # No need to close anything.
+ pass
+
+class ForkingMixIn:
+
+ """Mix-in class to handle each request in a new process."""
+
+ timeout = 300
+ active_children = None
+ max_children = 40
+
+ def collect_children(self):
+ """Internal routine to wait for children that have exited."""
+ if self.active_children is None: return
+ while len(self.active_children) >= self.max_children:
+ # XXX: This will wait for any child process, not just ones
+ # spawned by this library. This could confuse other
+ # libraries that expect to be able to wait for their own
+ # children.
+ try:
+ pid, status = os.waitpid(0, 0)
+ except os.error:
+ pid = None
+ if pid not in self.active_children: continue
+ self.active_children.remove(pid)
+
+ # XXX: This loop runs more system calls than it ought
+ # to. There should be a way to put the active_children into a
+ # process group and then use os.waitpid(-pgid) to wait for any
+ # of that set, but I couldn't find a way to allocate pgids
+ # that couldn't collide.
+ for child in self.active_children:
+ try:
+ pid, status = os.waitpid(child, os.WNOHANG) # @UndefinedVariable
+ except os.error:
+ pid = None
+ if not pid: continue
+ try:
+ self.active_children.remove(pid)
+ except ValueError, e:
+ raise ValueError('%s. x=%d and list=%r' % (e.message, pid,
+ self.active_children))
+
+ def handle_timeout(self):
+ """Wait for zombies after self.timeout seconds of inactivity.
+
+ May be extended, do not override.
+ """
+ self.collect_children()
+
+ def process_request(self, request, client_address):
+ """Fork a new subprocess to process the request."""
+ self.collect_children()
+ pid = os.fork() # @UndefinedVariable
+ if pid:
+ # Parent process
+ if self.active_children is None:
+ self.active_children = []
+ self.active_children.append(pid)
+ self.close_request(request) #close handle in parent process
+ return
+ else:
+ # Child process.
+ # This must never return, hence os._exit()!
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ os._exit(0)
+ except:
+ try:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+ finally:
+ os._exit(1)
+
+
+class ThreadingMixIn:
+ """Mix-in class to handle each request in a new thread."""
+
+ # Decides how threads will act upon termination of the
+ # main process
+ daemon_threads = False
+
+ def process_request_thread(self, request, client_address):
+ """Same as in BaseServer but as a thread.
+
+ In addition, exception handling is done here.
+
+ """
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def process_request(self, request, client_address):
+ """Start a new thread to process the request."""
+ t = threading.Thread(target = self.process_request_thread, # @UndefinedVariable
+ args = (request, client_address))
+ t.daemon = self.daemon_threads
+ t.start()
+
+
+class ForkingUDPServer(ForkingMixIn, UDPServer): pass
+class ForkingTCPServer(ForkingMixIn, TCPServer): pass
+
+class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
+
+if hasattr(socket, 'AF_UNIX'):
+
+ class UnixStreamServer(TCPServer):
+ address_family = socket.AF_UNIX # @UndefinedVariable
+
+ class UnixDatagramServer(UDPServer):
+ address_family = socket.AF_UNIX # @UndefinedVariable
+
+ class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
+
+ class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
+
+class BaseRequestHandler:
+
+ """Base class for request handler classes.
+
+ This class is instantiated for each request to be handled. The
+ constructor sets the instance variables request, client_address
+ and server, and then calls the handle() method. To implement a
+ specific service, all you need to do is to derive a class which
+ defines a handle() method.
+
+ The handle() method can find the request as self.request, the
+ client address as self.client_address, and the server (in case it
+ needs access to per-server information) as self.server. Since a
+ separate instance is created for each request, the handle() method
+ can define arbitrary other instance variariables.
+
+ """
+
+ def __init__(self, request, client_address, server):
+ self.request = request
+ self.client_address = client_address
+ self.server = server
+ self.setup()
+ try:
+ self.handle()
+ finally:
+ self.finish()
+
+ def setup(self):
+ pass
+
+ def handle(self):
+ pass
+
+ def finish(self):
+ pass
+
+
+# The following two classes make it possible to use the same service
+# class for stream or datagram servers.
+# Each class sets up these instance variables:
+# - rfile: a file object from which receives the request is read
+# - wfile: a file object to which the reply is written
+# When the handle() method returns, wfile is flushed properly
+
+
+class StreamRequestHandler(BaseRequestHandler):
+
+ """Define self.rfile and self.wfile for stream sockets."""
+
+ # Default buffer sizes for rfile, wfile.
+ # We default rfile to buffered because otherwise it could be
+ # really slow for large data (a getc() call per byte); we make
+ # wfile unbuffered because (a) often after a write() we want to
+ # read and we need to flush the line; (b) big writes to unbuffered
+ # files are typically optimized by stdio even when big reads
+ # aren't.
+ rbufsize = -1
+ wbufsize = 0
+
+ # A timeout to apply to the request socket, if not None.
+ timeout = None
+
+ # Disable nagle algorithm for this socket, if True.
+ # Use only when wbufsize != 0, to avoid small packets.
+ disable_nagle_algorithm = False
+
+ def setup(self):
+ self.connection = self.request
+ if self.timeout is not None:
+ self.connection.settimeout(self.timeout)
+ if self.disable_nagle_algorithm:
+ self.connection.setsockopt(socket.IPPROTO_TCP,
+ socket.TCP_NODELAY, True)
+ self.rfile = self.connection.makefile('rb', self.rbufsize)
+ self.wfile = self.connection.makefile('wb', self.wbufsize)
+
+ def finish(self):
+ if not self.wfile.closed:
+ self.wfile.flush()
+ self.wfile.close()
+ self.rfile.close()
+
+
+class DatagramRequestHandler(BaseRequestHandler):
+
+ # XXX Regrettably, I cannot get this working on Linux;
+ # s.recvfrom() doesn't return a meaningful client address.
+
+ """Define self.rfile and self.wfile for datagram sockets."""
+
+ def setup(self):
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+ self.packet, self.socket = self.request
+ self.rfile = StringIO(self.packet)
+ self.wfile = StringIO()
+
+ def finish(self):
+ self.socket.sendto(self.wfile.getvalue(), self.client_address)
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_execfile.py b/ptvsd/pydevd/_pydev_imps/_pydev_execfile.py
new file mode 100644
index 00000000..c02f8ecf
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_execfile.py
@@ -0,0 +1,25 @@
+#We must redefine it in Py3k if it's not already there
+def execfile(file, glob=None, loc=None):
+ if glob is None:
+ import sys
+ glob = sys._getframe().f_back.f_globals
+ if loc is None:
+ loc = glob
+
+ # It seems that the best way is using tokenize.open(): http://code.activestate.com/lists/python-dev/131251/
+ # (but tokenize.open() is only available for python 3.2)
+ import tokenize
+ if hasattr(tokenize, 'open'):
+ # version 3.2
+ stream = tokenize.open(file) # @UndefinedVariable
+ else:
+ # version 3.0 or 3.1
+ detect_encoding = tokenize.detect_encoding(open(file, mode="rb" ).readline)
+ stream = open(file, encoding=detect_encoding[0])
+ try:
+ contents = stream.read()
+ finally:
+ stream.close()
+
+ #execute the script (note: it's important to compile first to have the filename set in debug mode)
+ exec(compile(contents+"\n", file, 'exec'), glob, loc)
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_inspect.py b/ptvsd/pydevd/_pydev_imps/_pydev_inspect.py
new file mode 100644
index 00000000..5fd33d87
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_inspect.py
@@ -0,0 +1,788 @@
+"""Get useful information from live Python objects.
+
+This module encapsulates the interface provided by the internal special
+attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
+It also provides some help for examining source code and class layout.
+
+Here are some of the useful functions provided by this module:
+
+ ismodule(), isclass(), ismethod(), isfunction(), istraceback(),
+ isframe(), iscode(), isbuiltin(), isroutine() - check object types
+ getmembers() - get members of an object that satisfy a given condition
+
+ getfile(), getsourcefile(), getsource() - find an object's source code
+ getdoc(), getcomments() - get documentation on an object
+ getmodule() - determine the module that an object came from
+ getclasstree() - arrange classes so as to represent their hierarchy
+
+ getargspec(), getargvalues() - get info about function arguments
+ formatargspec(), formatargvalues() - format an argument spec
+ getouterframes(), getinnerframes() - get info about frames
+ currentframe() - get the current stack frame
+ stack(), trace() - get info about frames on the stack or in a traceback
+"""
+
+# This module is in the public domain. No warranties.
+
+__author__ = 'Ka-Ping Yee '
+__date__ = '1 Jan 2001'
+
+import sys, os, types, string, re, imp, tokenize
+
+# ----------------------------------------------------------- type-checking
+def ismodule(object):
+ """Return true if the object is a module.
+
+ Module objects provide these attributes:
+ __doc__ documentation string
+ __file__ filename (missing for built-in modules)"""
+ return isinstance(object, types.ModuleType)
+
+def isclass(object):
+ """Return true if the object is a class.
+
+ Class objects provide these attributes:
+ __doc__ documentation string
+ __module__ name of module in which this class was defined"""
+ return isinstance(object, types.ClassType) or hasattr(object, '__bases__')
+
+def ismethod(object):
+ """Return true if the object is an instance method.
+
+ Instance method objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this method was defined
+ im_class class object in which this method belongs
+ im_func function object containing implementation of method
+ im_self instance to which this method is bound, or None"""
+ return isinstance(object, types.MethodType)
+
+def ismethoddescriptor(object):
+ """Return true if the object is a method descriptor.
+
+ But not if ismethod() or isclass() or isfunction() are true.
+
+ This is new in Python 2.2, and, for example, is true of int.__add__.
+ An object passing this test has a __get__ attribute but not a __set__
+ attribute, but beyond that the set of attributes varies. __name__ is
+ usually sensible, and __doc__ often is.
+
+ Methods implemented via descriptors that also pass one of the other
+ tests return false from the ismethoddescriptor() test, simply because
+ the other tests promise more -- you can, e.g., count on having the
+ im_func attribute (etc) when an object passes ismethod()."""
+ return (hasattr(object, "__get__")
+ and not hasattr(object, "__set__") # else it's a data descriptor
+ and not ismethod(object) # mutual exclusion
+ and not isfunction(object)
+ and not isclass(object))
+
+def isfunction(object):
+ """Return true if the object is a user-defined function.
+
+ Function objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this function was defined
+ func_code code object containing compiled function bytecode
+ func_defaults tuple of any default values for arguments
+ func_doc (same as __doc__)
+ func_globals global namespace in which this function was defined
+ func_name (same as __name__)"""
+ return isinstance(object, types.FunctionType)
+
+def istraceback(object):
+ """Return true if the object is a traceback.
+
+ Traceback objects provide these attributes:
+ tb_frame frame object at this level
+ tb_lasti index of last attempted instruction in bytecode
+ tb_lineno current line number in Python source code
+ tb_next next inner traceback object (called by this level)"""
+ return isinstance(object, types.TracebackType)
+
+def isframe(object):
+ """Return true if the object is a frame object.
+
+ Frame objects provide these attributes:
+ f_back next outer frame object (this frame's caller)
+ f_builtins built-in namespace seen by this frame
+ f_code code object being executed in this frame
+ f_exc_traceback traceback if raised in this frame, or None
+ f_exc_type exception type if raised in this frame, or None
+ f_exc_value exception value if raised in this frame, or None
+ f_globals global namespace seen by this frame
+ f_lasti index of last attempted instruction in bytecode
+ f_lineno current line number in Python source code
+ f_locals local namespace seen by this frame
+ f_restricted 0 or 1 if frame is in restricted execution mode
+ f_trace tracing function for this frame, or None"""
+ return isinstance(object, types.FrameType)
+
+def iscode(object):
+ """Return true if the object is a code object.
+
+ Code objects provide these attributes:
+ co_argcount number of arguments (not including * or ** args)
+ co_code string of raw compiled bytecode
+ co_consts tuple of constants used in the bytecode
+ co_filename name of file in which this code object was created
+ co_firstlineno number of first line in Python source code
+ co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
+ co_lnotab encoded mapping of line numbers to bytecode indices
+ co_name name with which this code object was defined
+ co_names tuple of names of local variables
+ co_nlocals number of local variables
+ co_stacksize virtual machine stack space required
+ co_varnames tuple of names of arguments and local variables"""
+ return isinstance(object, types.CodeType)
+
+def isbuiltin(object):
+ """Return true if the object is a built-in function or method.
+
+ Built-in functions and methods provide these attributes:
+ __doc__ documentation string
+ __name__ original name of this function or method
+ __self__ instance to which a method is bound, or None"""
+ return isinstance(object, types.BuiltinFunctionType)
+
+def isroutine(object):
+ """Return true if the object is any kind of function or method."""
+ return (isbuiltin(object)
+ or isfunction(object)
+ or ismethod(object)
+ or ismethoddescriptor(object))
+
+def getmembers(object, predicate=None):
+ """Return all members of an object as (name, value) pairs sorted by name.
+ Optionally, only return members that satisfy a given predicate."""
+ results = []
+ for key in dir(object):
+ value = getattr(object, key)
+ if not predicate or predicate(value):
+ results.append((key, value))
+ results.sort()
+ return results
+
+def classify_class_attrs(cls):
+ """Return list of attribute-descriptor tuples.
+
+ For each name in dir(cls), the return list contains a 4-tuple
+ with these elements:
+
+ 0. The name (a string).
+
+ 1. The kind of attribute this is, one of these strings:
+ 'class method' created via classmethod()
+ 'static method' created via staticmethod()
+ 'property' created via property()
+ 'method' any other flavor of method
+ 'data' not a method
+
+ 2. The class which defined this attribute (a class).
+
+ 3. The object as obtained directly from the defining class's
+ __dict__, not via getattr. This is especially important for
+ data attributes: C.data is just a data object, but
+ C.__dict__['data'] may be a data descriptor with additional
+ info, like a __doc__ string.
+ """
+
+ mro = getmro(cls)
+ names = dir(cls)
+ result = []
+ for name in names:
+ # Get the object associated with the name.
+ # Getting an obj from the __dict__ sometimes reveals more than
+ # using getattr. Static and class methods are dramatic examples.
+ if name in cls.__dict__:
+ obj = cls.__dict__[name]
+ else:
+ obj = getattr(cls, name)
+
+ # Figure out where it was defined.
+ homecls = getattr(obj, "__objclass__", None)
+ if homecls is None:
+ # search the dicts.
+ for base in mro:
+ if name in base.__dict__:
+ homecls = base
+ break
+
+ # Get the object again, in order to get it from the defining
+ # __dict__ instead of via getattr (if possible).
+ if homecls is not None and name in homecls.__dict__:
+ obj = homecls.__dict__[name]
+
+ # Also get the object via getattr.
+ obj_via_getattr = getattr(cls, name)
+
+ # Classify the object.
+ if isinstance(obj, staticmethod):
+ kind = "static method"
+ elif isinstance(obj, classmethod):
+ kind = "class method"
+ elif isinstance(obj, property):
+ kind = "property"
+ elif (ismethod(obj_via_getattr) or
+ ismethoddescriptor(obj_via_getattr)):
+ kind = "method"
+ else:
+ kind = "data"
+
+ result.append((name, kind, homecls, obj))
+
+ return result
+
+# ----------------------------------------------------------- class helpers
+def _searchbases(cls, accum):
+ # Simulate the "classic class" search order.
+ if cls in accum:
+ return
+ accum.append(cls)
+ for base in cls.__bases__:
+ _searchbases(base, accum)
+
+def getmro(cls):
+ "Return tuple of base classes (including cls) in method resolution order."
+ if hasattr(cls, "__mro__"):
+ return cls.__mro__
+ else:
+ result = []
+ _searchbases(cls, result)
+ return tuple(result)
+
+# -------------------------------------------------- source code extraction
+def indentsize(line):
+ """Return the indent size, in spaces, at the start of a line of text."""
+ expline = string.expandtabs(line)
+ return len(expline) - len(string.lstrip(expline))
+
+def getdoc(object):
+ """Get the documentation string for an object.
+
+ All tabs are expanded to spaces. To clean up docstrings that are
+ indented to line up with blocks of code, any whitespace than can be
+ uniformly removed from the second line onwards is removed."""
+ try:
+ doc = object.__doc__
+ except AttributeError:
+ return None
+ if not isinstance(doc, (str, unicode)):
+ return None
+ try:
+ lines = string.split(string.expandtabs(doc), '\n')
+ except UnicodeError:
+ return None
+ else:
+ margin = None
+ for line in lines[1:]:
+ content = len(string.lstrip(line))
+ if not content: continue
+ indent = len(line) - content
+ if margin is None: margin = indent
+ else: margin = min(margin, indent)
+ if margin is not None:
+ for i in range(1, len(lines)): lines[i] = lines[i][margin:]
+ return string.join(lines, '\n')
+
+def getfile(object):
+ """Work out which source or compiled file an object was defined in."""
+ if ismodule(object):
+ if hasattr(object, '__file__'):
+ return object.__file__
+ raise TypeError, 'arg is a built-in module'
+ if isclass(object):
+ object = sys.modules.get(object.__module__)
+ if hasattr(object, '__file__'):
+ return object.__file__
+ raise TypeError, 'arg is a built-in class'
+ if ismethod(object):
+ object = object.im_func
+ if isfunction(object):
+ object = object.func_code
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ return object.co_filename
+ raise TypeError, 'arg is not a module, class, method, ' \
+ 'function, traceback, frame, or code object'
+
+def getmoduleinfo(path):
+ """Get the module name, suffix, mode, and module type for a given file."""
+ filename = os.path.basename(path)
+ suffixes = map(lambda (suffix, mode, mtype):
+ (-len(suffix), suffix, mode, mtype), imp.get_suffixes())
+ suffixes.sort() # try longest suffixes first, in case they overlap
+ for neglen, suffix, mode, mtype in suffixes:
+ if filename[neglen:] == suffix:
+ return filename[:neglen], suffix, mode, mtype
+
+def getmodulename(path):
+ """Return the module name for a given file, or None."""
+ info = getmoduleinfo(path)
+ if info: return info[0]
+
+def getsourcefile(object):
+ """Return the Python source file an object was defined in, if it exists."""
+ filename = getfile(object)
+ if string.lower(filename[-4:]) in ['.pyc', '.pyo']:
+ filename = filename[:-4] + '.py'
+ for suffix, mode, kind in imp.get_suffixes():
+ if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:
+ # Looks like a binary file. We want to only return a text file.
+ return None
+ if os.path.exists(filename):
+ return filename
+
+def getabsfile(object):
+ """Return an absolute path to the source or compiled file for an object.
+
+ The idea is for each object to have a unique origin, so this routine
+ normalizes the result as much as possible."""
+ return os.path.normcase(
+ os.path.abspath(getsourcefile(object) or getfile(object)))
+
+modulesbyfile = {}
+
+def getmodule(object):
+ """Return the module an object was defined in, or None if not found."""
+ if ismodule(object):
+ return object
+ if isclass(object):
+ return sys.modules.get(object.__module__)
+ try:
+ file = getabsfile(object)
+ except TypeError:
+ return None
+ if modulesbyfile.has_key(file):
+ return sys.modules[modulesbyfile[file]]
+ for module in sys.modules.values():
+ if hasattr(module, '__file__'):
+ modulesbyfile[getabsfile(module)] = module.__name__
+ if modulesbyfile.has_key(file):
+ return sys.modules[modulesbyfile[file]]
+ main = sys.modules['__main__']
+ if hasattr(main, object.__name__):
+ mainobject = getattr(main, object.__name__)
+ if mainobject is object:
+ return main
+ builtin = sys.modules['__builtin__']
+ if hasattr(builtin, object.__name__):
+ builtinobject = getattr(builtin, object.__name__)
+ if builtinobject is object:
+ return builtin
+
+def findsource(object):
+ """Return the entire source file and starting line number for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a list of all the lines
+ in the file and the line number indexes a line in that list. An IOError
+ is raised if the source code cannot be retrieved."""
+ try:
+ file = open(getsourcefile(object))
+ except (TypeError, IOError):
+ raise IOError, 'could not get source code'
+ lines = file.readlines()
+ file.close()
+
+ if ismodule(object):
+ return lines, 0
+
+ if isclass(object):
+ name = object.__name__
+ pat = re.compile(r'^\s*class\s*' + name + r'\b')
+ for i in range(len(lines)):
+ if pat.match(lines[i]): return lines, i
+ else: raise IOError, 'could not find class definition'
+
+ if ismethod(object):
+ object = object.im_func
+ if isfunction(object):
+ object = object.func_code
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ if not hasattr(object, 'co_firstlineno'):
+ raise IOError, 'could not find function definition'
+ lnum = object.co_firstlineno - 1
+ pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))')
+ while lnum > 0:
+ if pat.match(lines[lnum]): break
+ lnum = lnum - 1
+ return lines, lnum
+ raise IOError, 'could not find code object'
+
+def getcomments(object):
+ """Get lines of comments immediately preceding an object's source code."""
+ try: lines, lnum = findsource(object)
+ except IOError: return None
+
+ if ismodule(object):
+ # Look for a comment block at the top of the file.
+ start = 0
+ if lines and lines[0][:2] == '#!': start = 1
+ while start < len(lines) and string.strip(lines[start]) in ['', '#']:
+ start = start + 1
+ if start < len(lines) and lines[start][:1] == '#':
+ comments = []
+ end = start
+ while end < len(lines) and lines[end][:1] == '#':
+ comments.append(string.expandtabs(lines[end]))
+ end = end + 1
+ return string.join(comments, '')
+
+ # Look for a preceding block of comments at the same indentation.
+ elif lnum > 0:
+ indent = indentsize(lines[lnum])
+ end = lnum - 1
+ if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \
+ indentsize(lines[end]) == indent:
+ comments = [string.lstrip(string.expandtabs(lines[end]))]
+ if end > 0:
+ end = end - 1
+ comment = string.lstrip(string.expandtabs(lines[end]))
+ while comment[:1] == '#' and indentsize(lines[end]) == indent:
+ comments[:0] = [comment]
+ end = end - 1
+ if end < 0: break
+ comment = string.lstrip(string.expandtabs(lines[end]))
+ while comments and string.strip(comments[0]) == '#':
+ comments[:1] = []
+ while comments and string.strip(comments[-1]) == '#':
+ comments[-1:] = []
+ return string.join(comments, '')
+
+class ListReader:
+ """Provide a readline() method to return lines from a list of strings."""
+ def __init__(self, lines):
+ self.lines = lines
+ self.index = 0
+
+ def readline(self):
+ i = self.index
+ if i < len(self.lines):
+ self.index = i + 1
+ return self.lines[i]
+ else: return ''
+
+class EndOfBlock(Exception): pass
+
+class BlockFinder:
+ """Provide a tokeneater() method to detect the end of a code block."""
+ def __init__(self):
+ self.indent = 0
+ self.started = 0
+ self.last = 0
+
+ def tokeneater(self, type, token, (srow, scol), (erow, ecol), line):
+ if not self.started:
+ if type == tokenize.NAME: self.started = 1
+ elif type == tokenize.NEWLINE:
+ self.last = srow
+ elif type == tokenize.INDENT:
+ self.indent = self.indent + 1
+ elif type == tokenize.DEDENT:
+ self.indent = self.indent - 1
+ if self.indent == 0: raise EndOfBlock, self.last
+ elif type == tokenize.NAME and scol == 0:
+ raise EndOfBlock, self.last
+
+def getblock(lines):
+ """Extract the block of code at the top of the given list of lines."""
+ try:
+ tokenize.tokenize(ListReader(lines).readline, BlockFinder().tokeneater)
+ except EndOfBlock, eob:
+ return lines[:eob.args[0]]
+ # Fooling the indent/dedent logic implies a one-line definition
+ return lines[:1]
+
+def getsourcelines(object):
+ """Return a list of source lines and starting line number for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a list of the lines
+ corresponding to the object and the line number indicates where in the
+ original source file the first line of code was found. An IOError is
+ raised if the source code cannot be retrieved."""
+ lines, lnum = findsource(object)
+
+ if ismodule(object): return lines, 0
+ else: return getblock(lines[lnum:]), lnum + 1
+
+def getsource(object):
+ """Return the text of the source code for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a single string. An
+ IOError is raised if the source code cannot be retrieved."""
+ lines, lnum = getsourcelines(object)
+ return string.join(lines, '')
+
+# --------------------------------------------------- class tree extraction
+def walktree(classes, children, parent):
+ """Recursive helper function for getclasstree()."""
+ results = []
+ classes.sort(lambda a, b: cmp(a.__name__, b.__name__))
+ for c in classes:
+ results.append((c, c.__bases__))
+ if children.has_key(c):
+ results.append(walktree(children[c], children, c))
+ return results
+
+def getclasstree(classes, unique=0):
+ """Arrange the given list of classes into a hierarchy of nested lists.
+
+ Where a nested list appears, it contains classes derived from the class
+ whose entry immediately precedes the list. Each entry is a 2-tuple
+ containing a class and a tuple of its base classes. If the 'unique'
+ argument is true, exactly one entry appears in the returned structure
+ for each class in the given list. Otherwise, classes using multiple
+ inheritance and their descendants will appear multiple times."""
+ children = {}
+ roots = []
+ for c in classes:
+ if c.__bases__:
+ for parent in c.__bases__:
+ if not children.has_key(parent):
+ children[parent] = []
+ children[parent].append(c)
+ if unique and parent in classes: break
+ elif c not in roots:
+ roots.append(c)
+ for parent in children.keys():
+ if parent not in classes:
+ roots.append(parent)
+ return walktree(roots, children, None)
+
+# ------------------------------------------------ argument list extraction
+# These constants are from Python's compile.h.
+CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 1, 2, 4, 8
+
+def getargs(co):
+ """Get information about the arguments accepted by a code object.
+
+ Three things are returned: (args, varargs, varkw), where 'args' is
+ a list of argument names (possibly containing nested lists), and
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None."""
+ if not iscode(co): raise TypeError, 'arg is not a code object'
+
+ nargs = co.co_argcount
+ names = co.co_varnames
+ args = list(names[:nargs])
+ step = 0
+
+ # The following acrobatics are for anonymous (tuple) arguments.
+ if not sys.platform.startswith('java'):#Jython doesn't have co_code
+ code = co.co_code
+ import dis
+ for i in range(nargs):
+ if args[i][:1] in ['', '.']:
+ stack, remain, count = [], [], []
+ while step < len(code):
+ op = ord(code[step])
+ step = step + 1
+ if op >= dis.HAVE_ARGUMENT:
+ opname = dis.opname[op]
+ value = ord(code[step]) + ord(code[step + 1]) * 256
+ step = step + 2
+ if opname in ['UNPACK_TUPLE', 'UNPACK_SEQUENCE']:
+ remain.append(value)
+ count.append(value)
+ elif opname == 'STORE_FAST':
+ stack.append(names[value])
+ remain[-1] = remain[-1] - 1
+ while remain[-1] == 0:
+ remain.pop()
+ size = count.pop()
+ stack[-size:] = [stack[-size:]]
+ if not remain: break
+ remain[-1] = remain[-1] - 1
+ if not remain: break
+ args[i] = stack[0]
+
+ varargs = None
+ if co.co_flags & CO_VARARGS:
+ varargs = co.co_varnames[nargs]
+ nargs = nargs + 1
+ varkw = None
+ if co.co_flags & CO_VARKEYWORDS:
+ varkw = co.co_varnames[nargs]
+ return args, varargs, varkw
+
+def getargspec(func):
+ """Get the names and default values of a function's arguments.
+
+ A tuple of four things is returned: (args, varargs, varkw, defaults).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'defaults' is an n-tuple of the default values of the last n arguments."""
+ if ismethod(func):
+ func = func.im_func
+ if not isfunction(func): raise TypeError, 'arg is not a Python function'
+ args, varargs, varkw = getargs(func.func_code)
+ return args, varargs, varkw, func.func_defaults
+
+def getargvalues(frame):
+ """Get information about arguments passed into a particular frame.
+
+ A tuple of four things is returned: (args, varargs, varkw, locals).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'locals' is the locals dictionary of the given frame."""
+ args, varargs, varkw = getargs(frame.f_code)
+ return args, varargs, varkw, frame.f_locals
+
+def joinseq(seq):
+ if len(seq) == 1:
+ return '(' + seq[0] + ',)'
+ else:
+ return '(' + string.join(seq, ', ') + ')'
+
+def strseq(object, convert, join=joinseq):
+ """Recursively walk a sequence, stringifying each element."""
+ if type(object) in [types.ListType, types.TupleType]:
+ return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
+ else:
+ return convert(object)
+
+def formatargspec(args, varargs=None, varkw=None, defaults=None,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargspec.
+
+ The first four arguments are (args, varargs, varkw, defaults). The
+ other four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments."""
+ specs = []
+ if defaults:
+ firstdefault = len(args) - len(defaults)
+ for i in range(len(args)):
+ spec = strseq(args[i], formatarg, join)
+ if defaults and i >= firstdefault:
+ spec = spec + formatvalue(defaults[i - firstdefault])
+ specs.append(spec)
+ if varargs:
+ specs.append(formatvarargs(varargs))
+ if varkw:
+ specs.append(formatvarkw(varkw))
+ return '(' + string.join(specs, ', ') + ')'
+
+def formatargvalues(args, varargs, varkw, locals,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargvalues.
+
+ The first four arguments are (args, varargs, varkw, locals). The
+ next four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments."""
+ def convert(name, locals=locals,
+ formatarg=formatarg, formatvalue=formatvalue):
+ return formatarg(name) + formatvalue(locals[name])
+ specs = []
+ for i in range(len(args)):
+ specs.append(strseq(args[i], convert, join))
+ if varargs:
+ specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
+ if varkw:
+ specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
+ return '(' + string.join(specs, ', ') + ')'
+
+# -------------------------------------------------- stack frame extraction
+def getframeinfo(frame, context=1):
+ """Get information about a frame or traceback object.
+
+ A tuple of five things is returned: the filename, the line number of
+ the current line, the function name, a list of lines of context from
+ the source code, and the index of the current line within that list.
+ The optional second argument specifies the number of lines of context
+ to return, which are centered around the current line."""
+ raise NotImplementedError
+# if istraceback(frame):
+# frame = frame.tb_frame
+# if not isframe(frame):
+# raise TypeError, 'arg is not a frame or traceback object'
+#
+# filename = getsourcefile(frame)
+# lineno = getlineno(frame)
+# if context > 0:
+# start = lineno - 1 - context//2
+# try:
+# lines, lnum = findsource(frame)
+# except IOError:
+# lines = index = None
+# else:
+# start = max(start, 1)
+# start = min(start, len(lines) - context)
+# lines = lines[start:start+context]
+# index = lineno - 1 - start
+# else:
+# lines = index = None
+#
+# return (filename, lineno, frame.f_code.co_name, lines, index)
+
+def getlineno(frame):
+ """Get the line number from a frame object, allowing for optimization."""
+ # Written by Marc-Andr Lemburg; revised by Jim Hugunin and Fredrik Lundh.
+ lineno = frame.f_lineno
+ code = frame.f_code
+ if hasattr(code, 'co_lnotab'):
+ table = code.co_lnotab
+ lineno = code.co_firstlineno
+ addr = 0
+ for i in range(0, len(table), 2):
+ addr = addr + ord(table[i])
+ if addr > frame.f_lasti: break
+ lineno = lineno + ord(table[i + 1])
+ return lineno
+
+def getouterframes(frame, context=1):
+ """Get a list of records for a frame and all higher (calling) frames.
+
+ Each record contains a frame object, filename, line number, function
+ name, a list of lines of context, and index within the context."""
+ framelist = []
+ while frame:
+ framelist.append((frame,) + getframeinfo(frame, context))
+ frame = frame.f_back
+ return framelist
+
+def getinnerframes(tb, context=1):
+ """Get a list of records for a traceback's frame and all lower frames.
+
+ Each record contains a frame object, filename, line number, function
+ name, a list of lines of context, and index within the context."""
+ framelist = []
+ while tb:
+ framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
+ tb = tb.tb_next
+ return framelist
+
+def currentframe():
+ """Return the frame object for the caller's stack frame."""
+ try:
+ raise 'catch me'
+ except:
+ return sys.exc_traceback.tb_frame.f_back #@UndefinedVariable
+
+if hasattr(sys, '_getframe'): currentframe = sys._getframe
+
+def stack(context=1):
+ """Return a list of records for the stack above the caller's frame."""
+ return getouterframes(currentframe().f_back, context)
+
+def trace(context=1):
+ """Return a list of records for the stack below the current exception."""
+ return getinnerframes(sys.exc_traceback, context) #@UndefinedVariable
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_pkgutil_old.py b/ptvsd/pydevd/_pydev_imps/_pydev_pkgutil_old.py
new file mode 100644
index 00000000..ce072ec9
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_pkgutil_old.py
@@ -0,0 +1,591 @@
+"""Utilities to support packages."""
+
+# NOTE: This module must remain compatible with Python 2.3, as it is shared
+# by setuptools for distribution with Python 2.3 and up.
+
+import os
+import sys
+import imp
+import os.path
+from types import ModuleType
+
+__all__ = [
+ 'get_importer', 'iter_importers', 'get_loader', 'find_loader',
+ 'walk_packages', 'iter_modules', 'get_data',
+ 'ImpImporter', 'ImpLoader', 'read_code', 'extend_path',
+]
+
+def read_code(stream):
+ # This helper is needed in order for the PEP 302 emulation to
+ # correctly handle compiled files
+ import marshal
+
+ magic = stream.read(4)
+ if magic != imp.get_magic():
+ return None
+
+ stream.read(4) # Skip timestamp
+ return marshal.load(stream)
+
+
+def simplegeneric(func):
+ """Make a trivial single-dispatch generic function"""
+ registry = {}
+ def wrapper(*args, **kw):
+ ob = args[0]
+ try:
+ cls = ob.__class__
+ except AttributeError:
+ cls = type(ob)
+ try:
+ mro = cls.__mro__
+ except AttributeError:
+ try:
+ class cls(cls, object):
+ pass
+ mro = cls.__mro__[1:]
+ except TypeError:
+ mro = object, # must be an ExtensionClass or some such :(
+ for t in mro:
+ if t in registry:
+ return registry[t](*args, **kw)
+ else:
+ return func(*args, **kw)
+ try:
+ wrapper.__name__ = func.__name__
+ except (TypeError, AttributeError):
+ pass # Python 2.3 doesn't allow functions to be renamed
+
+ def register(typ, func=None):
+ if func is None:
+ return lambda f: register(typ, f)
+ registry[typ] = func
+ return func
+
+ wrapper.__dict__ = func.__dict__
+ wrapper.__doc__ = func.__doc__
+ wrapper.register = register
+ return wrapper
+
+
+def walk_packages(path=None, prefix='', onerror=None):
+ """Yields (module_loader, name, ispkg) for all modules recursively
+ on path, or, if path is None, all accessible modules.
+
+ 'path' should be either None or a list of paths to look for
+ modules in.
+
+ 'prefix' is a string to output on the front of every module name
+ on output.
+
+ Note that this function must import all *packages* (NOT all
+ modules!) on the given path, in order to access the __path__
+ attribute to find submodules.
+
+ 'onerror' is a function which gets called with one argument (the
+ name of the package which was being imported) if any exception
+ occurs while trying to import a package. If no onerror function is
+ supplied, ImportErrors are caught and ignored, while all other
+ exceptions are propagated, terminating the search.
+
+ Examples:
+
+ # list all modules python can access
+ walk_packages()
+
+ # list all submodules of ctypes
+ walk_packages(ctypes.__path__, ctypes.__name__+'.')
+ """
+
+ def seen(p, m={}):
+ if p in m:
+ return True
+ m[p] = True
+
+ for importer, name, ispkg in iter_modules(path, prefix):
+ yield importer, name, ispkg
+
+ if ispkg:
+ try:
+ __import__(name)
+ except ImportError:
+ if onerror is not None:
+ onerror(name)
+ except Exception:
+ if onerror is not None:
+ onerror(name)
+ else:
+ raise
+ else:
+ path = getattr(sys.modules[name], '__path__', None) or []
+
+ # don't traverse path items we've seen before
+ path = [p for p in path if not seen(p)]
+
+ for item in walk_packages(path, name+'.', onerror):
+ yield item
+
+
+def iter_modules(path=None, prefix=''):
+ """Yields (module_loader, name, ispkg) for all submodules on path,
+ or, if path is None, all top-level modules on sys.path.
+
+ 'path' should be either None or a list of paths to look for
+ modules in.
+
+ 'prefix' is a string to output on the front of every module name
+ on output.
+ """
+
+ if path is None:
+ importers = iter_importers()
+ else:
+ importers = map(get_importer, path)
+
+ yielded = {}
+ for i in importers:
+ for name, ispkg in iter_importer_modules(i, prefix):
+ if name not in yielded:
+ yielded[name] = 1
+ yield i, name, ispkg
+
+
+#@simplegeneric
+def iter_importer_modules(importer, prefix=''):
+ if not hasattr(importer, 'iter_modules'):
+ return []
+ return importer.iter_modules(prefix)
+
+iter_importer_modules = simplegeneric(iter_importer_modules)
+
+
+class ImpImporter:
+ """PEP 302 Importer that wraps Python's "classic" import algorithm
+
+ ImpImporter(dirname) produces a PEP 302 importer that searches that
+ directory. ImpImporter(None) produces a PEP 302 importer that searches
+ the current sys.path, plus any modules that are frozen or built-in.
+
+ Note that ImpImporter does not currently support being used by placement
+ on sys.meta_path.
+ """
+
+ def __init__(self, path=None):
+ self.path = path
+
+ def find_module(self, fullname, path=None):
+ # Note: we ignore 'path' argument since it is only used via meta_path
+ subname = fullname.split(".")[-1]
+ if subname != fullname and self.path is None:
+ return None
+ if self.path is None:
+ path = None
+ else:
+ path = [os.path.realpath(self.path)]
+ try:
+ file, filename, etc = imp.find_module(subname, path)
+ except ImportError:
+ return None
+ return ImpLoader(fullname, file, filename, etc)
+
+ def iter_modules(self, prefix=''):
+ if self.path is None or not os.path.isdir(self.path):
+ return
+
+ yielded = {}
+ import inspect
+ try:
+ filenames = os.listdir(self.path)
+ except OSError:
+ # ignore unreadable directories like import does
+ filenames = []
+ filenames.sort() # handle packages before same-named modules
+
+ for fn in filenames:
+ modname = inspect.getmodulename(fn)
+ if modname=='__init__' or modname in yielded:
+ continue
+
+ path = os.path.join(self.path, fn)
+ ispkg = False
+
+ if not modname and os.path.isdir(path) and '.' not in fn:
+ modname = fn
+ try:
+ dircontents = os.listdir(path)
+ except OSError:
+ # ignore unreadable directories like import does
+ dircontents = []
+ for fn in dircontents:
+ subname = inspect.getmodulename(fn)
+ if subname=='__init__':
+ ispkg = True
+ break
+ else:
+ continue # not a package
+
+ if modname and '.' not in modname:
+ yielded[modname] = 1
+ yield prefix + modname, ispkg
+
+
+class ImpLoader:
+ """PEP 302 Loader that wraps Python's "classic" import algorithm
+ """
+ code = source = None
+
+ def __init__(self, fullname, file, filename, etc):
+ self.file = file
+ self.filename = filename
+ self.fullname = fullname
+ self.etc = etc
+
+ def load_module(self, fullname):
+ self._reopen()
+ try:
+ mod = imp.load_module(fullname, self.file, self.filename, self.etc)
+ finally:
+ if self.file:
+ self.file.close()
+ # Note: we don't set __loader__ because we want the module to look
+ # normal; i.e. this is just a wrapper for standard import machinery
+ return mod
+
+ def get_data(self, pathname):
+ return open(pathname, "rb").read()
+
+ def _reopen(self):
+ if self.file and self.file.closed:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ self.file = open(self.filename, 'rU')
+ elif mod_type in (imp.PY_COMPILED, imp.C_EXTENSION):
+ self.file = open(self.filename, 'rb')
+
+ def _fix_name(self, fullname):
+ if fullname is None:
+ fullname = self.fullname
+ elif fullname != self.fullname:
+ raise ImportError("Loader for module %s cannot handle "
+ "module %s" % (self.fullname, fullname))
+ return fullname
+
+ def is_package(self, fullname):
+ fullname = self._fix_name(fullname)
+ return self.etc[2]==imp.PKG_DIRECTORY
+
+ def get_code(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ if self.code is None:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ source = self.get_source(fullname)
+ self.code = compile(source, self.filename, 'exec')
+ elif mod_type==imp.PY_COMPILED:
+ self._reopen()
+ try:
+ self.code = read_code(self.file)
+ finally:
+ self.file.close()
+ elif mod_type==imp.PKG_DIRECTORY:
+ self.code = self._get_delegate().get_code()
+ return self.code
+
+ def get_source(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ if self.source is None:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ self._reopen()
+ try:
+ self.source = self.file.read()
+ finally:
+ self.file.close()
+ elif mod_type==imp.PY_COMPILED:
+ if os.path.exists(self.filename[:-1]):
+ f = open(self.filename[:-1], 'rU')
+ self.source = f.read()
+ f.close()
+ elif mod_type==imp.PKG_DIRECTORY:
+ self.source = self._get_delegate().get_source()
+ return self.source
+
+
+ def _get_delegate(self):
+ return ImpImporter(self.filename).find_module('__init__')
+
+ def get_filename(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ mod_type = self.etc[2]
+ if self.etc[2]==imp.PKG_DIRECTORY:
+ return self._get_delegate().get_filename()
+ elif self.etc[2] in (imp.PY_SOURCE, imp.PY_COMPILED, imp.C_EXTENSION):
+ return self.filename
+ return None
+
+
+try:
+ import zipimport
+ from zipimport import zipimporter
+
+ def iter_zipimport_modules(importer, prefix=''):
+ dirlist = zipimport._zip_directory_cache[importer.archive].keys()
+ dirlist.sort()
+ _prefix = importer.prefix
+ plen = len(_prefix)
+ yielded = {}
+ import inspect
+ for fn in dirlist:
+ if not fn.startswith(_prefix):
+ continue
+
+ fn = fn[plen:].split(os.sep)
+
+ if len(fn)==2 and fn[1].startswith('__init__.py'):
+ if fn[0] not in yielded:
+ yielded[fn[0]] = 1
+ yield fn[0], True
+
+ if len(fn)!=1:
+ continue
+
+ modname = inspect.getmodulename(fn[0])
+ if modname=='__init__':
+ continue
+
+ if modname and '.' not in modname and modname not in yielded:
+ yielded[modname] = 1
+ yield prefix + modname, False
+
+ iter_importer_modules.register(zipimporter, iter_zipimport_modules)
+
+except ImportError:
+ pass
+
+
+def get_importer(path_item):
+ """Retrieve a PEP 302 importer for the given path item
+
+ The returned importer is cached in sys.path_importer_cache
+ if it was newly created by a path hook.
+
+ If there is no importer, a wrapper around the basic import
+ machinery is returned. This wrapper is never inserted into
+ the importer cache (None is inserted instead).
+
+ The cache (or part of it) can be cleared manually if a
+ rescan of sys.path_hooks is necessary.
+ """
+ try:
+ importer = sys.path_importer_cache[path_item]
+ except KeyError:
+ for path_hook in sys.path_hooks:
+ try:
+ importer = path_hook(path_item)
+ break
+ except ImportError:
+ pass
+ else:
+ importer = None
+ sys.path_importer_cache.setdefault(path_item, importer)
+
+ if importer is None:
+ try:
+ importer = ImpImporter(path_item)
+ except ImportError:
+ importer = None
+ return importer
+
+
+def iter_importers(fullname=""):
+ """Yield PEP 302 importers for the given module name
+
+ If fullname contains a '.', the importers will be for the package
+ containing fullname, otherwise they will be importers for sys.meta_path,
+ sys.path, and Python's "classic" import machinery, in that order. If
+ the named module is in a package, that package is imported as a side
+ effect of invoking this function.
+
+ Non PEP 302 mechanisms (e.g. the Windows registry) used by the
+ standard import machinery to find files in alternative locations
+ are partially supported, but are searched AFTER sys.path. Normally,
+ these locations are searched BEFORE sys.path, preventing sys.path
+ entries from shadowing them.
+
+ For this to cause a visible difference in behaviour, there must
+ be a module or package name that is accessible via both sys.path
+ and one of the non PEP 302 file system mechanisms. In this case,
+ the emulation will find the former version, while the builtin
+ import mechanism will find the latter.
+
+ Items of the following types can be affected by this discrepancy:
+ imp.C_EXTENSION, imp.PY_SOURCE, imp.PY_COMPILED, imp.PKG_DIRECTORY
+ """
+ if fullname.startswith('.'):
+ raise ImportError("Relative module names not supported")
+ if '.' in fullname:
+ # Get the containing package's __path__
+ pkg = '.'.join(fullname.split('.')[:-1])
+ if pkg not in sys.modules:
+ __import__(pkg)
+ path = getattr(sys.modules[pkg], '__path__', None) or []
+ else:
+ for importer in sys.meta_path:
+ yield importer
+ path = sys.path
+ for item in path:
+ yield get_importer(item)
+ if '.' not in fullname:
+ yield ImpImporter()
+
+def get_loader(module_or_name):
+ """Get a PEP 302 "loader" object for module_or_name
+
+ If the module or package is accessible via the normal import
+ mechanism, a wrapper around the relevant part of that machinery
+ is returned. Returns None if the module cannot be found or imported.
+ If the named module is not already imported, its containing package
+ (if any) is imported, in order to establish the package __path__.
+
+ This function uses iter_importers(), and is thus subject to the same
+ limitations regarding platform-specific special import locations such
+ as the Windows registry.
+ """
+ if module_or_name in sys.modules:
+ module_or_name = sys.modules[module_or_name]
+ if isinstance(module_or_name, ModuleType):
+ module = module_or_name
+ loader = getattr(module, '__loader__', None)
+ if loader is not None:
+ return loader
+ fullname = module.__name__
+ else:
+ fullname = module_or_name
+ return find_loader(fullname)
+
+def find_loader(fullname):
+ """Find a PEP 302 "loader" object for fullname
+
+ If fullname contains dots, path must be the containing package's __path__.
+ Returns None if the module cannot be found or imported. This function uses
+ iter_importers(), and is thus subject to the same limitations regarding
+ platform-specific special import locations such as the Windows registry.
+ """
+ for importer in iter_importers(fullname):
+ loader = importer.find_module(fullname)
+ if loader is not None:
+ return loader
+
+ return None
+
+
+def extend_path(path, name):
+ """Extend a package's path.
+
+ Intended use is to place the following code in a package's __init__.py:
+
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
+
+ This will add to the package's __path__ all subdirectories of
+ directories on sys.path named after the package. This is useful
+ if one wants to distribute different parts of a single logical
+ package as multiple directories.
+
+ It also looks for *.pkg files beginning where * matches the name
+ argument. This feature is similar to *.pth files (see site.py),
+ except that it doesn't special-case lines starting with 'import'.
+ A *.pkg file is trusted at face value: apart from checking for
+ duplicates, all entries found in a *.pkg file are added to the
+ path, regardless of whether they are exist the filesystem. (This
+ is a feature.)
+
+ If the input path is not a list (as is the case for frozen
+ packages) it is returned unchanged. The input path is not
+ modified; an extended copy is returned. Items are only appended
+ to the copy at the end.
+
+ It is assumed that sys.path is a sequence. Items of sys.path that
+ are not (unicode or 8-bit) strings referring to existing
+ directories are ignored. Unicode items of sys.path that cause
+ errors when used as filenames may cause this function to raise an
+ exception (in line with os.path.isdir() behavior).
+ """
+
+ if not isinstance(path, list):
+ # This could happen e.g. when this is called from inside a
+ # frozen package. Return the path unchanged in that case.
+ return path
+
+ pname = os.path.join(*name.split('.')) # Reconstitute as relative path
+ # Just in case os.extsep != '.'
+ sname = os.extsep.join(name.split('.'))
+ sname_pkg = sname + os.extsep + "pkg"
+ init_py = "__init__" + os.extsep + "py"
+
+ path = path[:] # Start with a copy of the existing path
+
+ for dir in sys.path:
+ if not isinstance(dir, basestring) or not os.path.isdir(dir):
+ continue
+ subdir = os.path.join(dir, pname)
+ # XXX This may still add duplicate entries to path on
+ # case-insensitive filesystems
+ initfile = os.path.join(subdir, init_py)
+ if subdir not in path and os.path.isfile(initfile):
+ path.append(subdir)
+ # XXX Is this the right thing for subpackages like zope.app?
+ # It looks for a file named "zope.app.pkg"
+ pkgfile = os.path.join(dir, sname_pkg)
+ if os.path.isfile(pkgfile):
+ try:
+ f = open(pkgfile)
+ except IOError, msg:
+ sys.stderr.write("Can't open %s: %s\n" %
+ (pkgfile, msg))
+ else:
+ for line in f:
+ line = line.rstrip('\n')
+ if not line or line.startswith('#'):
+ continue
+ path.append(line) # Don't check for existence!
+ f.close()
+
+ return path
+
+def get_data(package, resource):
+ """Get a resource from a package.
+
+ This is a wrapper round the PEP 302 loader get_data API. The package
+ argument should be the name of a package, in standard module format
+ (foo.bar). The resource argument should be in the form of a relative
+ filename, using '/' as the path separator. The parent directory name '..'
+ is not allowed, and nor is a rooted name (starting with a '/').
+
+ The function returns a binary string, which is the contents of the
+ specified resource.
+
+ For packages located in the filesystem, which have already been imported,
+ this is the rough equivalent of
+
+ d = os.path.dirname(sys.modules[package].__file__)
+ data = open(os.path.join(d, resource), 'rb').read()
+
+ If the package cannot be located or loaded, or it uses a PEP 302 loader
+ which does not support get_data(), then None is returned.
+ """
+
+ loader = get_loader(package)
+ if loader is None or not hasattr(loader, 'get_data'):
+ return None
+ mod = sys.modules.get(package) or loader.load_module(package)
+ if mod is None or not hasattr(mod, '__file__'):
+ return None
+
+ # Modify the resource name to be compatible with the loader.get_data
+ # signature - an os.path format "filename" starting with the dirname of
+ # the package's __file__
+ parts = resource.split('/')
+ parts.insert(0, os.path.dirname(mod.__file__))
+ resource_name = os.path.join(*parts)
+ return loader.get_data(resource_name)
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_saved_modules.py b/ptvsd/pydevd/_pydev_imps/_pydev_saved_modules.py
new file mode 100644
index 00000000..6ff3939d
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_saved_modules.py
@@ -0,0 +1,23 @@
+import sys
+IS_PY2 = sys.version_info < (3,)
+
+import threading
+
+import time
+
+import socket
+
+import select
+
+if IS_PY2:
+ import thread
+ import Queue as _queue
+ import xmlrpclib
+ import SimpleXMLRPCServer as _pydev_SimpleXMLRPCServer
+ import BaseHTTPServer
+else:
+ import _thread as thread
+ import queue as _queue
+ import xmlrpc.client as xmlrpclib
+ import xmlrpc.server as _pydev_SimpleXMLRPCServer
+ import http.server as BaseHTTPServer
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_sys_patch.py b/ptvsd/pydevd/_pydev_imps/_pydev_sys_patch.py
new file mode 100644
index 00000000..0220ad0d
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_sys_patch.py
@@ -0,0 +1,75 @@
+
+import sys
+
+
+def patch_sys_module():
+ def patched_exc_info(fun):
+ def pydev_debugger_exc_info():
+ type, value, traceback = fun()
+ if type == ImportError:
+ #we should not show frame added by plugin_import call
+ if traceback and hasattr(traceback, "tb_next"):
+ return type, value, traceback.tb_next
+ return type, value, traceback
+ return pydev_debugger_exc_info
+
+ system_exc_info = sys.exc_info
+ sys.exc_info = patched_exc_info(system_exc_info)
+ if not hasattr(sys, "system_exc_info"):
+ sys.system_exc_info = system_exc_info
+
+
+def patched_reload(orig_reload):
+ def pydev_debugger_reload(module):
+ orig_reload(module)
+ if module.__name__ == "sys":
+ # if sys module was reloaded we should patch it again
+ patch_sys_module()
+ return pydev_debugger_reload
+
+
+def patch_reload():
+ if sys.version_info[0] >= 3:
+ import builtins # Py3
+ else:
+ import __builtin__ as builtins
+
+ if hasattr(builtins, "reload"):
+ sys.builtin_orig_reload = builtins.reload
+ builtins.reload = patched_reload(sys.builtin_orig_reload) # @UndefinedVariable
+ try:
+ import imp
+ sys.imp_orig_reload = imp.reload
+ imp.reload = patched_reload(sys.imp_orig_reload) # @UndefinedVariable
+ except:
+ pass
+ else:
+ try:
+ import importlib
+ sys.importlib_orig_reload = importlib.reload # @UndefinedVariable
+ importlib.reload = patched_reload(sys.importlib_orig_reload) # @UndefinedVariable
+ except:
+ pass
+
+ del builtins
+
+
+def cancel_patches_in_sys_module():
+ sys.exc_info = sys.system_exc_info # @UndefinedVariable
+ if sys.version_info[0] >= 3:
+ import builtins # Py3
+ else:
+ import __builtin__ as builtins
+
+ if hasattr(sys, "builtin_orig_reload"):
+ builtins.reload = sys.builtin_orig_reload
+
+ if hasattr(sys, "imp_orig_reload"):
+ import imp
+ imp.reload = sys.imp_orig_reload
+
+ if hasattr(sys, "importlib_orig_reload"):
+ import importlib
+ importlib.reload = sys.importlib_orig_reload
+
+ del builtins
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_uuid_old.py b/ptvsd/pydevd/_pydev_imps/_pydev_uuid_old.py
new file mode 100644
index 00000000..20bc43b7
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_uuid_old.py
@@ -0,0 +1,541 @@
+r"""UUID objects (universally unique identifiers) according to RFC 4122.
+
+This module provides immutable UUID objects (class UUID) and the functions
+uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
+UUIDs as specified in RFC 4122.
+
+If all you want is a unique ID, you should probably call uuid1() or uuid4().
+Note that uuid1() may compromise privacy since it creates a UUID containing
+the computer's network address. uuid4() creates a random UUID.
+
+Typical usage:
+
+ >>> import uuid
+
+ # make a UUID based on the host ID and current time
+ >>> uuid.uuid1()
+ UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')
+
+ # make a UUID using an MD5 hash of a namespace UUID and a name
+ >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
+ UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
+
+ # make a random UUID
+ >>> uuid.uuid4()
+ UUID('16fd2706-8baf-433b-82eb-8c7fada847da')
+
+ # make a UUID using a SHA-1 hash of a namespace UUID and a name
+ >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
+ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
+
+ # make a UUID from a string of hex digits (braces and hyphens ignored)
+ >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')
+
+ # convert a UUID to a string of hex digits in standard form
+ >>> str(x)
+ '00010203-0405-0607-0809-0a0b0c0d0e0f'
+
+ # get the raw 16 bytes of the UUID
+ >>> x.bytes
+ '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
+
+ # make a UUID from a 16-byte string
+ >>> uuid.UUID(bytes=x.bytes)
+ UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
+"""
+
+__author__ = 'Ka-Ping Yee '
+
+RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE = [
+ 'reserved for NCS compatibility', 'specified in RFC 4122',
+ 'reserved for Microsoft compatibility', 'reserved for future definition']
+
+class UUID(object):
+ """Instances of the UUID class represent UUIDs as specified in RFC 4122.
+ UUID objects are immutable, hashable, and usable as dictionary keys.
+ Converting a UUID to a string with str() yields something in the form
+ '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts
+ five possible forms: a similar string of hexadecimal digits, or a tuple
+ of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
+ 48-bit values respectively) as an argument named 'fields', or a string
+ of 16 bytes (with all the integer fields in big-endian order) as an
+ argument named 'bytes', or a string of 16 bytes (with the first three
+ fields in little-endian order) as an argument named 'bytes_le', or a
+ single 128-bit integer as an argument named 'int'.
+
+ UUIDs have these read-only attributes:
+
+ bytes the UUID as a 16-byte string (containing the six
+ integer fields in big-endian byte order)
+
+ bytes_le the UUID as a 16-byte string (with time_low, time_mid,
+ and time_hi_version in little-endian byte order)
+
+ fields a tuple of the six integer fields of the UUID,
+ which are also available as six individual attributes
+ and two derived attributes:
+
+ time_low the first 32 bits of the UUID
+ time_mid the next 16 bits of the UUID
+ time_hi_version the next 16 bits of the UUID
+ clock_seq_hi_variant the next 8 bits of the UUID
+ clock_seq_low the next 8 bits of the UUID
+ node the last 48 bits of the UUID
+
+ time the 60-bit timestamp
+ clock_seq the 14-bit sequence number
+
+ hex the UUID as a 32-character hexadecimal string
+
+ int the UUID as a 128-bit integer
+
+ urn the UUID as a URN as specified in RFC 4122
+
+ variant the UUID variant (one of the constants RESERVED_NCS,
+ RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
+
+ version the UUID version number (1 through 5, meaningful only
+ when the variant is RFC_4122)
+ """
+
+ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
+ int=None, version=None):
+ r"""Create a UUID from either a string of 32 hexadecimal digits,
+ a string of 16 bytes as the 'bytes' argument, a string of 16 bytes
+ in little-endian order as the 'bytes_le' argument, a tuple of six
+ integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version,
+ 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as
+ the 'fields' argument, or a single 128-bit integer as the 'int'
+ argument. When a string of hex digits is given, curly braces,
+ hyphens, and a URN prefix are all optional. For example, these
+ expressions all yield the same UUID:
+
+ UUID('{12345678-1234-5678-1234-567812345678}')
+ UUID('12345678123456781234567812345678')
+ UUID('urn:uuid:12345678-1234-5678-1234-567812345678')
+ UUID(bytes='\x12\x34\x56\x78'*4)
+ UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' +
+ '\x12\x34\x56\x78\x12\x34\x56\x78')
+ UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
+ UUID(int=0x12345678123456781234567812345678)
+
+ Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must
+ be given. The 'version' argument is optional; if given, the resulting
+ UUID will have its variant and version set according to RFC 4122,
+ overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'.
+ """
+
+ if [hex, bytes, bytes_le, fields, int].count(None) != 4:
+ raise TypeError('need one of hex, bytes, bytes_le, fields, or int')
+ if hex is not None:
+ hex = hex.replace('urn:', '').replace('uuid:', '')
+ hex = hex.strip('{}').replace('-', '')
+ if len(hex) != 32:
+ raise ValueError('badly formed hexadecimal UUID string')
+ int = long(hex, 16)
+ if bytes_le is not None:
+ if len(bytes_le) != 16:
+ raise ValueError('bytes_le is not a 16-char string')
+ bytes = (bytes_le[3] + bytes_le[2] + bytes_le[1] + bytes_le[0] +
+ bytes_le[5] + bytes_le[4] + bytes_le[7] + bytes_le[6] +
+ bytes_le[8:])
+ if bytes is not None:
+ if len(bytes) != 16:
+ raise ValueError('bytes is not a 16-char string')
+ int = long(('%02x'*16) % tuple(map(ord, bytes)), 16)
+ if fields is not None:
+ if len(fields) != 6:
+ raise ValueError('fields is not a 6-tuple')
+ (time_low, time_mid, time_hi_version,
+ clock_seq_hi_variant, clock_seq_low, node) = fields
+ if not 0 <= time_low < 1<<32L:
+ raise ValueError('field 1 out of range (need a 32-bit value)')
+ if not 0 <= time_mid < 1<<16L:
+ raise ValueError('field 2 out of range (need a 16-bit value)')
+ if not 0 <= time_hi_version < 1<<16L:
+ raise ValueError('field 3 out of range (need a 16-bit value)')
+ if not 0 <= clock_seq_hi_variant < 1<<8L:
+ raise ValueError('field 4 out of range (need an 8-bit value)')
+ if not 0 <= clock_seq_low < 1<<8L:
+ raise ValueError('field 5 out of range (need an 8-bit value)')
+ if not 0 <= node < 1<<48L:
+ raise ValueError('field 6 out of range (need a 48-bit value)')
+ clock_seq = (clock_seq_hi_variant << 8L) | clock_seq_low
+ int = ((time_low << 96L) | (time_mid << 80L) |
+ (time_hi_version << 64L) | (clock_seq << 48L) | node)
+ if int is not None:
+ if not 0 <= int < 1<<128L:
+ raise ValueError('int is out of range (need a 128-bit value)')
+ if version is not None:
+ if not 1 <= version <= 5:
+ raise ValueError('illegal version number')
+ # Set the variant to RFC 4122.
+ int &= ~(0xc000 << 48L)
+ int |= 0x8000 << 48L
+ # Set the version number.
+ int &= ~(0xf000 << 64L)
+ int |= version << 76L
+ self.__dict__['int'] = int
+
+ def __cmp__(self, other):
+ if isinstance(other, UUID):
+ return cmp(self.int, other.int)
+ return NotImplemented
+
+ def __hash__(self):
+ return hash(self.int)
+
+ def __int__(self):
+ return self.int
+
+ def __repr__(self):
+ return 'UUID(%r)' % str(self)
+
+ def __setattr__(self, name, value):
+ raise TypeError('UUID objects are immutable')
+
+ def __str__(self):
+ hex = '%032x' % self.int
+ return '%s-%s-%s-%s-%s' % (
+ hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:])
+
+ def get_bytes(self):
+ bytes = ''
+ for shift in range(0, 128, 8):
+ bytes = chr((self.int >> shift) & 0xff) + bytes
+ return bytes
+
+ bytes = property(get_bytes)
+
+ def get_bytes_le(self):
+ bytes = self.bytes
+ return (bytes[3] + bytes[2] + bytes[1] + bytes[0] +
+ bytes[5] + bytes[4] + bytes[7] + bytes[6] + bytes[8:])
+
+ bytes_le = property(get_bytes_le)
+
+ def get_fields(self):
+ return (self.time_low, self.time_mid, self.time_hi_version,
+ self.clock_seq_hi_variant, self.clock_seq_low, self.node)
+
+ fields = property(get_fields)
+
+ def get_time_low(self):
+ return self.int >> 96L
+
+ time_low = property(get_time_low)
+
+ def get_time_mid(self):
+ return (self.int >> 80L) & 0xffff
+
+ time_mid = property(get_time_mid)
+
+ def get_time_hi_version(self):
+ return (self.int >> 64L) & 0xffff
+
+ time_hi_version = property(get_time_hi_version)
+
+ def get_clock_seq_hi_variant(self):
+ return (self.int >> 56L) & 0xff
+
+ clock_seq_hi_variant = property(get_clock_seq_hi_variant)
+
+ def get_clock_seq_low(self):
+ return (self.int >> 48L) & 0xff
+
+ clock_seq_low = property(get_clock_seq_low)
+
+ def get_time(self):
+ return (((self.time_hi_version & 0x0fffL) << 48L) |
+ (self.time_mid << 32L) | self.time_low)
+
+ time = property(get_time)
+
+ def get_clock_seq(self):
+ return (((self.clock_seq_hi_variant & 0x3fL) << 8L) |
+ self.clock_seq_low)
+
+ clock_seq = property(get_clock_seq)
+
+ def get_node(self):
+ return self.int & 0xffffffffffff
+
+ node = property(get_node)
+
+ def get_hex(self):
+ return '%032x' % self.int
+
+ hex = property(get_hex)
+
+ def get_urn(self):
+ return 'urn:uuid:' + str(self)
+
+ urn = property(get_urn)
+
+ def get_variant(self):
+ if not self.int & (0x8000 << 48L):
+ return RESERVED_NCS
+ elif not self.int & (0x4000 << 48L):
+ return RFC_4122
+ elif not self.int & (0x2000 << 48L):
+ return RESERVED_MICROSOFT
+ else:
+ return RESERVED_FUTURE
+
+ variant = property(get_variant)
+
+ def get_version(self):
+ # The version bits are only meaningful for RFC 4122 UUIDs.
+ if self.variant == RFC_4122:
+ return int((self.int >> 76L) & 0xf)
+
+ version = property(get_version)
+
+def _find_mac(command, args, hw_identifiers, get_index):
+ import os
+ for dir in ['', '/sbin/', '/usr/sbin']:
+ executable = os.path.join(dir, command)
+ if not os.path.exists(executable):
+ continue
+
+ try:
+ # LC_ALL to get English output, 2>/dev/null to
+ # prevent output on stderr
+ cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)
+ pipe = os.popen(cmd)
+ except IOError:
+ continue
+
+ for line in pipe:
+ words = line.lower().split()
+ for i in range(len(words)):
+ if words[i] in hw_identifiers:
+ return int(words[get_index(i)].replace(':', ''), 16)
+ return None
+
+def _ifconfig_getnode():
+ """Get the hardware address on Unix by running ifconfig."""
+
+ # This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes.
+ for args in ('', '-a', '-av'):
+ mac = _find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i+1)
+ if mac:
+ return mac
+
+ import socket
+ ip_addr = socket.gethostbyname(socket.gethostname())
+
+ # Try getting the MAC addr from arp based on our IP address (Solaris).
+ mac = _find_mac('arp', '-an', [ip_addr], lambda i: -1)
+ if mac:
+ return mac
+
+ # This might work on HP-UX.
+ mac = _find_mac('lanscan', '-ai', ['lan0'], lambda i: 0)
+ if mac:
+ return mac
+
+ return None
+
+def _ipconfig_getnode():
+ """Get the hardware address on Windows by running ipconfig.exe."""
+ import os, re
+ dirs = ['', r'c:\windows\system32', r'c:\winnt\system32']
+ try:
+ import ctypes
+ buffer = ctypes.create_string_buffer(300)
+ ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300) # @UndefinedVariable
+ dirs.insert(0, buffer.value.decode('mbcs'))
+ except:
+ pass
+ for dir in dirs:
+ try:
+ pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all')
+ except IOError:
+ continue
+ for line in pipe:
+ value = line.split(':')[-1].strip().lower()
+ if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
+ return int(value.replace('-', ''), 16)
+
+def _netbios_getnode():
+ """Get the hardware address on Windows using NetBIOS calls.
+ See http://support.microsoft.com/kb/118623 for details."""
+ import win32wnet, netbios
+ ncb = netbios.NCB()
+ ncb.Command = netbios.NCBENUM
+ ncb.Buffer = adapters = netbios.LANA_ENUM()
+ adapters._pack()
+ if win32wnet.Netbios(ncb) != 0:
+ return
+ adapters._unpack()
+ for i in range(adapters.length):
+ ncb.Reset()
+ ncb.Command = netbios.NCBRESET
+ ncb.Lana_num = ord(adapters.lana[i])
+ if win32wnet.Netbios(ncb) != 0:
+ continue
+ ncb.Reset()
+ ncb.Command = netbios.NCBASTAT
+ ncb.Lana_num = ord(adapters.lana[i])
+ ncb.Callname = '*'.ljust(16)
+ ncb.Buffer = status = netbios.ADAPTER_STATUS()
+ if win32wnet.Netbios(ncb) != 0:
+ continue
+ status._unpack()
+ bytes = map(ord, status.adapter_address)
+ return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) +
+ (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5])
+
+# Thanks to Thomas Heller for ctypes and for his help with its use here.
+
+# If ctypes is available, use it to find system routines for UUID generation.
+_uuid_generate_random = _uuid_generate_time = _UuidCreate = None
+try:
+ import ctypes, ctypes.util
+ _buffer = ctypes.create_string_buffer(16)
+
+ # The uuid_generate_* routines are provided by libuuid on at least
+ # Linux and FreeBSD, and provided by libc on Mac OS X.
+ for libname in ['uuid', 'c']:
+ try:
+ lib = ctypes.CDLL(ctypes.util.find_library(libname))
+ except:
+ continue
+ if hasattr(lib, 'uuid_generate_random'):
+ _uuid_generate_random = lib.uuid_generate_random
+ if hasattr(lib, 'uuid_generate_time'):
+ _uuid_generate_time = lib.uuid_generate_time
+
+ # On Windows prior to 2000, UuidCreate gives a UUID containing the
+ # hardware address. On Windows 2000 and later, UuidCreate makes a
+ # random UUID and UuidCreateSequential gives a UUID containing the
+ # hardware address. These routines are provided by the RPC runtime.
+ # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last
+ # 6 bytes returned by UuidCreateSequential are fixed, they don't appear
+ # to bear any relationship to the MAC address of any network device
+ # on the box.
+ try:
+ lib = ctypes.windll.rpcrt4
+ except:
+ lib = None
+ _UuidCreate = getattr(lib, 'UuidCreateSequential',
+ getattr(lib, 'UuidCreate', None))
+except:
+ pass
+
+def _unixdll_getnode():
+ """Get the hardware address on Unix using ctypes."""
+ _uuid_generate_time(_buffer)
+ return UUID(bytes=_buffer.raw).node
+
+def _windll_getnode():
+ """Get the hardware address on Windows using ctypes."""
+ if _UuidCreate(_buffer) == 0:
+ return UUID(bytes=_buffer.raw).node
+
+def _random_getnode():
+ """Get a random node ID, with eighth bit set as suggested by RFC 4122."""
+ import random
+ return random.randrange(0, 1<<48L) | 0x010000000000L
+
+_node = None
+
+def getnode():
+ """Get the hardware address as a 48-bit positive integer.
+
+ The first time this runs, it may launch a separate program, which could
+ be quite slow. If all attempts to obtain the hardware address fail, we
+ choose a random 48-bit number with its eighth bit set to 1 as recommended
+ in RFC 4122.
+ """
+
+ global _node
+ if _node is not None:
+ return _node
+
+ import sys
+ if sys.platform == 'win32':
+ getters = [_windll_getnode, _netbios_getnode, _ipconfig_getnode]
+ else:
+ getters = [_unixdll_getnode, _ifconfig_getnode]
+
+ for getter in getters + [_random_getnode]:
+ try:
+ _node = getter()
+ except:
+ continue
+ if _node is not None:
+ return _node
+
+_last_timestamp = None
+
+def uuid1(node=None, clock_seq=None):
+ """Generate a UUID from a host ID, sequence number, and the current time.
+ If 'node' is not given, getnode() is used to obtain the hardware
+ address. If 'clock_seq' is given, it is used as the sequence number;
+ otherwise a random 14-bit sequence number is chosen."""
+
+ # When the system provides a version-1 UUID generator, use it (but don't
+ # use UuidCreate here because its UUIDs don't conform to RFC 4122).
+ if _uuid_generate_time and node is clock_seq is None:
+ _uuid_generate_time(_buffer)
+ return UUID(bytes=_buffer.raw)
+
+ global _last_timestamp
+ import time
+ nanoseconds = int(time.time() * 1e9)
+ # 0x01b21dd213814000 is the number of 100-ns intervals between the
+ # UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
+ timestamp = int(nanoseconds/100) + 0x01b21dd213814000L
+ if timestamp <= _last_timestamp:
+ timestamp = _last_timestamp + 1
+ _last_timestamp = timestamp
+ if clock_seq is None:
+ import random
+ clock_seq = random.randrange(1<<14L) # instead of stable storage
+ time_low = timestamp & 0xffffffffL
+ time_mid = (timestamp >> 32L) & 0xffffL
+ time_hi_version = (timestamp >> 48L) & 0x0fffL
+ clock_seq_low = clock_seq & 0xffL
+ clock_seq_hi_variant = (clock_seq >> 8L) & 0x3fL
+ if node is None:
+ node = getnode()
+ return UUID(fields=(time_low, time_mid, time_hi_version,
+ clock_seq_hi_variant, clock_seq_low, node), version=1)
+
+def uuid3(namespace, name):
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
+ import md5
+ hash = md5.md5(namespace.bytes + name).digest()
+ return UUID(bytes=hash[:16], version=3)
+
+def uuid4():
+ """Generate a random UUID."""
+
+ # When the system provides a version-4 UUID generator, use it.
+ if _uuid_generate_random:
+ _uuid_generate_random(_buffer)
+ return UUID(bytes=_buffer.raw)
+
+ # Otherwise, get randomness from urandom or the 'random' module.
+ try:
+ import os
+ return UUID(bytes=os.urandom(16), version=4)
+ except:
+ import random
+ bytes = [chr(random.randrange(256)) for i in range(16)]
+ return UUID(bytes=bytes, version=4)
+
+def uuid5(namespace, name):
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
+ import sha
+ hash = sha.sha(namespace.bytes + name).digest()
+ return UUID(bytes=hash[:16], version=5)
+
+# The following standard UUIDs are for use with uuid3() or uuid5().
+
+NAMESPACE_DNS = UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
+NAMESPACE_URL = UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8')
+NAMESPACE_OID = UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')
+NAMESPACE_X500 = UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8')
diff --git a/ptvsd/pydevd/_pydev_imps/_pydev_xmlrpclib.py b/ptvsd/pydevd/_pydev_imps/_pydev_xmlrpclib.py
new file mode 100644
index 00000000..5f6e2b7f
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_imps/_pydev_xmlrpclib.py
@@ -0,0 +1,1493 @@
+#Just a copy of the version in python 2.5 to be used if it's not available in jython 2.1
+import sys
+
+#
+# XML-RPC CLIENT LIBRARY
+#
+# an XML-RPC client interface for Python.
+#
+# the marshalling and response parser code can also be used to
+# implement XML-RPC servers.
+#
+# Notes:
+# this version is designed to work with Python 2.1 or newer.
+#
+# History:
+# 1999-01-14 fl Created
+# 1999-01-15 fl Changed dateTime to use localtime
+# 1999-01-16 fl Added Binary/base64 element, default to RPC2 service
+# 1999-01-19 fl Fixed array data element (from Skip Montanaro)
+# 1999-01-21 fl Fixed dateTime constructor, etc.
+# 1999-02-02 fl Added fault handling, handle empty sequences, etc.
+# 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro)
+# 1999-06-20 fl Speed improvements, pluggable parsers/transports (0.9.8)
+# 2000-11-28 fl Changed boolean to check the truth value of its argument
+# 2001-02-24 fl Added encoding/Unicode/SafeTransport patches
+# 2001-02-26 fl Added compare support to wrappers (0.9.9/1.0b1)
+# 2001-03-28 fl Make sure response tuple is a singleton
+# 2001-03-29 fl Don't require empty params element (from Nicholas Riley)
+# 2001-06-10 fl Folded in _xmlrpclib accelerator support (1.0b2)
+# 2001-08-20 fl Base xmlrpclib.Error on built-in Exception (from Paul Prescod)
+# 2001-09-03 fl Allow Transport subclass to override getparser
+# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup)
+# 2001-10-01 fl Remove containers from memo cache when done with them
+# 2001-10-01 fl Use faster escape method (80% dumps speedup)
+# 2001-10-02 fl More dumps microtuning
+# 2001-10-04 fl Make sure import expat gets a parser (from Guido van Rossum)
+# 2001-10-10 sm Allow long ints to be passed as ints if they don't overflow
+# 2001-10-17 sm Test for int and long overflow (allows use on 64-bit systems)
+# 2001-11-12 fl Use repr() to marshal doubles (from Paul Felix)
+# 2002-03-17 fl Avoid buffered read when possible (from James Rucker)
+# 2002-04-07 fl Added pythondoc comments
+# 2002-04-16 fl Added __str__ methods to datetime/binary wrappers
+# 2002-05-15 fl Added error constants (from Andrew Kuchling)
+# 2002-06-27 fl Merged with Python CVS version
+# 2002-10-22 fl Added basic authentication (based on code from Phillip Eby)
+# 2003-01-22 sm Add support for the bool type
+# 2003-02-27 gvr Remove apply calls
+# 2003-04-24 sm Use cStringIO if available
+# 2003-04-25 ak Add support for nil
+# 2003-06-15 gn Add support for time.struct_time
+# 2003-07-12 gp Correct marshalling of Faults
+# 2003-10-31 mvl Add multicall support
+# 2004-08-20 mvl Bump minimum supported Python version to 2.1
+#
+# Copyright (c) 1999-2002 by Secret Labs AB.
+# Copyright (c) 1999-2002 by Fredrik Lundh.
+#
+# info@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The XML-RPC client interface is
+#
+# Copyright (c) 1999-2002 by Secret Labs AB
+# Copyright (c) 1999-2002 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+#
+# things to look into some day:
+
+# TODO: sort out True/False/boolean issues for Python 2.3
+
+"""
+An XML-RPC client interface for Python.
+
+The marshalling and response parser code can also be used to
+implement XML-RPC servers.
+
+Exported exceptions:
+
+ Error Base class for client errors
+ ProtocolError Indicates an HTTP protocol error
+ ResponseError Indicates a broken response package
+ Fault Indicates an XML-RPC fault package
+
+Exported classes:
+
+ ServerProxy Represents a logical connection to an XML-RPC server
+
+ MultiCall Executor of boxcared xmlrpc requests
+ Boolean boolean wrapper to generate a "boolean" XML-RPC value
+ DateTime dateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate a "dateTime.iso8601"
+ XML-RPC value
+ Binary binary data wrapper
+
+ SlowParser Slow but safe standard parser (based on xmllib)
+ Marshaller Generate an XML-RPC params chunk from a Python data structure
+ Unmarshaller Unmarshal an XML-RPC response from incoming XML event message
+ Transport Handles an HTTP transaction to an XML-RPC server
+ SafeTransport Handles an HTTPS transaction to an XML-RPC server
+
+Exported constants:
+
+ True
+ False
+
+Exported functions:
+
+ boolean Convert any Python value to an XML-RPC boolean
+ getparser Create instance of the fastest available parser & attach
+ to an unmarshalling object
+ dumps Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+ loads Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+"""
+
+import re, string, time, operator
+
+from types import *
+
+# --------------------------------------------------------------------
+# Internal stuff
+
+try:
+ unicode
+except NameError:
+ unicode = None # unicode support not available
+
+try:
+ import datetime
+except ImportError:
+ datetime = None
+
+try:
+ _bool_is_builtin = False.__class__.__name__ == "bool"
+except (NameError, AttributeError):
+ _bool_is_builtin = 0
+
+def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search):
+ # decode non-ascii string (if possible)
+ if unicode and encoding and is8bit(data):
+ data = unicode(data, encoding)
+ return data
+
+def escape(s, replace=string.replace):
+ s = replace(s, "&", "&")
+ s = replace(s, "<", "<")
+ return replace(s, ">", ">",)
+
+if unicode:
+ def _stringify(string):
+ # convert to 7-bit ascii if possible
+ try:
+ return string.encode("ascii")
+ except UnicodeError:
+ return string
+else:
+ def _stringify(string):
+ return string
+
+__version__ = "1.0.1"
+
+# xmlrpc integer limits
+try:
+ long
+except NameError:
+ long = int
+MAXINT = long(2) ** 31 - 1
+MININT = long(-2) ** 31
+
+# --------------------------------------------------------------------
+# Error constants (from Dan Libby's specification at
+# http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
+
+# Ranges of errors
+PARSE_ERROR = -32700
+SERVER_ERROR = -32600
+APPLICATION_ERROR = -32500
+SYSTEM_ERROR = -32400
+TRANSPORT_ERROR = -32300
+
+# Specific errors
+NOT_WELLFORMED_ERROR = -32700
+UNSUPPORTED_ENCODING = -32701
+INVALID_ENCODING_CHAR = -32702
+INVALID_XMLRPC = -32600
+METHOD_NOT_FOUND = -32601
+INVALID_METHOD_PARAMS = -32602
+INTERNAL_ERROR = -32603
+
+# --------------------------------------------------------------------
+# Exceptions
+
+##
+# Base class for all kinds of client-side errors.
+
+class Error(Exception):
+ """Base class for client errors."""
+ def __str__(self):
+ return repr(self)
+
+##
+# Indicates an HTTP-level protocol error. This is raised by the HTTP
+# transport layer, if the server returns an error code other than 200
+# (OK).
+#
+# @param url The target URL.
+# @param errcode The HTTP error code.
+# @param errmsg The HTTP error message.
+# @param headers The HTTP header dictionary.
+
+class ProtocolError(Error):
+ """Indicates an HTTP protocol error."""
+ def __init__(self, url, errcode, errmsg, headers):
+ Error.__init__(self)
+ self.url = url
+ self.errcode = errcode
+ self.errmsg = errmsg
+ self.headers = headers
+ def __repr__(self):
+ return (
+ "" %
+ (self.url, self.errcode, self.errmsg)
+ )
+
+##
+# Indicates a broken XML-RPC response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response is
+# malformed.
+
+class ResponseError(Error):
+ """Indicates a broken response package."""
+ pass
+
+##
+# Indicates an XML-RPC fault response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response contains
+# a fault string. This exception can also used as a class, to
+# generate a fault XML-RPC message.
+#
+# @param faultCode The XML-RPC fault code.
+# @param faultString The XML-RPC fault string.
+
+class Fault(Error):
+ """Indicates an XML-RPC fault package."""
+ def __init__(self, faultCode, faultString, **extra):
+ Error.__init__(self)
+ self.faultCode = faultCode
+ self.faultString = faultString
+ def __repr__(self):
+ return (
+ "" %
+ (self.faultCode, repr(self.faultString))
+ )
+
+# --------------------------------------------------------------------
+# Special values
+
+##
+# Wrapper for XML-RPC boolean values. Use the xmlrpclib.True and
+# xmlrpclib.False constants, or the xmlrpclib.boolean() function, to
+# generate boolean XML-RPC values.
+#
+# @param value A boolean value. Any true value is interpreted as True,
+# all other values are interpreted as False.
+
+if _bool_is_builtin:
+ boolean = Boolean = bool #@UndefinedVariable
+ # to avoid breaking code which references xmlrpclib.{True,False}
+ True, False = True, False
+else:
+ class Boolean:
+ """Boolean-value wrapper.
+
+ Use True or False to generate a "boolean" XML-RPC value.
+ """
+
+ def __init__(self, value=0):
+ self.value = operator.truth(value)
+
+ def encode(self, out):
+ out.write("%d \n" % self.value)
+
+ def __cmp__(self, other):
+ if isinstance(other, Boolean):
+ other = other.value
+ return cmp(self.value, other)
+
+ def __repr__(self):
+ if self.value:
+ return "" % id(self)
+ else:
+ return "" % id(self)
+
+ def __int__(self):
+ return self.value
+
+ def __nonzero__(self):
+ return self.value
+
+ True, False = Boolean(1), Boolean(0)
+
+ ##
+ # Map true or false value to XML-RPC boolean values.
+ #
+ # @def boolean(value)
+ # @param value A boolean value. Any true value is mapped to True,
+ # all other values are mapped to False.
+ # @return xmlrpclib.True or xmlrpclib.False.
+ # @see Boolean
+ # @see True
+ # @see False
+
+ def boolean(value, _truefalse=(False, True)):
+ """Convert any Python value to XML-RPC 'boolean'."""
+ return _truefalse[operator.truth(value)]
+
+##
+# Wrapper for XML-RPC DateTime values. This converts a time value to
+# the format used by XML-RPC.
+#
+# The value can be given as a string in the format
+# "yyyymmddThh:mm:ss", as a 9-item time tuple (as returned by
+# time.localtime()), or an integer value (as returned by time.time()).
+# The wrapper uses time.localtime() to convert an integer to a time
+# tuple.
+#
+# @param value The time, given as an ISO 8601 string, a time
+# tuple, or a integer time value.
+
+class DateTime:
+ """DateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate 'dateTime.iso8601' XML-RPC
+ value.
+ """
+
+ def __init__(self, value=0):
+ if not isinstance(value, StringType):
+ if datetime and isinstance(value, datetime.datetime):
+ self.value = value.strftime("%Y%m%dT%H:%M:%S")
+ return
+ if datetime and isinstance(value, datetime.date):
+ self.value = value.strftime("%Y%m%dT%H:%M:%S")
+ return
+ if datetime and isinstance(value, datetime.time):
+ today = datetime.datetime.now().strftime("%Y%m%d")
+ self.value = value.strftime(today + "T%H:%M:%S")
+ return
+ if not isinstance(value, (TupleType, time.struct_time)): #@UndefinedVariable
+ if value == 0:
+ value = time.time()
+ value = time.localtime(value)
+ value = time.strftime("%Y%m%dT%H:%M:%S", value)
+ self.value = value
+
+ def __cmp__(self, other):
+ if isinstance(other, DateTime):
+ other = other.value
+ return cmp(self.value, other)
+
+ ##
+ # Get date/time value.
+ #
+ # @return Date/time value, as an ISO 8601 string.
+
+ def __str__(self):
+ return self.value
+
+ def __repr__(self):
+ return "" % (repr(self.value), id(self))
+
+ def decode(self, data):
+ data = str(data)
+ self.value = string.strip(data)
+
+ def encode(self, out):
+ out.write("")
+ out.write(self.value)
+ out.write(" \n")
+
+def _datetime(data):
+ # decode xml element contents into a DateTime structure.
+ value = DateTime()
+ value.decode(data)
+ return value
+
+def _datetime_type(data):
+ t = time.strptime(data, "%Y%m%dT%H:%M:%S") #@UndefinedVariable
+ return datetime.datetime(*tuple(t)[:6])
+
+##
+# Wrapper for binary data. This can be used to transport any kind
+# of binary data over XML-RPC, using BASE64 encoding.
+#
+# @param data An 8-bit string containing arbitrary data.
+
+import base64
+try:
+ import cStringIO as StringIO
+except ImportError:
+ import StringIO
+
+class Binary:
+ """Wrapper for binary data."""
+
+ def __init__(self, data=None):
+ self.data = data
+
+ ##
+ # Get buffer contents.
+ #
+ # @return Buffer contents, as an 8-bit string.
+
+ def __str__(self):
+ return self.data or ""
+
+ def __cmp__(self, other):
+ if isinstance(other, Binary):
+ other = other.data
+ return cmp(self.data, other)
+
+ def decode(self, data):
+ self.data = base64.decodestring(data)
+
+ def encode(self, out):
+ out.write("\n")
+ base64.encode(StringIO.StringIO(self.data), out)
+ out.write(" \n")
+
+def _binary(data):
+ # decode xml element contents into a Binary structure
+ value = Binary()
+ value.decode(data)
+ return value
+
+WRAPPERS = (DateTime, Binary)
+if not _bool_is_builtin:
+ WRAPPERS = WRAPPERS + (Boolean,)
+
+# --------------------------------------------------------------------
+# XML parsers
+
+try:
+ # optional xmlrpclib accelerator
+ import _xmlrpclib #@UnresolvedImport
+ FastParser = _xmlrpclib.Parser
+ FastUnmarshaller = _xmlrpclib.Unmarshaller
+except (AttributeError, ImportError):
+ FastParser = FastUnmarshaller = None
+
+try:
+ import _xmlrpclib #@UnresolvedImport
+ FastMarshaller = _xmlrpclib.Marshaller
+except (AttributeError, ImportError):
+ FastMarshaller = None
+
+#
+# the SGMLOP parser is about 15x faster than Python's builtin
+# XML parser. SGMLOP sources can be downloaded from:
+#
+# http://www.pythonware.com/products/xml/sgmlop.htm
+#
+
+try:
+ import sgmlop
+ if not hasattr(sgmlop, "XMLParser"):
+ raise ImportError()
+except ImportError:
+ SgmlopParser = None # sgmlop accelerator not available
+else:
+ class SgmlopParser:
+ def __init__(self, target):
+
+ # setup callbacks
+ self.finish_starttag = target.start
+ self.finish_endtag = target.end
+ self.handle_data = target.data
+ self.handle_xml = target.xml
+
+ # activate parser
+ self.parser = sgmlop.XMLParser()
+ self.parser.register(self)
+ self.feed = self.parser.feed
+ self.entity = {
+ "amp": "&", "gt": ">", "lt": "<",
+ "apos": "'", "quot": '"'
+ }
+
+ def close(self):
+ try:
+ self.parser.close()
+ finally:
+ self.parser = self.feed = None # nuke circular reference
+
+ def handle_proc(self, tag, attr):
+ m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) #@UndefinedVariable
+ if m:
+ self.handle_xml(m.group(1), 1)
+
+ def handle_entityref(self, entity):
+ # entity
+ try:
+ self.handle_data(self.entity[entity])
+ except KeyError:
+ self.handle_data("&%s;" % entity)
+
+try:
+ from xml.parsers import expat
+ if not hasattr(expat, "ParserCreate"):
+ raise ImportError()
+except ImportError:
+ ExpatParser = None # expat not available
+else:
+ class ExpatParser:
+ # fast expat parser for Python 2.0 and later. this is about
+ # 50% slower than sgmlop, on roundtrip testing
+ def __init__(self, target):
+ self._parser = parser = expat.ParserCreate(None, None)
+ self._target = target
+ parser.StartElementHandler = target.start
+ parser.EndElementHandler = target.end
+ parser.CharacterDataHandler = target.data
+ encoding = None
+ if not parser.returns_unicode:
+ encoding = "utf-8"
+ target.xml(encoding, None)
+
+ def feed(self, data):
+ self._parser.Parse(data, 0)
+
+ def close(self):
+ self._parser.Parse("", 1) # end of data
+ del self._target, self._parser # get rid of circular references
+
+class SlowParser:
+ """Default XML parser (based on xmllib.XMLParser)."""
+ # this is about 10 times slower than sgmlop, on roundtrip
+ # testing.
+ def __init__(self, target):
+ import xmllib # lazy subclassing (!)
+ if xmllib.XMLParser not in SlowParser.__bases__:
+ SlowParser.__bases__ = (xmllib.XMLParser,)
+ self.handle_xml = target.xml
+ self.unknown_starttag = target.start
+ self.handle_data = target.data
+ self.handle_cdata = target.data
+ self.unknown_endtag = target.end
+ try:
+ xmllib.XMLParser.__init__(self, accept_utf8=1)
+ except TypeError:
+ xmllib.XMLParser.__init__(self) # pre-2.0
+
+# --------------------------------------------------------------------
+# XML-RPC marshalling and unmarshalling code
+
+##
+# XML-RPC marshaller.
+#
+# @param encoding Default encoding for 8-bit strings. The default
+# value is None (interpreted as UTF-8).
+# @see dumps
+
+class Marshaller:
+ """Generate an XML-RPC params chunk from a Python data structure.
+
+ Create a Marshaller instance for each set of parameters, and use
+ the "dumps" method to convert your data (represented as a tuple)
+ to an XML-RPC params chunk. To write a fault response, pass a
+ Fault instance instead. You may prefer to use the "dumps" module
+ function for this purpose.
+ """
+
+ # by the way, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, encoding=None, allow_none=0):
+ self.memo = {}
+ self.data = None
+ self.encoding = encoding
+ self.allow_none = allow_none
+
+ dispatch = {}
+
+ def dumps(self, values):
+ out = []
+ write = out.append
+ dump = self.__dump
+ if isinstance(values, Fault):
+ # fault instance
+ write("\n")
+ dump({'faultCode': values.faultCode,
+ 'faultString': values.faultString},
+ write)
+ write(" \n")
+ else:
+ # parameter block
+ # FIXME: the xml-rpc specification allows us to leave out
+ # the entire block if there are no parameters.
+ # however, changing this may break older code (including
+ # old versions of xmlrpclib.py), so this is better left as
+ # is for now. See @XMLRPC3 for more information. /F
+ write("\n")
+ for v in values:
+ write(" \n")
+ dump(v, write)
+ write("\n")
+ write(" \n")
+ result = string.join(out, "")
+ return result
+
+ def __dump(self, value, write):
+ try:
+ f = self.dispatch[type(value)]
+ except KeyError:
+ raise TypeError("cannot marshal %s objects" % type(value))
+ else:
+ f(self, value, write)
+
+ def dump_nil (self, value, write):
+ if not self.allow_none:
+ raise TypeError("cannot marshal None unless allow_none is enabled")
+ write(" ")
+ dispatch[NoneType] = dump_nil
+
+ def dump_int(self, value, write):
+ # in case ints are > 32 bits
+ if value > MAXINT or value < MININT:
+ raise OverflowError("int exceeds XML-RPC limits")
+ write("")
+ write(str(value))
+ write(" \n")
+ dispatch[IntType] = dump_int
+
+ if _bool_is_builtin:
+ def dump_bool(self, value, write):
+ write("")
+ write(value and "1" or "0")
+ write(" \n")
+ dispatch[bool] = dump_bool #@UndefinedVariable
+
+ def dump_long(self, value, write):
+ if value > MAXINT or value < MININT:
+ raise OverflowError("long int exceeds XML-RPC limits")
+ write("")
+ write(str(int(value)))
+ write(" \n")
+ dispatch[LongType] = dump_long
+
+ def dump_double(self, value, write):
+ write("")
+ write(repr(value))
+ write(" \n")
+ dispatch[FloatType] = dump_double
+
+ def dump_string(self, value, write, escape=escape):
+ write("")
+ write(escape(value))
+ write(" \n")
+ dispatch[StringType] = dump_string
+
+ if unicode:
+ def dump_unicode(self, value, write, escape=escape):
+ value = value.encode(self.encoding)
+ write("")
+ write(escape(value))
+ write(" \n")
+ dispatch[UnicodeType] = dump_unicode
+
+ def dump_array(self, value, write):
+ i = id(value)
+ if self.memo.has_key(i):
+ raise TypeError("cannot marshal recursive sequences")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for v in value:
+ dump(v, write)
+ write(" \n")
+ del self.memo[i]
+ dispatch[TupleType] = dump_array
+ dispatch[ListType] = dump_array
+
+ def dump_struct(self, value, write, escape=escape):
+ i = id(value)
+ if self.memo.has_key(i):
+ raise TypeError("cannot marshal recursive dictionaries")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for k, v in value.items():
+ write("\n")
+ if type(k) is not StringType:
+ if unicode and type(k) is UnicodeType:
+ k = k.encode(self.encoding)
+ else:
+ raise TypeError("dictionary key must be string")
+ write("%s \n" % escape(k))
+ dump(v, write)
+ write(" \n")
+ write(" \n")
+ del self.memo[i]
+ dispatch[DictType] = dump_struct
+
+ if datetime:
+ def dump_datetime(self, value, write):
+ write("")
+ write(value.strftime("%Y%m%dT%H:%M:%S"))
+ write(" \n")
+ dispatch[datetime.datetime] = dump_datetime
+
+ def dump_date(self, value, write):
+ write("")
+ write(value.strftime("%Y%m%dT00:00:00"))
+ write(" \n")
+ dispatch[datetime.date] = dump_date
+
+ def dump_time(self, value, write):
+ write("")
+ write(datetime.datetime.now().date().strftime("%Y%m%dT"))
+ write(value.strftime("%H:%M:%S"))
+ write(" \n")
+ dispatch[datetime.time] = dump_time
+
+ def dump_instance(self, value, write):
+ # check for special wrappers
+ if value.__class__ in WRAPPERS:
+ self.write = write
+ value.encode(self)
+ del self.write
+ else:
+ # store instance attributes as a struct (really?)
+ self.dump_struct(value.__dict__, write)
+ dispatch[InstanceType] = dump_instance
+
+##
+# XML-RPC unmarshaller.
+#
+# @see loads
+
+class Unmarshaller:
+ """Unmarshal an XML-RPC response, based on incoming XML event
+ messages (start, data, end). Call close() to get the resulting
+ data structure.
+
+ Note that this reader is fairly tolerant, and gladly accepts bogus
+ XML-RPC data without complaining (but not bogus XML).
+ """
+
+ # and again, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, use_datetime=0):
+ self._type = None
+ self._stack = []
+ self._marks = []
+ self._data = []
+ self._methodname = None
+ self._encoding = "utf-8"
+ self.append = self._stack.append
+ self._use_datetime = use_datetime
+ if use_datetime and not datetime:
+ raise ValueError("the datetime module is not available")
+
+ def close(self):
+ # return response tuple and target method
+ if self._type is None or self._marks:
+ raise ResponseError()
+ if self._type == "fault":
+ raise Fault(**self._stack[0])
+ return tuple(self._stack)
+
+ def getmethodname(self):
+ return self._methodname
+
+ #
+ # event handlers
+
+ def xml(self, encoding, standalone):
+ self._encoding = encoding
+ # FIXME: assert standalone == 1 ???
+
+ def start(self, tag, attrs):
+ # prepare to handle this element
+ if tag == "array" or tag == "struct":
+ self._marks.append(len(self._stack))
+ self._data = []
+ self._value = (tag == "value")
+
+ def data(self, text):
+ self._data.append(text)
+
+ def end(self, tag, join=string.join):
+ # call the appropriate end tag handler
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, join(self._data, ""))
+
+ #
+ # accelerator support
+
+ def end_dispatch(self, tag, data):
+ # dispatch data
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, data)
+
+ #
+ # element decoders
+
+ dispatch = {}
+
+ def end_nil (self, data):
+ self.append(None)
+ self._value = 0
+ dispatch["nil"] = end_nil
+
+ def end_boolean(self, data):
+ if data == "0":
+ self.append(False)
+ elif data == "1":
+ self.append(True)
+ else:
+ raise TypeError("bad boolean value")
+ self._value = 0
+ dispatch["boolean"] = end_boolean
+
+ def end_int(self, data):
+ self.append(int(data))
+ self._value = 0
+ dispatch["i4"] = end_int
+ dispatch["int"] = end_int
+
+ def end_double(self, data):
+ self.append(float(data))
+ self._value = 0
+ dispatch["double"] = end_double
+
+ def end_string(self, data):
+ if self._encoding:
+ data = _decode(data, self._encoding)
+ self.append(_stringify(data))
+ self._value = 0
+ dispatch["string"] = end_string
+ dispatch["name"] = end_string # struct keys are always strings
+
+ def end_array(self, data):
+ mark = self._marks.pop()
+ # map arrays to Python lists
+ self._stack[mark:] = [self._stack[mark:]]
+ self._value = 0
+ dispatch["array"] = end_array
+
+ def end_struct(self, data):
+ mark = self._marks.pop()
+ # map structs to Python dictionaries
+ dict = {}
+ items = self._stack[mark:]
+ for i in range(0, len(items), 2):
+ dict[_stringify(items[i])] = items[i + 1]
+ self._stack[mark:] = [dict]
+ self._value = 0
+ dispatch["struct"] = end_struct
+
+ def end_base64(self, data):
+ value = Binary()
+ value.decode(data)
+ self.append(value)
+ self._value = 0
+ dispatch["base64"] = end_base64
+
+ def end_dateTime(self, data):
+ value = DateTime()
+ value.decode(data)
+ if self._use_datetime:
+ value = _datetime_type(data)
+ self.append(value)
+ dispatch["dateTime.iso8601"] = end_dateTime
+
+ def end_value(self, data):
+ # if we stumble upon a value element with no internal
+ # elements, treat it as a string element
+ if self._value:
+ self.end_string(data)
+ dispatch["value"] = end_value
+
+ def end_params(self, data):
+ self._type = "params"
+ dispatch["params"] = end_params
+
+ def end_fault(self, data):
+ self._type = "fault"
+ dispatch["fault"] = end_fault
+
+ def end_methodName(self, data):
+ if self._encoding:
+ data = _decode(data, self._encoding)
+ self._methodname = data
+ self._type = "methodName" # no params
+ dispatch["methodName"] = end_methodName
+
+## Multicall support
+#
+
+class _MultiCallMethod:
+ # some lesser magic to store calls made to a MultiCall object
+ # for batch execution
+ def __init__(self, call_list, name):
+ self.__call_list = call_list
+ self.__name = name
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ self.__call_list.append((self.__name, args))
+
+class MultiCallIterator:
+ """Iterates over the results of a multicall. Exceptions are
+ thrown in response to xmlrpc faults."""
+
+ def __init__(self, results):
+ self.results = results
+
+ def __getitem__(self, i):
+ item = self.results[i]
+ if type(item) == type({}):
+ raise Fault(item['faultCode'], item['faultString'])
+ elif type(item) == type([]):
+ return item[0]
+ else:
+ raise ValueError("unexpected type in multicall result")
+
+class MultiCall:
+ """server -> a object used to boxcar method calls
+
+ server should be a ServerProxy object.
+
+ Methods can be added to the MultiCall using normal
+ method call syntax e.g.:
+
+ multicall = MultiCall(server_proxy)
+ multicall.add(2,3)
+ multicall.get_address("Guido")
+
+ To execute the multicall, call the MultiCall object e.g.:
+
+ add_result, address = multicall()
+ """
+
+ def __init__(self, server):
+ self.__server = server
+ self.__call_list = []
+
+ def __repr__(self):
+ return "" % id(self)
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, name)
+
+ def __call__(self):
+ marshalled_list = []
+ for name, args in self.__call_list:
+ marshalled_list.append({'methodName' : name, 'params' : args})
+
+ return MultiCallIterator(self.__server.system.multicall(marshalled_list))
+
+# --------------------------------------------------------------------
+# convenience functions
+
+##
+# Create a parser object, and connect it to an unmarshalling instance.
+# This function picks the fastest available XML parser.
+#
+# return A (parser, unmarshaller) tuple.
+
+def getparser(use_datetime=0):
+ """getparser() -> parser, unmarshaller
+
+ Create an instance of the fastest available parser, and attach it
+ to an unmarshalling object. Return both objects.
+ """
+ if use_datetime and not datetime:
+ raise ValueError("the datetime module is not available")
+ if FastParser and FastUnmarshaller:
+ if use_datetime:
+ mkdatetime = _datetime_type
+ else:
+ mkdatetime = _datetime
+ target = FastUnmarshaller(True, False, _binary, mkdatetime, Fault)
+ parser = FastParser(target)
+ else:
+ target = Unmarshaller(use_datetime=use_datetime)
+ if FastParser:
+ parser = FastParser(target)
+ elif SgmlopParser:
+ parser = SgmlopParser(target)
+ elif ExpatParser:
+ parser = ExpatParser(target)
+ else:
+ parser = SlowParser(target)
+ return parser, target
+
+##
+# Convert a Python tuple or a Fault instance to an XML-RPC packet.
+#
+# @def dumps(params, **options)
+# @param params A tuple or Fault instance.
+# @keyparam methodname If given, create a methodCall request for
+# this method name.
+# @keyparam methodresponse If given, create a methodResponse packet.
+# If used with a tuple, the tuple must be a singleton (that is,
+# it must contain exactly one element).
+# @keyparam encoding The packet encoding.
+# @return A string containing marshalled data.
+
+def dumps(params, methodname=None, methodresponse=None, encoding=None,
+ allow_none=0):
+ """data [,options] -> marshalled data
+
+ Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+
+ In addition to the data object, the following options can be given
+ as keyword arguments:
+
+ methodname: the method name for a methodCall packet
+
+ methodresponse: true to create a methodResponse packet.
+ If this option is used with a tuple, the tuple must be
+ a singleton (i.e. it can contain only one element).
+
+ encoding: the packet encoding (default is UTF-8)
+
+ All 8-bit strings in the data structure are assumed to use the
+ packet encoding. Unicode strings are automatically converted,
+ where necessary.
+ """
+
+ assert isinstance(params, TupleType) or isinstance(params, Fault), \
+ "argument must be tuple or Fault instance"
+
+ if isinstance(params, Fault):
+ methodresponse = 1
+ elif methodresponse and isinstance(params, TupleType):
+ assert len(params) == 1, "response tuple must be a singleton"
+
+ if not encoding:
+ encoding = "utf-8"
+
+ if FastMarshaller:
+ m = FastMarshaller(encoding)
+ else:
+ m = Marshaller(encoding, allow_none)
+
+ data = m.dumps(params)
+
+ if encoding != "utf-8":
+ xmlheader = "\n" % str(encoding)
+ else:
+ xmlheader = "\n" # utf-8 is default
+
+ # standard XML-RPC wrappings
+ if methodname:
+ # a method call
+ if not isinstance(methodname, StringType):
+ methodname = methodname.encode(encoding)
+ data = (
+ xmlheader,
+ "\n"
+ "", methodname, " \n",
+ data,
+ " \n"
+ )
+ elif methodresponse:
+ # a method response, or a fault structure
+ data = (
+ xmlheader,
+ "\n",
+ data,
+ " \n"
+ )
+ else:
+ return data # return as is
+ return string.join(data, "")
+
+##
+# Convert an XML-RPC packet to a Python object. If the XML-RPC packet
+# represents a fault condition, this function raises a Fault exception.
+#
+# @param data An XML-RPC packet, given as an 8-bit string.
+# @return A tuple containing the unpacked data, and the method name
+# (None if not present).
+# @see Fault
+
+def loads(data, use_datetime=0):
+ """data -> unmarshalled data, method name
+
+ Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+
+ If the XML-RPC packet represents a fault condition, this function
+ raises a Fault exception.
+ """
+ p, u = getparser(use_datetime=use_datetime)
+ p.feed(data)
+ p.close()
+ return u.close(), u.getmethodname()
+
+
+# --------------------------------------------------------------------
+# request dispatcher
+
+class _Method:
+ # some magic to bind an XML-RPC method to an RPC server.
+ # supports "nested" methods (e.g. examples.getStateName)
+ def __init__(self, send, name):
+ self.__send = send
+ self.__name = name
+ def __getattr__(self, name):
+ return _Method(self.__send, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ return self.__send(self.__name, args)
+
+##
+# Standard transport class for XML-RPC over HTTP.
+#
+# You can create custom transports by subclassing this method, and
+# overriding selected methods.
+
+class Transport:
+ """Handles an HTTP transaction to an XML-RPC server."""
+
+ # client identifier (may be overridden)
+ user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" % __version__
+
+ def __init__(self, use_datetime=0):
+ self._use_datetime = use_datetime
+
+ ##
+ # Send a complete request, and parse the response.
+ #
+ # @param host Target host.
+ # @param handler Target PRC handler.
+ # @param request_body XML-RPC request body.
+ # @param verbose Debugging flag.
+ # @return Parsed response.
+
+ def request(self, host, handler, request_body, verbose=0):
+ # issue XML-RPC request
+
+ h = self.make_connection(host)
+ if verbose:
+ h.set_debuglevel(1)
+
+ self.send_request(h, handler, request_body)
+ self.send_host(h, host)
+ self.send_user_agent(h)
+ self.send_content(h, request_body)
+
+ errcode, errmsg, headers = h.getreply()
+
+ if errcode != 200:
+ raise ProtocolError(
+ host + handler,
+ errcode, errmsg,
+ headers
+ )
+
+ self.verbose = verbose
+
+ try:
+ sock = h._conn.sock
+ except AttributeError:
+ sock = None
+
+ return self._parse_response(h.getfile(), sock)
+
+ ##
+ # Create parser.
+ #
+ # @return A 2-tuple containing a parser and a unmarshaller.
+
+ def getparser(self):
+ # get parser and unmarshaller
+ return getparser(use_datetime=self._use_datetime)
+
+ ##
+ # Get authorization info from host parameter
+ # Host may be a string, or a (host, x509-dict) tuple; if a string,
+ # it is checked for a "user:pw@host" format, and a "Basic
+ # Authentication" header is added if appropriate.
+ #
+ # @param host Host descriptor (URL or (URL, x509 info) tuple).
+ # @return A 3-tuple containing (actual host, extra headers,
+ # x509 info). The header and x509 fields may be None.
+
+ def get_host_info(self, host):
+
+ x509 = {}
+ if isinstance(host, TupleType):
+ host, x509 = host
+
+ import urllib
+ auth, host = urllib.splituser(host)
+
+ if auth:
+ import base64
+ auth = base64.encodestring(urllib.unquote(auth))
+ auth = string.join(string.split(auth), "") # get rid of whitespace
+ extra_headers = [
+ ("Authorization", "Basic " + auth)
+ ]
+ else:
+ extra_headers = None
+
+ return host, extra_headers, x509
+
+ ##
+ # Connect to server.
+ #
+ # @param host Target host.
+ # @return A connection handle.
+
+ def make_connection(self, host):
+ # create a HTTP connection object from a host descriptor
+ import httplib
+ host, extra_headers, x509 = self.get_host_info(host)
+ return httplib.HTTP(host)
+
+ ##
+ # Send request header.
+ #
+ # @param connection Connection handle.
+ # @param handler Target RPC handler.
+ # @param request_body XML-RPC body.
+
+ def send_request(self, connection, handler, request_body):
+ connection.putrequest("POST", handler)
+
+ ##
+ # Send host name.
+ #
+ # @param connection Connection handle.
+ # @param host Host name.
+
+ def send_host(self, connection, host):
+ host, extra_headers, x509 = self.get_host_info(host)
+ connection.putheader("Host", host)
+ if extra_headers:
+ if isinstance(extra_headers, DictType):
+ extra_headers = extra_headers.items()
+ for key, value in extra_headers:
+ connection.putheader(key, value)
+
+ ##
+ # Send user-agent identifier.
+ #
+ # @param connection Connection handle.
+
+ def send_user_agent(self, connection):
+ connection.putheader("User-Agent", self.user_agent)
+
+ ##
+ # Send request body.
+ #
+ # @param connection Connection handle.
+ # @param request_body XML-RPC request body.
+
+ def send_content(self, connection, request_body):
+ connection.putheader("Content-Type", "text/xml")
+ connection.putheader("Content-Length", str(len(request_body)))
+ connection.endheaders()
+ if request_body:
+ connection.send(request_body)
+
+ ##
+ # Parse response.
+ #
+ # @param file Stream.
+ # @return Response tuple and target method.
+
+ def parse_response(self, file):
+ # compatibility interface
+ return self._parse_response(file, None)
+
+ ##
+ # Parse response (alternate interface). This is similar to the
+ # parse_response method, but also provides direct access to the
+ # underlying socket object (where available).
+ #
+ # @param file Stream.
+ # @param sock Socket handle (or None, if the socket object
+ # could not be accessed).
+ # @return Response tuple and target method.
+
+ def _parse_response(self, file, sock):
+ # read response from input file/socket, and parse it
+
+ p, u = self.getparser()
+
+ while 1:
+ if sock:
+ response = sock.recv(1024)
+ else:
+ response = file.read(1024)
+ if not response:
+ break
+ if self.verbose:
+ sys.stdout.write("body: %s\n" % repr(response))
+ p.feed(response)
+
+ file.close()
+ p.close()
+
+ return u.close()
+
+##
+# Standard transport class for XML-RPC over HTTPS.
+
+class SafeTransport(Transport):
+ """Handles an HTTPS transaction to an XML-RPC server."""
+
+ # FIXME: mostly untested
+
+ def make_connection(self, host):
+ # create a HTTPS connection object from a host descriptor
+ # host may be a string, or a (host, x509-dict) tuple
+ import httplib
+ host, extra_headers, x509 = self.get_host_info(host)
+ try:
+ HTTPS = httplib.HTTPS
+ except AttributeError:
+ raise NotImplementedError(
+ "your version of httplib doesn't support HTTPS"
+ )
+ else:
+ return HTTPS(host, None, **(x509 or {}))
+
+##
+# Standard server proxy. This class establishes a virtual connection
+# to an XML-RPC server.
+#
+# This class is available as ServerProxy and Server. New code should
+# use ServerProxy, to avoid confusion.
+#
+# @def ServerProxy(uri, **options)
+# @param uri The connection point on the server.
+# @keyparam transport A transport factory, compatible with the
+# standard transport class.
+# @keyparam encoding The default encoding used for 8-bit strings
+# (default is UTF-8).
+# @keyparam verbose Use a true value to enable debugging output.
+# (printed to standard output).
+# @see Transport
+
+class ServerProxy:
+ """uri [,options] -> a logical connection to an XML-RPC server
+
+ uri is the connection point on the server, given as
+ scheme://host/target.
+
+ The standard implementation always supports the "http" scheme. If
+ SSL socket support is available (Python 2.0), it also supports
+ "https".
+
+ If the target part and the slash preceding it are both omitted,
+ "/RPC2" is assumed.
+
+ The following options can be given as keyword arguments:
+
+ transport: a transport factory
+ encoding: the request encoding (default is UTF-8)
+
+ All 8-bit strings passed to the server proxy are assumed to use
+ the given encoding.
+ """
+
+ def __init__(self, uri, transport=None, encoding=None, verbose=0,
+ allow_none=0, use_datetime=0):
+ # establish a "logical" server connection
+
+ # get the url
+ import urllib
+ type, uri = urllib.splittype(uri)
+ if type not in ("http", "https"):
+ raise IOError("unsupported XML-RPC protocol")
+ self.__host, self.__handler = urllib.splithost(uri)
+ if not self.__handler:
+ self.__handler = "/RPC2"
+
+ if transport is None:
+ if type == "https":
+ transport = SafeTransport(use_datetime=use_datetime)
+ else:
+ transport = Transport(use_datetime=use_datetime)
+ self.__transport = transport
+
+ self.__encoding = encoding
+ self.__verbose = verbose
+ self.__allow_none = allow_none
+
+ def __request(self, methodname, params):
+ # call a method on the remote server
+
+ request = dumps(params, methodname, encoding=self.__encoding,
+ allow_none=self.__allow_none)
+
+ response = self.__transport.request(
+ self.__host,
+ self.__handler,
+ request,
+ verbose=self.__verbose
+ )
+
+ if len(response) == 1:
+ response = response[0]
+
+ return response
+
+ def __repr__(self):
+ return (
+ "" %
+ (self.__host, self.__handler)
+ )
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ # magic method dispatcher
+ return _Method(self.__request, name)
+
+ # note: to call a remote object with an non-standard name, use
+ # result getattr(server, "strange-python-name")(args)
+
+# compatibility
+
+Server = ServerProxy
+
+# --------------------------------------------------------------------
+# test code
+
+if __name__ == "__main__":
+
+ # simple test program (from the XML-RPC specification)
+
+ # server = ServerProxy("http://localhost:8000") # local server
+ server = ServerProxy("http://time.xmlrpc.com/RPC2")
+
+ sys.stdout.write('%s\n' % server)
+
+ try:
+ sys.stdout.write('%s\n' % (server.currentTime.getCurrentTime(),))
+ except Error:
+ import traceback;traceback.print_exc()
+
+ multi = MultiCall(server)
+ multi.currentTime.getCurrentTime()
+ multi.currentTime.getCurrentTime()
+ try:
+ for response in multi():
+ sys.stdout.write('%s\n' % (response,))
+ except Error:
+ import traceback;traceback.print_exc()
diff --git a/ptvsd/pydevd/_pydev_runfiles/__init__.py b/ptvsd/pydevd/_pydev_runfiles/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles.py
new file mode 100644
index 00000000..66e646d3
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles.py
@@ -0,0 +1,874 @@
+from __future__ import nested_scopes
+
+import fnmatch
+import os.path
+from _pydev_runfiles.pydev_runfiles_coverage import start_coverage_support
+from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
+import re
+import time
+
+
+#=======================================================================================================================
+# Configuration
+#=======================================================================================================================
+class Configuration:
+
+ def __init__(
+ self,
+ files_or_dirs='',
+ verbosity=2,
+ include_tests=None,
+ tests=None,
+ port=None,
+ files_to_tests=None,
+ jobs=1,
+ split_jobs='tests',
+ coverage_output_dir=None,
+ coverage_include=None,
+ coverage_output_file=None,
+ exclude_files=None,
+ exclude_tests=None,
+ include_files=None,
+ django=False,
+ ):
+ self.files_or_dirs = files_or_dirs
+ self.verbosity = verbosity
+ self.include_tests = include_tests
+ self.tests = tests
+ self.port = port
+ self.files_to_tests = files_to_tests
+ self.jobs = jobs
+ self.split_jobs = split_jobs
+ self.django = django
+
+ if include_tests:
+ assert isinstance(include_tests, (list, tuple))
+
+ if exclude_files:
+ assert isinstance(exclude_files, (list, tuple))
+
+ if exclude_tests:
+ assert isinstance(exclude_tests, (list, tuple))
+
+ self.exclude_files = exclude_files
+ self.include_files = include_files
+ self.exclude_tests = exclude_tests
+
+ self.coverage_output_dir = coverage_output_dir
+ self.coverage_include = coverage_include
+ self.coverage_output_file = coverage_output_file
+
+ def __str__(self):
+ return '''Configuration
+ - files_or_dirs: %s
+ - verbosity: %s
+ - tests: %s
+ - port: %s
+ - files_to_tests: %s
+ - jobs: %s
+ - split_jobs: %s
+
+ - include_files: %s
+ - include_tests: %s
+
+ - exclude_files: %s
+ - exclude_tests: %s
+
+ - coverage_output_dir: %s
+ - coverage_include_dir: %s
+ - coverage_output_file: %s
+
+ - django: %s
+''' % (
+ self.files_or_dirs,
+ self.verbosity,
+ self.tests,
+ self.port,
+ self.files_to_tests,
+ self.jobs,
+ self.split_jobs,
+
+ self.include_files,
+ self.include_tests,
+
+ self.exclude_files,
+ self.exclude_tests,
+
+ self.coverage_output_dir,
+ self.coverage_include,
+ self.coverage_output_file,
+
+ self.django,
+ )
+
+
+#=======================================================================================================================
+# parse_cmdline
+#=======================================================================================================================
+def parse_cmdline(argv=None):
+ """
+ Parses command line and returns test directories, verbosity, test filter and test suites
+
+ usage:
+ runfiles.py -v|--verbosity -t|--tests dirs|files
+
+ Multiprocessing options:
+ jobs=number (with the number of jobs to be used to run the tests)
+ split_jobs='module'|'tests'
+ if == module, a given job will always receive all the tests from a module
+ if == tests, the tests will be split independently of their originating module (default)
+
+ --exclude_files = comma-separated list of patterns with files to exclude (fnmatch style)
+ --include_files = comma-separated list of patterns with files to include (fnmatch style)
+ --exclude_tests = comma-separated list of patterns with test names to exclude (fnmatch style)
+
+ Note: if --tests is given, --exclude_files, --include_files and --exclude_tests are ignored!
+ """
+ if argv is None:
+ argv = sys.argv
+
+ verbosity = 2
+ include_tests = None
+ tests = None
+ port = None
+ jobs = 1
+ split_jobs = 'tests'
+ files_to_tests = {}
+ coverage_output_dir = None
+ coverage_include = None
+ exclude_files = None
+ exclude_tests = None
+ include_files = None
+ django = False
+
+ from _pydev_bundle._pydev_getopt import gnu_getopt
+ optlist, dirs = gnu_getopt(
+ argv[1:], "",
+ [
+ "verbosity=",
+ "tests=",
+
+ "port=",
+ "config_file=",
+
+ "jobs=",
+ "split_jobs=",
+
+ "include_tests=",
+ "include_files=",
+
+ "exclude_files=",
+ "exclude_tests=",
+
+ "coverage_output_dir=",
+ "coverage_include=",
+
+ "django="
+ ]
+ )
+
+ for opt, value in optlist:
+ if opt in ("-v", "--verbosity"):
+ verbosity = value
+
+ elif opt in ("-p", "--port"):
+ port = int(value)
+
+ elif opt in ("-j", "--jobs"):
+ jobs = int(value)
+
+ elif opt in ("-s", "--split_jobs"):
+ split_jobs = value
+ if split_jobs not in ('module', 'tests'):
+ raise AssertionError('Expected split to be either "module" or "tests". Was :%s' % (split_jobs,))
+
+ elif opt in ("-d", "--coverage_output_dir",):
+ coverage_output_dir = value.strip()
+
+ elif opt in ("-i", "--coverage_include",):
+ coverage_include = value.strip()
+
+ elif opt in ("-I", "--include_tests"):
+ include_tests = value.split(',')
+
+ elif opt in ("-E", "--exclude_files"):
+ exclude_files = value.split(',')
+
+ elif opt in ("-F", "--include_files"):
+ include_files = value.split(',')
+
+ elif opt in ("-e", "--exclude_tests"):
+ exclude_tests = value.split(',')
+
+ elif opt in ("-t", "--tests"):
+ tests = value.split(',')
+
+ elif opt in ("--django",):
+ django = value.strip() in ['true', 'True', '1']
+
+ elif opt in ("-c", "--config_file"):
+ config_file = value.strip()
+ if os.path.exists(config_file):
+ f = open(config_file, 'rU')
+ try:
+ config_file_contents = f.read()
+ finally:
+ f.close()
+
+ if config_file_contents:
+ config_file_contents = config_file_contents.strip()
+
+ if config_file_contents:
+ for line in config_file_contents.splitlines():
+ file_and_test = line.split('|')
+ if len(file_and_test) == 2:
+ file, test = file_and_test
+ if file in files_to_tests:
+ files_to_tests[file].append(test)
+ else:
+ files_to_tests[file] = [test]
+
+ else:
+ sys.stderr.write('Could not find config file: %s\n' % (config_file,))
+
+ if type([]) != type(dirs):
+ dirs = [dirs]
+
+ ret_dirs = []
+ for d in dirs:
+ if '|' in d:
+ #paths may come from the ide separated by |
+ ret_dirs.extend(d.split('|'))
+ else:
+ ret_dirs.append(d)
+
+ verbosity = int(verbosity)
+
+ if tests:
+ if verbosity > 4:
+ sys.stdout.write('--tests provided. Ignoring --exclude_files, --exclude_tests and --include_files\n')
+ exclude_files = exclude_tests = include_files = None
+
+ config = Configuration(
+ ret_dirs,
+ verbosity,
+ include_tests,
+ tests,
+ port,
+ files_to_tests,
+ jobs,
+ split_jobs,
+ coverage_output_dir,
+ coverage_include,
+ exclude_files=exclude_files,
+ exclude_tests=exclude_tests,
+ include_files=include_files,
+ django=django,
+ )
+
+ if verbosity > 5:
+ sys.stdout.write(str(config) + '\n')
+ return config
+
+
+#=======================================================================================================================
+# PydevTestRunner
+#=======================================================================================================================
+class PydevTestRunner(object):
+ """ finds and runs a file or directory of files as a unit test """
+
+ __py_extensions = ["*.py", "*.pyw"]
+ __exclude_files = ["__init__.*"]
+
+ #Just to check that only this attributes will be written to this file
+ __slots__ = [
+ 'verbosity', #Always used
+
+ 'files_to_tests', #If this one is given, the ones below are not used
+
+ 'files_or_dirs', #Files or directories received in the command line
+ 'include_tests', #The filter used to collect the tests
+ 'tests', #Strings with the tests to be run
+
+ 'jobs', #Integer with the number of jobs that should be used to run the test cases
+ 'split_jobs', #String with 'tests' or 'module' (how should the jobs be split)
+
+ 'configuration',
+ 'coverage',
+ ]
+
+ def __init__(self, configuration):
+ self.verbosity = configuration.verbosity
+
+ self.jobs = configuration.jobs
+ self.split_jobs = configuration.split_jobs
+
+ files_to_tests = configuration.files_to_tests
+ if files_to_tests:
+ self.files_to_tests = files_to_tests
+ self.files_or_dirs = list(files_to_tests.keys())
+ self.tests = None
+ else:
+ self.files_to_tests = {}
+ self.files_or_dirs = configuration.files_or_dirs
+ self.tests = configuration.tests
+
+ self.configuration = configuration
+ self.__adjust_path()
+
+
+ def __adjust_path(self):
+ """ add the current file or directory to the python path """
+ path_to_append = None
+ for n in xrange(len(self.files_or_dirs)):
+ dir_name = self.__unixify(self.files_or_dirs[n])
+ if os.path.isdir(dir_name):
+ if not dir_name.endswith("/"):
+ self.files_or_dirs[n] = dir_name + "/"
+ path_to_append = os.path.normpath(dir_name)
+ elif os.path.isfile(dir_name):
+ path_to_append = os.path.dirname(dir_name)
+ else:
+ if not os.path.exists(dir_name):
+ block_line = '*' * 120
+ sys.stderr.write('\n%s\n* PyDev test runner error: %s does not exist.\n%s\n' % (block_line, dir_name, block_line))
+ return
+ msg = ("unknown type. \n%s\nshould be file or a directory.\n" % (dir_name))
+ raise RuntimeError(msg)
+ if path_to_append is not None:
+ #Add it as the last one (so, first things are resolved against the default dirs and
+ #if none resolves, then we try a relative import).
+ sys.path.append(path_to_append)
+
+ def __is_valid_py_file(self, fname):
+ """ tests that a particular file contains the proper file extension
+ and is not in the list of files to exclude """
+ is_valid_fname = 0
+ for invalid_fname in self.__class__.__exclude_files:
+ is_valid_fname += int(not fnmatch.fnmatch(fname, invalid_fname))
+ if_valid_ext = 0
+ for ext in self.__class__.__py_extensions:
+ if_valid_ext += int(fnmatch.fnmatch(fname, ext))
+ return is_valid_fname > 0 and if_valid_ext > 0
+
+ def __unixify(self, s):
+ """ stupid windows. converts the backslash to forwardslash for consistency """
+ return os.path.normpath(s).replace(os.sep, "/")
+
+ def __importify(self, s, dir=False):
+ """ turns directory separators into dots and removes the ".py*" extension
+ so the string can be used as import statement """
+ if not dir:
+ dirname, fname = os.path.split(s)
+
+ if fname.count('.') > 1:
+ #if there's a file named xxx.xx.py, it is not a valid module, so, let's not load it...
+ return
+
+ imp_stmt_pieces = [dirname.replace("\\", "/").replace("/", "."), os.path.splitext(fname)[0]]
+
+ if len(imp_stmt_pieces[0]) == 0:
+ imp_stmt_pieces = imp_stmt_pieces[1:]
+
+ return ".".join(imp_stmt_pieces)
+
+ else: #handle dir
+ return s.replace("\\", "/").replace("/", ".")
+
+ def __add_files(self, pyfiles, root, files):
+ """ if files match, appends them to pyfiles. used by os.path.walk fcn """
+ for fname in files:
+ if self.__is_valid_py_file(fname):
+ name_without_base_dir = self.__unixify(os.path.join(root, fname))
+ pyfiles.append(name_without_base_dir)
+
+
+ def find_import_files(self):
+ """ return a list of files to import """
+ if self.files_to_tests:
+ pyfiles = self.files_to_tests.keys()
+ else:
+ pyfiles = []
+
+ for base_dir in self.files_or_dirs:
+ if os.path.isdir(base_dir):
+ if hasattr(os, 'walk'):
+ for root, dirs, files in os.walk(base_dir):
+
+ #Note: handling directories that should be excluded from the search because
+ #they don't have __init__.py
+ exclude = {}
+ for d in dirs:
+ for init in ['__init__.py', '__init__.pyo', '__init__.pyc', '__init__.pyw', '__init__$py.class']:
+ if os.path.exists(os.path.join(root, d, init).replace('\\', '/')):
+ break
+ else:
+ exclude[d] = 1
+
+ if exclude:
+ new = []
+ for d in dirs:
+ if d not in exclude:
+ new.append(d)
+
+ dirs[:] = new
+
+ self.__add_files(pyfiles, root, files)
+ else:
+ # jython2.1 is too old for os.walk!
+ os.path.walk(base_dir, self.__add_files, pyfiles)
+
+ elif os.path.isfile(base_dir):
+ pyfiles.append(base_dir)
+
+ if self.configuration.exclude_files or self.configuration.include_files:
+ ret = []
+ for f in pyfiles:
+ add = True
+ basename = os.path.basename(f)
+ if self.configuration.include_files:
+ add = False
+
+ for pat in self.configuration.include_files:
+ if fnmatch.fnmatchcase(basename, pat):
+ add = True
+ break
+
+ if not add:
+ if self.verbosity > 3:
+ sys.stdout.write('Skipped file: %s (did not match any include_files pattern: %s)\n' % (f, self.configuration.include_files))
+
+ elif self.configuration.exclude_files:
+ for pat in self.configuration.exclude_files:
+ if fnmatch.fnmatchcase(basename, pat):
+ if self.verbosity > 3:
+ sys.stdout.write('Skipped file: %s (matched exclude_files pattern: %s)\n' % (f, pat))
+
+ elif self.verbosity > 2:
+ sys.stdout.write('Skipped file: %s\n' % (f,))
+
+ add = False
+ break
+
+ if add:
+ if self.verbosity > 3:
+ sys.stdout.write('Adding file: %s for test discovery.\n' % (f,))
+ ret.append(f)
+
+ pyfiles = ret
+
+
+ return pyfiles
+
+ def __get_module_from_str(self, modname, print_exception, pyfile):
+ """ Import the module in the given import path.
+ * Returns the "final" module, so importing "coilib40.subject.visu"
+ returns the "visu" module, not the "coilib40" as returned by __import__ """
+ try:
+ mod = __import__(modname)
+ for part in modname.split('.')[1:]:
+ mod = getattr(mod, part)
+ return mod
+ except:
+ if print_exception:
+ from _pydev_runfiles import pydev_runfiles_xml_rpc
+ from _pydevd_bundle import pydevd_io
+ buf_err = pydevd_io.start_redirect(keep_original_redirection=True, std='stderr')
+ buf_out = pydevd_io.start_redirect(keep_original_redirection=True, std='stdout')
+ try:
+ import traceback;traceback.print_exc()
+ sys.stderr.write('ERROR: Module: %s could not be imported (file: %s).\n' % (modname, pyfile))
+ finally:
+ pydevd_io.end_redirect('stderr')
+ pydevd_io.end_redirect('stdout')
+
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'error', buf_out.getvalue(), buf_err.getvalue(), pyfile, modname, 0)
+
+ return None
+
+ def remove_duplicates_keeping_order(self, seq):
+ seen = set()
+ seen_add = seen.add
+ return [x for x in seq if not (x in seen or seen_add(x))]
+
+ def find_modules_from_files(self, pyfiles):
+ """ returns a list of modules given a list of files """
+ #let's make sure that the paths we want are in the pythonpath...
+ imports = [(s, self.__importify(s)) for s in pyfiles]
+
+ sys_path = [os.path.normpath(path) for path in sys.path]
+ sys_path = self.remove_duplicates_keeping_order(sys_path)
+
+ system_paths = []
+ for s in sys_path:
+ system_paths.append(self.__importify(s, True))
+
+ ret = []
+ for pyfile, imp in imports:
+ if imp is None:
+ continue #can happen if a file is not a valid module
+ choices = []
+ for s in system_paths:
+ if imp.startswith(s):
+ add = imp[len(s) + 1:]
+ if add:
+ choices.append(add)
+ #sys.stdout.write(' ' + add + ' ')
+
+ if not choices:
+ sys.stdout.write('PYTHONPATH not found for file: %s\n' % imp)
+ else:
+ for i, import_str in enumerate(choices):
+ print_exception = i == len(choices) - 1
+ mod = self.__get_module_from_str(import_str, print_exception, pyfile)
+ if mod is not None:
+ ret.append((pyfile, mod, import_str))
+ break
+
+
+ return ret
+
+ #===================================================================================================================
+ # GetTestCaseNames
+ #===================================================================================================================
+ class GetTestCaseNames:
+ """Yes, we need a class for that (cannot use outer context on jython 2.1)"""
+
+ def __init__(self, accepted_classes, accepted_methods):
+ self.accepted_classes = accepted_classes
+ self.accepted_methods = accepted_methods
+
+ def __call__(self, testCaseClass):
+ """Return a sorted sequence of method names found within testCaseClass"""
+ testFnNames = []
+ className = testCaseClass.__name__
+
+ if className in self.accepted_classes:
+ for attrname in dir(testCaseClass):
+ #If a class is chosen, we select all the 'test' methods'
+ if attrname.startswith('test') and hasattr(getattr(testCaseClass, attrname), '__call__'):
+ testFnNames.append(attrname)
+
+ else:
+ for attrname in dir(testCaseClass):
+ #If we have the class+method name, we must do a full check and have an exact match.
+ if className + '.' + attrname in self.accepted_methods:
+ if hasattr(getattr(testCaseClass, attrname), '__call__'):
+ testFnNames.append(attrname)
+
+ #sorted() is not available in jython 2.1
+ testFnNames.sort()
+ return testFnNames
+
+
+ def _decorate_test_suite(self, suite, pyfile, module_name):
+ import unittest
+ if isinstance(suite, unittest.TestSuite):
+ add = False
+ suite.__pydev_pyfile__ = pyfile
+ suite.__pydev_module_name__ = module_name
+
+ for t in suite._tests:
+ t.__pydev_pyfile__ = pyfile
+ t.__pydev_module_name__ = module_name
+ if self._decorate_test_suite(t, pyfile, module_name):
+ add = True
+
+ return add
+
+ elif isinstance(suite, unittest.TestCase):
+ return True
+
+ else:
+ return False
+
+
+
+ def find_tests_from_modules(self, file_and_modules_and_module_name):
+ """ returns the unittests given a list of modules """
+ #Use our own suite!
+ from _pydev_runfiles import pydev_runfiles_unittest
+ import unittest
+ unittest.TestLoader.suiteClass = pydev_runfiles_unittest.PydevTestSuite
+ loader = unittest.TestLoader()
+
+ ret = []
+ if self.files_to_tests:
+ for pyfile, m, module_name in file_and_modules_and_module_name:
+ accepted_classes = {}
+ accepted_methods = {}
+ tests = self.files_to_tests[pyfile]
+ for t in tests:
+ accepted_methods[t] = t
+
+ loader.getTestCaseNames = self.GetTestCaseNames(accepted_classes, accepted_methods)
+
+ suite = loader.loadTestsFromModule(m)
+ if self._decorate_test_suite(suite, pyfile, module_name):
+ ret.append(suite)
+ return ret
+
+
+ if self.tests:
+ accepted_classes = {}
+ accepted_methods = {}
+
+ for t in self.tests:
+ splitted = t.split('.')
+ if len(splitted) == 1:
+ accepted_classes[t] = t
+
+ elif len(splitted) == 2:
+ accepted_methods[t] = t
+
+ loader.getTestCaseNames = self.GetTestCaseNames(accepted_classes, accepted_methods)
+
+
+ for pyfile, m, module_name in file_and_modules_and_module_name:
+ suite = loader.loadTestsFromModule(m)
+ if self._decorate_test_suite(suite, pyfile, module_name):
+ ret.append(suite)
+
+ return ret
+
+
+ def filter_tests(self, test_objs, internal_call=False):
+ """ based on a filter name, only return those tests that have
+ the test case names that match """
+ import unittest
+ if not internal_call:
+ if not self.configuration.include_tests and not self.tests and not self.configuration.exclude_tests:
+ #No need to filter if we have nothing to filter!
+ return test_objs
+
+ if self.verbosity > 1:
+ if self.configuration.include_tests:
+ sys.stdout.write('Tests to include: %s\n' % (self.configuration.include_tests,))
+
+ if self.tests:
+ sys.stdout.write('Tests to run: %s\n' % (self.tests,))
+
+ if self.configuration.exclude_tests:
+ sys.stdout.write('Tests to exclude: %s\n' % (self.configuration.exclude_tests,))
+
+ test_suite = []
+ for test_obj in test_objs:
+
+ if isinstance(test_obj, unittest.TestSuite):
+ #Note: keep the suites as they are and just 'fix' the tests (so, don't use the iter_tests).
+ if test_obj._tests:
+ test_obj._tests = self.filter_tests(test_obj._tests, True)
+ if test_obj._tests: #Only add the suite if we still have tests there.
+ test_suite.append(test_obj)
+
+ elif isinstance(test_obj, unittest.TestCase):
+ try:
+ testMethodName = test_obj._TestCase__testMethodName
+ except AttributeError:
+ #changed in python 2.5
+ testMethodName = test_obj._testMethodName
+
+ add = True
+ if self.configuration.exclude_tests:
+ for pat in self.configuration.exclude_tests:
+ if fnmatch.fnmatchcase(testMethodName, pat):
+ if self.verbosity > 3:
+ sys.stdout.write('Skipped test: %s (matched exclude_tests pattern: %s)\n' % (testMethodName, pat))
+
+ elif self.verbosity > 2:
+ sys.stdout.write('Skipped test: %s\n' % (testMethodName,))
+
+ add = False
+ break
+
+ if add:
+ if self.__match_tests(self.tests, test_obj, testMethodName):
+ include = True
+ if self.configuration.include_tests:
+ include = False
+ for pat in self.configuration.include_tests:
+ if fnmatch.fnmatchcase(testMethodName, pat):
+ include = True
+ break
+ if include:
+ test_suite.append(test_obj)
+ else:
+ if self.verbosity > 3:
+ sys.stdout.write('Skipped test: %s (did not match any include_tests pattern %s)\n' % (
+ testMethodName, self.configuration.include_tests,))
+ return test_suite
+
+
+ def iter_tests(self, test_objs):
+ #Note: not using yield because of Jython 2.1.
+ import unittest
+ tests = []
+ for test_obj in test_objs:
+ if isinstance(test_obj, unittest.TestSuite):
+ tests.extend(self.iter_tests(test_obj._tests))
+
+ elif isinstance(test_obj, unittest.TestCase):
+ tests.append(test_obj)
+ return tests
+
+
+ def list_test_names(self, test_objs):
+ names = []
+ for tc in self.iter_tests(test_objs):
+ try:
+ testMethodName = tc._TestCase__testMethodName
+ except AttributeError:
+ #changed in python 2.5
+ testMethodName = tc._testMethodName
+ names.append(testMethodName)
+ return names
+
+
+ def __match_tests(self, tests, test_case, test_method_name):
+ if not tests:
+ return 1
+
+ for t in tests:
+ class_and_method = t.split('.')
+ if len(class_and_method) == 1:
+ #only class name
+ if class_and_method[0] == test_case.__class__.__name__:
+ return 1
+
+ elif len(class_and_method) == 2:
+ if class_and_method[0] == test_case.__class__.__name__ and class_and_method[1] == test_method_name:
+ return 1
+
+ return 0
+
+
+ def __match(self, filter_list, name):
+ """ returns whether a test name matches the test filter """
+ if filter_list is None:
+ return 1
+ for f in filter_list:
+ if re.match(f, name):
+ return 1
+ return 0
+
+
+ def run_tests(self, handle_coverage=True):
+ """ runs all tests """
+ sys.stdout.write("Finding files... ")
+ files = self.find_import_files()
+ if self.verbosity > 3:
+ sys.stdout.write('%s ... done.\n' % (self.files_or_dirs))
+ else:
+ sys.stdout.write('done.\n')
+ sys.stdout.write("Importing test modules ... ")
+
+
+ if handle_coverage:
+ coverage_files, coverage = start_coverage_support(self.configuration)
+
+ file_and_modules_and_module_name = self.find_modules_from_files(files)
+ sys.stdout.write("done.\n")
+
+ all_tests = self.find_tests_from_modules(file_and_modules_and_module_name)
+ all_tests = self.filter_tests(all_tests)
+
+ from _pydev_runfiles import pydev_runfiles_unittest
+ test_suite = pydev_runfiles_unittest.PydevTestSuite(all_tests)
+ from _pydev_runfiles import pydev_runfiles_xml_rpc
+ pydev_runfiles_xml_rpc.notifyTestsCollected(test_suite.countTestCases())
+
+ start_time = time.time()
+
+ def run_tests():
+ executed_in_parallel = False
+ if self.jobs > 1:
+ from _pydev_runfiles import pydev_runfiles_parallel
+
+ #What may happen is that the number of jobs needed is lower than the number of jobs requested
+ #(e.g.: 2 jobs were requested for running 1 test) -- in which case execute_tests_in_parallel will
+ #return False and won't run any tests.
+ executed_in_parallel = pydev_runfiles_parallel.execute_tests_in_parallel(
+ all_tests, self.jobs, self.split_jobs, self.verbosity, coverage_files, self.configuration.coverage_include)
+
+ if not executed_in_parallel:
+ #If in coverage, we don't need to pass anything here (coverage is already enabled for this execution).
+ runner = pydev_runfiles_unittest.PydevTextTestRunner(stream=sys.stdout, descriptions=1, verbosity=self.verbosity)
+ sys.stdout.write('\n')
+ runner.run(test_suite)
+
+ if self.configuration.django:
+ get_django_test_suite_runner()(run_tests).run_tests([])
+ else:
+ run_tests()
+
+ if handle_coverage:
+ coverage.stop()
+ coverage.save()
+
+ total_time = 'Finished in: %.2f secs.' % (time.time() - start_time,)
+ pydev_runfiles_xml_rpc.notifyTestRunFinished(total_time)
+
+
+DJANGO_TEST_SUITE_RUNNER = None
+
+def get_django_test_suite_runner():
+ global DJANGO_TEST_SUITE_RUNNER
+ if DJANGO_TEST_SUITE_RUNNER:
+ return DJANGO_TEST_SUITE_RUNNER
+ try:
+ # django >= 1.8
+ import django
+ from django.test.runner import DiscoverRunner
+
+ class MyDjangoTestSuiteRunner(DiscoverRunner):
+
+ def __init__(self, on_run_suite):
+ django.setup()
+ DiscoverRunner.__init__(self)
+ self.on_run_suite = on_run_suite
+
+ def build_suite(self, *args, **kwargs):
+ pass
+
+ def suite_result(self, *args, **kwargs):
+ pass
+
+ def run_suite(self, *args, **kwargs):
+ self.on_run_suite()
+ except:
+ # django < 1.8
+ try:
+ from django.test.simple import DjangoTestSuiteRunner
+ except:
+ class DjangoTestSuiteRunner:
+ def __init__(self):
+ pass
+
+ def run_tests(self, *args, **kwargs):
+ raise AssertionError("Unable to run suite with django.test.runner.DiscoverRunner nor django.test.simple.DjangoTestSuiteRunner because it couldn't be imported.")
+
+ class MyDjangoTestSuiteRunner(DjangoTestSuiteRunner):
+
+ def __init__(self, on_run_suite):
+ DjangoTestSuiteRunner.__init__(self)
+ self.on_run_suite = on_run_suite
+
+ def build_suite(self, *args, **kwargs):
+ pass
+
+ def suite_result(self, *args, **kwargs):
+ pass
+
+ def run_suite(self, *args, **kwargs):
+ self.on_run_suite()
+
+ DJANGO_TEST_SUITE_RUNNER = MyDjangoTestSuiteRunner
+ return DJANGO_TEST_SUITE_RUNNER
+
+
+#=======================================================================================================================
+# main
+#=======================================================================================================================
+def main(configuration):
+ PydevTestRunner(configuration).run_tests()
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py
new file mode 100644
index 00000000..a8359250
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py
@@ -0,0 +1,76 @@
+import os.path
+import sys
+from _pydevd_bundle.pydevd_constants import Null
+
+
+#=======================================================================================================================
+# get_coverage_files
+#=======================================================================================================================
+def get_coverage_files(coverage_output_dir, number_of_files):
+ base_dir = coverage_output_dir
+ ret = []
+ i = 0
+ while len(ret) < number_of_files:
+ while True:
+ f = os.path.join(base_dir, '.coverage.%s' % i)
+ i += 1
+ if not os.path.exists(f):
+ ret.append(f)
+ break #Break only inner for.
+ return ret
+
+
+#=======================================================================================================================
+# start_coverage_support
+#=======================================================================================================================
+def start_coverage_support(configuration):
+ return start_coverage_support_from_params(
+ configuration.coverage_output_dir,
+ configuration.coverage_output_file,
+ configuration.jobs,
+ configuration.coverage_include,
+ )
+
+
+#=======================================================================================================================
+# start_coverage_support_from_params
+#=======================================================================================================================
+def start_coverage_support_from_params(coverage_output_dir, coverage_output_file, jobs, coverage_include):
+ coverage_files = []
+ coverage_instance = Null()
+ if coverage_output_dir or coverage_output_file:
+ try:
+ import coverage #@UnresolvedImport
+ except:
+ sys.stderr.write('Error: coverage module could not be imported\n')
+ sys.stderr.write('Please make sure that the coverage module (http://nedbatchelder.com/code/coverage/)\n')
+ sys.stderr.write('is properly installed in your interpreter: %s\n' % (sys.executable,))
+
+ import traceback;traceback.print_exc()
+ else:
+ if coverage_output_dir:
+ if not os.path.exists(coverage_output_dir):
+ sys.stderr.write('Error: directory for coverage output (%s) does not exist.\n' % (coverage_output_dir,))
+
+ elif not os.path.isdir(coverage_output_dir):
+ sys.stderr.write('Error: expected (%s) to be a directory.\n' % (coverage_output_dir,))
+
+ else:
+ n = jobs
+ if n <= 0:
+ n += 1
+ n += 1 #Add 1 more for the current process (which will do the initial import).
+ coverage_files = get_coverage_files(coverage_output_dir, n)
+ os.environ['COVERAGE_FILE'] = coverage_files.pop(0)
+
+ coverage_instance = coverage.coverage(source=[coverage_include])
+ coverage_instance.start()
+
+ elif coverage_output_file:
+ #Client of parallel run.
+ os.environ['COVERAGE_FILE'] = coverage_output_file
+ coverage_instance = coverage.coverage(source=[coverage_include])
+ coverage_instance.start()
+
+ return coverage_files, coverage_instance
+
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_nose.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_nose.py
new file mode 100644
index 00000000..1cee0ff1
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_nose.py
@@ -0,0 +1,182 @@
+from nose.plugins.multiprocess import MultiProcessTestRunner # @UnresolvedImport
+from nose.plugins.base import Plugin # @UnresolvedImport
+import sys
+from _pydev_runfiles import pydev_runfiles_xml_rpc
+import time
+from _pydev_runfiles.pydev_runfiles_coverage import start_coverage_support
+
+#=======================================================================================================================
+# PydevPlugin
+#=======================================================================================================================
+class PydevPlugin(Plugin):
+
+ def __init__(self, configuration):
+ self.configuration = configuration
+ Plugin.__init__(self)
+
+
+ def begin(self):
+ # Called before any test is run (it's always called, with multiprocess or not)
+ self.start_time = time.time()
+ self.coverage_files, self.coverage = start_coverage_support(self.configuration)
+
+
+ def finalize(self, result):
+ # Called after all tests are run (it's always called, with multiprocess or not)
+ self.coverage.stop()
+ self.coverage.save()
+
+ pydev_runfiles_xml_rpc.notifyTestRunFinished('Finished in: %.2f secs.' % (time.time() - self.start_time,))
+
+
+
+ #===================================================================================================================
+ # Methods below are not called with multiprocess (so, we monkey-patch MultiProcessTestRunner.consolidate
+ # so that they're called, but unfortunately we loose some info -- i.e.: the time for each test in this
+ # process).
+ #===================================================================================================================
+
+
+ def report_cond(self, cond, test, captured_output, error=''):
+ '''
+ @param cond: fail, error, ok
+ '''
+
+ # test.address() is something as:
+ # ('D:\\workspaces\\temp\\test_workspace\\pytesting1\\src\\mod1\\hello.py', 'mod1.hello', 'TestCase.testMet1')
+ #
+ # and we must pass: location, test
+ # E.g.: ['D:\\src\\mod1\\hello.py', 'TestCase.testMet1']
+ try:
+ if hasattr(test, 'address'):
+ address = test.address()
+ address = address[0], address[2]
+ else:
+ # multiprocess
+ try:
+ address = test[0], test[1]
+ except TypeError:
+ # It may be an error at setup, in which case it's not really a test, but a Context object.
+ f = test.context.__file__
+ if f.endswith('.pyc'):
+ f = f[:-1]
+ elif f.endswith('$py.class'):
+ f = f[:-len('$py.class')] + '.py'
+ address = f, '?'
+ except:
+ sys.stderr.write("PyDev: Internal pydev error getting test address. Please report at the pydev bug tracker\n")
+ import traceback;traceback.print_exc()
+ sys.stderr.write("\n\n\n")
+ address = '?', '?'
+
+ error_contents = self.get_io_from_error(error)
+ try:
+ time_str = '%.2f' % (time.time() - test._pydev_start_time)
+ except:
+ time_str = '?'
+
+ pydev_runfiles_xml_rpc.notifyTest(cond, captured_output, error_contents, address[0], address[1], time_str)
+
+
+ def startTest(self, test):
+ test._pydev_start_time = time.time()
+ if hasattr(test, 'address'):
+ address = test.address()
+ file, test = address[0], address[2]
+ else:
+ # multiprocess
+ file, test = test
+ pydev_runfiles_xml_rpc.notifyStartTest(file, test)
+
+
+ def get_io_from_error(self, err):
+ if type(err) == type(()):
+ if len(err) != 3:
+ if len(err) == 2:
+ return err[1] # multiprocess
+ try:
+ from StringIO import StringIO
+ except:
+ from io import StringIO
+ s = StringIO()
+ etype, value, tb = err
+ import traceback;traceback.print_exception(etype, value, tb, file=s)
+ return s.getvalue()
+ return err
+
+
+ def get_captured_output(self, test):
+ if hasattr(test, 'capturedOutput') and test.capturedOutput:
+ return test.capturedOutput
+ return ''
+
+
+ def addError(self, test, err):
+ self.report_cond(
+ 'error',
+ test,
+ self.get_captured_output(test),
+ err,
+ )
+
+
+ def addFailure(self, test, err):
+ self.report_cond(
+ 'fail',
+ test,
+ self.get_captured_output(test),
+ err,
+ )
+
+
+ def addSuccess(self, test):
+ self.report_cond(
+ 'ok',
+ test,
+ self.get_captured_output(test),
+ '',
+ )
+
+
+PYDEV_NOSE_PLUGIN_SINGLETON = None
+def start_pydev_nose_plugin_singleton(configuration):
+ global PYDEV_NOSE_PLUGIN_SINGLETON
+ PYDEV_NOSE_PLUGIN_SINGLETON = PydevPlugin(configuration)
+ return PYDEV_NOSE_PLUGIN_SINGLETON
+
+
+
+
+original = MultiProcessTestRunner.consolidate
+#=======================================================================================================================
+# new_consolidate
+#=======================================================================================================================
+def new_consolidate(self, result, batch_result):
+ '''
+ Used so that it can work with the multiprocess plugin.
+ Monkeypatched because nose seems a bit unsupported at this time (ideally
+ the plugin would have this support by default).
+ '''
+ ret = original(self, result, batch_result)
+
+ parent_frame = sys._getframe().f_back
+ # addr is something as D:\pytesting1\src\mod1\hello.py:TestCase.testMet4
+ # so, convert it to what report_cond expects
+ addr = parent_frame.f_locals['addr']
+ i = addr.rindex(':')
+ addr = [addr[:i], addr[i + 1:]]
+
+ output, testsRun, failures, errors, errorClasses = batch_result
+ if failures or errors:
+ for failure in failures:
+ PYDEV_NOSE_PLUGIN_SINGLETON.report_cond('fail', addr, output, failure)
+
+ for error in errors:
+ PYDEV_NOSE_PLUGIN_SINGLETON.report_cond('error', addr, output, error)
+ else:
+ PYDEV_NOSE_PLUGIN_SINGLETON.report_cond('ok', addr, output)
+
+
+ return ret
+
+MultiProcessTestRunner.consolidate = new_consolidate
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel.py
new file mode 100644
index 00000000..c6f15a2e
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel.py
@@ -0,0 +1,295 @@
+import unittest
+from _pydev_imps._pydev_saved_modules import thread
+try:
+ import Queue
+except:
+ import queue as Queue #@UnresolvedImport
+from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
+from _pydev_runfiles import pydev_runfiles_xml_rpc
+import time
+import os
+
+#=======================================================================================================================
+# flatten_test_suite
+#=======================================================================================================================
+def flatten_test_suite(test_suite, ret):
+ if isinstance(test_suite, unittest.TestSuite):
+ for t in test_suite._tests:
+ flatten_test_suite(t, ret)
+
+ elif isinstance(test_suite, unittest.TestCase):
+ ret.append(test_suite)
+
+
+#=======================================================================================================================
+# execute_tests_in_parallel
+#=======================================================================================================================
+def execute_tests_in_parallel(tests, jobs, split, verbosity, coverage_files, coverage_include):
+ '''
+ @param tests: list(PydevTestSuite)
+ A list with the suites to be run
+
+ @param split: str
+ Either 'module' or the number of tests that should be run in each batch
+
+ @param coverage_files: list(file)
+ A list with the files that should be used for giving coverage information (if empty, coverage information
+ should not be gathered).
+
+ @param coverage_include: str
+ The pattern that should be included in the coverage.
+
+ @return: bool
+ Returns True if the tests were actually executed in parallel. If the tests were not executed because only 1
+ should be used (e.g.: 2 jobs were requested for running 1 test), False will be returned and no tests will be
+ run.
+
+ It may also return False if in debug mode (in which case, multi-processes are not accepted)
+ '''
+ try:
+ from _pydevd_bundle.pydevd_comm import get_global_debugger
+ if get_global_debugger() is not None:
+ return False
+ except:
+ pass #Ignore any error here.
+
+ #This queue will receive the tests to be run. Each entry in a queue is a list with the tests to be run together When
+ #split == 'tests', each list will have a single element, when split == 'module', each list will have all the tests
+ #from a given module.
+ tests_queue = []
+
+ queue_elements = []
+ if split == 'module':
+ module_to_tests = {}
+ for test in tests:
+ lst = []
+ flatten_test_suite(test, lst)
+ for test in lst:
+ key = (test.__pydev_pyfile__, test.__pydev_module_name__)
+ module_to_tests.setdefault(key, []).append(test)
+
+ for key, tests in module_to_tests.items():
+ queue_elements.append(tests)
+
+ if len(queue_elements) < jobs:
+ #Don't create jobs we will never use.
+ jobs = len(queue_elements)
+
+ elif split == 'tests':
+ for test in tests:
+ lst = []
+ flatten_test_suite(test, lst)
+ for test in lst:
+ queue_elements.append([test])
+
+ if len(queue_elements) < jobs:
+ #Don't create jobs we will never use.
+ jobs = len(queue_elements)
+
+ else:
+ raise AssertionError('Do not know how to handle: %s' % (split,))
+
+ for test_cases in queue_elements:
+ test_queue_elements = []
+ for test_case in test_cases:
+ try:
+ test_name = test_case.__class__.__name__+"."+test_case._testMethodName
+ except AttributeError:
+ #Support for jython 2.1 (__testMethodName is pseudo-private in the test case)
+ test_name = test_case.__class__.__name__+"."+test_case._TestCase__testMethodName
+
+ test_queue_elements.append(test_case.__pydev_pyfile__+'|'+test_name)
+
+ tests_queue.append(test_queue_elements)
+
+ if jobs < 2:
+ return False
+
+ sys.stdout.write('Running tests in parallel with: %s jobs.\n' %(jobs,))
+
+
+ queue = Queue.Queue()
+ for item in tests_queue:
+ queue.put(item, block=False)
+
+
+ providers = []
+ clients = []
+ for i in xrange(jobs):
+ test_cases_provider = CommunicationThread(queue)
+ providers.append(test_cases_provider)
+
+ test_cases_provider.start()
+ port = test_cases_provider.port
+
+ if coverage_files:
+ clients.append(ClientThread(i, port, verbosity, coverage_files.pop(0), coverage_include))
+ else:
+ clients.append(ClientThread(i, port, verbosity))
+
+ for client in clients:
+ client.start()
+
+ client_alive = True
+ while client_alive:
+ client_alive = False
+ for client in clients:
+ #Wait for all the clients to exit.
+ if not client.finished:
+ client_alive = True
+ time.sleep(.2)
+ break
+
+ for provider in providers:
+ provider.shutdown()
+
+ return True
+
+
+
+#=======================================================================================================================
+# CommunicationThread
+#=======================================================================================================================
+class CommunicationThread(threading.Thread):
+
+ def __init__(self, tests_queue):
+ threading.Thread.__init__(self)
+ self.setDaemon(True)
+ self.queue = tests_queue
+ self.finished = False
+ from _pydev_bundle.pydev_imports import SimpleXMLRPCServer
+
+
+ # This is a hack to patch slow socket.getfqdn calls that
+ # BaseHTTPServer (and its subclasses) make.
+ # See: http://bugs.python.org/issue6085
+ # See: http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/
+ try:
+ import BaseHTTPServer
+ def _bare_address_string(self):
+ host, port = self.client_address[:2]
+ return '%s' % host
+ BaseHTTPServer.BaseHTTPRequestHandler.address_string = _bare_address_string
+
+ except:
+ pass
+ # End hack.
+
+
+ # Create server
+
+ from _pydev_bundle import pydev_localhost
+ server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), 0), logRequests=False)
+ server.register_function(self.GetTestsToRun)
+ server.register_function(self.notifyStartTest)
+ server.register_function(self.notifyTest)
+ server.register_function(self.notifyCommands)
+ self.port = server.socket.getsockname()[1]
+ self.server = server
+
+
+ def GetTestsToRun(self, job_id):
+ '''
+ @param job_id:
+
+ @return: list(str)
+ Each entry is a string in the format: filename|Test.testName
+ '''
+ try:
+ ret = self.queue.get(block=False)
+ return ret
+ except: #Any exception getting from the queue (empty or not) means we finished our work on providing the tests.
+ self.finished = True
+ return []
+
+
+ def notifyCommands(self, job_id, commands):
+ #Batch notification.
+ for command in commands:
+ getattr(self, command[0])(job_id, *command[1], **command[2])
+
+ return True
+
+ def notifyStartTest(self, job_id, *args, **kwargs):
+ pydev_runfiles_xml_rpc.notifyStartTest(*args, **kwargs)
+ return True
+
+
+ def notifyTest(self, job_id, *args, **kwargs):
+ pydev_runfiles_xml_rpc.notifyTest(*args, **kwargs)
+ return True
+
+ def shutdown(self):
+ if hasattr(self.server, 'shutdown'):
+ self.server.shutdown()
+ else:
+ self._shutdown = True
+
+ def run(self):
+ if hasattr(self.server, 'shutdown'):
+ self.server.serve_forever()
+ else:
+ self._shutdown = False
+ while not self._shutdown:
+ self.server.handle_request()
+
+
+
+#=======================================================================================================================
+# Client
+#=======================================================================================================================
+class ClientThread(threading.Thread):
+
+ def __init__(self, job_id, port, verbosity, coverage_output_file=None, coverage_include=None):
+ threading.Thread.__init__(self)
+ self.setDaemon(True)
+ self.port = port
+ self.job_id = job_id
+ self.verbosity = verbosity
+ self.finished = False
+ self.coverage_output_file = coverage_output_file
+ self.coverage_include = coverage_include
+
+
+ def _reader_thread(self, pipe, target):
+ while True:
+ target.write(pipe.read(1))
+
+
+ def run(self):
+ try:
+ from _pydev_runfiles import pydev_runfiles_parallel_client
+ #TODO: Support Jython:
+ #
+ #For jython, instead of using sys.executable, we should use:
+ #r'D:\bin\jdk_1_5_09\bin\java.exe',
+ #'-classpath',
+ #'D:/bin/jython-2.2.1/jython.jar',
+ #'org.python.util.jython',
+
+ args = [
+ sys.executable,
+ pydev_runfiles_parallel_client.__file__,
+ str(self.job_id),
+ str(self.port),
+ str(self.verbosity),
+ ]
+
+ if self.coverage_output_file and self.coverage_include:
+ args.append(self.coverage_output_file)
+ args.append(self.coverage_include)
+
+ import subprocess
+ if False:
+ proc = subprocess.Popen(args, env=os.environ, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ thread.start_new_thread(self._reader_thread,(proc.stdout, sys.stdout))
+
+ thread.start_new_thread(target=self._reader_thread,args=(proc.stderr, sys.stderr))
+ else:
+ proc = subprocess.Popen(args, env=os.environ, shell=False)
+ proc.wait()
+
+ finally:
+ self.finished = True
+
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py
new file mode 100644
index 00000000..d7dcf04a
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py
@@ -0,0 +1,214 @@
+from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
+from _pydev_bundle.pydev_imports import xmlrpclib, _queue
+Queue = _queue.Queue
+import traceback
+from _pydev_runfiles.pydev_runfiles_coverage import start_coverage_support_from_params
+
+
+
+#=======================================================================================================================
+# ParallelNotification
+#=======================================================================================================================
+class ParallelNotification(object):
+
+ def __init__(self, method, args, kwargs):
+ self.method = method
+ self.args = args
+ self.kwargs = kwargs
+
+ def to_tuple(self):
+ return self.method, self.args, self.kwargs
+
+
+#=======================================================================================================================
+# KillServer
+#=======================================================================================================================
+class KillServer(object):
+ pass
+
+
+
+#=======================================================================================================================
+# ServerComm
+#=======================================================================================================================
+class ServerComm(threading.Thread):
+
+
+
+ def __init__(self, job_id, server):
+ self.notifications_queue = Queue()
+ threading.Thread.__init__(self)
+ self.setDaemon(False) #Wait for all the notifications to be passed before exiting!
+ assert job_id is not None
+ assert port is not None
+ self.job_id = job_id
+
+ self.finished = False
+ self.server = server
+
+
+ def run(self):
+ while True:
+ kill_found = False
+ commands = []
+ command = self.notifications_queue.get(block=True)
+ if isinstance(command, KillServer):
+ kill_found = True
+ else:
+ assert isinstance(command, ParallelNotification)
+ commands.append(command.to_tuple())
+
+ try:
+ while True:
+ command = self.notifications_queue.get(block=False) #No block to create a batch.
+ if isinstance(command, KillServer):
+ kill_found = True
+ else:
+ assert isinstance(command, ParallelNotification)
+ commands.append(command.to_tuple())
+ except:
+ pass #That's OK, we're getting it until it becomes empty so that we notify multiple at once.
+
+
+ if commands:
+ try:
+ #Batch notification.
+ self.server.lock.acquire()
+ try:
+ self.server.notifyCommands(self.job_id, commands)
+ finally:
+ self.server.lock.release()
+ except:
+ traceback.print_exc()
+
+ if kill_found:
+ self.finished = True
+ return
+
+
+
+#=======================================================================================================================
+# ServerFacade
+#=======================================================================================================================
+class ServerFacade(object):
+
+
+ def __init__(self, notifications_queue):
+ self.notifications_queue = notifications_queue
+
+
+ def notifyTestsCollected(self, *args, **kwargs):
+ pass #This notification won't be passed
+
+
+ def notifyTestRunFinished(self, *args, **kwargs):
+ pass #This notification won't be passed
+
+
+ def notifyStartTest(self, *args, **kwargs):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyStartTest', args, kwargs))
+
+
+ def notifyTest(self, *args, **kwargs):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyTest', args, kwargs))
+
+
+
+#=======================================================================================================================
+# run_client
+#=======================================================================================================================
+def run_client(job_id, port, verbosity, coverage_output_file, coverage_include):
+ job_id = int(job_id)
+
+ from _pydev_bundle import pydev_localhost
+ server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), port))
+ server.lock = threading.Lock()
+
+
+ server_comm = ServerComm(job_id, server)
+ server_comm.start()
+
+ try:
+ server_facade = ServerFacade(server_comm.notifications_queue)
+ from _pydev_runfiles import pydev_runfiles
+ from _pydev_runfiles import pydev_runfiles_xml_rpc
+ pydev_runfiles_xml_rpc.set_server(server_facade)
+
+ #Starts None and when the 1st test is gotten, it's started (because a server may be initiated and terminated
+ #before receiving any test -- which would mean a different process got all the tests to run).
+ coverage = None
+
+ try:
+ tests_to_run = [1]
+ while tests_to_run:
+ #Investigate: is it dangerous to use the same xmlrpclib server from different threads?
+ #It seems it should be, as it creates a new connection for each request...
+ server.lock.acquire()
+ try:
+ tests_to_run = server.GetTestsToRun(job_id)
+ finally:
+ server.lock.release()
+
+ if not tests_to_run:
+ break
+
+ if coverage is None:
+ _coverage_files, coverage = start_coverage_support_from_params(
+ None, coverage_output_file, 1, coverage_include)
+
+
+ files_to_tests = {}
+ for test in tests_to_run:
+ filename_and_test = test.split('|')
+ if len(filename_and_test) == 2:
+ files_to_tests.setdefault(filename_and_test[0], []).append(filename_and_test[1])
+
+ configuration = pydev_runfiles.Configuration(
+ '',
+ verbosity,
+ None,
+ None,
+ None,
+ files_to_tests,
+ 1, #Always single job here
+ None,
+
+ #The coverage is handled in this loop.
+ coverage_output_file=None,
+ coverage_include=None,
+ )
+ test_runner = pydev_runfiles.PydevTestRunner(configuration)
+ sys.stdout.flush()
+ test_runner.run_tests(handle_coverage=False)
+ finally:
+ if coverage is not None:
+ coverage.stop()
+ coverage.save()
+
+
+ except:
+ traceback.print_exc()
+ server_comm.notifications_queue.put_nowait(KillServer())
+
+
+
+#=======================================================================================================================
+# main
+#=======================================================================================================================
+if __name__ == '__main__':
+ if len(sys.argv) -1 == 3:
+ job_id, port, verbosity = sys.argv[1:]
+ coverage_output_file, coverage_include = None, None
+
+ elif len(sys.argv) -1 == 5:
+ job_id, port, verbosity, coverage_output_file, coverage_include = sys.argv[1:]
+
+ else:
+ raise AssertionError('Could not find out how to handle the parameters: '+sys.argv[1:])
+
+ job_id = int(job_id)
+ port = int(port)
+ verbosity = int(verbosity)
+ run_client(job_id, port, verbosity, coverage_output_file, coverage_include)
+
+
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py
new file mode 100644
index 00000000..fae814cf
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py
@@ -0,0 +1,278 @@
+from _pydev_runfiles import pydev_runfiles_xml_rpc
+import pickle
+import zlib
+import base64
+import os
+import py
+from pydevd_file_utils import _NormFile
+import pytest
+import sys
+import time
+
+
+#=========================================================================
+# Load filters with tests we should skip
+#=========================================================================
+py_test_accept_filter = None
+
+
+def _load_filters():
+ global py_test_accept_filter
+ if py_test_accept_filter is None:
+ py_test_accept_filter = os.environ.get('PYDEV_PYTEST_SKIP')
+ if py_test_accept_filter:
+ py_test_accept_filter = pickle.loads(
+ zlib.decompress(base64.b64decode(py_test_accept_filter)))
+ else:
+ py_test_accept_filter = {}
+
+
+def is_in_xdist_node():
+ main_pid = os.environ.get('PYDEV_MAIN_PID')
+ if main_pid and main_pid != str(os.getpid()):
+ return True
+ return False
+
+
+connected = False
+def connect_to_server_for_communication_to_xml_rpc_on_xdist():
+ global connected
+ if connected:
+ return
+ connected = True
+ if is_in_xdist_node():
+ port = os.environ.get('PYDEV_PYTEST_SERVER')
+ if not port:
+ sys.stderr.write(
+ 'Error: no PYDEV_PYTEST_SERVER environment variable defined.\n')
+ else:
+ pydev_runfiles_xml_rpc.initialize_server(int(port), daemon=True)
+
+
+PY2 = sys.version_info[0] <= 2
+PY3 = not PY2
+
+
+class State:
+ start_time = time.time()
+ buf_err = None
+ buf_out = None
+
+
+def start_redirect():
+ if State.buf_out is not None:
+ return
+ from _pydevd_bundle import pydevd_io
+ State.buf_err = pydevd_io.start_redirect(keep_original_redirection=True, std='stderr')
+ State.buf_out = pydevd_io.start_redirect(keep_original_redirection=True, std='stdout')
+
+
+def get_curr_output():
+ return State.buf_out.getvalue(), State.buf_err.getvalue()
+
+
+def pytest_unconfigure():
+ if is_in_xdist_node():
+ return
+ # Only report that it finished when on the main node (we don't want to report
+ # the finish on each separate node).
+ pydev_runfiles_xml_rpc.notifyTestRunFinished(
+ 'Finished in: %.2f secs.' % (time.time() - State.start_time,))
+
+
+def pytest_collection_modifyitems(session, config, items):
+ # A note: in xdist, this is not called on the main process, only in the
+ # secondary nodes, so, we'll actually make the filter and report it multiple
+ # times.
+ connect_to_server_for_communication_to_xml_rpc_on_xdist()
+
+ _load_filters()
+ if not py_test_accept_filter:
+ pydev_runfiles_xml_rpc.notifyTestsCollected(len(items))
+ return # Keep on going (nothing to filter)
+
+ new_items = []
+ for item in items:
+ f = _NormFile(str(item.parent.fspath))
+ name = item.name
+
+ if f not in py_test_accept_filter:
+ # print('Skip file: %s' % (f,))
+ continue # Skip the file
+
+ accept_tests = py_test_accept_filter[f]
+
+ if item.cls is not None:
+ class_name = item.cls.__name__
+ else:
+ class_name = None
+ for test in accept_tests:
+ # This happens when parameterizing pytest tests.
+ i = name.find('[')
+ if i > 0:
+ name = name[:i]
+ if test == name:
+ # Direct match of the test (just go on with the default
+ # loading)
+ new_items.append(item)
+ break
+
+ if class_name is not None:
+ if test == class_name + '.' + name:
+ new_items.append(item)
+ break
+
+ if class_name == test:
+ new_items.append(item)
+ break
+ else:
+ pass
+ # print('Skip test: %s.%s. Accept: %s' % (class_name, name, accept_tests))
+
+ # Modify the original list
+ items[:] = new_items
+ pydev_runfiles_xml_rpc.notifyTestsCollected(len(items))
+
+
+from py.io import TerminalWriter
+
+def _get_error_contents_from_report(report):
+ if report.longrepr is not None:
+ tw = TerminalWriter(stringio=True)
+ tw.hasmarkup = False
+ report.toterminal(tw)
+ exc = tw.stringio.getvalue()
+ s = exc.strip()
+ if s:
+ return s
+
+ return ''
+
+def pytest_collectreport(report):
+ error_contents = _get_error_contents_from_report(report)
+ if error_contents:
+ report_test('fail', '', '', '', error_contents, 0.0)
+
+def append_strings(s1, s2):
+ if s1.__class__ == s2.__class__:
+ return s1 + s2
+
+ if sys.version_info[0] == 2:
+ if not isinstance(s1, basestring):
+ s1 = str(s1)
+
+ if not isinstance(s2, basestring):
+ s2 = str(s2)
+
+ # Prefer bytes
+ if isinstance(s1, unicode):
+ s1 = s1.encode('utf-8')
+
+ if isinstance(s2, unicode):
+ s2 = s2.encode('utf-8')
+
+ return s1 + s2
+ else:
+ # Prefer str
+ if isinstance(s1, bytes):
+ s1 = s1.decode('utf-8', 'replace')
+
+ if isinstance(s2, bytes):
+ s2 = s2.decode('utf-8', 'replace')
+
+ return s1 + s2
+
+
+
+def pytest_runtest_logreport(report):
+ if is_in_xdist_node():
+ # When running with xdist, we don't want the report to be called from the node, only
+ # from the main process.
+ return
+ report_duration = report.duration
+ report_when = report.when
+ report_outcome = report.outcome
+
+ if hasattr(report, 'wasxfail'):
+ if report_outcome != 'skipped':
+ report_outcome = 'passed'
+
+ if report_outcome == 'passed':
+ # passed on setup/teardown: no need to report if in setup or teardown
+ # (only on the actual test if it passed).
+ if report_when in ('setup', 'teardown'):
+ return
+
+ status = 'ok'
+
+ elif report_outcome == 'skipped':
+ status = 'skip'
+
+ else:
+ # It has only passed, skipped and failed (no error), so, let's consider
+ # error if not on call.
+ if report_when in ('setup', 'teardown'):
+ status = 'error'
+
+ else:
+ # any error in the call (not in setup or teardown) is considered a
+ # regular failure.
+ status = 'fail'
+
+ # This will work if pytest is not capturing it, if it is, nothing will
+ # come from here...
+ captured_output, error_contents = getattr(report, 'pydev_captured_output', ''), getattr(report, 'pydev_error_contents', '')
+ for type_section, value in report.sections:
+ if value:
+ if type_section in ('err', 'stderr', 'Captured stderr call'):
+ error_contents = append_strings(error_contents, value)
+ else:
+ captured_output = append_strings(error_contents, value)
+
+ filename = getattr(report, 'pydev_fspath_strpath', '')
+ test = report.location[2]
+
+ if report_outcome != 'skipped':
+ # On skipped, we'll have a traceback for the skip, which is not what we
+ # want.
+ exc = _get_error_contents_from_report(report)
+ if exc:
+ if error_contents:
+ error_contents = append_strings(error_contents, '----------------------------- Exceptions -----------------------------\n')
+ error_contents = append_strings(error_contents, exc)
+
+ report_test(status, filename, test, captured_output, error_contents, report_duration)
+
+
+def report_test(status, filename, test, captured_output, error_contents, duration):
+ '''
+ @param filename: 'D:\\src\\mod1\\hello.py'
+ @param test: 'TestCase.testMet1'
+ @param status: fail, error, ok
+ '''
+ time_str = '%.2f' % (duration,)
+ pydev_runfiles_xml_rpc.notifyTest(
+ status, captured_output, error_contents, filename, test, time_str)
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_runtest_makereport(item, call):
+ outcome = yield
+ report = outcome.get_result()
+ report.pydev_fspath_strpath = item.fspath.strpath
+ report.pydev_captured_output, report.pydev_error_contents = get_curr_output()
+
+
+@pytest.mark.tryfirst
+def pytest_runtest_setup(item):
+ '''
+ Note: with xdist will be on a secondary process.
+ '''
+ # We have our own redirection: if xdist does its redirection, we'll have
+ # nothing in our contents (which is OK), but if it does, we'll get nothing
+ # from pytest but will get our own here.
+ start_redirect()
+ filename = item.fspath.strpath
+ test = item.location[2]
+
+ pydev_runfiles_xml_rpc.notifyStartTest(filename, test)
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_unittest.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_unittest.py
new file mode 100644
index 00000000..f0ad9efd
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_unittest.py
@@ -0,0 +1,185 @@
+try:
+ import unittest2 as python_unittest # @UnresolvedImport
+except:
+ import unittest as python_unittest
+
+from _pydev_runfiles import pydev_runfiles_xml_rpc
+import time
+from _pydevd_bundle import pydevd_io
+import traceback
+from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
+
+
+#=======================================================================================================================
+# PydevTextTestRunner
+#=======================================================================================================================
+class PydevTextTestRunner(python_unittest.TextTestRunner):
+
+ def _makeResult(self):
+ return PydevTestResult(self.stream, self.descriptions, self.verbosity)
+
+
+_PythonTextTestResult = python_unittest.TextTestRunner()._makeResult().__class__
+
+#=======================================================================================================================
+# PydevTestResult
+#=======================================================================================================================
+class PydevTestResult(_PythonTextTestResult):
+
+ def addSubTest(self, test, subtest, err):
+ """Called at the end of a subtest.
+ 'err' is None if the subtest ended successfully, otherwise it's a
+ tuple of values as returned by sys.exc_info().
+ """
+ _PythonTextTestResult.addSubTest(self, test, subtest, err)
+ if err is not None:
+ subdesc = subtest._subDescription()
+ error = (test, self._exc_info_to_string(err, test))
+ self._reportErrors([error], [], '', '%s %s' % (self.get_test_name(test), subdesc))
+
+
+ def startTest(self, test):
+ _PythonTextTestResult.startTest(self, test)
+ self.buf = pydevd_io.start_redirect(keep_original_redirection=True, std='both')
+ self.start_time = time.time()
+ self._current_errors_stack = []
+ self._current_failures_stack = []
+
+ try:
+ test_name = test.__class__.__name__+"."+test._testMethodName
+ except AttributeError:
+ #Support for jython 2.1 (__testMethodName is pseudo-private in the test case)
+ test_name = test.__class__.__name__+"."+test._TestCase__testMethodName
+
+ pydev_runfiles_xml_rpc.notifyStartTest(
+ test.__pydev_pyfile__, test_name)
+
+
+
+
+ def get_test_name(self, test):
+ try:
+ try:
+ test_name = test.__class__.__name__ + "." + test._testMethodName
+ except AttributeError:
+ #Support for jython 2.1 (__testMethodName is pseudo-private in the test case)
+ try:
+ test_name = test.__class__.__name__ + "." + test._TestCase__testMethodName
+ #Support for class/module exceptions (test is instance of _ErrorHolder)
+ except:
+ test_name = test.description.split()[1][1:-1] + ' <' + test.description.split()[0] + '>'
+ except:
+ traceback.print_exc()
+ return ''
+ return test_name
+
+
+ def stopTest(self, test):
+ end_time = time.time()
+ pydevd_io.end_redirect(std='both')
+
+ _PythonTextTestResult.stopTest(self, test)
+
+ captured_output = self.buf.getvalue()
+ del self.buf
+ error_contents = ''
+ test_name = self.get_test_name(test)
+
+
+ diff_time = '%.2f' % (end_time - self.start_time)
+ if not self._current_errors_stack and not self._current_failures_stack:
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'ok', captured_output, error_contents, test.__pydev_pyfile__, test_name, diff_time)
+ else:
+ self._reportErrors(self._current_errors_stack, self._current_failures_stack, captured_output, test_name)
+
+
+ def _reportErrors(self, errors, failures, captured_output, test_name, diff_time=''):
+ error_contents = []
+ for test, s in errors+failures:
+ if type(s) == type((1,)): #If it's a tuple (for jython 2.1)
+ sio = StringIO()
+ traceback.print_exception(s[0], s[1], s[2], file=sio)
+ s = sio.getvalue()
+ error_contents.append(s)
+
+ sep = '\n'+self.separator1
+ error_contents = sep.join(error_contents)
+
+ if errors and not failures:
+ try:
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'error', captured_output, error_contents, test.__pydev_pyfile__, test_name, diff_time)
+ except:
+ file_start = error_contents.find('File "')
+ file_end = error_contents.find('", ', file_start)
+ if file_start != -1 and file_end != -1:
+ file = error_contents[file_start+6:file_end]
+ else:
+ file = ''
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'error', captured_output, error_contents, file, test_name, diff_time)
+
+ elif failures and not errors:
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'fail', captured_output, error_contents, test.__pydev_pyfile__, test_name, diff_time)
+
+ else: #Ok, we got both, errors and failures. Let's mark it as an error in the end.
+ pydev_runfiles_xml_rpc.notifyTest(
+ 'error', captured_output, error_contents, test.__pydev_pyfile__, test_name, diff_time)
+
+
+
+ def addError(self, test, err):
+ _PythonTextTestResult.addError(self, test, err)
+ #Support for class/module exceptions (test is instance of _ErrorHolder)
+ if not hasattr(self, '_current_errors_stack') or test.__class__.__name__ == '_ErrorHolder':
+ #Not in start...end, so, report error now (i.e.: django pre/post-setup)
+ self._reportErrors([self.errors[-1]], [], '', self.get_test_name(test))
+ else:
+ self._current_errors_stack.append(self.errors[-1])
+
+
+ def addFailure(self, test, err):
+ _PythonTextTestResult.addFailure(self, test, err)
+ if not hasattr(self, '_current_failures_stack'):
+ #Not in start...end, so, report error now (i.e.: django pre/post-setup)
+ self._reportErrors([], [self.failures[-1]], '', self.get_test_name(test))
+ else:
+ self._current_failures_stack.append(self.failures[-1])
+
+
+try:
+ #Version 2.7 onwards has a different structure... Let's not make any changes in it for now
+ #(waiting for bug: http://bugs.python.org/issue11798)
+ try:
+ from unittest2 import suite
+ except ImportError:
+ from unittest import suite
+ #===================================================================================================================
+ # PydevTestSuite
+ #===================================================================================================================
+ class PydevTestSuite(python_unittest.TestSuite):
+ pass
+
+
+except ImportError:
+
+ #===================================================================================================================
+ # PydevTestSuite
+ #===================================================================================================================
+ class PydevTestSuite(python_unittest.TestSuite):
+
+
+ def run(self, result):
+ for index, test in enumerate(self._tests):
+ if result.shouldStop:
+ break
+ test(result)
+
+ # Let the memory be released!
+ self._tests[index] = None
+
+ return result
+
+
diff --git a/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py
new file mode 100644
index 00000000..256ce215
--- /dev/null
+++ b/ptvsd/pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py
@@ -0,0 +1,281 @@
+import threading
+import traceback
+import warnings
+
+from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
+from _pydev_bundle.pydev_imports import xmlrpclib, _queue
+Queue = _queue.Queue
+from _pydevd_bundle.pydevd_constants import *
+
+#This may happen in IronPython (in Python it shouldn't happen as there are
+#'fast' replacements that are used in xmlrpclib.py)
+warnings.filterwarnings(
+ 'ignore', 'The xmllib module is obsolete.*', DeprecationWarning)
+
+
+file_system_encoding = getfilesystemencoding()
+
+#=======================================================================================================================
+# _ServerHolder
+#=======================================================================================================================
+class _ServerHolder:
+ '''
+ Helper so that we don't have to use a global here.
+ '''
+ SERVER = None
+
+
+#=======================================================================================================================
+# set_server
+#=======================================================================================================================
+def set_server(server):
+ _ServerHolder.SERVER = server
+
+
+
+#=======================================================================================================================
+# ParallelNotification
+#=======================================================================================================================
+class ParallelNotification(object):
+
+ def __init__(self, method, args):
+ self.method = method
+ self.args = args
+
+ def to_tuple(self):
+ return self.method, self.args
+
+
+
+#=======================================================================================================================
+# KillServer
+#=======================================================================================================================
+class KillServer(object):
+ pass
+
+
+#=======================================================================================================================
+# ServerFacade
+#=======================================================================================================================
+class ServerFacade(object):
+
+
+ def __init__(self, notifications_queue):
+ self.notifications_queue = notifications_queue
+
+
+ def notifyTestsCollected(self, *args):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyTestsCollected', args))
+
+ def notifyConnected(self, *args):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyConnected', args))
+
+
+ def notifyTestRunFinished(self, *args):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyTestRunFinished', args))
+
+
+ def notifyStartTest(self, *args):
+ self.notifications_queue.put_nowait(ParallelNotification('notifyStartTest', args))
+
+
+ def notifyTest(self, *args):
+ new_args = []
+ for arg in args:
+ new_args.append(_encode_if_needed(arg))
+ args = tuple(new_args)
+ self.notifications_queue.put_nowait(ParallelNotification('notifyTest', args))
+
+
+
+
+
+#=======================================================================================================================
+# ServerComm
+#=======================================================================================================================
+class ServerComm(threading.Thread):
+
+
+
+ def __init__(self, notifications_queue, port, daemon=False):
+ threading.Thread.__init__(self)
+ self.setDaemon(daemon) # If False, wait for all the notifications to be passed before exiting!
+ self.finished = False
+ self.notifications_queue = notifications_queue
+
+ from _pydev_bundle import pydev_localhost
+
+ # It is necessary to specify an encoding, that matches
+ # the encoding of all bytes-strings passed into an
+ # XMLRPC call: "All 8-bit strings in the data structure are assumed to use the
+ # packet encoding. Unicode strings are automatically converted,
+ # where necessary."
+ # Byte strings most likely come from file names.
+ encoding = file_system_encoding
+ if encoding == "mbcs":
+ # Windos symbolic name for the system encoding CP_ACP.
+ # We need to convert it into a encoding that is recognized by Java.
+ # Unfortunately this is not always possible. You could use
+ # GetCPInfoEx and get a name similar to "windows-1251". Then
+ # you need a table to translate on a best effort basis. Much to complicated.
+ # ISO-8859-1 is good enough.
+ encoding = "ISO-8859-1"
+
+ self.server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), port),
+ encoding=encoding)
+
+
+ def run(self):
+ while True:
+ kill_found = False
+ commands = []
+ command = self.notifications_queue.get(block=True)
+ if isinstance(command, KillServer):
+ kill_found = True
+ else:
+ assert isinstance(command, ParallelNotification)
+ commands.append(command.to_tuple())
+
+ try:
+ while True:
+ command = self.notifications_queue.get(block=False) #No block to create a batch.
+ if isinstance(command, KillServer):
+ kill_found = True
+ else:
+ assert isinstance(command, ParallelNotification)
+ commands.append(command.to_tuple())
+ except:
+ pass #That's OK, we're getting it until it becomes empty so that we notify multiple at once.
+
+
+ if commands:
+ try:
+ self.server.notifyCommands(commands)
+ except:
+ traceback.print_exc()
+
+ if kill_found:
+ self.finished = True
+ return
+
+
+
+#=======================================================================================================================
+# initialize_server
+#=======================================================================================================================
+def initialize_server(port, daemon=False):
+ if _ServerHolder.SERVER is None:
+ if port is not None:
+ notifications_queue = Queue()
+ _ServerHolder.SERVER = ServerFacade(notifications_queue)
+ _ServerHolder.SERVER_COMM = ServerComm(notifications_queue, port, daemon)
+ _ServerHolder.SERVER_COMM.start()
+ else:
+ #Create a null server, so that we keep the interface even without any connection.
+ _ServerHolder.SERVER = Null()
+ _ServerHolder.SERVER_COMM = Null()
+
+ try:
+ _ServerHolder.SERVER.notifyConnected()
+ except:
+ traceback.print_exc()
+
+
+
+#=======================================================================================================================
+# notifyTest
+#=======================================================================================================================
+def notifyTestsCollected(tests_count):
+ assert tests_count is not None
+ try:
+ _ServerHolder.SERVER.notifyTestsCollected(tests_count)
+ except:
+ traceback.print_exc()
+
+
+#=======================================================================================================================
+# notifyStartTest
+#=======================================================================================================================
+def notifyStartTest(file, test):
+ '''
+ @param file: the tests file (c:/temp/test.py)
+ @param test: the test ran (i.e.: TestCase.test1)
+ '''
+ assert file is not None
+ if test is None:
+ test = '' #Could happen if we have an import error importing module.
+
+ try:
+ _ServerHolder.SERVER.notifyStartTest(file, test)
+ except:
+ traceback.print_exc()
+
+
+def _encode_if_needed(obj):
+ # In the java side we expect strings to be ISO-8859-1 (org.python.pydev.debug.pyunit.PyUnitServer.initializeDispatches().new Dispatch() {...}.getAsStr(Object))
+ if not IS_PY3K:
+ if isinstance(obj, str):
+ try:
+ return xmlrpclib.Binary(obj.decode(sys.stdin.encoding).encode('ISO-8859-1', 'xmlcharrefreplace'))
+ except:
+ return xmlrpclib.Binary(obj)
+
+ elif isinstance(obj, unicode):
+ return xmlrpclib.Binary(obj.encode('ISO-8859-1', 'xmlcharrefreplace'))
+
+ else:
+ if isinstance(obj, str): # Unicode in py3
+ return xmlrpclib.Binary(obj.encode('ISO-8859-1', 'xmlcharrefreplace'))
+
+ elif isinstance(obj, bytes):
+ try:
+ return xmlrpclib.Binary(obj.decode(sys.stdin.encoding).encode('ISO-8859-1', 'xmlcharrefreplace'))
+ except:
+ return xmlrpclib.Binary(obj) #bytes already
+
+ return obj
+
+
+#=======================================================================================================================
+# notifyTest
+#=======================================================================================================================
+def notifyTest(cond, captured_output, error_contents, file, test, time):
+ '''
+ @param cond: ok, fail, error
+ @param captured_output: output captured from stdout
+ @param captured_output: output captured from stderr
+ @param file: the tests file (c:/temp/test.py)
+ @param test: the test ran (i.e.: TestCase.test1)
+ @param time: float with the number of seconds elapsed
+ '''
+ assert cond is not None
+ assert captured_output is not None
+ assert error_contents is not None
+ assert file is not None
+ if test is None:
+ test = '' #Could happen if we have an import error importing module.
+ assert time is not None
+ try:
+ captured_output = _encode_if_needed(captured_output)
+ error_contents = _encode_if_needed(error_contents)
+
+ _ServerHolder.SERVER.notifyTest(cond, captured_output, error_contents, file, test, time)
+ except:
+ traceback.print_exc()
+
+#=======================================================================================================================
+# notifyTestRunFinished
+#=======================================================================================================================
+def notifyTestRunFinished(total_time):
+ assert total_time is not None
+ try:
+ _ServerHolder.SERVER.notifyTestRunFinished(total_time)
+ except:
+ traceback.print_exc()
+
+
+#=======================================================================================================================
+# force_server_kill
+#=======================================================================================================================
+def force_server_kill():
+ _ServerHolder.SERVER_COMM.notifications_queue.put_nowait(KillServer())
diff --git a/ptvsd/pydevd/_pydevd_bundle/__init__.py b/ptvsd/pydevd/_pydevd_bundle/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py b/ptvsd/pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py
new file mode 100644
index 00000000..71346ccd
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py
@@ -0,0 +1,513 @@
+"""Utilities needed to emulate Python's interactive interpreter.
+
+"""
+
+# Inspired by similar code by Jeff Epler and Fredrik Lundh.
+
+
+import sys
+import traceback
+
+
+
+
+
+
+
+
+#START --------------------------- from codeop import CommandCompiler, compile_command
+#START --------------------------- from codeop import CommandCompiler, compile_command
+#START --------------------------- from codeop import CommandCompiler, compile_command
+#START --------------------------- from codeop import CommandCompiler, compile_command
+#START --------------------------- from codeop import CommandCompiler, compile_command
+r"""Utilities to compile possibly incomplete Python source code.
+
+This module provides two interfaces, broadly similar to the builtin
+function compile(), which take program text, a filename and a 'mode'
+and:
+
+- Return code object if the command is complete and valid
+- Return None if the command is incomplete
+- Raise SyntaxError, ValueError or OverflowError if the command is a
+ syntax error (OverflowError and ValueError can be produced by
+ malformed literals).
+
+Approach:
+
+First, check if the source consists entirely of blank lines and
+comments; if so, replace it with 'pass', because the built-in
+parser doesn't always do the right thing for these.
+
+Compile three times: as is, with \n, and with \n\n appended. If it
+compiles as is, it's complete. If it compiles with one \n appended,
+we expect more. If it doesn't compile either way, we compare the
+error we get when compiling with \n or \n\n appended. If the errors
+are the same, the code is broken. But if the errors are different, we
+expect more. Not intuitive; not even guaranteed to hold in future
+releases; but this matches the compiler's behavior from Python 1.4
+through 2.2, at least.
+
+Caveat:
+
+It is possible (but not likely) that the parser stops parsing with a
+successful outcome before reaching the end of the source; in this
+case, trailing symbols may be ignored instead of causing an error.
+For example, a backslash followed by two newlines may be followed by
+arbitrary garbage. This will be fixed once the API for the parser is
+better.
+
+The two interfaces are:
+
+compile_command(source, filename, symbol):
+
+ Compiles a single command in the manner described above.
+
+CommandCompiler():
+
+ Instances of this class have __call__ methods identical in
+ signature to compile_command; the difference is that if the
+ instance compiles program text containing a __future__ statement,
+ the instance 'remembers' and compiles all subsequent program texts
+ with the statement in force.
+
+The module also provides another class:
+
+Compile():
+
+ Instances of this class act like the built-in function compile,
+ but with 'memory' in the sense described above.
+"""
+
+import __future__
+
+_features = [getattr(__future__, fname)
+ for fname in __future__.all_feature_names]
+
+__all__ = ["compile_command", "Compile", "CommandCompiler"]
+
+PyCF_DONT_IMPLY_DEDENT = 0x200 # Matches pythonrun.h
+
+def _maybe_compile(compiler, source, filename, symbol):
+ # Check for source consisting of only blank lines and comments
+ for line in source.split("\n"):
+ line = line.strip()
+ if line and line[0] != '#':
+ break # Leave it alone
+ else:
+ if symbol != "eval":
+ source = "pass" # Replace it with a 'pass' statement
+
+ err = err1 = err2 = None
+ code = code1 = code2 = None
+
+ try:
+ code = compiler(source, filename, symbol)
+ except SyntaxError, err:
+ pass
+
+ try:
+ code1 = compiler(source + "\n", filename, symbol)
+ except SyntaxError, err1:
+ pass
+
+ try:
+ code2 = compiler(source + "\n\n", filename, symbol)
+ except SyntaxError, err2:
+ pass
+
+ if code:
+ return code
+ if not code1 and repr(err1) == repr(err2):
+ raise SyntaxError, err1
+
+def _compile(source, filename, symbol):
+ return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)
+
+def compile_command(source, filename=" ", symbol="single"):
+ r"""Compile a command and determine whether it is incomplete.
+
+ Arguments:
+
+ source -- the source string; may contain \n characters
+ filename -- optional filename from which source was read; default
+ " "
+ symbol -- optional grammar start symbol; "single" (default) or "eval"
+
+ Return value / exceptions raised:
+
+ - Return a code object if the command is complete and valid
+ - Return None if the command is incomplete
+ - Raise SyntaxError, ValueError or OverflowError if the command is a
+ syntax error (OverflowError and ValueError can be produced by
+ malformed literals).
+ """
+ return _maybe_compile(_compile, source, filename, symbol)
+
+class Compile:
+ """Instances of this class behave much like the built-in compile
+ function, but if one is used to compile text containing a future
+ statement, it "remembers" and compiles all subsequent program texts
+ with the statement in force."""
+ def __init__(self):
+ self.flags = PyCF_DONT_IMPLY_DEDENT
+
+ def __call__(self, source, filename, symbol):
+ codeob = compile(source, filename, symbol, self.flags, 1)
+ for feature in _features:
+ if codeob.co_flags & feature.compiler_flag:
+ self.flags |= feature.compiler_flag
+ return codeob
+
+class CommandCompiler:
+ """Instances of this class have __call__ methods identical in
+ signature to compile_command; the difference is that if the
+ instance compiles program text containing a __future__ statement,
+ the instance 'remembers' and compiles all subsequent program texts
+ with the statement in force."""
+
+ def __init__(self,):
+ self.compiler = Compile()
+
+ def __call__(self, source, filename=" ", symbol="single"):
+ r"""Compile a command and determine whether it is incomplete.
+
+ Arguments:
+
+ source -- the source string; may contain \n characters
+ filename -- optional filename from which source was read;
+ default " "
+ symbol -- optional grammar start symbol; "single" (default) or
+ "eval"
+
+ Return value / exceptions raised:
+
+ - Return a code object if the command is complete and valid
+ - Return None if the command is incomplete
+ - Raise SyntaxError, ValueError or OverflowError if the command is a
+ syntax error (OverflowError and ValueError can be produced by
+ malformed literals).
+ """
+ return _maybe_compile(self.compiler, source, filename, symbol)
+
+#END --------------------------- from codeop import CommandCompiler, compile_command
+#END --------------------------- from codeop import CommandCompiler, compile_command
+#END --------------------------- from codeop import CommandCompiler, compile_command
+#END --------------------------- from codeop import CommandCompiler, compile_command
+#END --------------------------- from codeop import CommandCompiler, compile_command
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
+ "compile_command"]
+
+def softspace(file, newvalue):
+ oldvalue = 0
+ try:
+ oldvalue = file.softspace
+ except AttributeError:
+ pass
+ try:
+ file.softspace = newvalue
+ except (AttributeError, TypeError):
+ # "attribute-less object" or "read-only attributes"
+ pass
+ return oldvalue
+
+class InteractiveInterpreter:
+ """Base class for InteractiveConsole.
+
+ This class deals with parsing and interpreter state (the user's
+ namespace); it doesn't deal with input buffering or prompting or
+ input file naming (the filename is always passed in explicitly).
+
+ """
+
+ def __init__(self, locals=None):
+ """Constructor.
+
+ The optional 'locals' argument specifies the dictionary in
+ which code will be executed; it defaults to a newly created
+ dictionary with key "__name__" set to "__console__" and key
+ "__doc__" set to None.
+
+ """
+ if locals is None:
+ locals = {"__name__": "__console__", "__doc__": None}
+ self.locals = locals
+ self.compile = CommandCompiler()
+
+ def runsource(self, source, filename=" ", symbol="single"):
+ """Compile and run some source in the interpreter.
+
+ Arguments are as for compile_command().
+
+ One several things can happen:
+
+ 1) The input is incorrect; compile_command() raised an
+ exception (SyntaxError or OverflowError). A syntax traceback
+ will be printed by calling the showsyntaxerror() method.
+
+ 2) The input is incomplete, and more input is required;
+ compile_command() returned None. Nothing happens.
+
+ 3) The input is complete; compile_command() returned a code
+ object. The code is executed by calling self.runcode() (which
+ also handles run-time exceptions, except for SystemExit).
+
+ The return value is True in case 2, False in the other cases (unless
+ an exception is raised). The return value can be used to
+ decide whether to use sys.ps1 or sys.ps2 to prompt the next
+ line.
+
+ """
+ try:
+ code = self.compile(source, filename, symbol)
+ except (OverflowError, SyntaxError, ValueError):
+ # Case 1
+ self.showsyntaxerror(filename)
+ return False
+
+ if code is None:
+ # Case 2
+ return True
+
+ # Case 3
+ self.runcode(code)
+ return False
+
+ def runcode(self, code):
+ """Execute a code object.
+
+ When an exception occurs, self.showtraceback() is called to
+ display a traceback. All exceptions are caught except
+ SystemExit, which is reraised.
+
+ A note about KeyboardInterrupt: this exception may occur
+ elsewhere in this code, and may not always be caught. The
+ caller should be prepared to deal with it.
+
+ """
+ try:
+ exec code in self.locals
+ except SystemExit:
+ raise
+ except:
+ self.showtraceback()
+ else:
+ if softspace(sys.stdout, 0):
+ sys.stdout.write('\n')
+
+ def showsyntaxerror(self, filename=None):
+ """Display the syntax error that just occurred.
+
+ This doesn't display a stack trace because there isn't one.
+
+ If a filename is given, it is stuffed in the exception instead
+ of what was there before (because Python's parser always uses
+ "" when reading from a string).
+
+ The output is written by self.write(), below.
+
+ """
+ type, value, sys.last_traceback = sys.exc_info()
+ sys.last_type = type
+ sys.last_value = value
+ if filename and type is SyntaxError:
+ # Work hard to stuff the correct filename in the exception
+ try:
+ msg, (dummy_filename, lineno, offset, line) = value
+ except:
+ # Not the format we expect; leave it alone
+ pass
+ else:
+ # Stuff in the right filename
+ value = SyntaxError(msg, (filename, lineno, offset, line))
+ sys.last_value = value
+ list = traceback.format_exception_only(type, value)
+ map(self.write, list)
+
+ def showtraceback(self):
+ """Display the exception that just occurred.
+
+ We remove the first stack item because it is our own code.
+
+ The output is written by self.write(), below.
+
+ """
+ try:
+ type, value, tb = sys.exc_info()
+ sys.last_type = type
+ sys.last_value = value
+ sys.last_traceback = tb
+ tblist = traceback.extract_tb(tb)
+ del tblist[:1]
+ list = traceback.format_list(tblist)
+ if list:
+ list.insert(0, "Traceback (most recent call last):\n")
+ list[len(list):] = traceback.format_exception_only(type, value)
+ finally:
+ tblist = tb = None
+ map(self.write, list)
+
+ def write(self, data):
+ """Write a string.
+
+ The base implementation writes to sys.stderr; a subclass may
+ replace this with a different implementation.
+
+ """
+ sys.stderr.write(data)
+
+
+class InteractiveConsole(InteractiveInterpreter):
+ """Closely emulate the behavior of the interactive Python interpreter.
+
+ This class builds on InteractiveInterpreter and adds prompting
+ using the familiar sys.ps1 and sys.ps2, and input buffering.
+
+ """
+
+ def __init__(self, locals=None, filename=""):
+ """Constructor.
+
+ The optional locals argument will be passed to the
+ InteractiveInterpreter base class.
+
+ The optional filename argument should specify the (file)name
+ of the input stream; it will show up in tracebacks.
+
+ """
+ InteractiveInterpreter.__init__(self, locals)
+ self.filename = filename
+ self.resetbuffer()
+
+ def resetbuffer(self):
+ """Reset the input buffer."""
+ self.buffer = []
+
+ def interact(self, banner=None):
+ """Closely emulate the interactive Python console.
+
+ The optional banner argument specify the banner to print
+ before the first interaction; by default it prints a banner
+ similar to the one printed by the real Python interpreter,
+ followed by the current class name in parentheses (so as not
+ to confuse this with the real interpreter -- since it's so
+ close!).
+
+ """
+ try:
+ sys.ps1 #@UndefinedVariable
+ except AttributeError:
+ sys.ps1 = ">>> "
+ try:
+ sys.ps2 #@UndefinedVariable
+ except AttributeError:
+ sys.ps2 = "... "
+ cprt = 'Type "help", "copyright", "credits" or "license" for more information.'
+ if banner is None:
+ self.write("Python %s on %s\n%s\n(%s)\n" %
+ (sys.version, sys.platform, cprt,
+ self.__class__.__name__))
+ else:
+ self.write("%s\n" % str(banner))
+ more = 0
+ while 1:
+ try:
+ if more:
+ prompt = sys.ps2 #@UndefinedVariable
+ else:
+ prompt = sys.ps1 #@UndefinedVariable
+ try:
+ line = self.raw_input(prompt)
+ # Can be None if sys.stdin was redefined
+ encoding = getattr(sys.stdin, "encoding", None)
+ if encoding and not isinstance(line, unicode):
+ line = line.decode(encoding)
+ except EOFError:
+ self.write("\n")
+ break
+ else:
+ more = self.push(line)
+ except KeyboardInterrupt:
+ self.write("\nKeyboardInterrupt\n")
+ self.resetbuffer()
+ more = 0
+
+ def push(self, line):
+ """Push a line to the interpreter.
+
+ The line should not have a trailing newline; it may have
+ internal newlines. The line is appended to a buffer and the
+ interpreter's runsource() method is called with the
+ concatenated contents of the buffer as source. If this
+ indicates that the command was executed or invalid, the buffer
+ is reset; otherwise, the command is incomplete, and the buffer
+ is left as it was after the line was appended. The return
+ value is 1 if more input is required, 0 if the line was dealt
+ with in some way (this is the same as runsource()).
+
+ """
+ self.buffer.append(line)
+ source = "\n".join(self.buffer)
+ more = self.runsource(source, self.filename)
+ if not more:
+ self.resetbuffer()
+ return more
+
+ def raw_input(self, prompt=""):
+ """Write a prompt and read a line.
+
+ The returned line does not include the trailing newline.
+ When the user enters the EOF key sequence, EOFError is raised.
+
+ The base implementation uses the built-in function
+ raw_input(); a subclass may replace this with a different
+ implementation.
+
+ """
+ return raw_input(prompt)
+
+
+def interact(banner=None, readfunc=None, local=None):
+ """Closely emulate the interactive Python interpreter.
+
+ This is a backwards compatible interface to the InteractiveConsole
+ class. When readfunc is not specified, it attempts to import the
+ readline module to enable GNU readline if it is available.
+
+ Arguments (all optional, all default to None):
+
+ banner -- passed to InteractiveConsole.interact()
+ readfunc -- if not None, replaces InteractiveConsole.raw_input()
+ local -- passed to InteractiveInterpreter.__init__()
+
+ """
+ console = InteractiveConsole(local)
+ if readfunc is not None:
+ console.raw_input = readfunc
+ else:
+ try:
+ import readline
+ except ImportError:
+ pass
+ console.interact(banner)
+
+
+if __name__ == '__main__':
+ import pdb
+ pdb.run("interact()\n")
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py
new file mode 100644
index 00000000..1c67795a
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py
@@ -0,0 +1,23 @@
+# Defines which version of the PyDBAdditionalThreadInfo we'll use.
+
+import os
+use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
+
+if use_cython == 'YES':
+ # We must import the cython version if forcing cython
+ from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo # @UnusedImport
+
+elif use_cython == 'NO':
+ # Use the regular version if not forcing cython
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport @Reimport
+
+elif use_cython is None:
+ # Regular: use fallback if not found (message is already given elsewhere).
+ try:
+ from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
+ except ImportError:
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport
+else:
+ raise RuntimeError('Unexpected value for PYDEVD_USE_CYTHON: %s (accepted: YES, NO)' % (use_cython,))
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py
new file mode 100644
index 00000000..796e349b
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py
@@ -0,0 +1,124 @@
+import sys
+from _pydevd_bundle.pydevd_constants import STATE_RUN, PYTHON_SUSPEND, IS_JYTHON, IS_IRONPYTHON
+# IFDEF CYTHON
+# ELSE
+from _pydevd_bundle.pydevd_frame import PyDBFrame
+# ENDIF
+
+version = 4
+
+if not hasattr(sys, '_current_frames'):
+
+ # Some versions of Jython don't have it (but we can provide a replacement)
+ if IS_JYTHON:
+ from java.lang import NoSuchFieldException
+ from org.python.core import ThreadStateMapping
+ try:
+ cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ except NoSuchFieldException:
+ cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ cachedThreadState.accessible = True
+ thread_states = cachedThreadState.get(ThreadStateMapping)
+
+ def _current_frames():
+ as_array = thread_states.entrySet().toArray()
+ ret = {}
+ for thread_to_state in as_array:
+ thread = thread_to_state.getKey()
+ if thread is None:
+ continue
+ thread_state = thread_to_state.getValue()
+ if thread_state is None:
+ continue
+
+ frame = thread_state.frame
+ if frame is None:
+ continue
+
+ ret[thread.getId()] = frame
+ return ret
+
+ elif IS_IRONPYTHON:
+ _tid_to_last_frame = {}
+
+ # IronPython doesn't have it. Let's use our workaround...
+ def _current_frames():
+ return _tid_to_last_frame
+
+ else:
+ raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).')
+else:
+ _current_frames = sys._current_frames
+
+#=======================================================================================================================
+# PyDBAdditionalThreadInfo
+#=======================================================================================================================
+# IFDEF CYTHON
+# cdef class PyDBAdditionalThreadInfo:
+# ELSE
+class PyDBAdditionalThreadInfo(object):
+# ENDIF
+
+ # IFDEF CYTHON
+ # cdef public int pydev_state;
+ # cdef public object pydev_step_stop; # Actually, it's a frame or None
+ # cdef public int pydev_step_cmd;
+ # cdef public bint pydev_notify_kill;
+ # cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ # cdef public bint pydev_django_resolve_frame;
+ # cdef public object pydev_call_from_jinja2;
+ # cdef public object pydev_call_inside_jinja2;
+ # cdef public bint is_tracing;
+ # cdef public tuple conditional_breakpoint_exception;
+ # cdef public str pydev_message;
+ # cdef public int suspend_type;
+ # cdef public int pydev_next_line;
+ # cdef public str pydev_func_name;
+ # ELSE
+ __slots__ = [
+ 'pydev_state',
+ 'pydev_step_stop',
+ 'pydev_step_cmd',
+ 'pydev_notify_kill',
+ 'pydev_smart_step_stop',
+ 'pydev_django_resolve_frame',
+ 'pydev_call_from_jinja2',
+ 'pydev_call_inside_jinja2',
+ 'is_tracing',
+ 'conditional_breakpoint_exception',
+ 'pydev_message',
+ 'suspend_type',
+ 'pydev_next_line',
+ 'pydev_func_name',
+ ]
+ # ENDIF
+
+ def __init__(self):
+ self.pydev_state = STATE_RUN
+ self.pydev_step_stop = None
+ self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ self.pydev_notify_kill = False
+ self.pydev_smart_step_stop = None
+ self.pydev_django_resolve_frame = False
+ self.pydev_call_from_jinja2 = None
+ self.pydev_call_inside_jinja2 = None
+ self.is_tracing = False
+ self.conditional_breakpoint_exception = None
+ self.pydev_message = ''
+ self.suspend_type = PYTHON_SUSPEND
+ self.pydev_next_line = -1
+ self.pydev_func_name = '.invalid.' # Must match the type in cython
+
+
+ def iter_frames(self, t):
+ #sys._current_frames(): dictionary with thread id -> topmost frame
+ current_frames = _current_frames()
+ v = current_frames.get(t.ident)
+ if v is not None:
+ return [v]
+ return []
+
+ def __str__(self):
+ return 'State:%s Stop:%s Cmd: %s Kill:%s' % (
+ self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_breakpoints.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_breakpoints.py
new file mode 100644
index 00000000..2fbdf76b
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_breakpoints.py
@@ -0,0 +1,185 @@
+from _pydevd_bundle.pydevd_constants import dict_iter_values, IS_PY24
+import pydevd_tracing
+import sys
+from _pydev_bundle import pydev_log
+from _pydevd_bundle import pydevd_import_class
+
+_original_excepthook = None
+_handle_exceptions = None
+
+
+from _pydev_imps._pydev_saved_modules import threading
+
+threadingCurrentThread = threading.currentThread
+
+from _pydevd_bundle.pydevd_comm import get_global_debugger
+
+class ExceptionBreakpoint:
+
+ def __init__(
+ self,
+ qname,
+ notify_always,
+ notify_on_terminate,
+ notify_on_first_raise_only,
+ ignore_libraries
+ ):
+ exctype = _get_class(qname)
+ self.qname = qname
+ if exctype is not None:
+ self.name = exctype.__name__
+ else:
+ self.name = None
+
+ self.notify_on_terminate = notify_on_terminate
+ self.notify_always = notify_always
+ self.notify_on_first_raise_only = notify_on_first_raise_only
+ self.ignore_libraries = ignore_libraries
+
+ self.type = exctype
+
+
+ def __str__(self):
+ return self.qname
+
+
+class LineBreakpoint(object):
+ def __init__(self, line, condition, func_name, expression, suspend_policy="NONE"):
+ self.line = line
+ self.condition = condition
+ self.func_name = func_name
+ self.expression = expression
+ self.suspend_policy = suspend_policy
+ # need for frame evaluation: list of code objects, which bytecode was modified by this breakpoint
+ self.code_objects = set()
+
+def get_exception_full_qname(exctype):
+ if not exctype:
+ return None
+ return str(exctype.__module__) + '.' + exctype.__name__
+
+def get_exception_name(exctype):
+ if not exctype:
+ return None
+ return exctype.__name__
+
+
+def get_exception_breakpoint(exctype, exceptions):
+ exception_full_qname = get_exception_full_qname(exctype)
+
+ exc = None
+ if exceptions is not None:
+ try:
+ return exceptions[exception_full_qname]
+ except KeyError:
+ for exception_breakpoint in dict_iter_values(exceptions):
+ if exception_breakpoint.type is not None and issubclass(exctype, exception_breakpoint.type):
+ if exc is None or issubclass(exception_breakpoint.type, exc.type):
+ exc = exception_breakpoint
+ return exc
+
+
+def _set_additional_info_if_needed(thread):
+ try:
+ additional_info = thread.additional_info
+ if additional_info is None:
+ raise AttributeError()
+ except:
+ from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ thread.additional_info = PyDBAdditionalThreadInfo()
+
+
+#=======================================================================================================================
+# _excepthook
+#=======================================================================================================================
+def _excepthook(exctype, value, tb):
+ global _handle_exceptions
+ if _handle_exceptions:
+ exception_breakpoint = get_exception_breakpoint(exctype, _handle_exceptions)
+ else:
+ exception_breakpoint = None
+
+ #Always call the original excepthook before going on to call the debugger post mortem to show it.
+ _original_excepthook(exctype, value, tb)
+
+ if not exception_breakpoint:
+ return
+
+ if tb is None: #sometimes it can be None, e.g. with GTK
+ return
+
+ if exctype is KeyboardInterrupt:
+ return
+
+ frames = []
+ debugger = get_global_debugger()
+ user_frame = None
+
+ while tb:
+ frame = tb.tb_frame
+ if exception_breakpoint.ignore_libraries and not debugger.not_in_scope(frame.f_code.co_filename):
+ user_frame = tb.tb_frame
+ frames.append(tb.tb_frame)
+ tb = tb.tb_next
+
+ thread = threadingCurrentThread()
+ frames_byid = dict([(id(frame),frame) for frame in frames])
+ if exception_breakpoint.ignore_libraries and user_frame is not None:
+ frame = user_frame
+ else:
+ frame = frames[-1]
+ exception = (exctype, value, tb)
+ _set_additional_info_if_needed(thread)
+ try:
+ thread.additional_info.pydev_message = exception_breakpoint.qname
+ except:
+ thread.additional_info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+
+ pydevd_tracing.SetTrace(None) #no tracing from here
+
+ pydev_log.debug('Handling post-mortem stop on exception breakpoint %s' % exception_breakpoint.qname)
+
+ debugger.handle_post_mortem_stop(thread, frame, frames_byid, exception)
+
+#=======================================================================================================================
+# _set_pm_excepthook
+#=======================================================================================================================
+def _set_pm_excepthook(handle_exceptions_dict=None):
+ '''
+ Should be called to register the excepthook to be used.
+
+ It's only useful for uncaught exceptions. I.e.: exceptions that go up to the excepthook.
+
+ @param handle_exceptions: dict(exception -> ExceptionBreakpoint)
+ The exceptions that should be handled.
+ '''
+ global _handle_exceptions
+ global _original_excepthook
+ if sys.excepthook != _excepthook:
+ #Only keep the original if it's not our own _excepthook (if called many times).
+ _original_excepthook = sys.excepthook
+
+ _handle_exceptions = handle_exceptions_dict
+ sys.excepthook = _excepthook
+
+def _restore_pm_excepthook():
+ global _original_excepthook
+ if _original_excepthook:
+ sys.excepthook = _original_excepthook
+ _original_excepthook = None
+
+
+def update_exception_hook(dbg):
+ if dbg.break_on_uncaught_exceptions:
+ _set_pm_excepthook(dbg.break_on_uncaught_exceptions)
+ else:
+ _restore_pm_excepthook()
+
+def _get_class( kls ):
+ if IS_PY24 and "BaseException" == kls:
+ kls = "Exception"
+
+ try:
+ return eval(kls)
+ except:
+ return pydevd_import_class.import_name(kls)
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_comm.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_comm.py
new file mode 100644
index 00000000..3313797a
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_comm.py
@@ -0,0 +1,1441 @@
+''' pydevd - a debugging daemon
+This is the daemon you launch for python remote debugging.
+
+Protocol:
+each command has a format:
+ id\tsequence-num\ttext
+ id: protocol command number
+ sequence-num: each request has a sequence number. Sequence numbers
+ originating at the debugger are odd, sequence numbers originating
+ at the daemon are even. Every response uses the same sequence number
+ as the request.
+ payload: it is protocol dependent. When response is a complex structure, it
+ is returned as XML. Each attribute value is urlencoded, and then the whole
+ payload is urlencoded again to prevent stray characters corrupting protocol/xml encodings
+
+ Commands:
+
+ NUMBER NAME FROM* ARGUMENTS RESPONSE NOTE
+100 series: program execution
+ 101 RUN JAVA - -
+ 102 LIST_THREADS JAVA RETURN with XML listing of all threads
+ 103 THREAD_CREATE PYDB - XML with thread information
+ 104 THREAD_KILL JAVA id (or * to exit) kills the thread
+ PYDB id nofies JAVA that thread was killed
+ 105 THREAD_SUSPEND JAVA XML of the stack, suspends the thread
+ reason for suspension
+ PYDB id notifies JAVA that thread was suspended
+
+ 106 CMD_THREAD_RUN JAVA id resume the thread
+ PYDB id \t reason notifies JAVA that thread was resumed
+
+ 107 STEP_INTO JAVA thread_id
+ 108 STEP_OVER JAVA thread_id
+ 109 STEP_RETURN JAVA thread_id
+
+ 110 GET_VARIABLE JAVA thread_id \t frame_id \t GET_VARIABLE with XML of var content
+ FRAME|GLOBAL \t attributes*
+
+ 111 SET_BREAK JAVA file/line of the breakpoint
+ 112 REMOVE_BREAK JAVA file/line of the return
+ 113 CMD_EVALUATE_EXPRESSION JAVA expression result of evaluating the expression
+ 114 CMD_GET_FRAME JAVA request for frame contents
+ 115 CMD_EXEC_EXPRESSION JAVA
+ 116 CMD_WRITE_TO_CONSOLE PYDB
+ 117 CMD_CHANGE_VARIABLE
+ 118 CMD_RUN_TO_LINE
+ 119 CMD_RELOAD_CODE
+ 120 CMD_GET_COMPLETIONS JAVA
+
+500 series diagnostics/ok
+ 501 VERSION either Version string (1.0) Currently just used at startup
+ 502 RETURN either Depends on caller -
+
+900 series: errors
+ 901 ERROR either - This is reserved for unexpected errors.
+
+ * JAVA - remote debugger, the java end
+ * PYDB - pydevd, the python end
+'''
+
+import os
+
+from _pydev_bundle.pydev_imports import _queue
+from _pydev_imps._pydev_saved_modules import time
+from _pydev_imps._pydev_saved_modules import thread
+from _pydev_imps._pydev_saved_modules import threading
+from _pydev_imps._pydev_saved_modules import socket
+from socket import socket, AF_INET, SOCK_STREAM, SHUT_RD, SHUT_WR, SOL_SOCKET, SO_REUSEADDR, SHUT_RDWR, timeout
+from _pydevd_bundle.pydevd_constants import DebugInfoHolder, get_thread_id, IS_JYTHON, IS_PY2, IS_PY3K, STATE_RUN,\
+ dict_keys
+
+try:
+ from urllib import quote_plus, unquote, unquote_plus
+except:
+ from urllib.parse import quote_plus, unquote, unquote_plus #@Reimport @UnresolvedImport
+import pydevconsole
+from _pydevd_bundle import pydevd_vars
+import pydevd_tracing
+from _pydevd_bundle import pydevd_xml
+from _pydevd_bundle import pydevd_vm_type
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER, norm_file_to_client
+import sys
+import traceback
+from _pydevd_bundle.pydevd_utils import quote_smart as quote, compare_object_attrs_key, to_string
+from _pydev_bundle import pydev_log
+from _pydev_bundle import _pydev_completer
+
+from pydevd_tracing import get_exception_traceback_str
+from _pydevd_bundle import pydevd_console
+from _pydev_bundle.pydev_monkey import disable_trace_thread_modules, enable_trace_thread_modules
+from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+
+
+CMD_RUN = 101
+CMD_LIST_THREADS = 102
+CMD_THREAD_CREATE = 103
+CMD_THREAD_KILL = 104
+CMD_THREAD_SUSPEND = 105
+CMD_THREAD_RUN = 106
+CMD_STEP_INTO = 107
+CMD_STEP_OVER = 108
+CMD_STEP_RETURN = 109
+CMD_GET_VARIABLE = 110
+CMD_SET_BREAK = 111
+CMD_REMOVE_BREAK = 112
+CMD_EVALUATE_EXPRESSION = 113
+CMD_GET_FRAME = 114
+CMD_EXEC_EXPRESSION = 115
+CMD_WRITE_TO_CONSOLE = 116
+CMD_CHANGE_VARIABLE = 117
+CMD_RUN_TO_LINE = 118
+CMD_RELOAD_CODE = 119
+CMD_GET_COMPLETIONS = 120
+
+# Note: renumbered (conflicted on merge)
+CMD_CONSOLE_EXEC = 121
+CMD_ADD_EXCEPTION_BREAK = 122
+CMD_REMOVE_EXCEPTION_BREAK = 123
+CMD_LOAD_SOURCE = 124
+CMD_ADD_DJANGO_EXCEPTION_BREAK = 125
+CMD_REMOVE_DJANGO_EXCEPTION_BREAK = 126
+CMD_SET_NEXT_STATEMENT = 127
+CMD_SMART_STEP_INTO = 128
+CMD_EXIT = 129
+CMD_SIGNATURE_CALL_TRACE = 130
+
+CMD_SET_PY_EXCEPTION = 131
+CMD_GET_FILE_CONTENTS = 132
+CMD_SET_PROPERTY_TRACE = 133
+# Pydev debug console commands
+CMD_EVALUATE_CONSOLE_EXPRESSION = 134
+CMD_RUN_CUSTOM_OPERATION = 135
+CMD_GET_BREAKPOINT_EXCEPTION = 136
+CMD_STEP_CAUGHT_EXCEPTION = 137
+CMD_SEND_CURR_EXCEPTION_TRACE = 138
+CMD_SEND_CURR_EXCEPTION_TRACE_PROCEEDED = 139
+CMD_IGNORE_THROWN_EXCEPTION_AT = 140
+CMD_ENABLE_DONT_TRACE = 141
+CMD_SHOW_CONSOLE = 142
+
+CMD_GET_ARRAY = 143
+CMD_STEP_INTO_MY_CODE = 144
+CMD_GET_CONCURRENCY_EVENT = 145
+CMD_SHOW_RETURN_VALUES = 146
+CMD_INPUT_REQUESTED = 147
+CMD_GET_DESCRIPTION = 148
+
+CMD_PROCESS_CREATED = 149
+
+CMD_VERSION = 501
+CMD_RETURN = 502
+CMD_ERROR = 901
+
+ID_TO_MEANING = {
+ '101': 'CMD_RUN',
+ '102': 'CMD_LIST_THREADS',
+ '103': 'CMD_THREAD_CREATE',
+ '104': 'CMD_THREAD_KILL',
+ '105': 'CMD_THREAD_SUSPEND',
+ '106': 'CMD_THREAD_RUN',
+ '107': 'CMD_STEP_INTO',
+ '108': 'CMD_STEP_OVER',
+ '109': 'CMD_STEP_RETURN',
+ '110': 'CMD_GET_VARIABLE',
+ '111': 'CMD_SET_BREAK',
+ '112': 'CMD_REMOVE_BREAK',
+ '113': 'CMD_EVALUATE_EXPRESSION',
+ '114': 'CMD_GET_FRAME',
+ '115': 'CMD_EXEC_EXPRESSION',
+ '116': 'CMD_WRITE_TO_CONSOLE',
+ '117': 'CMD_CHANGE_VARIABLE',
+ '118': 'CMD_RUN_TO_LINE',
+ '119': 'CMD_RELOAD_CODE',
+ '120': 'CMD_GET_COMPLETIONS',
+ '121': 'CMD_CONSOLE_EXEC',
+ '122': 'CMD_ADD_EXCEPTION_BREAK',
+ '123': 'CMD_REMOVE_EXCEPTION_BREAK',
+ '124': 'CMD_LOAD_SOURCE',
+ '125': 'CMD_ADD_DJANGO_EXCEPTION_BREAK',
+ '126': 'CMD_REMOVE_DJANGO_EXCEPTION_BREAK',
+ '127': 'CMD_SET_NEXT_STATEMENT',
+ '128': 'CMD_SMART_STEP_INTO',
+ '129': 'CMD_EXIT',
+ '130': 'CMD_SIGNATURE_CALL_TRACE',
+
+ '131': 'CMD_SET_PY_EXCEPTION',
+ '132': 'CMD_GET_FILE_CONTENTS',
+ '133': 'CMD_SET_PROPERTY_TRACE',
+ '134': 'CMD_EVALUATE_CONSOLE_EXPRESSION',
+ '135': 'CMD_RUN_CUSTOM_OPERATION',
+ '136': 'CMD_GET_BREAKPOINT_EXCEPTION',
+ '137': 'CMD_STEP_CAUGHT_EXCEPTION',
+ '138': 'CMD_SEND_CURR_EXCEPTION_TRACE',
+ '139': 'CMD_SEND_CURR_EXCEPTION_TRACE_PROCEEDED',
+ '140': 'CMD_IGNORE_THROWN_EXCEPTION_AT',
+ '141': 'CMD_ENABLE_DONT_TRACE',
+ '142': 'CMD_SHOW_CONSOLE',
+ '143': 'CMD_GET_ARRAY',
+ '144': 'CMD_STEP_INTO_MY_CODE',
+ '145': 'CMD_GET_CONCURRENCY_EVENT',
+ '146': 'CMD_SHOW_RETURN_VALUES',
+ '147': 'CMD_INPUT_REQUESTED',
+ '148': 'CMD_GET_DESCRIPTION',
+
+ '149': 'CMD_PROCESS_CREATED',
+
+ '501': 'CMD_VERSION',
+ '502': 'CMD_RETURN',
+ '901': 'CMD_ERROR',
+ }
+
+MAX_IO_MSG_SIZE = 1000 #if the io is too big, we'll not send all (could make the debugger too non-responsive)
+#this number can be changed if there's need to do so
+
+VERSION_STRING = "@@BUILD_NUMBER@@"
+
+from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
+file_system_encoding = getfilesystemencoding()
+
+#--------------------------------------------------------------------------------------------------- UTILITIES
+
+#=======================================================================================================================
+# pydevd_log
+#=======================================================================================================================
+def pydevd_log(level, *args):
+ """ levels are:
+ 0 most serious warnings/errors
+ 1 warnings/significant events
+ 2 informational trace
+ """
+ if level <= DebugInfoHolder.DEBUG_TRACE_LEVEL:
+ #yes, we can have errors printing if the console of the program has been finished (and we're still trying to print something)
+ try:
+ sys.stderr.write('%s\n' % (args,))
+ except:
+ pass
+
+#=======================================================================================================================
+# GlobalDebuggerHolder
+#=======================================================================================================================
+class GlobalDebuggerHolder:
+ '''
+ Holder for the global debugger.
+ '''
+ global_dbg = None # Note: don't rename (the name is used in our attach to process)
+
+#=======================================================================================================================
+# get_global_debugger
+#=======================================================================================================================
+def get_global_debugger():
+ return GlobalDebuggerHolder.global_dbg
+
+GetGlobalDebugger = get_global_debugger # Backward-compatibility
+
+#=======================================================================================================================
+# set_global_debugger
+#=======================================================================================================================
+def set_global_debugger(dbg):
+ GlobalDebuggerHolder.global_dbg = dbg
+
+
+#------------------------------------------------------------------- ACTUAL COMM
+
+#=======================================================================================================================
+# PyDBDaemonThread
+#=======================================================================================================================
+class PyDBDaemonThread(threading.Thread):
+ created_pydb_daemon_threads = {}
+
+ def __init__(self):
+ threading.Thread.__init__(self)
+ self.setDaemon(True)
+ self.killReceived = False
+ self.pydev_do_not_trace = True
+ self.is_pydev_daemon_thread = True
+
+ def run(self):
+ created_pydb_daemon = self.created_pydb_daemon_threads
+ created_pydb_daemon[self] = 1
+ try:
+ try:
+ if IS_JYTHON and not isinstance(threading.currentThread(), threading._MainThread):
+ # we shouldn't update sys.modules for the main thread, cause it leads to the second importing 'threading'
+ # module, and the new instance of main thread is created
+ import org.python.core as PyCore #@UnresolvedImport
+ ss = PyCore.PySystemState()
+ # Note: Py.setSystemState() affects only the current thread.
+ PyCore.Py.setSystemState(ss)
+
+ self._on_run()
+ except:
+ if sys is not None and traceback is not None:
+ traceback.print_exc()
+ finally:
+ del created_pydb_daemon[self]
+
+ def _on_run(self):
+ raise NotImplementedError('Should be reimplemented by: %s' % self.__class__)
+
+ def do_kill_pydev_thread(self):
+ #that was not working very well because jython gave some socket errors
+ self.killReceived = True
+
+ def _stop_trace(self):
+ if self.pydev_do_not_trace:
+
+ disable_tracing = True
+
+ if pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON and sys.hexversion <= 0x020201f0:
+ # don't run untraced threads if we're in jython 2.2.1 or lower
+ # jython bug: if we start a thread and another thread changes the tracing facility
+ # it affects other threads (it's not set only for the thread but globally)
+ # Bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1870039&group_id=12867&atid=112867
+ disable_tracing = False
+
+ if disable_tracing:
+ pydevd_tracing.SetTrace(None) # no debugging on this thread
+
+
+#=======================================================================================================================
+# ReaderThread
+#=======================================================================================================================
+class ReaderThread(PyDBDaemonThread):
+ """ reader thread reads and dispatches commands in an infinite loop """
+
+ def __init__(self, sock):
+ PyDBDaemonThread.__init__(self)
+ self.sock = sock
+ self.setName("pydevd.Reader")
+ from _pydevd_bundle.pydevd_process_net_command import process_net_command
+ self.process_net_command = process_net_command
+ self.global_debugger_holder = GlobalDebuggerHolder
+
+
+
+ def do_kill_pydev_thread(self):
+ #We must close the socket so that it doesn't stay halted there.
+ self.killReceived = True
+ try:
+ self.sock.shutdown(SHUT_RD) #shutdown the socket for read
+ except:
+ #just ignore that
+ pass
+
+ def _on_run(self):
+ self._stop_trace()
+ read_buffer = ""
+ try:
+
+ while not self.killReceived:
+ try:
+ r = self.sock.recv(1024)
+ except:
+ if not self.killReceived:
+ traceback.print_exc()
+ self.handle_except()
+ return #Finished communication.
+
+ #Note: the java backend is always expected to pass utf-8 encoded strings. We now work with unicode
+ #internally and thus, we may need to convert to the actual encoding where needed (i.e.: filenames
+ #on python 2 may need to be converted to the filesystem encoding).
+ if hasattr(r, 'decode'):
+ r = r.decode('utf-8')
+
+ read_buffer += r
+ if DebugInfoHolder.DEBUG_RECORD_SOCKET_READS:
+ sys.stderr.write('debugger: received >>%s<<\n' % (read_buffer,))
+ sys.stderr.flush()
+
+ if len(read_buffer) == 0:
+ self.handle_except()
+ break
+ while read_buffer.find('\n') != -1:
+ command, read_buffer = read_buffer.split('\n', 1)
+
+ args = command.split('\t', 2)
+ try:
+ cmd_id = int(args[0])
+ pydev_log.debug('Received command: %s %s\n' % (ID_TO_MEANING.get(str(cmd_id), '???'), command,))
+ self.process_command(cmd_id, int(args[1]), args[2])
+ except:
+ traceback.print_exc()
+ sys.stderr.write("Can't process net command: %s\n" % command)
+ sys.stderr.flush()
+
+ except:
+ traceback.print_exc()
+ self.handle_except()
+
+
+ def handle_except(self):
+ self.global_debugger_holder.global_dbg.finish_debugging_session()
+
+ def process_command(self, cmd_id, seq, text):
+ self.process_net_command(self.global_debugger_holder.global_dbg, cmd_id, seq, text)
+
+
+#----------------------------------------------------------------------------------- SOCKET UTILITIES - WRITER
+#=======================================================================================================================
+# WriterThread
+#=======================================================================================================================
+class WriterThread(PyDBDaemonThread):
+ """ writer thread writes out the commands in an infinite loop """
+ def __init__(self, sock):
+ PyDBDaemonThread.__init__(self)
+ self.sock = sock
+ self.setName("pydevd.Writer")
+ self.cmdQueue = _queue.Queue()
+ if pydevd_vm_type.get_vm_type() == 'python':
+ self.timeout = 0
+ else:
+ self.timeout = 0.1
+
+ def add_command(self, cmd):
+ """ cmd is NetCommand """
+ if not self.killReceived: #we don't take new data after everybody die
+ self.cmdQueue.put(cmd)
+
+ def _on_run(self):
+ """ just loop and write responses """
+
+ self._stop_trace()
+ get_has_timeout = sys.hexversion >= 0x02030000 # 2.3 onwards have it.
+ try:
+ while True:
+ try:
+ try:
+ if get_has_timeout:
+ cmd = self.cmdQueue.get(1, 0.1)
+ else:
+ time.sleep(.01)
+ cmd = self.cmdQueue.get(0)
+ except _queue.Empty:
+ if self.killReceived:
+ try:
+ self.sock.shutdown(SHUT_WR)
+ self.sock.close()
+ except:
+ pass
+
+ return #break if queue is empty and killReceived
+ else:
+ continue
+ except:
+ #pydevd_log(0, 'Finishing debug communication...(1)')
+ #when liberating the thread here, we could have errors because we were shutting down
+ #but the thread was still not liberated
+ return
+ out = cmd.outgoing
+
+ if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 1:
+ out_message = 'sending cmd --> '
+ out_message += "%20s" % ID_TO_MEANING.get(out[:3], 'UNKNOWN')
+ out_message += ' '
+ out_message += unquote(unquote(out)).replace('\n', ' ')
+ try:
+ sys.stderr.write('%s\n' % (out_message,))
+ except:
+ pass
+
+ if IS_PY3K:
+ out = bytearray(out, 'utf-8')
+ self.sock.send(out) #TODO: this does not guarantee that all message are sent (and jython does not have a send all)
+ if cmd.id == CMD_EXIT:
+ break
+ if time is None:
+ break #interpreter shutdown
+ time.sleep(self.timeout)
+ except Exception:
+ GlobalDebuggerHolder.global_dbg.finish_debugging_session()
+ if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 0:
+ traceback.print_exc()
+
+ def empty(self):
+ return self.cmdQueue.empty()
+
+
+
+#--------------------------------------------------- CREATING THE SOCKET THREADS
+
+#=======================================================================================================================
+# start_server
+#=======================================================================================================================
+def start_server(port):
+ """ binds to a port, waits for the debugger to connect """
+ s = socket(AF_INET, SOCK_STREAM)
+ s.settimeout(None)
+
+ try:
+ from socket import SO_REUSEPORT
+ s.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
+ except ImportError:
+ s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
+
+ s.bind(('', port))
+ pydevd_log(1, "Bound to port ", str(port))
+
+ try:
+ s.listen(1)
+ newSock, _addr = s.accept()
+ pydevd_log(1, "Connection accepted")
+ # closing server socket is not necessary but we don't need it
+ s.shutdown(SHUT_RDWR)
+ s.close()
+ return newSock
+
+ except:
+ sys.stderr.write("Could not bind to port: %s\n" % (port,))
+ sys.stderr.flush()
+ traceback.print_exc()
+
+#=======================================================================================================================
+# start_client
+#=======================================================================================================================
+def start_client(host, port):
+ """ connects to a host/port """
+ pydevd_log(1, "Connecting to ", host, ":", str(port))
+
+ s = socket(AF_INET, SOCK_STREAM)
+
+ MAX_TRIES = 100
+ i = 0
+ while i_=" \t')
+ self.outgoing = '%s\t%s\t%s\n' % (id, seq, encoded)
+
+#=======================================================================================================================
+# NetCommandFactory
+#=======================================================================================================================
+class NetCommandFactory:
+
+ def _thread_to_xml(self, thread):
+ """ thread information as XML """
+ name = pydevd_xml.make_valid_xml_value(thread.getName())
+ cmdText = ' ' % (quote(name), get_thread_id(thread))
+ return cmdText
+
+ def make_error_message(self, seq, text):
+ cmd = NetCommand(CMD_ERROR, seq, text)
+ if DebugInfoHolder.DEBUG_TRACE_LEVEL > 2:
+ sys.stderr.write("Error: %s" % (text,))
+ return cmd
+
+ def make_thread_created_message(self, thread):
+ cmdText = "" + self._thread_to_xml(thread) + " "
+ return NetCommand(CMD_THREAD_CREATE, 0, cmdText)
+
+ def make_process_created_message(self):
+ cmdText = ' '
+ return NetCommand(CMD_PROCESS_CREATED, 0, cmdText)
+
+ def make_custom_frame_created_message(self, frameId, frameDescription):
+ frameDescription = pydevd_xml.make_valid_xml_value(frameDescription)
+ cmdText = ' ' % (frameDescription, frameId)
+ return NetCommand(CMD_THREAD_CREATE, 0, cmdText)
+
+
+ def make_list_threads_message(self, seq):
+ """ returns thread listing as XML """
+ try:
+ t = threading.enumerate()
+ cmd_text = [""]
+ append = cmd_text.append
+ for i in t:
+ if is_thread_alive(i):
+ append(self._thread_to_xml(i))
+ append(" ")
+ return NetCommand(CMD_RETURN, seq, ''.join(cmd_text))
+ except:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_variable_changed_message(self, seq, payload):
+ # notify debugger that value was changed successfully
+ return NetCommand(CMD_RETURN, seq, payload)
+
+ def make_io_message(self, v, ctx, dbg=None):
+ '''
+ @param v: the message to pass to the debug server
+ @param ctx: 1 for stdio 2 for stderr
+ @param dbg: If not none, add to the writer
+ '''
+
+ try:
+ if len(v) > MAX_IO_MSG_SIZE:
+ v = v[0:MAX_IO_MSG_SIZE]
+ v += '...'
+
+ v = pydevd_xml.make_valid_xml_value(quote(v, '/>_= \t'))
+ net = NetCommand(str(CMD_WRITE_TO_CONSOLE), 0, ' ' % (v, ctx))
+ except:
+ net = self.make_error_message(0, get_exception_traceback_str())
+
+ if dbg:
+ dbg.writer.add_command(net)
+
+ return net
+
+ def make_version_message(self, seq):
+ try:
+ return NetCommand(CMD_VERSION, seq, VERSION_STRING)
+ except:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_thread_killed_message(self, id):
+ try:
+ return NetCommand(CMD_THREAD_KILL, 0, str(id))
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+ def make_thread_suspend_str(self, thread_id, frame, stop_reason, message, suspend_type="trace"):
+ """
+
+
+
+
+ """
+ cmd_text_list = [""]
+ append = cmd_text_list.append
+ make_valid_xml_value = pydevd_xml.make_valid_xml_value
+
+ if message:
+ message = make_valid_xml_value(message)
+
+ append('' % (thread_id, stop_reason, message, suspend_type))
+
+ curr_frame = frame
+ try:
+ while curr_frame:
+ #print cmdText
+ my_id = id(curr_frame)
+ #print "id is ", my_id
+
+ if curr_frame.f_code is None:
+ break #Iron Python sometimes does not have it!
+
+ my_name = curr_frame.f_code.co_name #method name (if in method) or ? if global
+ if my_name is None:
+ break #Iron Python sometimes does not have it!
+
+ #print "name is ", my_name
+
+ abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(curr_frame)
+
+ myFile = norm_file_to_client(abs_path_real_path_and_base[0])
+ if file_system_encoding.lower() != "utf-8" and hasattr(myFile, "decode"):
+ # myFile is a byte string encoded using the file system encoding
+ # convert it to utf8
+ myFile = myFile.decode(file_system_encoding).encode("utf-8")
+
+ #print "file is ", myFile
+ #myFile = inspect.getsourcefile(curr_frame) or inspect.getfile(frame)
+
+ myLine = str(curr_frame.f_lineno)
+ #print "line is ", myLine
+
+ #the variables are all gotten 'on-demand'
+ #variables = pydevd_xml.frame_vars_to_xml(curr_frame.f_locals)
+
+ variables = ''
+ append(' ' % (quote(myFile, '/>_= \t'), myLine))
+ append(variables)
+ append("")
+ curr_frame = curr_frame.f_back
+ except :
+ traceback.print_exc()
+
+ append(" ")
+ return ''.join(cmd_text_list)
+
+ def make_thread_suspend_message(self, thread_id, frame, stop_reason, message, suspend_type):
+ try:
+ return NetCommand(CMD_THREAD_SUSPEND, 0, self.make_thread_suspend_str(thread_id, frame, stop_reason, message, suspend_type))
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+ def make_thread_run_message(self, id, reason):
+ try:
+ return NetCommand(CMD_THREAD_RUN, 0, str(id) + "\t" + str(reason))
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+ def make_get_variable_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_VARIABLE, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+
+ def make_get_array_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_ARRAY, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_get_description_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_DESCRIPTION, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_get_frame_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_FRAME, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+
+ def make_evaluate_expression_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_EVALUATE_EXPRESSION, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_get_completions_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_COMPLETIONS, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_get_file_contents(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_FILE_CONTENTS, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_send_breakpoint_exception_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_GET_BREAKPOINT_EXCEPTION, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_send_curr_exception_trace_message(self, seq, thread_id, curr_frame_id, exc_type, exc_desc, trace_obj):
+ try:
+ while trace_obj.tb_next is not None:
+ trace_obj = trace_obj.tb_next
+
+ exc_type = pydevd_xml.make_valid_xml_value(str(exc_type)).replace('\t', ' ') or 'exception: type unknown'
+ exc_desc = pydevd_xml.make_valid_xml_value(str(exc_desc)).replace('\t', ' ') or 'exception: no description'
+
+ payload = str(curr_frame_id) + '\t' + exc_type + "\t" + exc_desc + "\t" + \
+ self.make_thread_suspend_str(thread_id, trace_obj.tb_frame, CMD_SEND_CURR_EXCEPTION_TRACE, '')
+
+ return NetCommand(CMD_SEND_CURR_EXCEPTION_TRACE, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_send_curr_exception_trace_proceeded_message(self, seq, thread_id):
+ try:
+ return NetCommand(CMD_SEND_CURR_EXCEPTION_TRACE_PROCEEDED, 0, str(thread_id))
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+ def make_send_console_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_EVALUATE_CONSOLE_EXPRESSION, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_custom_operation_message(self, seq, payload):
+ try:
+ return NetCommand(CMD_RUN_CUSTOM_OPERATION, seq, payload)
+ except Exception:
+ return self.make_error_message(seq, get_exception_traceback_str())
+
+ def make_load_source_message(self, seq, source, dbg=None):
+ try:
+ net = NetCommand(CMD_LOAD_SOURCE, seq, '%s' % source)
+
+ except:
+ net = self.make_error_message(0, get_exception_traceback_str())
+
+ if dbg:
+ dbg.writer.add_command(net)
+ return net
+
+ def make_show_console_message(self, thread_id, frame):
+ try:
+ return NetCommand(CMD_SHOW_CONSOLE, 0, self.make_thread_suspend_str(thread_id, frame, CMD_SHOW_CONSOLE, ''))
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+ def make_input_requested_message(self, started):
+ try:
+ return NetCommand(CMD_INPUT_REQUESTED, 0, started)
+ except:
+ return self.make_error_message(0, get_exception_traceback_str())
+
+
+ def make_exit_message(self):
+ try:
+ net = NetCommand(CMD_EXIT, 0, '')
+
+ except:
+ net = self.make_error_message(0, get_exception_traceback_str())
+
+ return net
+
+INTERNAL_TERMINATE_THREAD = 1
+INTERNAL_SUSPEND_THREAD = 2
+
+
+#=======================================================================================================================
+# InternalThreadCommand
+#=======================================================================================================================
+class InternalThreadCommand:
+ """ internal commands are generated/executed by the debugger.
+
+ The reason for their existence is that some commands have to be executed
+ on specific threads. These are the InternalThreadCommands that get
+ get posted to PyDB.cmdQueue.
+ """
+
+ def can_be_executed_by(self, thread_id):
+ '''By default, it must be in the same thread to be executed
+ '''
+ return self.thread_id == thread_id or self.thread_id.endswith('|' + thread_id)
+
+ def do_it(self, dbg):
+ raise NotImplementedError("you have to override do_it")
+
+
+class ReloadCodeCommand(InternalThreadCommand):
+
+
+ def __init__(self, module_name, thread_id):
+ self.thread_id = thread_id
+ self.module_name = module_name
+ self.executed = False
+ self.lock = thread.allocate_lock()
+
+
+ def can_be_executed_by(self, thread_id):
+ if self.thread_id == '*':
+ return True #Any thread can execute it!
+
+ return InternalThreadCommand.can_be_executed_by(self, thread_id)
+
+
+ def do_it(self, dbg):
+ self.lock.acquire()
+ try:
+ if self.executed:
+ return
+ self.executed = True
+ finally:
+ self.lock.release()
+
+ module_name = self.module_name
+ if module_name not in sys.modules:
+ if '.' in module_name:
+ new_module_name = module_name.split('.')[-1]
+ if new_module_name in sys.modules:
+ module_name = new_module_name
+
+ if module_name not in sys.modules:
+ sys.stderr.write('pydev debugger: Unable to find module to reload: "' + module_name + '".\n')
+ # Too much info...
+ # sys.stderr.write('pydev debugger: This usually means you are trying to reload the __main__ module (which cannot be reloaded).\n')
+
+ else:
+ sys.stderr.write('pydev debugger: Start reloading module: "' + module_name + '" ... \n')
+ from _pydevd_bundle import pydevd_reload
+ if pydevd_reload.xreload(sys.modules[module_name]):
+ sys.stderr.write('pydev debugger: reload finished\n')
+ else:
+ sys.stderr.write('pydev debugger: reload finished without applying any change\n')
+
+
+#=======================================================================================================================
+# InternalTerminateThread
+#=======================================================================================================================
+class InternalTerminateThread(InternalThreadCommand):
+ def __init__(self, thread_id):
+ self.thread_id = thread_id
+
+ def do_it(self, dbg):
+ pydevd_log(1, "killing ", str(self.thread_id))
+ cmd = dbg.cmd_factory.make_thread_killed_message(self.thread_id)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalRunThread
+#=======================================================================================================================
+class InternalRunThread(InternalThreadCommand):
+ def __init__(self, thread_id):
+ self.thread_id = thread_id
+
+ def do_it(self, dbg):
+ t = pydevd_find_thread_by_id(self.thread_id)
+ if t:
+ t.additional_info.pydev_step_cmd = -1
+ t.additional_info.pydev_step_stop = None
+ t.additional_info.pydev_state = STATE_RUN
+
+
+#=======================================================================================================================
+# InternalStepThread
+#=======================================================================================================================
+class InternalStepThread(InternalThreadCommand):
+ def __init__(self, thread_id, cmd_id):
+ self.thread_id = thread_id
+ self.cmd_id = cmd_id
+
+ def do_it(self, dbg):
+ t = pydevd_find_thread_by_id(self.thread_id)
+ if t:
+ t.additional_info.pydev_step_cmd = self.cmd_id
+ t.additional_info.pydev_state = STATE_RUN
+
+
+#=======================================================================================================================
+# InternalSetNextStatementThread
+#=======================================================================================================================
+class InternalSetNextStatementThread(InternalThreadCommand):
+ def __init__(self, thread_id, cmd_id, line, func_name):
+ self.thread_id = thread_id
+ self.cmd_id = cmd_id
+ self.line = line
+
+ if IS_PY2:
+ if isinstance(func_name, unicode):
+ # On cython with python 2.X it requires an str, not unicode (but on python 3.3 it should be a str, not bytes).
+ func_name = func_name.encode('utf-8')
+
+ self.func_name = func_name
+
+ def do_it(self, dbg):
+ t = pydevd_find_thread_by_id(self.thread_id)
+ if t:
+ t.additional_info.pydev_step_cmd = self.cmd_id
+ t.additional_info.pydev_next_line = int(self.line)
+ t.additional_info.pydev_func_name = self.func_name
+ t.additional_info.pydev_state = STATE_RUN
+
+
+#=======================================================================================================================
+# InternalGetVariable
+#=======================================================================================================================
+class InternalGetVariable(InternalThreadCommand):
+ """ gets the value of a variable """
+ def __init__(self, seq, thread_id, frame_id, scope, attrs):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.scope = scope
+ self.attributes = attrs
+
+ def do_it(self, dbg):
+ """ Converts request into python variable """
+ try:
+ xml = ""
+ val_dict = pydevd_vars.resolve_compound_variable(self.thread_id, self.frame_id, self.scope, self.attributes)
+ if val_dict is None:
+ val_dict = {}
+
+ # assume properly ordered if resolver returns 'OrderedDict'
+ # check type as string to support OrderedDict backport for older Python
+ keys = dict_keys(val_dict)
+ if not val_dict.__class__.__name__ == "OrderedDict":
+ keys.sort(key=compare_object_attrs_key)
+
+ for k in keys:
+ xml += pydevd_xml.var_to_xml(val_dict[k], to_string(k))
+
+ xml += " "
+ cmd = dbg.cmd_factory.make_get_variable_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ except Exception:
+ cmd = dbg.cmd_factory.make_error_message(
+ self.sequence, "Error resolving variables %s" % (get_exception_traceback_str(),))
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalGetArray
+#=======================================================================================================================
+class InternalGetArray(InternalThreadCommand):
+ def __init__(self, seq, roffset, coffset, rows, cols, format, thread_id, frame_id, scope, attrs):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.scope = scope
+ self.name = attrs.split("\t")[-1]
+ self.attrs = attrs
+ self.roffset = int(roffset)
+ self.coffset = int(coffset)
+ self.rows = int(rows)
+ self.cols = int(cols)
+ self.format = format
+
+ def do_it(self, dbg):
+ try:
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ var = pydevd_vars.eval_in_context(self.name, frame.f_globals, frame.f_locals)
+ xml = pydevd_vars.table_like_struct_to_xml(var, self.name, self.roffset, self.coffset, self.rows, self.cols, self.format )
+ cmd = dbg.cmd_factory.make_get_array_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ except:
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error resolving array: " + get_exception_traceback_str())
+ dbg.writer.add_command(cmd)
+
+#=======================================================================================================================
+# InternalChangeVariable
+#=======================================================================================================================
+class InternalChangeVariable(InternalThreadCommand):
+ """ changes the value of a variable """
+ def __init__(self, seq, thread_id, frame_id, scope, attr, expression):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.scope = scope
+ self.attr = attr
+ self.expression = expression
+
+ def do_it(self, dbg):
+ """ Converts request into python variable """
+ try:
+ result = pydevd_vars.change_attr_expression(self.thread_id, self.frame_id, self.attr, self.expression, dbg)
+ xml = ""
+ xml += pydevd_xml.var_to_xml(result, "")
+ xml += " "
+ cmd = dbg.cmd_factory.make_variable_changed_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ except Exception:
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error changing variable attr:%s expression:%s traceback:%s" % (self.attr, self.expression, get_exception_traceback_str()))
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalGetFrame
+#=======================================================================================================================
+class InternalGetFrame(InternalThreadCommand):
+ """ gets the value of a variable """
+ def __init__(self, seq, thread_id, frame_id):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+
+ def do_it(self, dbg):
+ """ Converts request into python variable """
+ try:
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ if frame is not None:
+ hidden_ns = pydevconsole.get_ipython_hidden_vars()
+ xml = ""
+ xml += pydevd_xml.frame_vars_to_xml(frame.f_locals, hidden_ns)
+ del frame
+ xml += " "
+ cmd = dbg.cmd_factory.make_get_frame_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ else:
+ #pydevd_vars.dump_frames(self.thread_id)
+ #don't print this error: frame not found: means that the client is not synchronized (but that's ok)
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Frame not found: %s from thread: %s" % (self.frame_id, self.thread_id))
+ dbg.writer.add_command(cmd)
+ except:
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error resolving frame: %s from thread: %s" % (self.frame_id, self.thread_id))
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalEvaluateExpression
+#=======================================================================================================================
+class InternalEvaluateExpression(InternalThreadCommand):
+ """ gets the value of a variable """
+
+ def __init__(self, seq, thread_id, frame_id, expression, doExec, doTrim, temp_name):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.expression = expression
+ self.doExec = doExec
+ self.doTrim = doTrim
+ self.temp_name = temp_name
+
+ def do_it(self, dbg):
+ """ Converts request into python variable """
+ try:
+ result = pydevd_vars.evaluate_expression(self.thread_id, self.frame_id, self.expression, self.doExec)
+ if self.temp_name != "":
+ pydevd_vars.change_attr_expression(self.thread_id, self.frame_id, self.temp_name, self.expression, dbg, result)
+ xml = ""
+ xml += pydevd_xml.var_to_xml(result, self.expression, self.doTrim)
+ xml += " "
+ cmd = dbg.cmd_factory.make_evaluate_expression_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error evaluating expression " + exc)
+ dbg.writer.add_command(cmd)
+
+#=======================================================================================================================
+# InternalGetCompletions
+#=======================================================================================================================
+class InternalGetCompletions(InternalThreadCommand):
+ """ Gets the completions in a given scope """
+
+ def __init__(self, seq, thread_id, frame_id, act_tok):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.act_tok = act_tok
+
+
+ def do_it(self, dbg):
+ """ Converts request into completions """
+ try:
+ remove_path = None
+ try:
+
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ if frame is not None:
+
+ msg = _pydev_completer.generate_completions_as_xml(frame, self.act_tok)
+
+ cmd = dbg.cmd_factory.make_get_completions_message(self.sequence, msg)
+ dbg.writer.add_command(cmd)
+ else:
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "InternalGetCompletions: Frame not found: %s from thread: %s" % (self.frame_id, self.thread_id))
+ dbg.writer.add_command(cmd)
+
+
+ finally:
+ if remove_path is not None:
+ sys.path.remove(remove_path)
+
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error evaluating expression " + exc)
+ dbg.writer.add_command(cmd)
+
+
+# =======================================================================================================================
+# InternalGetDescription
+# =======================================================================================================================
+class InternalGetDescription(InternalThreadCommand):
+ """ Fetch the variable description stub from the debug console
+ """
+
+ def __init__(self, seq, thread_id, frame_id, expression):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.expression = expression
+
+ def do_it(self, dbg):
+ """ Get completions and write back to the client
+ """
+ try:
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ description = pydevd_console.get_description(frame, self.thread_id, self.frame_id, self.expression)
+ description = pydevd_xml.make_valid_xml_value(quote(description, '/>_= \t'))
+ description_xml = ' ' % description
+ cmd = dbg.cmd_factory.make_get_description_message(self.sequence, description_xml)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error in fetching description" + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalGetBreakpointException
+#=======================================================================================================================
+class InternalGetBreakpointException(InternalThreadCommand):
+ """ Send details of exception raised while evaluating conditional breakpoint """
+ def __init__(self, thread_id, exc_type, stacktrace):
+ self.sequence = 0
+ self.thread_id = thread_id
+ self.stacktrace = stacktrace
+ self.exc_type = exc_type
+
+ def do_it(self, dbg):
+ try:
+ callstack = ""
+
+ makeValid = pydevd_xml.make_valid_xml_value
+
+ for filename, line, methodname, methodobj in self.stacktrace:
+ if file_system_encoding.lower() != "utf-8" and hasattr(filename, "decode"):
+ # filename is a byte string encoded using the file system encoding
+ # convert it to utf8
+ filename = filename.decode(file_system_encoding).encode("utf-8")
+
+ callstack += ' ' \
+ % (self.thread_id, makeValid(filename), line, makeValid(methodname), makeValid(methodobj))
+ callstack += " "
+
+ cmd = dbg.cmd_factory.make_send_breakpoint_exception_message(self.sequence, self.exc_type + "\t" + callstack)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error Sending Exception: " + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalSendCurrExceptionTrace
+#=======================================================================================================================
+class InternalSendCurrExceptionTrace(InternalThreadCommand):
+ """ Send details of the exception that was caught and where we've broken in.
+ """
+ def __init__(self, thread_id, arg, curr_frame_id):
+ '''
+ :param arg: exception type, description, traceback object
+ '''
+ self.sequence = 0
+ self.thread_id = thread_id
+ self.curr_frame_id = curr_frame_id
+ self.arg = arg
+
+ def do_it(self, dbg):
+ try:
+ cmd = dbg.cmd_factory.make_send_curr_exception_trace_message(self.sequence, self.thread_id, self.curr_frame_id, *self.arg)
+ del self.arg
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error Sending Current Exception Trace: " + exc)
+ dbg.writer.add_command(cmd)
+
+#=======================================================================================================================
+# InternalSendCurrExceptionTraceProceeded
+#=======================================================================================================================
+class InternalSendCurrExceptionTraceProceeded(InternalThreadCommand):
+ """ Send details of the exception that was caught and where we've broken in.
+ """
+ def __init__(self, thread_id):
+ self.sequence = 0
+ self.thread_id = thread_id
+
+ def do_it(self, dbg):
+ try:
+ cmd = dbg.cmd_factory.make_send_curr_exception_trace_proceeded_message(self.sequence, self.thread_id)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error Sending Current Exception Trace Proceeded: " + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalEvaluateConsoleExpression
+#=======================================================================================================================
+class InternalEvaluateConsoleExpression(InternalThreadCommand):
+ """ Execute the given command in the debug console """
+
+ def __init__(self, seq, thread_id, frame_id, line, buffer_output=True):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.line = line
+ self.buffer_output = buffer_output
+
+ def do_it(self, dbg):
+ """ Create an XML for console output, error and more (true/false)
+
+
+
+ true/false
+
+ """
+ try:
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ if frame is not None:
+ console_message = pydevd_console.execute_console_command(
+ frame, self.thread_id, self.frame_id, self.line, self.buffer_output)
+
+ cmd = dbg.cmd_factory.make_send_console_message(self.sequence, console_message.to_xml())
+ else:
+ from _pydevd_bundle.pydevd_console import ConsoleMessage
+ console_message = ConsoleMessage()
+ console_message.add_console_message(
+ pydevd_console.CONSOLE_ERROR,
+ "Select the valid frame in the debug view (thread: %s, frame: %s invalid)" % (self.thread_id, self.frame_id),
+ )
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, console_message.to_xml())
+ except:
+ exc = get_exception_traceback_str()
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error evaluating expression " + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalRunCustomOperation
+#=======================================================================================================================
+class InternalRunCustomOperation(InternalThreadCommand):
+ """ Run a custom command on an expression
+ """
+ def __init__(self, seq, thread_id, frame_id, scope, attrs, style, encoded_code_or_file, fnname):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.scope = scope
+ self.attrs = attrs
+ self.style = style
+ self.code_or_file = unquote_plus(encoded_code_or_file)
+ self.fnname = fnname
+
+ def do_it(self, dbg):
+ try:
+ res = pydevd_vars.custom_operation(self.thread_id, self.frame_id, self.scope, self.attrs,
+ self.style, self.code_or_file, self.fnname)
+ resEncoded = quote_plus(res)
+ cmd = dbg.cmd_factory.make_custom_operation_message(self.sequence, resEncoded)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error in running custom operation" + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalConsoleGetCompletions
+#=======================================================================================================================
+class InternalConsoleGetCompletions(InternalThreadCommand):
+ """ Fetch the completions in the debug console
+ """
+ def __init__(self, seq, thread_id, frame_id, act_tok):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.act_tok = act_tok
+
+ def do_it(self, dbg):
+ """ Get completions and write back to the client
+ """
+ try:
+ frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
+ completions_xml = pydevd_console.get_completions(frame, self.act_tok)
+ cmd = dbg.cmd_factory.make_send_console_message(self.sequence, completions_xml)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error in fetching completions" + exc)
+ dbg.writer.add_command(cmd)
+
+
+#=======================================================================================================================
+# InternalConsoleExec
+#=======================================================================================================================
+class InternalConsoleExec(InternalThreadCommand):
+ """ gets the value of a variable """
+
+ def __init__(self, seq, thread_id, frame_id, expression):
+ self.sequence = seq
+ self.thread_id = thread_id
+ self.frame_id = frame_id
+ self.expression = expression
+
+ def do_it(self, dbg):
+ """ Converts request into python variable """
+ try:
+ try:
+ #don't trace new threads created by console command
+ disable_trace_thread_modules()
+
+ result = pydevconsole.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
+ xml = ""
+ xml += pydevd_xml.var_to_xml(result, "")
+ xml += " "
+ cmd = dbg.cmd_factory.make_evaluate_expression_message(self.sequence, xml)
+ dbg.writer.add_command(cmd)
+ except:
+ exc = get_exception_traceback_str()
+ sys.stderr.write('%s\n' % (exc,))
+ cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error evaluating console expression " + exc)
+ dbg.writer.add_command(cmd)
+ finally:
+ enable_trace_thread_modules()
+
+ sys.stderr.flush()
+ sys.stdout.flush()
+
+
+#=======================================================================================================================
+# pydevd_find_thread_by_id
+#=======================================================================================================================
+def pydevd_find_thread_by_id(thread_id):
+ try:
+ # there was a deadlock here when I did not remove the tracing function when thread was dead
+ threads = threading.enumerate()
+ for i in threads:
+ tid = get_thread_id(i)
+ if thread_id == tid or thread_id.endswith('|' + tid):
+ return i
+
+ sys.stderr.write("Could not find thread %s\n" % thread_id)
+ sys.stderr.write("Available: %s\n" % [get_thread_id(t) for t in threads])
+ sys.stderr.flush()
+ except:
+ traceback.print_exc()
+
+ return None
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_command_line_handling.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_command_line_handling.py
new file mode 100644
index 00000000..d672f277
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_command_line_handling.py
@@ -0,0 +1,147 @@
+class ArgHandlerWithParam:
+ '''
+ Handler for some arguments which needs a value
+ '''
+
+ def __init__(self, arg_name, convert_val=None, default_val=None):
+ self.arg_name = arg_name
+ self.arg_v_rep = '--%s' % (arg_name,)
+ self.convert_val = convert_val
+ self.default_val = default_val
+
+ def to_argv(self, lst, setup):
+ v = setup.get(self.arg_name)
+ if v is not None and v != self.default_val:
+ lst.append(self.arg_v_rep)
+ lst.append('%s' % (v,))
+
+ def handle_argv(self, argv, i, setup):
+ assert argv[i] == self.arg_v_rep
+ del argv[i]
+
+ val = argv[i]
+ if self.convert_val:
+ val = self.convert_val(val)
+
+ setup[self.arg_name] = val
+ del argv[i]
+
+class ArgHandlerBool:
+ '''
+ If a given flag is received, mark it as 'True' in setup.
+ '''
+
+ def __init__(self, arg_name, default_val=False):
+ self.arg_name = arg_name
+ self.arg_v_rep = '--%s' % (arg_name,)
+ self.default_val = default_val
+
+ def to_argv(self, lst, setup):
+ v = setup.get(self.arg_name)
+ if v:
+ lst.append(self.arg_v_rep)
+
+ def handle_argv(self, argv, i, setup):
+ assert argv[i] == self.arg_v_rep
+ del argv[i]
+ setup[self.arg_name] = True
+
+
+ACCEPTED_ARG_HANDLERS = [
+ ArgHandlerWithParam('port', int, 0),
+ ArgHandlerWithParam('vm_type'),
+ ArgHandlerWithParam('client'),
+
+ ArgHandlerBool('server'),
+ ArgHandlerBool('DEBUG_RECORD_SOCKET_READS'),
+ ArgHandlerBool('multiproc'), # Used by PyCharm (reuses connection: ssh tunneling)
+ ArgHandlerBool('multiprocess'), # Used by PyDev (creates new connection to ide)
+ ArgHandlerBool('save-signatures'),
+ ArgHandlerBool('save-threading'),
+ ArgHandlerBool('save-asyncio'),
+ ArgHandlerBool('print-in-debugger-startup'),
+ ArgHandlerBool('cmd-line'),
+ ArgHandlerBool('module'),
+]
+
+ARGV_REP_TO_HANDLER = {}
+for handler in ACCEPTED_ARG_HANDLERS:
+ ARGV_REP_TO_HANDLER[handler.arg_v_rep] = handler
+
+def get_pydevd_file():
+ import pydevd
+ f = pydevd.__file__
+ if f.endswith('.pyc'):
+ f = f[:-1]
+ elif f.endswith('$py.class'):
+ f = f[:-len('$py.class')] + '.py'
+ return f
+
+def setup_to_argv(setup):
+ '''
+ :param dict setup:
+ A dict previously gotten from process_command_line.
+
+ :note: does not handle --file nor --DEBUG.
+ '''
+ ret = [get_pydevd_file()]
+
+ for handler in ACCEPTED_ARG_HANDLERS:
+ if handler.arg_name in setup:
+ handler.to_argv(ret, setup)
+ return ret
+
+def process_command_line(argv):
+ """ parses the arguments.
+ removes our arguments from the command line """
+ setup = {}
+ for handler in ACCEPTED_ARG_HANDLERS:
+ setup[handler.arg_name] = handler.default_val
+ setup['file'] = ''
+ setup['qt-support'] = ''
+
+ i = 0
+ del argv[0]
+ while i < len(argv):
+ handler = ARGV_REP_TO_HANDLER.get(argv[i])
+ if handler is not None:
+ handler.handle_argv(argv, i, setup)
+
+ elif argv[i].startswith('--qt-support'):
+ # The --qt-support is special because we want to keep backward compatibility:
+ # Previously, just passing '--qt-support' meant that we should use the auto-discovery mode
+ # whereas now, if --qt-support is passed, it should be passed as --qt-support=, where
+ # mode can be one of 'auto', 'none', 'pyqt5', 'pyqt4', 'pyside'.
+ if argv[i] == '--qt-support':
+ setup['qt-support'] = 'auto'
+
+ elif argv[i].startswith('--qt-support='):
+ qt_support = argv[i][len('--qt-support='):]
+ valid_modes = ('none', 'auto', 'pyqt5', 'pyqt4', 'pyside')
+ if qt_support not in valid_modes:
+ raise ValueError("qt-support mode invalid: " + qt_support)
+ if qt_support == 'none':
+ # On none, actually set an empty string to evaluate to False.
+ setup['qt-support'] = ''
+ else:
+ setup['qt-support'] = qt_support
+ else:
+ raise ValueError("Unexpected definition for qt-support flag: " + argv[i])
+
+ del argv[i]
+
+
+ elif argv[i] == '--file':
+ # --file is special because it's the last one (so, no handler for it).
+ del argv[i]
+ setup['file'] = argv[i]
+ i = len(argv) # pop out, file is our last argument
+
+ elif argv[i] == '--DEBUG':
+ from pydevd import set_debug
+ del argv[i]
+ set_debug(setup)
+
+ else:
+ raise ValueError("Unexpected option: " + argv[i])
+ return setup
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_console.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_console.py
new file mode 100644
index 00000000..88318a52
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_console.py
@@ -0,0 +1,247 @@
+'''An helper file for the pydev debugger (REPL) console
+'''
+import sys
+import traceback
+from code import InteractiveConsole
+
+from _pydev_bundle import _pydev_completer
+from _pydev_bundle.pydev_console_utils import BaseInterpreterInterface, BaseStdIn
+from _pydev_bundle.pydev_imports import Exec
+from _pydev_bundle.pydev_override import overrides
+from _pydevd_bundle import pydevd_save_locals
+from _pydevd_bundle.pydevd_io import IOBuf
+from pydevd_tracing import get_exception_traceback_str
+from _pydevd_bundle.pydevd_xml import make_valid_xml_value
+
+CONSOLE_OUTPUT = "output"
+CONSOLE_ERROR = "error"
+
+
+#=======================================================================================================================
+# ConsoleMessage
+#=======================================================================================================================
+class ConsoleMessage:
+ """Console Messages
+ """
+ def __init__(self):
+ self.more = False
+ # List of tuple [('error', 'error_message'), ('message_list', 'output_message')]
+ self.console_messages = []
+
+ def add_console_message(self, message_type, message):
+ """add messages in the console_messages list
+ """
+ for m in message.split("\n"):
+ if m.strip():
+ self.console_messages.append((message_type, m))
+
+ def update_more(self, more):
+ """more is set to true if further input is required from the user
+ else more is set to false
+ """
+ self.more = more
+
+ def to_xml(self):
+ """Create an XML for console message_list, error and more (true/false)
+
+ console message_list
+ console error
+ true/false
+
+ """
+ makeValid = make_valid_xml_value
+
+ xml = '%s ' % (self.more)
+
+ for message_type, message in self.console_messages:
+ xml += '<%s message="%s">%s>' % (message_type, makeValid(message), message_type)
+
+ xml += ' '
+
+ return xml
+
+
+#=======================================================================================================================
+# DebugConsoleStdIn
+#=======================================================================================================================
+class DebugConsoleStdIn(BaseStdIn):
+
+ overrides(BaseStdIn.readline)
+ def readline(self, *args, **kwargs):
+ sys.stderr.write('Warning: Reading from stdin is still not supported in this console.\n')
+ return '\n'
+
+#=======================================================================================================================
+# DebugConsole
+#=======================================================================================================================
+class DebugConsole(InteractiveConsole, BaseInterpreterInterface):
+ """Wrapper around code.InteractiveConsole, in order to send
+ errors and outputs to the debug console
+ """
+
+ overrides(BaseInterpreterInterface.create_std_in)
+ def create_std_in(self, *args, **kwargs):
+ try:
+ if not self.__buffer_output:
+ return sys.stdin
+ except:
+ pass
+
+ return DebugConsoleStdIn() #If buffered, raw_input is not supported in this console.
+
+
+ overrides(InteractiveConsole.push)
+ def push(self, line, frame, buffer_output=True):
+ """Change built-in stdout and stderr methods by the
+ new custom StdMessage.
+ execute the InteractiveConsole.push.
+ Change the stdout and stderr back be the original built-ins
+
+ :param buffer_output: if False won't redirect the output.
+
+ Return boolean (True if more input is required else False),
+ output_messages and input_messages
+ """
+ self.__buffer_output = buffer_output
+ more = False
+ if buffer_output:
+ original_stdout = sys.stdout
+ original_stderr = sys.stderr
+ try:
+ try:
+ self.frame = frame
+ if buffer_output:
+ out = sys.stdout = IOBuf()
+ err = sys.stderr = IOBuf()
+ more = self.add_exec(line)
+ except Exception:
+ exc = get_exception_traceback_str()
+ if buffer_output:
+ err.buflist.append("Internal Error: %s" % (exc,))
+ else:
+ sys.stderr.write("Internal Error: %s\n" % (exc,))
+ finally:
+ #Remove frame references.
+ self.frame = None
+ frame = None
+ if buffer_output:
+ sys.stdout = original_stdout
+ sys.stderr = original_stderr
+
+ if buffer_output:
+ return more, out.buflist, err.buflist
+ else:
+ return more, [], []
+
+
+ overrides(BaseInterpreterInterface.do_add_exec)
+ def do_add_exec(self, line):
+ return InteractiveConsole.push(self, line)
+
+
+ overrides(InteractiveConsole.runcode)
+ def runcode(self, code):
+ """Execute a code object.
+
+ When an exception occurs, self.showtraceback() is called to
+ display a traceback. All exceptions are caught except
+ SystemExit, which is reraised.
+
+ A note about KeyboardInterrupt: this exception may occur
+ elsewhere in this code, and may not always be caught. The
+ caller should be prepared to deal with it.
+
+ """
+ try:
+ Exec(code, self.frame.f_globals, self.frame.f_locals)
+ pydevd_save_locals.save_locals(self.frame)
+ except SystemExit:
+ raise
+ except:
+ self.showtraceback()
+
+ def get_namespace(self):
+ dbg_namespace = {}
+ dbg_namespace.update(self.frame.f_globals)
+ dbg_namespace.update(self.frame.f_locals) # locals later because it has precedence over the actual globals
+ return dbg_namespace
+
+
+#=======================================================================================================================
+# InteractiveConsoleCache
+#=======================================================================================================================
+class InteractiveConsoleCache:
+
+ thread_id = None
+ frame_id = None
+ interactive_console_instance = None
+
+
+#Note: On Jython 2.1 we can't use classmethod or staticmethod, so, just make the functions below free-functions.
+def get_interactive_console(thread_id, frame_id, frame, console_message):
+ """returns the global interactive console.
+ interactive console should have been initialized by this time
+ :rtype: DebugConsole
+ """
+ if InteractiveConsoleCache.thread_id == thread_id and InteractiveConsoleCache.frame_id == frame_id:
+ return InteractiveConsoleCache.interactive_console_instance
+
+ InteractiveConsoleCache.interactive_console_instance = DebugConsole()
+ InteractiveConsoleCache.thread_id = thread_id
+ InteractiveConsoleCache.frame_id = frame_id
+
+ console_stacktrace = traceback.extract_stack(frame, limit=1)
+ if console_stacktrace:
+ current_context = console_stacktrace[0] # top entry from stacktrace
+ context_message = 'File "%s", line %s, in %s' % (current_context[0], current_context[1], current_context[2])
+ console_message.add_console_message(CONSOLE_OUTPUT, "[Current context]: %s" % (context_message,))
+ return InteractiveConsoleCache.interactive_console_instance
+
+
+def clear_interactive_console():
+ InteractiveConsoleCache.thread_id = None
+ InteractiveConsoleCache.frame_id = None
+ InteractiveConsoleCache.interactive_console_instance = None
+
+
+def execute_console_command(frame, thread_id, frame_id, line, buffer_output=True):
+ """fetch an interactive console instance from the cache and
+ push the received command to the console.
+
+ create and return an instance of console_message
+ """
+ console_message = ConsoleMessage()
+
+ interpreter = get_interactive_console(thread_id, frame_id, frame, console_message)
+ more, output_messages, error_messages = interpreter.push(line, frame, buffer_output)
+ console_message.update_more(more)
+
+ for message in output_messages:
+ console_message.add_console_message(CONSOLE_OUTPUT, message)
+
+ for message in error_messages:
+ console_message.add_console_message(CONSOLE_ERROR, message)
+
+ return console_message
+
+
+def get_description(frame, thread_id, frame_id, expression):
+ console_message = ConsoleMessage()
+ interpreter = get_interactive_console(thread_id, frame_id, frame, console_message)
+ try:
+ interpreter.frame = frame
+ return interpreter.getDescription(expression)
+ finally:
+ interpreter.frame = None
+
+
+def get_completions(frame, act_tok):
+ """ fetch all completions, create xml for the same
+ return the completions xml
+ """
+ return _pydev_completer.generate_completions_as_xml(frame, act_tok)
+
+
+
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_constants.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_constants.py
new file mode 100644
index 00000000..ad1ec8b4
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_constants.py
@@ -0,0 +1,337 @@
+'''
+This module holds the constants used for specifying the states of the debugger.
+'''
+from __future__ import nested_scopes
+
+STATE_RUN = 1
+STATE_SUSPEND = 2
+
+PYTHON_SUSPEND = 1
+DJANGO_SUSPEND = 2
+JINJA2_SUSPEND = 3
+
+
+class DebugInfoHolder:
+ #we have to put it here because it can be set through the command line (so, the
+ #already imported references would not have it).
+ DEBUG_RECORD_SOCKET_READS = False
+ DEBUG_TRACE_LEVEL = -1
+ DEBUG_TRACE_BREAKPOINTS = -1
+
+#Hold a reference to the original _getframe (because psyco will change that as soon as it's imported)
+import sys #Note: the sys import must be here anyways (others depend on it)
+try:
+ get_frame = sys._getframe
+except AttributeError:
+ def get_frame():
+ raise AssertionError('sys._getframe not available (possible causes: enable -X:Frames on IronPython?)')
+
+#Used to determine the maximum size of each variable passed to eclipse -- having a big value here may make
+#the communication slower -- as the variables are being gathered lazily in the latest version of eclipse,
+#this value was raised from 200 to 1000.
+MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 1000
+# Prefix for saving functions return values in locals
+RETURN_VALUES_DICT = '__pydevd_ret_val_dict'
+
+import os
+
+from _pydevd_bundle import pydevd_vm_type
+
+IS_JYTHON = pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON
+IS_IRONPYTHON = sys.platform == 'cli'
+
+IS_JYTH_LESS25 = False
+if IS_JYTHON:
+ if sys.version_info[0] == 2 and sys.version_info[1] < 5:
+ IS_JYTH_LESS25 = True
+
+IS_PYTHON_STACKLESS = "stackless" in sys.version.lower()
+CYTHON_SUPPORTED = False
+
+try:
+ import platform
+ python_implementation = platform.python_implementation()
+except:
+ pass
+else:
+ if python_implementation == 'CPython' and not IS_PYTHON_STACKLESS:
+ # Only available for CPython!
+ if (
+ (sys.version_info[0] == 2 and sys.version_info[1] >= 7)
+ or (sys.version_info[0] == 3 and sys.version_info[1] >= 3)
+ or (sys.version_info[0] > 3)
+ ):
+ # Supported in 2.7 or 3.3 onwards (32 or 64)
+ CYTHON_SUPPORTED = True
+
+
+#=======================================================================================================================
+# Python 3?
+#=======================================================================================================================
+IS_PY3K = False
+IS_PY34_OLDER = False
+IS_PY2 = True
+IS_PY27 = False
+IS_PY24 = False
+try:
+ if sys.version_info[0] >= 3:
+ IS_PY3K = True
+ IS_PY2 = False
+ if (sys.version_info[0] == 3 and sys.version_info[1] >= 4) or sys.version_info[0] > 3:
+ IS_PY34_OLDER = True
+ elif sys.version_info[0] == 2 and sys.version_info[1] == 7:
+ IS_PY27 = True
+ elif sys.version_info[0] == 2 and sys.version_info[1] == 4:
+ IS_PY24 = True
+except AttributeError:
+ pass #Not all versions have sys.version_info
+
+try:
+ SUPPORT_GEVENT = os.getenv('GEVENT_SUPPORT', 'False') == 'True'
+except:
+ # Jython 2.1 doesn't accept that construct
+ SUPPORT_GEVENT = False
+
+# At the moment gevent supports Python >= 2.6 and Python >= 3.3
+USE_LIB_COPY = SUPPORT_GEVENT and \
+ ((not IS_PY3K and sys.version_info[1] >= 6) or
+ (IS_PY3K and sys.version_info[1] >= 3))
+
+
+INTERACTIVE_MODE_AVAILABLE = sys.platform in ('darwin', 'win32') or os.getenv('DISPLAY') is not None
+
+
+def protect_libraries_from_patching():
+ """
+ In this function we delete some modules from `sys.modules` dictionary and import them again inside
+ `_pydev_saved_modules` in order to save their original copies there. After that we can use these
+ saved modules within the debugger to protect them from patching by external libraries (e.g. gevent).
+ """
+ patched = ['threading', 'thread', '_thread', 'time', 'socket', 'Queue', 'queue', 'select',
+ 'xmlrpclib', 'SimpleXMLRPCServer', 'BaseHTTPServer', 'SocketServer',
+ 'xmlrpc.client', 'xmlrpc.server', 'http.server', 'socketserver']
+
+ for name in patched:
+ try:
+ __import__(name)
+ except:
+ pass
+
+ patched_modules = dict([(k, v) for k, v in sys.modules.items()
+ if k in patched])
+
+ for name in patched_modules:
+ del sys.modules[name]
+
+ # import for side effects
+ import _pydev_imps._pydev_saved_modules
+
+ for name in patched_modules:
+ sys.modules[name] = patched_modules[name]
+
+
+if USE_LIB_COPY:
+ protect_libraries_from_patching()
+
+
+from _pydev_imps._pydev_saved_modules import thread
+_nextThreadIdLock = thread.allocate_lock()
+
+if IS_PY3K:
+ def dict_keys(d):
+ return list(d.keys())
+
+ def dict_values(d):
+ return list(d.values())
+
+ dict_iter_values = dict.values
+
+ def dict_iter_items(d):
+ return d.items()
+
+ def dict_items(d):
+ return list(d.items())
+
+else:
+ dict_keys = None
+ try:
+ dict_keys = dict.keys
+ except:
+ pass
+
+ if IS_JYTHON or not dict_keys:
+ def dict_keys(d):
+ return d.keys()
+
+ try:
+ dict_iter_values = dict.itervalues
+ except:
+ try:
+ dict_iter_values = dict.values #Older versions don't have the itervalues
+ except:
+ def dict_iter_values(d):
+ return d.values()
+
+ try:
+ dict_values = dict.values
+ except:
+ def dict_values(d):
+ return d.values()
+
+ def dict_iter_items(d):
+ try:
+ return d.iteritems()
+ except:
+ return d.items()
+
+ def dict_items(d):
+ return d.items()
+
+
+try:
+ xrange = xrange
+except:
+ #Python 3k does not have it
+ xrange = range
+
+try:
+ import itertools
+ izip = itertools.izip
+except:
+ izip = zip
+
+
+#=======================================================================================================================
+# StringIO
+#=======================================================================================================================
+try:
+ from StringIO import StringIO
+except:
+ from io import StringIO
+
+
+#=======================================================================================================================
+# get_pid
+#=======================================================================================================================
+def get_pid():
+ try:
+ return os.getpid()
+ except AttributeError:
+ try:
+ #Jython does not have it!
+ import java.lang.management.ManagementFactory #@UnresolvedImport -- just for jython
+ pid = java.lang.management.ManagementFactory.getRuntimeMXBean().getName()
+ return pid.replace('@', '_')
+ except:
+ #ok, no pid available (will be unable to debug multiple processes)
+ return '000001'
+
+def clear_cached_thread_id(thread):
+ try:
+ del thread.__pydevd_id__
+ except AttributeError:
+ pass
+
+#=======================================================================================================================
+# get_thread_id
+#=======================================================================================================================
+def get_thread_id(thread):
+ try:
+ tid = thread.__pydevd_id__
+ if tid is None:
+ # Fix for https://sw-brainwy.rhcloud.com/tracker/PyDev/645
+ # if __pydevd_id__ is None, recalculate it... also, use an heuristic
+ # that gives us always the same id for the thread (using thread.ident or id(thread)).
+ raise AttributeError()
+ except AttributeError:
+ _nextThreadIdLock.acquire()
+ try:
+ #We do a new check with the lock in place just to be sure that nothing changed
+ tid = getattr(thread, '__pydevd_id__', None)
+ if tid is None:
+ pid = get_pid()
+ try:
+ tid = thread.__pydevd_id__ = 'pid_%s_id_%s' % (pid, thread.get_ident())
+ except:
+ # thread.ident isn't always there... (use id(thread) instead if it's not there).
+ tid = thread.__pydevd_id__ = 'pid_%s_id_%s' % (pid, id(thread))
+ finally:
+ _nextThreadIdLock.release()
+
+ return tid
+
+#===============================================================================
+# Null
+#===============================================================================
+class Null:
+ """
+ Gotten from: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205
+ """
+
+ def __init__(self, *args, **kwargs):
+ return None
+
+ def __call__(self, *args, **kwargs):
+ return self
+
+ def __getattr__(self, mname):
+ if len(mname) > 4 and mname[:2] == '__' and mname[-2:] == '__':
+ # Don't pretend to implement special method names.
+ raise AttributeError(mname)
+ return self
+
+ def __setattr__(self, name, value):
+ return self
+
+ def __delattr__(self, name):
+ return self
+
+ def __repr__(self):
+ return ""
+
+ def __str__(self):
+ return "Null"
+
+ def __len__(self):
+ return 0
+
+ def __getitem__(self):
+ return self
+
+ def __setitem__(self, *args, **kwargs):
+ pass
+
+ def write(self, *args, **kwargs):
+ pass
+
+ def __nonzero__(self):
+ return 0
+
+ def __iter__(self):
+ return iter(())
+
+
+def call_only_once(func):
+ '''
+ To be used as a decorator
+
+ @call_only_once
+ def func():
+ print 'Calling func only this time'
+
+ Actually, in PyDev it must be called as:
+
+ func = call_only_once(func) to support older versions of Python.
+ '''
+ def new_func(*args, **kwargs):
+ if not new_func._called:
+ new_func._called = True
+ return func(*args, **kwargs)
+
+ new_func._called = False
+ return new_func
+
+if __name__ == '__main__':
+ if Null():
+ sys.stdout.write('here\n')
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_custom_frames.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_custom_frames.py
new file mode 100644
index 00000000..ca4e0e9d
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_custom_frames.py
@@ -0,0 +1,133 @@
+from _pydevd_bundle.pydevd_constants import get_thread_id, Null
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+from _pydev_imps._pydev_saved_modules import thread, threading
+import sys
+
+DEBUG = False
+
+#=======================================================================================================================
+# CustomFramesContainer
+#=======================================================================================================================
+class CustomFramesContainer:
+
+ # Actual Values initialized later on.
+ custom_frames_lock = None #: :type custom_frames_lock: threading.Lock
+
+ custom_frames = None
+
+ _next_frame_id = None
+
+ _py_db_command_thread_event = None
+
+
+def custom_frames_container_init(): #Note: no staticmethod on jython 2.1 (so, use free-function)
+
+ CustomFramesContainer.custom_frames_lock = thread.allocate_lock()
+
+ # custom_frames can only be accessed if properly locked with custom_frames_lock!
+ # Key is a string identifying the frame (as well as the thread it belongs to).
+ # Value is a CustomFrame.
+ #
+ CustomFramesContainer.custom_frames = {}
+
+ # Only to be used in this module
+ CustomFramesContainer._next_frame_id = 0
+
+ # This is the event we must set to release an internal process events. It's later set by the actual debugger
+ # when we do create the debugger.
+ CustomFramesContainer._py_db_command_thread_event = Null()
+
+#Initialize it the first time (it may be reinitialized later on when dealing with a fork).
+custom_frames_container_init()
+
+
+#=======================================================================================================================
+# CustomFrame
+#=======================================================================================================================
+class CustomFrame:
+
+ def __init__(self, name, frame, thread_id):
+ # 0 = string with the representation of that frame
+ self.name = name
+
+ # 1 = the frame to show
+ self.frame = frame
+
+ # 2 = an integer identifying the last time the frame was changed.
+ self.mod_time = 0
+
+ # 3 = the thread id of the given frame
+ self.thread_id = thread_id
+
+
+def add_custom_frame(frame, name, thread_id):
+ CustomFramesContainer.custom_frames_lock.acquire()
+ try:
+ curr_thread_id = get_thread_id(threading.currentThread())
+ next_id = CustomFramesContainer._next_frame_id = CustomFramesContainer._next_frame_id + 1
+
+ # Note: the frame id kept contains an id and thread information on the thread where the frame was added
+ # so that later on we can check if the frame is from the current thread by doing frame_id.endswith('|'+thread_id).
+ frame_id = '__frame__:%s|%s' % (next_id, curr_thread_id)
+ if DEBUG:
+ sys.stderr.write('add_custom_frame: %s (%s) %s %s\n' % (
+ frame_id, get_abs_path_real_path_and_base_from_frame(frame)[-1], frame.f_lineno, frame.f_code.co_name))
+
+ CustomFramesContainer.custom_frames[frame_id] = CustomFrame(name, frame, thread_id)
+ CustomFramesContainer._py_db_command_thread_event.set()
+ return frame_id
+ finally:
+ CustomFramesContainer.custom_frames_lock.release()
+
+addCustomFrame = add_custom_frame # Backward compatibility
+
+def update_custom_frame(frame_id, frame, thread_id, name=None):
+ CustomFramesContainer.custom_frames_lock.acquire()
+ try:
+ if DEBUG:
+ sys.stderr.write('update_custom_frame: %s\n' % frame_id)
+ try:
+ old = CustomFramesContainer.custom_frames[frame_id]
+ if name is not None:
+ old.name = name
+ old.mod_time += 1
+ old.thread_id = thread_id
+ except:
+ sys.stderr.write('Unable to get frame to replace: %s\n' % (frame_id,))
+ import traceback;traceback.print_exc()
+
+ CustomFramesContainer._py_db_command_thread_event.set()
+ finally:
+ CustomFramesContainer.custom_frames_lock.release()
+
+
+def get_custom_frame(thread_id, frame_id):
+ '''
+ :param thread_id: This should actually be the frame_id which is returned by add_custom_frame.
+ :param frame_id: This is the actual id() of the frame
+ '''
+
+ CustomFramesContainer.custom_frames_lock.acquire()
+ try:
+ frame_id = int(frame_id)
+ f = CustomFramesContainer.custom_frames[thread_id].frame
+ while f is not None:
+ if id(f) == frame_id:
+ return f
+ f = f.f_back
+ finally:
+ f = None
+ CustomFramesContainer.custom_frames_lock.release()
+
+
+def remove_custom_frame(frame_id):
+ CustomFramesContainer.custom_frames_lock.acquire()
+ try:
+ if DEBUG:
+ sys.stderr.write('remove_custom_frame: %s\n' % frame_id)
+ CustomFramesContainer.custom_frames.pop(frame_id, None)
+ CustomFramesContainer._py_db_command_thread_event.set()
+ finally:
+ CustomFramesContainer.custom_frames_lock.release()
+
+removeCustomFrame = remove_custom_frame # Backward compatibility
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c
new file mode 100644
index 00000000..d73fe5c9
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c
@@ -0,0 +1,30941 @@
+/* Generated by Cython 0.26 */
+
+/* BEGIN: Cython Metadata
+{
+ "distutils": {
+ "depends": [],
+ "name": "_pydevd_bundle.pydevd_cython",
+ "sources": [
+ "_pydevd_bundle/pydevd_cython.pyx"
+ ]
+ },
+ "module_name": "_pydevd_bundle.pydevd_cython"
+}
+END: Cython Metadata */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_26"
+#include
+#ifndef offsetof
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#define __PYX_COMMA ,
+#ifndef HAVE_LONG_LONG
+ #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
+ #define HAVE_LONG_LONG
+ #endif
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+ #define CYTHON_COMPILING_IN_PYPY 1
+ #define CYTHON_COMPILING_IN_PYSTON 0
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #undef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 0
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #undef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 1
+ #undef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 0
+ #undef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 0
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+#elif defined(PYSTON_VERSION)
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_PYSTON 1
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+#else
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_PYSTON 0
+ #define CYTHON_COMPILING_IN_CPYTHON 1
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #if PY_VERSION_HEX < 0x02070000
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
+ #define CYTHON_USE_PYLONG_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #if PY_VERSION_HEX < 0x030300F0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
+ #define CYTHON_USE_UNICODE_WRITER 1
+ #endif
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #ifndef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 1
+ #endif
+ #ifndef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 1
+ #endif
+#endif
+#if !defined(CYTHON_FAST_PYCCALL)
+#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
+#endif
+#if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #undef SHIFT
+ #undef BASE
+ #undef MASK
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+ #define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#ifndef Py_TPFLAGS_CHECKTYPES
+ #define Py_TPFLAGS_CHECKTYPES 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_INDEX
+ #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_FINALIZE
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL)
+ #ifndef METH_FASTCALL
+ #define METH_FASTCALL 0x80
+ #endif
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs);
+ typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args,
+ Py_ssize_t nargs, PyObject *kwnames);
+#else
+ #define __Pyx_PyCFunctionFast _PyCFunctionFast
+ #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
+#endif
+#if CYTHON_FAST_PYCCALL
+#define __Pyx_PyFastCFunction_Check(func)\
+ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
+#else
+#define __Pyx_PyFastCFunction_Check(func) 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define PyUnicode_1BYTE_KIND 1
+ #define PyUnicode_2BYTE_KIND 2
+ #define PyUnicode_4BYTE_KIND 4
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
+ #define PyObject_Free(p) PyMem_Free(p)
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
+#endif
+#if CYTHON_COMPILING_IN_PYSTON
+ #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
+#else
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
+ #define PyObject_ASCII(o) PyObject_Repr(o)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+#ifndef __has_cpp_attribute
+ #define __has_cpp_attribute(x) 0
+#endif
+#if CYTHON_USE_ASYNC_SLOTS
+ #if PY_VERSION_HEX >= 0x030500B1
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
+ #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
+ #else
+ typedef struct {
+ unaryfunc am_await;
+ unaryfunc am_aiter;
+ unaryfunc am_anext;
+ } __Pyx_PyAsyncMethodsStruct;
+ #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
+ #endif
+#else
+ #define __Pyx_PyType_AsAsync(obj) NULL
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+#ifndef CYTHON_MAYBE_UNUSED_VAR
+# if defined(__cplusplus)
+ template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
+# else
+# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
+# endif
+#endif
+#ifndef CYTHON_NCP_UNUSED
+# if CYTHON_COMPILING_IN_CPYTHON
+# define CYTHON_NCP_UNUSED
+# else
+# define CYTHON_NCP_UNUSED CYTHON_UNUSED
+# endif
+#endif
+#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
+#ifdef _MSC_VER
+ #ifndef _MSC_STDINT_H_
+ #if _MSC_VER < 1300
+ typedef unsigned char uint8_t;
+ typedef unsigned int uint32_t;
+ #else
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int32 uint32_t;
+ #endif
+ #endif
+#else
+ #include
+#endif
+#ifndef CYTHON_FALLTHROUGH
+ #ifdef __cplusplus
+ #if __has_cpp_attribute(fallthrough)
+ #define CYTHON_FALLTHROUGH [[fallthrough]]
+ #elif __has_cpp_attribute(clang::fallthrough)
+ #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
+ #endif
+ #endif
+ #ifndef CYTHON_FALLTHROUGH
+ #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__))
+ #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
+ #else
+ #define CYTHON_FALLTHROUGH
+ #endif
+ #endif
+#endif
+
+#ifndef CYTHON_INLINE
+ #if defined(__clang__)
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
+ #elif defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+ #define _USE_MATH_DEFINES
+#endif
+#include
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
+#define __Pyx_truncl trunc
+#else
+#define __Pyx_truncl truncl
+#endif
+
+
+#define __PYX_ERR(f_index, lineno, Ln_error) \
+{ \
+ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
+}
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#define __PYX_HAVE___pydevd_bundle__pydevd_cython
+#define __PYX_HAVE_API___pydevd_bundle__pydevd_cython
+#include
+#include
+#ifdef _OPENMP
+#include
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_uchar_cast(c) ((unsigned char)c)
+#define __Pyx_long_cast(x) ((long)x)
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
+ (sizeof(type) < sizeof(Py_ssize_t)) ||\
+ (sizeof(type) > sizeof(Py_ssize_t) &&\
+ likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX) &&\
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
+ v == (type)PY_SSIZE_T_MIN))) ||\
+ (sizeof(type) == sizeof(Py_ssize_t) &&\
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX))) )
+#if defined (__cplusplus) && __cplusplus >= 201103L
+ #include
+ #define __Pyx_sst_abs(value) std::abs(value)
+#elif SIZEOF_INT >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) abs(value)
+#elif SIZEOF_LONG >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) labs(value)
+#elif defined (_MSC_VER) && defined (_M_X64)
+ #define __Pyx_sst_abs(value) _abs64(value)
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define __Pyx_sst_abs(value) llabs(value)
+#elif defined (__GNUC__)
+ #define __Pyx_sst_abs(value) __builtin_llabs(value)
+#else
+ #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
+#endif
+static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
+#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_ASSUME_SAFE_MACROS
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
+#else
+#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
+#endif
+#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_cython_runtime;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static PyObject *__pyx_empty_unicode;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "_pydevd_bundle\\pydevd_cython.pyx",
+ "stringsource",
+ "type.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo;
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper;
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer;
+
+/* "_pydevd_bundle/pydevd_cython.pyx":61
+ * #=======================================================================================================================
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef class PyDBAdditionalThreadInfo: # <<<<<<<<<<<<<<
+ * # ELSE
+ * # class PyDBAdditionalThreadInfo(object):
+ */
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo {
+ PyObject_HEAD
+ int pydev_state;
+ PyObject *pydev_step_stop;
+ int pydev_step_cmd;
+ int pydev_notify_kill;
+ PyObject *pydev_smart_step_stop;
+ int pydev_django_resolve_frame;
+ PyObject *pydev_call_from_jinja2;
+ PyObject *pydev_call_inside_jinja2;
+ int is_tracing;
+ PyObject *conditional_breakpoint_exception;
+ PyObject *pydev_message;
+ int suspend_type;
+ int pydev_next_line;
+ PyObject *pydev_func_name;
+};
+
+
+/* "_pydevd_bundle/pydevd_cython.pyx":218
+ * #=======================================================================================================================
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef class PyDBFrame: # <<<<<<<<<<<<<<
+ * # ELSE
+ * # class PyDBFrame:
+ */
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_vtab;
+ PyObject *_args;
+ int should_skip;
+};
+
+
+/* "_pydevd_bundle/pydevd_cython.pyx":973
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef class SafeCallWrapper: # <<<<<<<<<<<<<<
+ * cdef method_object
+ * def __init__(self, method_object):
+ */
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper {
+ PyObject_HEAD
+ PyObject *method_object;
+};
+
+
+/* "_pydevd_bundle/pydevd_cython.pyx":985
+ * Py_XDECREF (method_obj)
+ * return SafeCallWrapper(ret) if ret is not None else None
+ * cdef class ThreadTracer: # <<<<<<<<<<<<<<
+ * cdef public tuple _args;
+ * def __init__(self, tuple args):
+ */
+struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer {
+ PyObject_HEAD
+ PyObject *_args;
+};
+
+
+
+/* "_pydevd_bundle/pydevd_cython.pyx":218
+ * #=======================================================================================================================
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef class PyDBFrame: # <<<<<<<<<<<<<<
+ * # ELSE
+ * # class PyDBFrame:
+ */
+
+struct __pyx_vtabstruct_14_pydevd_bundle_13pydevd_cython_PyDBFrame {
+ PyObject *(*trace_dispatch)(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
+};
+static struct __pyx_vtabstruct_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_vtabptr_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+
+/* --- Runtime support code (head) --- */
+/* Refnanny.proto */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ if (acquire_gil) {\
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
+ PyGILState_Release(__pyx_gilstate_save);\
+ } else {\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext()\
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_XDECREF(tmp);\
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_DECREF(tmp);\
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+/* PyObjectGetAttrStr.proto */
+#if CYTHON_USE_TYPE_SLOTS
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+/* GetBuiltinName.proto */
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+/* GetModuleGlobalName.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+/* PyCFunctionFastCall.proto */
+#if CYTHON_FAST_PYCCALL
+static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
+#else
+#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
+#endif
+
+/* PyFunctionFastCall.proto */
+#if CYTHON_FAST_PYCALL
+#define __Pyx_PyFunction_FastCall(func, args, nargs)\
+ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
+#if 1 || PY_VERSION_HEX < 0x030600B1
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
+#else
+#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
+#endif
+#endif
+
+/* PyObjectCall.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+/* PyObjectCallMethO.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+/* PyObjectCallOneArg.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+/* PyObjectCallNoArg.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+/* RaiseArgTupleInvalid.proto */
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+/* KeywordStringCheck.proto */
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
+
+/* GetAttr.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
+
+/* GetAttr3.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
+
+/* RaiseDoubleKeywords.proto */
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+/* ParseKeywords.proto */
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
+ const char* function_name);
+
+/* PyThreadStateGet.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
+#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
+#else
+#define __Pyx_PyThreadState_declare
+#define __Pyx_PyThreadState_assign
+#endif
+
+/* SaveResetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+#else
+#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
+#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
+#endif
+
+/* GetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
+static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+#endif
+
+/* HasAttr.proto */
+static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
+
+/* RaiseTooManyValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+/* RaiseNeedMoreValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+/* IterFinish.proto */
+static CYTHON_INLINE int __Pyx_IterFinish(void);
+
+/* UnpackItemEndCheck.proto */
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
+
+/* StringJoin.proto */
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyString_Join __Pyx_PyBytes_Join
+#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
+#else
+#define __Pyx_PyString_Join PyUnicode_Join
+#define __Pyx_PyBaseString_Join PyUnicode_Join
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ #if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyBytes_Join _PyString_Join
+ #else
+ #define __Pyx_PyBytes_Join _PyBytes_Join
+ #endif
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
+#endif
+
+/* PyObjectSetAttrStr.proto */
+#if CYTHON_USE_TYPE_SLOTS
+#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
+static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_setattro))
+ return tp->tp_setattro(obj, attr_name, value);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_setattr))
+ return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
+#endif
+ return PyObject_SetAttr(obj, attr_name, value);
+}
+#else
+#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
+#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
+#endif
+
+/* PyErrFetchRestore.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
+#endif
+
+/* SwapException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
+#endif
+
+/* GetItemInt.proto */
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
+
+/* None.proto */
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
+/* ArgTypeTest.proto */
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
+
+/* IncludeStringH.proto */
+#include
+
+/* BytesEquals.proto */
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
+
+/* UnicodeEquals.proto */
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
+
+/* StrEquals.proto */
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
+/* ExtTypeTest.proto */
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
+
+/* PySequenceContains.proto */
+static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
+ int result = PySequence_Contains(seq, item);
+ return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+/* RaiseNoneIterError.proto */
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+/* PyIntBinop.proto */
+#if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
+#else
+#define __Pyx_PyInt_AndObjC(op1, op2, intval, inplace)\
+ (inplace ? PyNumber_InPlaceAnd(op1, op2) : PyNumber_And(op1, op2))
+#endif
+
+/* dict_getitem_default.proto */
+static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
+
+/* PyErrExceptionMatches.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
+static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
+#else
+#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
+#endif
+
+/* RaiseException.proto */
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+/* PyDictContains.proto */
+static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
+ int result = PyDict_Contains(dict, item);
+ return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+/* PyIntBinop.proto */
+#if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
+#else
+#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
+ PyObject_RichCompare(op1, op2, Py_EQ)
+ #endif
+
+/* Import.proto */
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+/* ImportFrom.proto */
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+/* SetupReduce.proto */
+static int __Pyx_setup_reduce(PyObject* type_obj);
+
+/* SetVTable.proto */
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
+
+/* PatchModuleWithCoroutine.proto */
+static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
+
+/* PatchInspect.proto */
+static PyObject* __Pyx_patch_inspect(PyObject* module);
+
+/* CLineInTraceback.proto */
+static int __Pyx_CLineForTraceback(int c_line);
+
+/* CodeObjectCache.proto */
+typedef struct {
+ PyCodeObject* code_object;
+ int code_line;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+/* AddTraceback.proto */
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+/* CheckBinaryVersion.proto */
+static int __Pyx_check_binary_version(void);
+
+/* PyIdentifierFromString.proto */
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+/* ModuleImport.proto */
+static PyObject *__Pyx_ImportModule(const char *name);
+
+/* TypeImport.proto */
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+/* InitStrings.proto */
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_trace_dispatch(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg, int __pyx_skip_dispatch); /* proto*/
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from '_pydevd_bundle.pydevd_cython' */
+static PyTypeObject *__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo = 0;
+static PyTypeObject *__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame = 0;
+static PyTypeObject *__pyx_ptype_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper = 0;
+static PyTypeObject *__pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer = 0;
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBAdditionalThreadInfo__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *, PyObject *); /*proto*/
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBFrame__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *, PyObject *); /*proto*/
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_SafeCallWrapper__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *, PyObject *); /*proto*/
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_ThreadTracer__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *, PyObject *); /*proto*/
+#define __Pyx_MODULE_NAME "_pydevd_bundle.pydevd_cython"
+int __pyx_module_is_main__pydevd_bundle__pydevd_cython = 0;
+
+/* Implementation of '_pydevd_bundle.pydevd_cython' */
+static PyObject *__pyx_builtin_RuntimeError;
+static PyObject *__pyx_builtin_ImportError;
+static PyObject *__pyx_builtin_eval;
+static PyObject *__pyx_builtin_id;
+static PyObject *__pyx_builtin_StopIteration;
+static PyObject *__pyx_builtin_GeneratorExit;
+static PyObject *__pyx_builtin_KeyboardInterrupt;
+static PyObject *__pyx_builtin_AttributeError;
+static PyObject *__pyx_builtin_SystemExit;
+static const char __pyx_k_[] = "";
+static const char __pyx_k_f[] = "f";
+static const char __pyx_k_t[] = "t";
+static const char __pyx_k__5[] = "?";
+static const char __pyx_k_id[] = "id";
+static const char __pyx_k_os[] = "os";
+static const char __pyx_k_re[] = "re";
+static const char __pyx_k_tb[] = "tb";
+static const char __pyx_k_ALL[] = "ALL";
+static const char __pyx_k_arg[] = "arg";
+static const char __pyx_k_get[] = "get";
+static const char __pyx_k_msg[] = "msg";
+static const char __pyx_k_new[] = "__new__";
+static const char __pyx_k_pop[] = "pop";
+static const char __pyx_k_ret[] = "ret";
+static const char __pyx_k_run[] = "run";
+static const char __pyx_k_s_s[] = "%s.%s";
+static const char __pyx_k_sys[] = "sys";
+static const char __pyx_k_val[] = "val";
+static const char __pyx_k_None[] = "None";
+static const char __pyx_k_args[] = "args";
+static const char __pyx_k_call[] = "call";
+static const char __pyx_k_dict[] = "__dict__";
+static const char __pyx_k_eval[] = "eval";
+static const char __pyx_k_info[] = "info";
+static const char __pyx_k_join[] = "join";
+static const char __pyx_k_line[] = "line";
+static const char __pyx_k_main[] = "__main__";
+static const char __pyx_k_path[] = "path";
+static const char __pyx_k_self[] = "self";
+static const char __pyx_k_stat[] = "stat";
+static const char __pyx_k_stop[] = "stop";
+static const char __pyx_k_test[] = "__test__";
+static const char __pyx_k_Error[] = "\n\nError:\n";
+static const char __pyx_k_clear[] = "clear";
+static const char __pyx_k_debug[] = "debug";
+static const char __pyx_k_error[] = "error";
+static const char __pyx_k_etype[] = "etype";
+static const char __pyx_k_event[] = "event";
+static const char __pyx_k_frame[] = "frame";
+static const char __pyx_k_getId[] = "getId";
+static const char __pyx_k_ident[] = "ident";
+static const char __pyx_k_match[] = "match";
+static const char __pyx_k_py_db[] = "py_db";
+static const char __pyx_k_qname[] = "qname";
+static const char __pyx_k_stack[] = "stack";
+static const char __pyx_k_utf_8[] = "utf-8";
+static const char __pyx_k_value[] = "value";
+static const char __pyx_k_write[] = "write";
+static const char __pyx_k_args_2[] = "_args";
+static const char __pyx_k_call_2[] = "__call__";
+static const char __pyx_k_encode[] = "encode";
+static const char __pyx_k_f_back[] = "f_back";
+static const char __pyx_k_f_code[] = "f_code";
+static const char __pyx_k_getKey[] = "getKey";
+static const char __pyx_k_import[] = "__import__";
+static const char __pyx_k_kwargs[] = "kwargs";
+static const char __pyx_k_module[] = "";
+static const char __pyx_k_pickle[] = "pickle";
+static const char __pyx_k_plugin[] = "plugin";
+static const char __pyx_k_result[] = "result";
+static const char __pyx_k_return[] = "return";
+static const char __pyx_k_stderr[] = "stderr";
+static const char __pyx_k_thread[] = "thread";
+static const char __pyx_k_tracer[] = "_tracer";
+static const char __pyx_k_update[] = "update";
+static const char __pyx_k_IS_PY3K[] = "IS_PY3K";
+static const char __pyx_k_co_name[] = "co_name";
+static const char __pyx_k_compile[] = "compile";
+static const char __pyx_k_f_trace[] = "f_trace";
+static const char __pyx_k_getline[] = "getline";
+static const char __pyx_k_inspect[] = "inspect";
+static const char __pyx_k_invalid[] = ".invalid.";
+static const char __pyx_k_os_path[] = "os.path";
+static const char __pyx_k_st_size[] = "st_size";
+static const char __pyx_k_suspend[] = "suspend";
+static const char __pyx_k_tb_next[] = "tb_next";
+static const char __pyx_k_toArray[] = "toArray";
+static const char __pyx_k_version[] = "version";
+static const char __pyx_k_SetTrace[] = "SetTrace";
+static const char __pyx_k_as_array[] = "as_array";
+static const char __pyx_k_basename[] = "basename";
+static const char __pyx_k_co_flags[] = "co_flags";
+static const char __pyx_k_entrySet[] = "entrySet";
+static const char __pyx_k_exc_info[] = "exc_info";
+static const char __pyx_k_execfile[] = "execfile";
+static const char __pyx_k_f_lineno[] = "f_lineno";
+static const char __pyx_k_f_locals[] = "f_locals";
+static const char __pyx_k_getValue[] = "getValue";
+static const char __pyx_k_pyx_type[] = "__pyx_type";
+static const char __pyx_k_quitting[] = "quitting";
+static const char __pyx_k_st_mtime[] = "st_mtime";
+static const char __pyx_k_tb_frame[] = "tb_frame";
+static const char __pyx_k_Condition[] = "Condition:\n";
+static const char __pyx_k_IS_JYTHON[] = "IS_JYTHON";
+static const char __pyx_k_STATE_RUN[] = "STATE_RUN";
+static const char __pyx_k_condition[] = "condition";
+static const char __pyx_k_exception[] = "exception";
+static const char __pyx_k_f_globals[] = "f_globals";
+static const char __pyx_k_func_name[] = "func_name";
+static const char __pyx_k_java_lang[] = "java.lang";
+static const char __pyx_k_linecache[] = "linecache";
+static const char __pyx_k_log_event[] = "log_event";
+static const char __pyx_k_new_frame[] = "new_frame";
+static const char __pyx_k_print_exc[] = "print_exc";
+static const char __pyx_k_pydev_log[] = "pydev_log";
+static const char __pyx_k_pydevd_py[] = "pydevd.py";
+static const char __pyx_k_pyx_state[] = "__pyx_state";
+static const char __pyx_k_tb_lineno[] = "tb_lineno";
+static const char __pyx_k_threading[] = "threading";
+static const char __pyx_k_traceback[] = "traceback";
+static const char __pyx_k_DONT_TRACE[] = "DONT_TRACE";
+static const char __pyx_k_PYDEV_FILE[] = "PYDEV_FILE";
+static const char __pyx_k_SystemExit[] = "SystemExit";
+static const char __pyx_k_accessible[] = "accessible";
+static const char __pyx_k_breakpoint[] = "breakpoint";
+static const char __pyx_k_checkcache[] = "checkcache";
+static const char __pyx_k_expression[] = "expression";
+static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static const char __pyx_k_DEBUG_START[] = "DEBUG_START";
+static const char __pyx_k_ImportError[] = "ImportError";
+static const char __pyx_k_PickleError[] = "PickleError";
+static const char __pyx_k_breakpoints[] = "breakpoints";
+static const char __pyx_k_co_filename[] = "co_filename";
+static const char __pyx_k_just_raised[] = "just_raised";
+static const char __pyx_k_pydevd_vars[] = "pydevd_vars";
+static const char __pyx_k_set_suspend[] = "set_suspend";
+static const char __pyx_k_CO_GENERATOR[] = "CO_GENERATOR";
+static const char __pyx_k_RuntimeError[] = "RuntimeError";
+static const char __pyx_k_can_not_skip[] = "can_not_skip";
+static const char __pyx_k_not_in_scope[] = "not_in_scope";
+static const char __pyx_k_pydev_bundle[] = "_pydev_bundle";
+static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
+static const char __pyx_k_stringsource[] = "stringsource";
+static const char __pyx_k_thread_state[] = "thread_state";
+static const char __pyx_k_trace_return[] = "trace_return";
+static const char __pyx_k_CMD_SET_BREAK[] = "CMD_SET_BREAK";
+static const char __pyx_k_CMD_STEP_INTO[] = "CMD_STEP_INTO";
+static const char __pyx_k_CMD_STEP_OVER[] = "CMD_STEP_OVER";
+static const char __pyx_k_GeneratorExit[] = "GeneratorExit";
+static const char __pyx_k_IS_IRONPYTHON[] = "IS_IRONPYTHON";
+static const char __pyx_k_STATE_SUSPEND[] = "STATE_SUSPEND";
+static const char __pyx_k_StopIteration[] = "StopIteration";
+static const char __pyx_k_cmd_step_into[] = "cmd_step_into";
+static const char __pyx_k_cmd_step_over[] = "cmd_step_over";
+static const char __pyx_k_currentThread[] = "currentThread";
+static const char __pyx_k_extract_stack[] = "extract_stack";
+static const char __pyx_k_get_file_type[] = "get_file_type";
+static const char __pyx_k_get_func_name[] = "get_func_name";
+static const char __pyx_k_get_thread_id[] = "get_thread_id";
+static const char __pyx_k_main_debugger[] = "main_debugger";
+static const char __pyx_k_method_object[] = "method_object";
+static const char __pyx_k_original_call[] = "_original_call";
+static const char __pyx_k_pydev_message[] = "pydev_message";
+static const char __pyx_k_pydevd_bundle[] = "_pydevd_bundle";
+static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
+static const char __pyx_k_thread_states[] = "thread_states";
+static const char __pyx_k_thread_tracer[] = "thread_tracer";
+static const char __pyx_k_AttributeError[] = "AttributeError";
+static const char __pyx_k_PYTHON_SUSPEND[] = "PYTHON_SUSPEND";
+static const char __pyx_k_TRACE_PROPERTY[] = "TRACE_PROPERTY";
+static const char __pyx_k_co_firstlineno[] = "co_firstlineno";
+static const char __pyx_k_current_frames[] = "_current_frames";
+static const char __pyx_k_get_breakpoint[] = "get_breakpoint";
+static const char __pyx_k_output_checker[] = "output_checker";
+static const char __pyx_k_pydevd_tracing[] = "pydevd_tracing";
+static const char __pyx_k_suspend_policy[] = "suspend_policy";
+static const char __pyx_k_trace_dispatch[] = "trace_dispatch";
+static const char __pyx_k_CMD_RUN_TO_LINE[] = "CMD_RUN_TO_LINE";
+static const char __pyx_k_CMD_STEP_RETURN[] = "CMD_STEP_RETURN";
+static const char __pyx_k_IgnoreException[] = "[^#]*#.*@IgnoreException";
+static const char __pyx_k_additional_info[] = "additional_info";
+static const char __pyx_k_do_wait_suspend[] = "do_wait_suspend";
+static const char __pyx_k_exception_break[] = "exception_break";
+static const char __pyx_k_is_thread_alive[] = "is_thread_alive";
+static const char __pyx_k_org_python_core[] = "org.python.core";
+static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
+static const char __pyx_k_thread_analyser[] = "thread_analyser";
+static const char __pyx_k_thread_to_state[] = "thread_to_state";
+static const char __pyx_k_trace_exception[] = "trace_exception";
+static const char __pyx_k_DEBUG_START_PY3K[] = "DEBUG_START_PY3K";
+static const char __pyx_k_asyncio_analyser[] = "asyncio_analyser";
+static const char __pyx_k_dict_iter_values[] = "dict_iter_values";
+static const char __pyx_k_getDeclaredField[] = "getDeclaredField";
+static const char __pyx_k_handle_exception[] = "handle_exception";
+static const char __pyx_k_ignore_libraries[] = "ignore_libraries";
+static const char __pyx_k_KeyboardInterrupt[] = "KeyboardInterrupt";
+static const char __pyx_k_cachedThreadState[] = "cachedThreadState";
+static const char __pyx_k_is_filter_enabled[] = "is_filter_enabled";
+static const char __pyx_k_pydev_execfile_py[] = "_pydev_execfile.py";
+static const char __pyx_k_pydevd_dont_trace[] = "pydevd_dont_trace";
+static const char __pyx_k_pydevd_file_utils[] = "pydevd_file_utils";
+static const char __pyx_k_should_trace_hook[] = "should_trace_hook";
+static const char __pyx_k_signature_factory[] = "signature_factory";
+static const char __pyx_k_tid_to_last_frame[] = "_tid_to_last_frame";
+static const char __pyx_k_RETURN_VALUES_DICT[] = "RETURN_VALUES_DICT";
+static const char __pyx_k_ThreadStateMapping[] = "ThreadStateMapping";
+static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
+static const char __pyx_k_globalThreadStates[] = "globalThreadStates";
+static const char __pyx_k_global_cache_skips[] = "global_cache_skips";
+static const char __pyx_k_pydev_do_not_trace[] = "pydev_do_not_trace";
+static const char __pyx_k_show_return_values[] = "show_return_values";
+static const char __pyx_k_CMD_SMART_STEP_INTO[] = "CMD_SMART_STEP_INTO";
+static const char __pyx_k_is_filter_libraries[] = "is_filter_libraries";
+static const char __pyx_k_IGNORE_EXCEPTION_TAG[] = "IGNORE_EXCEPTION_TAG";
+static const char __pyx_k_NoSuchFieldException[] = "NoSuchFieldException";
+static const char __pyx_k_default_return_value[] = "default_return_value";
+static const char __pyx_k_get_clsname_for_code[] = "get_clsname_for_code";
+static const char __pyx_k_overwrite_prev_trace[] = "overwrite_prev_trace";
+static const char __pyx_k_remove_return_values[] = "remove_return_values";
+static const char __pyx_k_CMD_STEP_INTO_MY_CODE[] = "CMD_STEP_INTO_MY_CODE";
+static const char __pyx_k_filename_to_stat_info[] = "filename_to_stat_info";
+static const char __pyx_k_format_exception_only[] = "format_exception_only";
+static const char __pyx_k_is_ignored_by_filters[] = "is_ignored_by_filters";
+static const char __pyx_k_termination_event_set[] = "_termination_event_set";
+static const char __pyx_k_CMD_SET_NEXT_STATEMENT[] = "CMD_SET_NEXT_STATEMENT";
+static const char __pyx_k_add_exception_to_frame[] = "add_exception_to_frame";
+static const char __pyx_k_has_plugin_line_breaks[] = "has_plugin_line_breaks";
+static const char __pyx_k_kill_all_pydev_threads[] = "kill_all_pydev_threads";
+static const char __pyx_k_pyx_unpickle_PyDBFrame[] = "__pyx_unpickle_PyDBFrame";
+static const char __pyx_k_threadingCurrentThread[] = "threadingCurrentThread";
+static const char __pyx_k_pydevd_traceproperty_py[] = "pydevd_traceproperty.py";
+static const char __pyx_k_finish_debugging_session[] = "_finish_debugging_session";
+static const char __pyx_k_first_breakpoint_reached[] = "first_breakpoint_reached";
+static const char __pyx_k_get_exception_breakpoint[] = "get_exception_breakpoint";
+static const char __pyx_k_global_cache_frame_skips[] = "global_cache_frame_skips";
+static const char __pyx_k_process_thread_not_alive[] = "_process_thread_not_alive";
+static const char __pyx_k_should_stop_on_exception[] = "should_stop_on_exception";
+static const char __pyx_k_CMD_STEP_CAUGHT_EXCEPTION[] = "CMD_STEP_CAUGHT_EXCEPTION";
+static const char __pyx_k_first_appearance_in_scope[] = "first_appearance_in_scope";
+static const char __pyx_k_pydevd_bundle_pydevd_comm[] = "_pydevd_bundle.pydevd_comm";
+static const char __pyx_k_pyx_unpickle_ThreadTracer[] = "__pyx_unpickle_ThreadTracer";
+static const char __pyx_k_remove_return_values_flag[] = "remove_return_values_flag";
+static const char __pyx_k_send_signature_call_trace[] = "send_signature_call_trace";
+static const char __pyx_k_suspend_all_other_threads[] = "suspend_all_other_threads";
+static const char __pyx_k_add_additional_frame_by_id[] = "add_additional_frame_by_id";
+static const char __pyx_k_break_on_caught_exceptions[] = "break_on_caught_exceptions";
+static const char __pyx_k_notify_on_first_raise_only[] = "notify_on_first_raise_only";
+static const char __pyx_k_pydevd_bundle_pydevd_utils[] = "_pydevd_bundle.pydevd_utils";
+static const char __pyx_k_State_s_Stop_s_Cmd_s_Kill_s[] = "State:%s Stop:%s Cmd: %s Kill:%s";
+static const char __pyx_k_handle_breakpoint_condition[] = "handle_breakpoint_condition";
+static const char __pyx_k_has_plugin_exception_breaks[] = "has_plugin_exception_breaks";
+static const char __pyx_k_pydevd_bundle_pydevd_cython[] = "_pydevd_bundle.pydevd_cython";
+static const char __pyx_k_send_caught_exception_stack[] = "send_caught_exception_stack";
+static const char __pyx_k_send_signature_return_trace[] = "send_signature_return_trace";
+static const char __pyx_k_handle_breakpoint_expression[] = "handle_breakpoint_expression";
+static const char __pyx_k_pyx_unpickle_SafeCallWrapper[] = "__pyx_unpickle_SafeCallWrapper";
+static const char __pyx_k_NORM_PATHS_AND_BASE_CONTAINER[] = "NORM_PATHS_AND_BASE_CONTAINER";
+static const char __pyx_k_remove_additional_frame_by_id[] = "remove_additional_frame_by_id";
+static const char __pyx_k_pydevd_bundle_pydevd_constants[] = "_pydevd_bundle.pydevd_constants";
+static const char __pyx_k_pydevd_bundle_pydevd_signature[] = "_pydevd_bundle.pydevd_signature";
+static const char __pyx_k_pyx_unpickle_PyDBAdditionalThr[] = "__pyx_unpickle_PyDBAdditionalThreadInfo";
+static const char __pyx_k_Ignore_exception_s_in_library_s[] = "Ignore exception %s in library %s";
+static const char __pyx_k_get_abs_path_real_path_and_base[] = "get_abs_path_real_path_and_base_from_frame";
+static const char __pyx_k_pydev_bundle_pydev_is_thread_al[] = "_pydev_bundle.pydev_is_thread_alive";
+static const char __pyx_k_pydev_imps__pydev_saved_modules[] = "_pydev_imps._pydev_saved_modules";
+static const char __pyx_k_pydevd_bundle_pydevd_additional[] = "_pydevd_bundle.pydevd_additional_thread_info_regular";
+static const char __pyx_k_pydevd_bundle_pydevd_breakpoint[] = "_pydevd_bundle.pydevd_breakpoints";
+static const char __pyx_k_pydevd_bundle_pydevd_cython_pyx[] = "_pydevd_bundle\\pydevd_cython.pyx";
+static const char __pyx_k_pydevd_bundle_pydevd_dont_trace[] = "_pydevd_bundle.pydevd_dont_trace_files";
+static const char __pyx_k_pydevd_bundle_pydevd_frame_util[] = "_pydevd_bundle.pydevd_frame_utils";
+static const char __pyx_k_pydevd_bundle_pydevd_kill_all_p[] = "_pydevd_bundle.pydevd_kill_all_pydevd_threads";
+static const char __pyx_k_set_trace_for_frame_and_parents[] = "set_trace_for_frame_and_parents";
+static const char __pyx_k_suspend_on_breakpoint_exception[] = "suspend_on_breakpoint_exception";
+static const char __pyx_k_Error_while_evaluating_expressio[] = "Error while evaluating expression: %s\n";
+static const char __pyx_k_Incompatible_checksums_s_vs_0x3d[] = "Incompatible checksums (%s vs 0x3d7902a = (_args))";
+static const char __pyx_k_Incompatible_checksums_s_vs_0x77[] = "Incompatible checksums (%s vs 0x77c077b = (method_object))";
+static const char __pyx_k_Incompatible_checksums_s_vs_0xa9[] = "Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))";
+static const char __pyx_k_Incompatible_checksums_s_vs_0xfa[] = "Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))";
+static const char __pyx_k_Unable_to_proceed_sys__current_f[] = "Unable to proceed (sys._current_frames not available in this Python implementation).";
+static const char __pyx_k_break_on_exceptions_thrown_in_sa[] = "break_on_exceptions_thrown_in_same_context";
+static const char __pyx_k_conditional_breakpoint_exception[] = "conditional_breakpoint_exception";
+static const char __pyx_k_filename_to_lines_where_exceptio[] = "filename_to_lines_where_exceptions_are_ignored";
+static const char __pyx_k_ignore_exceptions_thrown_in_line[] = "ignore_exceptions_thrown_in_lines_with_ignore_exception";
+static const char __pyx_k_send_caught_exception_stack_proc[] = "send_caught_exception_stack_proceeded";
+static PyObject *__pyx_kp_s_;
+static PyObject *__pyx_n_s_ALL;
+static PyObject *__pyx_n_s_AttributeError;
+static PyObject *__pyx_n_s_CMD_RUN_TO_LINE;
+static PyObject *__pyx_n_s_CMD_SET_BREAK;
+static PyObject *__pyx_n_s_CMD_SET_NEXT_STATEMENT;
+static PyObject *__pyx_n_s_CMD_SMART_STEP_INTO;
+static PyObject *__pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION;
+static PyObject *__pyx_n_s_CMD_STEP_INTO;
+static PyObject *__pyx_n_s_CMD_STEP_INTO_MY_CODE;
+static PyObject *__pyx_n_s_CMD_STEP_OVER;
+static PyObject *__pyx_n_s_CMD_STEP_RETURN;
+static PyObject *__pyx_n_s_CO_GENERATOR;
+static PyObject *__pyx_kp_s_Condition;
+static PyObject *__pyx_n_s_DEBUG_START;
+static PyObject *__pyx_n_s_DEBUG_START_PY3K;
+static PyObject *__pyx_n_s_DONT_TRACE;
+static PyObject *__pyx_kp_s_Error;
+static PyObject *__pyx_kp_s_Error_while_evaluating_expressio;
+static PyObject *__pyx_n_s_GeneratorExit;
+static PyObject *__pyx_n_s_IGNORE_EXCEPTION_TAG;
+static PyObject *__pyx_n_s_IS_IRONPYTHON;
+static PyObject *__pyx_n_s_IS_JYTHON;
+static PyObject *__pyx_n_s_IS_PY3K;
+static PyObject *__pyx_kp_s_IgnoreException;
+static PyObject *__pyx_kp_s_Ignore_exception_s_in_library_s;
+static PyObject *__pyx_n_s_ImportError;
+static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x3d;
+static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x77;
+static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xa9;
+static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xfa;
+static PyObject *__pyx_n_s_KeyboardInterrupt;
+static PyObject *__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER;
+static PyObject *__pyx_n_s_NoSuchFieldException;
+static PyObject *__pyx_n_s_None;
+static PyObject *__pyx_n_s_PYDEV_FILE;
+static PyObject *__pyx_n_s_PYTHON_SUSPEND;
+static PyObject *__pyx_n_s_PickleError;
+static PyObject *__pyx_n_s_RETURN_VALUES_DICT;
+static PyObject *__pyx_n_s_RuntimeError;
+static PyObject *__pyx_n_s_STATE_RUN;
+static PyObject *__pyx_n_s_STATE_SUSPEND;
+static PyObject *__pyx_n_s_SetTrace;
+static PyObject *__pyx_kp_s_State_s_Stop_s_Cmd_s_Kill_s;
+static PyObject *__pyx_n_s_StopIteration;
+static PyObject *__pyx_n_s_SystemExit;
+static PyObject *__pyx_n_s_TRACE_PROPERTY;
+static PyObject *__pyx_n_s_ThreadStateMapping;
+static PyObject *__pyx_kp_s_Unable_to_proceed_sys__current_f;
+static PyObject *__pyx_kp_s__5;
+static PyObject *__pyx_n_s_accessible;
+static PyObject *__pyx_n_s_add_additional_frame_by_id;
+static PyObject *__pyx_n_s_add_exception_to_frame;
+static PyObject *__pyx_n_s_additional_info;
+static PyObject *__pyx_n_s_arg;
+static PyObject *__pyx_n_s_args;
+static PyObject *__pyx_n_s_args_2;
+static PyObject *__pyx_n_s_as_array;
+static PyObject *__pyx_n_s_asyncio_analyser;
+static PyObject *__pyx_n_s_basename;
+static PyObject *__pyx_n_s_break_on_caught_exceptions;
+static PyObject *__pyx_n_s_break_on_exceptions_thrown_in_sa;
+static PyObject *__pyx_n_s_breakpoint;
+static PyObject *__pyx_n_s_breakpoints;
+static PyObject *__pyx_n_s_cachedThreadState;
+static PyObject *__pyx_n_s_call;
+static PyObject *__pyx_n_s_call_2;
+static PyObject *__pyx_n_s_can_not_skip;
+static PyObject *__pyx_n_s_checkcache;
+static PyObject *__pyx_n_s_clear;
+static PyObject *__pyx_n_s_cline_in_traceback;
+static PyObject *__pyx_n_s_cmd_step_into;
+static PyObject *__pyx_n_s_cmd_step_over;
+static PyObject *__pyx_n_s_co_filename;
+static PyObject *__pyx_n_s_co_firstlineno;
+static PyObject *__pyx_n_s_co_flags;
+static PyObject *__pyx_n_s_co_name;
+static PyObject *__pyx_n_s_compile;
+static PyObject *__pyx_n_s_condition;
+static PyObject *__pyx_n_s_conditional_breakpoint_exception;
+static PyObject *__pyx_n_s_currentThread;
+static PyObject *__pyx_n_s_current_frames;
+static PyObject *__pyx_n_s_debug;
+static PyObject *__pyx_n_s_default_return_value;
+static PyObject *__pyx_n_s_dict;
+static PyObject *__pyx_n_s_dict_iter_values;
+static PyObject *__pyx_n_s_do_wait_suspend;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_n_s_entrySet;
+static PyObject *__pyx_n_s_error;
+static PyObject *__pyx_n_s_etype;
+static PyObject *__pyx_n_s_eval;
+static PyObject *__pyx_n_s_event;
+static PyObject *__pyx_n_s_exc_info;
+static PyObject *__pyx_n_s_exception;
+static PyObject *__pyx_n_s_exception_break;
+static PyObject *__pyx_n_s_execfile;
+static PyObject *__pyx_n_s_expression;
+static PyObject *__pyx_n_s_extract_stack;
+static PyObject *__pyx_n_s_f;
+static PyObject *__pyx_n_s_f_back;
+static PyObject *__pyx_n_s_f_code;
+static PyObject *__pyx_n_s_f_globals;
+static PyObject *__pyx_n_s_f_lineno;
+static PyObject *__pyx_n_s_f_locals;
+static PyObject *__pyx_n_s_f_trace;
+static PyObject *__pyx_n_s_filename_to_lines_where_exceptio;
+static PyObject *__pyx_n_s_filename_to_stat_info;
+static PyObject *__pyx_n_s_finish_debugging_session;
+static PyObject *__pyx_n_s_first_appearance_in_scope;
+static PyObject *__pyx_n_s_first_breakpoint_reached;
+static PyObject *__pyx_n_s_format_exception_only;
+static PyObject *__pyx_n_s_frame;
+static PyObject *__pyx_n_s_func_name;
+static PyObject *__pyx_n_s_get;
+static PyObject *__pyx_n_s_getDeclaredField;
+static PyObject *__pyx_n_s_getId;
+static PyObject *__pyx_n_s_getKey;
+static PyObject *__pyx_n_s_getValue;
+static PyObject *__pyx_n_s_get_abs_path_real_path_and_base;
+static PyObject *__pyx_n_s_get_breakpoint;
+static PyObject *__pyx_n_s_get_clsname_for_code;
+static PyObject *__pyx_n_s_get_exception_breakpoint;
+static PyObject *__pyx_n_s_get_file_type;
+static PyObject *__pyx_n_s_get_func_name;
+static PyObject *__pyx_n_s_get_thread_id;
+static PyObject *__pyx_n_s_getline;
+static PyObject *__pyx_n_s_globalThreadStates;
+static PyObject *__pyx_n_s_global_cache_frame_skips;
+static PyObject *__pyx_n_s_global_cache_skips;
+static PyObject *__pyx_n_s_handle_breakpoint_condition;
+static PyObject *__pyx_n_s_handle_breakpoint_expression;
+static PyObject *__pyx_n_s_handle_exception;
+static PyObject *__pyx_n_s_has_plugin_exception_breaks;
+static PyObject *__pyx_n_s_has_plugin_line_breaks;
+static PyObject *__pyx_n_s_id;
+static PyObject *__pyx_n_s_ident;
+static PyObject *__pyx_n_s_ignore_exceptions_thrown_in_line;
+static PyObject *__pyx_n_s_ignore_libraries;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_info;
+static PyObject *__pyx_n_s_inspect;
+static PyObject *__pyx_kp_s_invalid;
+static PyObject *__pyx_n_s_is_filter_enabled;
+static PyObject *__pyx_n_s_is_filter_libraries;
+static PyObject *__pyx_n_s_is_ignored_by_filters;
+static PyObject *__pyx_n_s_is_thread_alive;
+static PyObject *__pyx_n_s_java_lang;
+static PyObject *__pyx_n_s_join;
+static PyObject *__pyx_n_s_just_raised;
+static PyObject *__pyx_n_s_kill_all_pydev_threads;
+static PyObject *__pyx_n_s_kwargs;
+static PyObject *__pyx_n_s_line;
+static PyObject *__pyx_n_s_linecache;
+static PyObject *__pyx_n_s_log_event;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_main_debugger;
+static PyObject *__pyx_n_s_match;
+static PyObject *__pyx_n_s_method_object;
+static PyObject *__pyx_kp_s_module;
+static PyObject *__pyx_n_s_msg;
+static PyObject *__pyx_n_s_new;
+static PyObject *__pyx_n_s_new_frame;
+static PyObject *__pyx_n_s_not_in_scope;
+static PyObject *__pyx_n_s_notify_on_first_raise_only;
+static PyObject *__pyx_n_s_org_python_core;
+static PyObject *__pyx_n_s_original_call;
+static PyObject *__pyx_n_s_os;
+static PyObject *__pyx_n_s_os_path;
+static PyObject *__pyx_n_s_output_checker;
+static PyObject *__pyx_n_s_overwrite_prev_trace;
+static PyObject *__pyx_n_s_path;
+static PyObject *__pyx_n_s_pickle;
+static PyObject *__pyx_n_s_plugin;
+static PyObject *__pyx_n_s_pop;
+static PyObject *__pyx_n_s_print_exc;
+static PyObject *__pyx_n_s_process_thread_not_alive;
+static PyObject *__pyx_n_s_py_db;
+static PyObject *__pyx_n_s_pydev_bundle;
+static PyObject *__pyx_n_s_pydev_bundle_pydev_is_thread_al;
+static PyObject *__pyx_n_s_pydev_do_not_trace;
+static PyObject *__pyx_kp_s_pydev_execfile_py;
+static PyObject *__pyx_n_s_pydev_imps__pydev_saved_modules;
+static PyObject *__pyx_n_s_pydev_log;
+static PyObject *__pyx_n_s_pydev_message;
+static PyObject *__pyx_n_s_pydevd_bundle;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_additional;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_breakpoint;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_comm;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_constants;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_cython;
+static PyObject *__pyx_kp_s_pydevd_bundle_pydevd_cython_pyx;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_dont_trace;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_frame_util;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_kill_all_p;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_signature;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_utils;
+static PyObject *__pyx_n_s_pydevd_dont_trace;
+static PyObject *__pyx_n_s_pydevd_file_utils;
+static PyObject *__pyx_kp_s_pydevd_py;
+static PyObject *__pyx_kp_s_pydevd_traceproperty_py;
+static PyObject *__pyx_n_s_pydevd_tracing;
+static PyObject *__pyx_n_s_pydevd_vars;
+static PyObject *__pyx_n_s_pyx_checksum;
+static PyObject *__pyx_n_s_pyx_state;
+static PyObject *__pyx_n_s_pyx_type;
+static PyObject *__pyx_n_s_pyx_unpickle_PyDBAdditionalThr;
+static PyObject *__pyx_n_s_pyx_unpickle_PyDBFrame;
+static PyObject *__pyx_n_s_pyx_unpickle_SafeCallWrapper;
+static PyObject *__pyx_n_s_pyx_unpickle_ThreadTracer;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_qname;
+static PyObject *__pyx_n_s_quitting;
+static PyObject *__pyx_n_s_re;
+static PyObject *__pyx_n_s_reduce_cython;
+static PyObject *__pyx_n_s_remove_additional_frame_by_id;
+static PyObject *__pyx_n_s_remove_return_values;
+static PyObject *__pyx_n_s_remove_return_values_flag;
+static PyObject *__pyx_n_s_result;
+static PyObject *__pyx_n_s_ret;
+static PyObject *__pyx_n_s_return;
+static PyObject *__pyx_n_s_run;
+static PyObject *__pyx_kp_s_s_s;
+static PyObject *__pyx_n_s_self;
+static PyObject *__pyx_n_s_send_caught_exception_stack;
+static PyObject *__pyx_n_s_send_caught_exception_stack_proc;
+static PyObject *__pyx_n_s_send_signature_call_trace;
+static PyObject *__pyx_n_s_send_signature_return_trace;
+static PyObject *__pyx_n_s_set_suspend;
+static PyObject *__pyx_n_s_set_trace_for_frame_and_parents;
+static PyObject *__pyx_n_s_setstate_cython;
+static PyObject *__pyx_n_s_should_stop_on_exception;
+static PyObject *__pyx_n_s_should_trace_hook;
+static PyObject *__pyx_n_s_show_return_values;
+static PyObject *__pyx_n_s_signature_factory;
+static PyObject *__pyx_n_s_st_mtime;
+static PyObject *__pyx_n_s_st_size;
+static PyObject *__pyx_n_s_stack;
+static PyObject *__pyx_n_s_stat;
+static PyObject *__pyx_n_s_stderr;
+static PyObject *__pyx_n_s_stop;
+static PyObject *__pyx_kp_s_stringsource;
+static PyObject *__pyx_n_s_suspend;
+static PyObject *__pyx_n_s_suspend_all_other_threads;
+static PyObject *__pyx_n_s_suspend_on_breakpoint_exception;
+static PyObject *__pyx_n_s_suspend_policy;
+static PyObject *__pyx_n_s_sys;
+static PyObject *__pyx_n_s_t;
+static PyObject *__pyx_n_s_tb;
+static PyObject *__pyx_n_s_tb_frame;
+static PyObject *__pyx_n_s_tb_lineno;
+static PyObject *__pyx_n_s_tb_next;
+static PyObject *__pyx_n_s_termination_event_set;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_thread;
+static PyObject *__pyx_n_s_thread_analyser;
+static PyObject *__pyx_n_s_thread_state;
+static PyObject *__pyx_n_s_thread_states;
+static PyObject *__pyx_n_s_thread_to_state;
+static PyObject *__pyx_n_s_thread_tracer;
+static PyObject *__pyx_n_s_threading;
+static PyObject *__pyx_n_s_threadingCurrentThread;
+static PyObject *__pyx_n_s_tid_to_last_frame;
+static PyObject *__pyx_n_s_toArray;
+static PyObject *__pyx_n_s_trace_dispatch;
+static PyObject *__pyx_n_s_trace_exception;
+static PyObject *__pyx_n_s_trace_return;
+static PyObject *__pyx_n_s_traceback;
+static PyObject *__pyx_n_s_tracer;
+static PyObject *__pyx_n_s_update;
+static PyObject *__pyx_kp_s_utf_8;
+static PyObject *__pyx_n_s_val;
+static PyObject *__pyx_n_s_value;
+static PyObject *__pyx_n_s_version;
+static PyObject *__pyx_n_s_write;
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython__current_frames(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_2_current_frames(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_2iter_frames(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_4__str__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_6__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_8__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_4send_signature_call_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_6handle_breakpoint_condition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_db, PyObject *__pyx_v_info, PyObject *__pyx_v_breakpoint, PyObject *__pyx_v_new_frame, PyObject *__pyx_v_default_return_value); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_8handle_breakpoint_expression(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_breakpoint, PyObject *__pyx_v_info, PyObject *__pyx_v_new_frame); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_2set_suspend(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_4do_wait_suspend(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_6trace_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_8trace_return(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_10should_stop_on_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, CYTHON_UNUSED PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_12handle_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_14get_func_name(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_16show_return_values(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_18remove_return_values(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_main_debugger, PyObject *__pyx_v_frame); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_20trace_dispatch(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_22__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_24__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_10send_signature_call_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12trace_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_db, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v_method_object); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_2__call__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_4__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_6__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_4__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_6__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_14__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_16__pyx_unpickle_PyDBAdditionalThreadInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_18__pyx_unpickle_PyDBFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_20__pyx_unpickle_SafeCallWrapper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_22__pyx_unpickle_ThreadTracer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBFrame(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_ThreadTracer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_4;
+static PyObject *__pyx_int_32;
+static PyObject *__pyx_int_64458794;
+static PyObject *__pyx_int_125568891;
+static PyObject *__pyx_int_177881921;
+static PyObject *__pyx_int_262582659;
+static PyObject *__pyx_int_neg_1;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+static PyObject *__pyx_tuple__6;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__8;
+static PyObject *__pyx_tuple__11;
+static PyObject *__pyx_tuple__12;
+static PyObject *__pyx_tuple__14;
+static PyObject *__pyx_tuple__15;
+static PyObject *__pyx_tuple__16;
+static PyObject *__pyx_tuple__17;
+static PyObject *__pyx_tuple__19;
+static PyObject *__pyx_tuple__21;
+static PyObject *__pyx_tuple__23;
+static PyObject *__pyx_tuple__25;
+static PyObject *__pyx_tuple__27;
+static PyObject *__pyx_tuple__29;
+static PyObject *__pyx_tuple__31;
+static PyObject *__pyx_tuple__33;
+static PyObject *__pyx_codeobj__9;
+static PyObject *__pyx_codeobj__10;
+static PyObject *__pyx_codeobj__13;
+static PyObject *__pyx_codeobj__18;
+static PyObject *__pyx_codeobj__20;
+static PyObject *__pyx_codeobj__22;
+static PyObject *__pyx_codeobj__24;
+static PyObject *__pyx_codeobj__26;
+static PyObject *__pyx_codeobj__28;
+static PyObject *__pyx_codeobj__30;
+static PyObject *__pyx_codeobj__32;
+static PyObject *__pyx_codeobj__34;
+
+/* "_pydevd_bundle/pydevd_cython.pyx":27
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ *
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_1_current_frames(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_1_current_frames = {"_current_frames", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_1_current_frames, METH_NOARGS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_1_current_frames(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_current_frames (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython__current_frames(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython__current_frames(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyObject *__pyx_v_as_array = NULL;
+ PyObject *__pyx_v_ret = NULL;
+ PyObject *__pyx_v_thread_to_state = NULL;
+ PyObject *__pyx_v_thread = NULL;
+ PyObject *__pyx_v_thread_state = NULL;
+ PyObject *__pyx_v_frame = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
+ int __pyx_t_7;
+ int __pyx_t_8;
+ __Pyx_RefNannySetupContext("_current_frames", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":28
+ *
+ * def _current_frames():
+ * as_array = thread_states.entrySet().toArray() # <<<<<<<<<<<<<<
+ * ret = {}
+ * for thread_to_state in as_array:
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_thread_states); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_entrySet); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_toArray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_2) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_as_array = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":29
+ * def _current_frames():
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {} # <<<<<<<<<<<<<<
+ * for thread_to_state in as_array:
+ * thread = thread_to_state.getKey()
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_ret = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":30
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ * for thread_to_state in as_array: # <<<<<<<<<<<<<<
+ * thread = thread_to_state.getKey()
+ * if thread is None:
+ */
+ if (likely(PyList_CheckExact(__pyx_v_as_array)) || PyTuple_CheckExact(__pyx_v_as_array)) {
+ __pyx_t_1 = __pyx_v_as_array; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
+ __pyx_t_6 = NULL;
+ } else {
+ __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_as_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error)
+ }
+ for (;;) {
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ #endif
+ } else {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ #endif
+ }
+ } else {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_1);
+ if (unlikely(!__pyx_t_4)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 30, __pyx_L1_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ }
+ __Pyx_XDECREF_SET(__pyx_v_thread_to_state, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":31
+ * ret = {}
+ * for thread_to_state in as_array:
+ * thread = thread_to_state.getKey() # <<<<<<<<<<<<<<
+ * if thread is None:
+ * continue
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread_to_state, __pyx_n_s_getKey); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_thread, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":32
+ * for thread_to_state in as_array:
+ * thread = thread_to_state.getKey()
+ * if thread is None: # <<<<<<<<<<<<<<
+ * continue
+ * thread_state = thread_to_state.getValue()
+ */
+ __pyx_t_7 = (__pyx_v_thread == Py_None);
+ __pyx_t_8 = (__pyx_t_7 != 0);
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":33
+ * thread = thread_to_state.getKey()
+ * if thread is None:
+ * continue # <<<<<<<<<<<<<<
+ * thread_state = thread_to_state.getValue()
+ * if thread_state is None:
+ */
+ goto __pyx_L3_continue;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":32
+ * for thread_to_state in as_array:
+ * thread = thread_to_state.getKey()
+ * if thread is None: # <<<<<<<<<<<<<<
+ * continue
+ * thread_state = thread_to_state.getValue()
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":34
+ * if thread is None:
+ * continue
+ * thread_state = thread_to_state.getValue() # <<<<<<<<<<<<<<
+ * if thread_state is None:
+ * continue
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread_to_state, __pyx_n_s_getValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_thread_state, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":35
+ * continue
+ * thread_state = thread_to_state.getValue()
+ * if thread_state is None: # <<<<<<<<<<<<<<
+ * continue
+ *
+ */
+ __pyx_t_8 = (__pyx_v_thread_state == Py_None);
+ __pyx_t_7 = (__pyx_t_8 != 0);
+ if (__pyx_t_7) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":36
+ * thread_state = thread_to_state.getValue()
+ * if thread_state is None:
+ * continue # <<<<<<<<<<<<<<
+ *
+ * frame = thread_state.frame
+ */
+ goto __pyx_L3_continue;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":35
+ * continue
+ * thread_state = thread_to_state.getValue()
+ * if thread_state is None: # <<<<<<<<<<<<<<
+ * continue
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":38
+ * continue
+ *
+ * frame = thread_state.frame # <<<<<<<<<<<<<<
+ * if frame is None:
+ * continue
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread_state, __pyx_n_s_frame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_XDECREF_SET(__pyx_v_frame, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":39
+ *
+ * frame = thread_state.frame
+ * if frame is None: # <<<<<<<<<<<<<<
+ * continue
+ *
+ */
+ __pyx_t_7 = (__pyx_v_frame == Py_None);
+ __pyx_t_8 = (__pyx_t_7 != 0);
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":40
+ * frame = thread_state.frame
+ * if frame is None:
+ * continue # <<<<<<<<<<<<<<
+ *
+ * ret[thread.getId()] = frame
+ */
+ goto __pyx_L3_continue;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":39
+ *
+ * frame = thread_state.frame
+ * if frame is None: # <<<<<<<<<<<<<<
+ * continue
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":42
+ * continue
+ *
+ * ret[thread.getId()] = frame # <<<<<<<<<<<<<<
+ * return ret
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread, __pyx_n_s_getId); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(PyDict_SetItem(__pyx_v_ret, __pyx_t_4, __pyx_v_frame) < 0)) __PYX_ERR(0, 42, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":30
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ * for thread_to_state in as_array: # <<<<<<<<<<<<<<
+ * thread = thread_to_state.getKey()
+ * if thread is None:
+ */
+ __pyx_L3_continue:;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":43
+ *
+ * ret[thread.getId()] = frame
+ * return ret # <<<<<<<<<<<<<<
+ *
+ * elif IS_IRONPYTHON:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ret);
+ __pyx_r = __pyx_v_ret;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":27
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ *
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython._current_frames", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_as_array);
+ __Pyx_XDECREF(__pyx_v_ret);
+ __Pyx_XDECREF(__pyx_v_thread_to_state);
+ __Pyx_XDECREF(__pyx_v_thread);
+ __Pyx_XDECREF(__pyx_v_thread_state);
+ __Pyx_XDECREF(__pyx_v_frame);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":49
+ *
+ * # IronPython doesn't have it. Let's use our workaround...
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * return _tid_to_last_frame
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_3_current_frames(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_3_current_frames = {"_current_frames", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_3_current_frames, METH_NOARGS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_3_current_frames(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_current_frames (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_2_current_frames(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_2_current_frames(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("_current_frames", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":50
+ * # IronPython doesn't have it. Let's use our workaround...
+ * def _current_frames():
+ * return _tid_to_last_frame # <<<<<<<<<<<<<<
+ *
+ * else:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_tid_to_last_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":49
+ *
+ * # IronPython doesn't have it. Let's use our workaround...
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * return _tid_to_last_frame
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython._current_frames", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":100
+ * # ENDIF
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * self.pydev_state = STATE_RUN
+ * self.pydev_step_stop = None
+ */
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo___init__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":101
+ *
+ * def __init__(self):
+ * self.pydev_state = STATE_RUN # <<<<<<<<<<<<<<
+ * self.pydev_step_stop = None
+ * self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_STATE_RUN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_self->pydev_state = __pyx_t_2;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":102
+ * def __init__(self):
+ * self.pydev_state = STATE_RUN
+ * self.pydev_step_stop = None # <<<<<<<<<<<<<<
+ * self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ * self.pydev_notify_kill = False
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_step_stop);
+ __pyx_v_self->pydev_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":103
+ * self.pydev_state = STATE_RUN
+ * self.pydev_step_stop = None
+ * self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc. # <<<<<<<<<<<<<<
+ * self.pydev_notify_kill = False
+ * self.pydev_smart_step_stop = None
+ */
+ __pyx_v_self->pydev_step_cmd = -1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":104
+ * self.pydev_step_stop = None
+ * self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ * self.pydev_notify_kill = False # <<<<<<<<<<<<<<
+ * self.pydev_smart_step_stop = None
+ * self.pydev_django_resolve_frame = False
+ */
+ __pyx_v_self->pydev_notify_kill = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":105
+ * self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ * self.pydev_notify_kill = False
+ * self.pydev_smart_step_stop = None # <<<<<<<<<<<<<<
+ * self.pydev_django_resolve_frame = False
+ * self.pydev_call_from_jinja2 = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_smart_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_smart_step_stop);
+ __pyx_v_self->pydev_smart_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":106
+ * self.pydev_notify_kill = False
+ * self.pydev_smart_step_stop = None
+ * self.pydev_django_resolve_frame = False # <<<<<<<<<<<<<<
+ * self.pydev_call_from_jinja2 = None
+ * self.pydev_call_inside_jinja2 = None
+ */
+ __pyx_v_self->pydev_django_resolve_frame = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":107
+ * self.pydev_smart_step_stop = None
+ * self.pydev_django_resolve_frame = False
+ * self.pydev_call_from_jinja2 = None # <<<<<<<<<<<<<<
+ * self.pydev_call_inside_jinja2 = None
+ * self.is_tracing = False
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_from_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_from_jinja2);
+ __pyx_v_self->pydev_call_from_jinja2 = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":108
+ * self.pydev_django_resolve_frame = False
+ * self.pydev_call_from_jinja2 = None
+ * self.pydev_call_inside_jinja2 = None # <<<<<<<<<<<<<<
+ * self.is_tracing = False
+ * self.conditional_breakpoint_exception = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __pyx_v_self->pydev_call_inside_jinja2 = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":109
+ * self.pydev_call_from_jinja2 = None
+ * self.pydev_call_inside_jinja2 = None
+ * self.is_tracing = False # <<<<<<<<<<<<<<
+ * self.conditional_breakpoint_exception = None
+ * self.pydev_message = ''
+ */
+ __pyx_v_self->is_tracing = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":110
+ * self.pydev_call_inside_jinja2 = None
+ * self.is_tracing = False
+ * self.conditional_breakpoint_exception = None # <<<<<<<<<<<<<<
+ * self.pydev_message = ''
+ * self.suspend_type = PYTHON_SUSPEND
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->conditional_breakpoint_exception);
+ __Pyx_DECREF(__pyx_v_self->conditional_breakpoint_exception);
+ __pyx_v_self->conditional_breakpoint_exception = ((PyObject*)Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":111
+ * self.is_tracing = False
+ * self.conditional_breakpoint_exception = None
+ * self.pydev_message = '' # <<<<<<<<<<<<<<
+ * self.suspend_type = PYTHON_SUSPEND
+ * self.pydev_next_line = -1
+ */
+ __Pyx_INCREF(__pyx_kp_s_);
+ __Pyx_GIVEREF(__pyx_kp_s_);
+ __Pyx_GOTREF(__pyx_v_self->pydev_message);
+ __Pyx_DECREF(__pyx_v_self->pydev_message);
+ __pyx_v_self->pydev_message = __pyx_kp_s_;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":112
+ * self.conditional_breakpoint_exception = None
+ * self.pydev_message = ''
+ * self.suspend_type = PYTHON_SUSPEND # <<<<<<<<<<<<<<
+ * self.pydev_next_line = -1
+ * self.pydev_func_name = '.invalid.' # Must match the type in cython
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PYTHON_SUSPEND); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_self->suspend_type = __pyx_t_2;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":113
+ * self.pydev_message = ''
+ * self.suspend_type = PYTHON_SUSPEND
+ * self.pydev_next_line = -1 # <<<<<<<<<<<<<<
+ * self.pydev_func_name = '.invalid.' # Must match the type in cython
+ *
+ */
+ __pyx_v_self->pydev_next_line = -1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":114
+ * self.suspend_type = PYTHON_SUSPEND
+ * self.pydev_next_line = -1
+ * self.pydev_func_name = '.invalid.' # Must match the type in cython # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_INCREF(__pyx_kp_s_invalid);
+ __Pyx_GIVEREF(__pyx_kp_s_invalid);
+ __Pyx_GOTREF(__pyx_v_self->pydev_func_name);
+ __Pyx_DECREF(__pyx_v_self->pydev_func_name);
+ __pyx_v_self->pydev_func_name = __pyx_kp_s_invalid;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":100
+ * # ENDIF
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * self.pydev_state = STATE_RUN
+ * self.pydev_step_stop = None
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":117
+ *
+ *
+ * def iter_frames(self, t): # <<<<<<<<<<<<<<
+ * #sys._current_frames(): dictionary with thread id -> topmost frame
+ * current_frames = _current_frames()
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_3iter_frames(PyObject *__pyx_v_self, PyObject *__pyx_v_t); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_3iter_frames(PyObject *__pyx_v_self, PyObject *__pyx_v_t) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("iter_frames (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_2iter_frames(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_t));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_2iter_frames(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_t) {
+ PyObject *__pyx_v_current_frames = NULL;
+ PyObject *__pyx_v_v = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ __Pyx_RefNannySetupContext("iter_frames", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":119
+ * def iter_frames(self, t):
+ * #sys._current_frames(): dictionary with thread id -> topmost frame
+ * current_frames = _current_frames() # <<<<<<<<<<<<<<
+ * v = current_frames.get(t.ident)
+ * if v is not None:
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_current_frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_current_frames = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":120
+ * #sys._current_frames(): dictionary with thread id -> topmost frame
+ * current_frames = _current_frames()
+ * v = current_frames.get(t.ident) # <<<<<<<<<<<<<<
+ * if v is not None:
+ * return [v]
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_current_frames, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_ident); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_v = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":121
+ * current_frames = _current_frames()
+ * v = current_frames.get(t.ident)
+ * if v is not None: # <<<<<<<<<<<<<<
+ * return [v]
+ * return []
+ */
+ __pyx_t_6 = (__pyx_v_v != Py_None);
+ __pyx_t_7 = (__pyx_t_6 != 0);
+ if (__pyx_t_7) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":122
+ * v = current_frames.get(t.ident)
+ * if v is not None:
+ * return [v] # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_v);
+ __Pyx_GIVEREF(__pyx_v_v);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":121
+ * current_frames = _current_frames()
+ * v = current_frames.get(t.ident)
+ * if v is not None: # <<<<<<<<<<<<<<
+ * return [v]
+ * return []
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":123
+ * if v is not None:
+ * return [v]
+ * return [] # <<<<<<<<<<<<<<
+ *
+ * def __str__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":117
+ *
+ *
+ * def iter_frames(self, t): # <<<<<<<<<<<<<<
+ * #sys._current_frames(): dictionary with thread id -> topmost frame
+ * current_frames = _current_frames()
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.iter_frames", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_current_frames);
+ __Pyx_XDECREF(__pyx_v_v);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":125
+ * return []
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return 'State:%s Stop:%s Cmd: %s Kill:%s' % (
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_5__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_5__str__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_4__str__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_4__str__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ __Pyx_RefNannySetupContext("__str__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":126
+ *
+ * def __str__(self):
+ * return 'State:%s Stop:%s Cmd: %s Kill:%s' % ( # <<<<<<<<<<<<<<
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":127
+ * def __str__(self):
+ * return 'State:%s Stop:%s Cmd: %s Kill:%s' % (
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill) # <<<<<<<<<<<<<<
+ *
+ * import linecache
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_step_cmd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->pydev_notify_kill); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_self->pydev_step_stop);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_step_stop);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->pydev_step_stop);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":126
+ *
+ * def __str__(self):
+ * return 'State:%s Stop:%s Cmd: %s Kill:%s' % ( # <<<<<<<<<<<<<<
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+ *
+ */
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_State_s_Stop_s_Cmd_s_Kill_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":125
+ * return []
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return 'State:%s Stop:%s Cmd: %s Kill:%s' % (
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":67
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef public int pydev_state; # <<<<<<<<<<<<<<
+ * cdef public object pydev_step_stop; # Actually, it's a frame or None
+ * cdef public int pydev_step_cmd;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_state.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error)
+ __pyx_v_self->pydev_state = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_state.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":68
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cdef public int pydev_state;
+ * cdef public object pydev_step_stop; # Actually, it's a frame or None # <<<<<<<<<<<<<<
+ * cdef public int pydev_step_cmd;
+ * cdef public bint pydev_notify_kill;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_step_stop);
+ __pyx_r = __pyx_v_self->pydev_step_stop;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_step_stop);
+ __pyx_v_self->pydev_step_stop = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_step_stop);
+ __pyx_v_self->pydev_step_stop = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":69
+ * cdef public int pydev_state;
+ * cdef public object pydev_step_stop; # Actually, it's a frame or None
+ * cdef public int pydev_step_cmd; # <<<<<<<<<<<<<<
+ * cdef public bint pydev_notify_kill;
+ * cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_step_cmd.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
+ __pyx_v_self->pydev_step_cmd = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_step_cmd.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":70
+ * cdef public object pydev_step_stop; # Actually, it's a frame or None
+ * cdef public int pydev_step_cmd;
+ * cdef public bint pydev_notify_kill; # <<<<<<<<<<<<<<
+ * cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ * cdef public bint pydev_django_resolve_frame;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->pydev_notify_kill); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_notify_kill.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L1_error)
+ __pyx_v_self->pydev_notify_kill = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_notify_kill.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":71
+ * cdef public int pydev_step_cmd;
+ * cdef public bint pydev_notify_kill;
+ * cdef public object pydev_smart_step_stop; # Actually, it's a frame or None # <<<<<<<<<<<<<<
+ * cdef public bint pydev_django_resolve_frame;
+ * cdef public object pydev_call_from_jinja2;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_smart_step_stop);
+ __pyx_r = __pyx_v_self->pydev_smart_step_stop;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->pydev_smart_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_smart_step_stop);
+ __pyx_v_self->pydev_smart_step_stop = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_smart_step_stop);
+ __Pyx_DECREF(__pyx_v_self->pydev_smart_step_stop);
+ __pyx_v_self->pydev_smart_step_stop = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":72
+ * cdef public bint pydev_notify_kill;
+ * cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ * cdef public bint pydev_django_resolve_frame; # <<<<<<<<<<<<<<
+ * cdef public object pydev_call_from_jinja2;
+ * cdef public object pydev_call_inside_jinja2;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->pydev_django_resolve_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_django_resolve_frame.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
+ __pyx_v_self->pydev_django_resolve_frame = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_django_resolve_frame.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":73
+ * cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ * cdef public bint pydev_django_resolve_frame;
+ * cdef public object pydev_call_from_jinja2; # <<<<<<<<<<<<<<
+ * cdef public object pydev_call_inside_jinja2;
+ * cdef public bint is_tracing;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_call_from_jinja2);
+ __pyx_r = __pyx_v_self->pydev_call_from_jinja2;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_from_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_from_jinja2);
+ __pyx_v_self->pydev_call_from_jinja2 = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_from_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_from_jinja2);
+ __pyx_v_self->pydev_call_from_jinja2 = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":74
+ * cdef public bint pydev_django_resolve_frame;
+ * cdef public object pydev_call_from_jinja2;
+ * cdef public object pydev_call_inside_jinja2; # <<<<<<<<<<<<<<
+ * cdef public bint is_tracing;
+ * cdef public tuple conditional_breakpoint_exception;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __pyx_r = __pyx_v_self->pydev_call_inside_jinja2;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __pyx_v_self->pydev_call_inside_jinja2 = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __Pyx_DECREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __pyx_v_self->pydev_call_inside_jinja2 = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":75
+ * cdef public object pydev_call_from_jinja2;
+ * cdef public object pydev_call_inside_jinja2;
+ * cdef public bint is_tracing; # <<<<<<<<<<<<<<
+ * cdef public tuple conditional_breakpoint_exception;
+ * cdef public str pydev_message;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_tracing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.is_tracing.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
+ __pyx_v_self->is_tracing = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.is_tracing.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":76
+ * cdef public object pydev_call_inside_jinja2;
+ * cdef public bint is_tracing;
+ * cdef public tuple conditional_breakpoint_exception; # <<<<<<<<<<<<<<
+ * cdef public str pydev_message;
+ * cdef public int suspend_type;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->conditional_breakpoint_exception);
+ __pyx_r = __pyx_v_self->conditional_breakpoint_exception;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 76, __pyx_L1_error)
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_self->conditional_breakpoint_exception);
+ __Pyx_DECREF(__pyx_v_self->conditional_breakpoint_exception);
+ __pyx_v_self->conditional_breakpoint_exception = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.conditional_breakpoint_exception.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->conditional_breakpoint_exception);
+ __Pyx_DECREF(__pyx_v_self->conditional_breakpoint_exception);
+ __pyx_v_self->conditional_breakpoint_exception = ((PyObject*)Py_None);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":77
+ * cdef public bint is_tracing;
+ * cdef public tuple conditional_breakpoint_exception;
+ * cdef public str pydev_message; # <<<<<<<<<<<<<<
+ * cdef public int suspend_type;
+ * cdef public int pydev_next_line;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_message);
+ __pyx_r = __pyx_v_self->pydev_message;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 77, __pyx_L1_error)
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_self->pydev_message);
+ __Pyx_DECREF(__pyx_v_self->pydev_message);
+ __pyx_v_self->pydev_message = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_message.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_message);
+ __Pyx_DECREF(__pyx_v_self->pydev_message);
+ __pyx_v_self->pydev_message = ((PyObject*)Py_None);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":78
+ * cdef public tuple conditional_breakpoint_exception;
+ * cdef public str pydev_message;
+ * cdef public int suspend_type; # <<<<<<<<<<<<<<
+ * cdef public int pydev_next_line;
+ * cdef public str pydev_func_name;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->suspend_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.suspend_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
+ __pyx_v_self->suspend_type = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.suspend_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":79
+ * cdef public str pydev_message;
+ * cdef public int suspend_type;
+ * cdef public int pydev_next_line; # <<<<<<<<<<<<<<
+ * cdef public str pydev_func_name;
+ * # ELSE
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_next_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_next_line.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
+ __pyx_v_self->pydev_next_line = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_next_line.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":80
+ * cdef public int suspend_type;
+ * cdef public int pydev_next_line;
+ * cdef public str pydev_func_name; # <<<<<<<<<<<<<<
+ * # ELSE
+ * # __slots__ = [
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->pydev_func_name);
+ __pyx_r = __pyx_v_self->pydev_func_name;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 80, __pyx_L1_error)
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_self->pydev_func_name);
+ __Pyx_DECREF(__pyx_v_self->pydev_func_name);
+ __pyx_v_self->pydev_func_name = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.pydev_func_name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->pydev_func_name);
+ __Pyx_DECREF(__pyx_v_self->pydev_func_name);
+ __pyx_v_self->pydev_func_name = ((PyObject*)Py_None);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_6__reduce_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_6__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self) {
+ int __pyx_v_use_setstate;
+ PyObject *__pyx_v_state = NULL;
+ PyObject *__pyx_v__dict = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_9;
+ int __pyx_t_10;
+ int __pyx_t_11;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 0);
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * cdef bint use_setstate
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type) # <<<<<<<<<<<<<<
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ */
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_tracing); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->pydev_django_resolve_frame); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_next_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->pydev_notify_kill); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_state); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->pydev_step_cmd); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->suspend_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyTuple_New(14); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_self->conditional_breakpoint_exception);
+ __Pyx_GIVEREF(__pyx_v_self->conditional_breakpoint_exception);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self->conditional_breakpoint_exception);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_self->pydev_call_from_jinja2);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_call_from_jinja2);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_self->pydev_call_from_jinja2);
+ __Pyx_INCREF(__pyx_v_self->pydev_call_inside_jinja2);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_call_inside_jinja2);
+ PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_self->pydev_call_inside_jinja2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_2);
+ __Pyx_INCREF(__pyx_v_self->pydev_func_name);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_func_name);
+ PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_self->pydev_func_name);
+ __Pyx_INCREF(__pyx_v_self->pydev_message);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_message);
+ PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_v_self->pydev_message);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_8, 8, __pyx_t_4);
+ __Pyx_INCREF(__pyx_v_self->pydev_smart_step_stop);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_smart_step_stop);
+ PyTuple_SET_ITEM(__pyx_t_8, 9, __pyx_v_self->pydev_smart_step_stop);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_8, 10, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_8, 11, __pyx_t_6);
+ __Pyx_INCREF(__pyx_v_self->pydev_step_stop);
+ __Pyx_GIVEREF(__pyx_v_self->pydev_step_stop);
+ PyTuple_SET_ITEM(__pyx_t_8, 12, __pyx_v_self->pydev_step_stop);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_8, 13, __pyx_t_7);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_6 = 0;
+ __pyx_t_7 = 0;
+ __pyx_v_state = ((PyObject*)__pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "(tree fragment)":4
+ * cdef bint use_setstate
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type)
+ * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
+ * if _dict is not None:
+ * state += _dict,
+ */
+ __pyx_t_8 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_v__dict = __pyx_t_8;
+ __pyx_t_8 = 0;
+
+ /* "(tree fragment)":5
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ __pyx_t_9 = (__pyx_v__dict != Py_None);
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ if (__pyx_t_10) {
+
+ /* "(tree fragment)":6
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ * state += _dict, # <<<<<<<<<<<<<<
+ * use_setstate = True
+ * else:
+ */
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v__dict);
+ __Pyx_GIVEREF(__pyx_v__dict);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v__dict);
+ __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_7));
+ __pyx_t_7 = 0;
+
+ /* "(tree fragment)":7
+ * if _dict is not None:
+ * state += _dict,
+ * use_setstate = True # <<<<<<<<<<<<<<
+ * else:
+ * use_setstate = self.conditional_breakpoint_exception is not None or self.pydev_call_from_jinja2 is not None or self.pydev_call_inside_jinja2 is not None or self.pydev_func_name is not None or self.pydev_message is not None or self.pydev_smart_step_stop is not None or self.pydev_step_stop is not None
+ */
+ __pyx_v_use_setstate = 1;
+
+ /* "(tree fragment)":5
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ goto __pyx_L3;
+ }
+
+ /* "(tree fragment)":9
+ * use_setstate = True
+ * else:
+ * use_setstate = self.conditional_breakpoint_exception is not None or self.pydev_call_from_jinja2 is not None or self.pydev_call_inside_jinja2 is not None or self.pydev_func_name is not None or self.pydev_message is not None or self.pydev_smart_step_stop is not None or self.pydev_step_stop is not None # <<<<<<<<<<<<<<
+ * if use_setstate:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, None), state
+ */
+ /*else*/ {
+ __pyx_t_9 = (__pyx_v_self->conditional_breakpoint_exception != ((PyObject*)Py_None));
+ __pyx_t_11 = (__pyx_t_9 != 0);
+ if (!__pyx_t_11) {
+ } else {
+ __pyx_t_10 = __pyx_t_11;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_11 = (__pyx_v_self->pydev_call_from_jinja2 != Py_None);
+ __pyx_t_9 = (__pyx_t_11 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_self->pydev_call_inside_jinja2 != Py_None);
+ __pyx_t_11 = (__pyx_t_9 != 0);
+ if (!__pyx_t_11) {
+ } else {
+ __pyx_t_10 = __pyx_t_11;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_11 = (__pyx_v_self->pydev_func_name != ((PyObject*)Py_None));
+ __pyx_t_9 = (__pyx_t_11 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_self->pydev_message != ((PyObject*)Py_None));
+ __pyx_t_11 = (__pyx_t_9 != 0);
+ if (!__pyx_t_11) {
+ } else {
+ __pyx_t_10 = __pyx_t_11;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_11 = (__pyx_v_self->pydev_smart_step_stop != Py_None);
+ __pyx_t_9 = (__pyx_t_11 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_self->pydev_step_stop != Py_None);
+ __pyx_t_11 = (__pyx_t_9 != 0);
+ __pyx_t_10 = __pyx_t_11;
+ __pyx_L4_bool_binop_done:;
+ __pyx_v_use_setstate = __pyx_t_10;
+ }
+ __pyx_L3:;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self.conditional_breakpoint_exception is not None or self.pydev_call_from_jinja2 is not None or self.pydev_call_inside_jinja2 is not None or self.pydev_func_name is not None or self.pydev_message is not None or self.pydev_smart_step_stop is not None or self.pydev_step_stop is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, None), state
+ * else:
+ */
+ __pyx_t_10 = (__pyx_v_use_setstate != 0);
+ if (__pyx_t_10) {
+
+ /* "(tree fragment)":11
+ * use_setstate = self.conditional_breakpoint_exception is not None or self.pydev_call_from_jinja2 is not None or self.pydev_call_inside_jinja2 is not None or self.pydev_func_name is not None or self.pydev_message is not None or self.pydev_smart_step_stop is not None or self.pydev_step_stop is not None
+ * if use_setstate:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, None), state # <<<<<<<<<<<<<<
+ * else:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, state)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_PyDBAdditionalThr); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_177881921);
+ __Pyx_GIVEREF(__pyx_int_177881921);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_177881921);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, Py_None);
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
+ __pyx_t_7 = 0;
+ __pyx_t_8 = 0;
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self.conditional_breakpoint_exception is not None or self.pydev_call_from_jinja2 is not None or self.pydev_call_inside_jinja2 is not None or self.pydev_func_name is not None or self.pydev_message is not None or self.pydev_smart_step_stop is not None or self.pydev_step_stop is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, None), state
+ * else:
+ */
+ }
+
+ /* "(tree fragment)":13
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, None), state
+ * else:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, state) # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(self, __pyx_state)
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_PyDBAdditionalThr); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_177881921);
+ __Pyx_GIVEREF(__pyx_int_177881921);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_177881921);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
+ __pyx_t_6 = 0;
+ __pyx_t_8 = 0;
+ __pyx_r = __pyx_t_7;
+ __pyx_t_7 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self.conditional_breakpoint_exception, self.is_tracing, self.pydev_call_from_jinja2, self.pydev_call_inside_jinja2, self.pydev_django_resolve_frame, self.pydev_func_name, self.pydev_message, self.pydev_next_line, self.pydev_notify_kill, self.pydev_smart_step_stop, self.pydev_state, self.pydev_step_cmd, self.pydev_step_stop, self.suspend_type)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_state);
+ __Pyx_XDECREF(__pyx_v__dict);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(self, __pyx_state)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_8__setstate_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_8__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 0);
+
+ /* "(tree fragment)":15
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, state)
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
+ __pyx_t_1 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBAdditionalThreadInfo__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_PyDBAdditionalThreadInfo, (type(self), 0xa9a4341, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(self, __pyx_state)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":155
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_5send_signature_call_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_5send_signature_call_trace = {"send_signature_call_trace", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_5send_signature_call_trace, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_5send_signature_call_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_args = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("send_signature_call_trace (wrapper)", 0);
+ if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "send_signature_call_trace", 1))) return NULL;
+ __Pyx_INCREF(__pyx_args);
+ __pyx_v_args = __pyx_args;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_4send_signature_call_trace(__pyx_self, __pyx_v_args, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_4send_signature_call_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("send_signature_call_trace", 0);
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":167
+ *
+ *
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value): # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * try:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_7handle_breakpoint_condition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_7handle_breakpoint_condition = {"handle_breakpoint_condition", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_7handle_breakpoint_condition, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_7handle_breakpoint_condition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_py_db = 0;
+ PyObject *__pyx_v_info = 0;
+ PyObject *__pyx_v_breakpoint = 0;
+ PyObject *__pyx_v_new_frame = 0;
+ PyObject *__pyx_v_default_return_value = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("handle_breakpoint_condition (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_db,&__pyx_n_s_info,&__pyx_n_s_breakpoint,&__pyx_n_s_new_frame,&__pyx_n_s_default_return_value,0};
+ PyObject* values[5] = {0,0,0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+ CYTHON_FALLTHROUGH;
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ CYTHON_FALLTHROUGH;
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_py_db)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_condition", 1, 5, 5, 1); __PYX_ERR(0, 167, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_breakpoint)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_condition", 1, 5, 5, 2); __PYX_ERR(0, 167, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 3:
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_frame)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_condition", 1, 5, 5, 3); __PYX_ERR(0, 167, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 4:
+ if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default_return_value)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_condition", 1, 5, 5, 4); __PYX_ERR(0, 167, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "handle_breakpoint_condition") < 0)) __PYX_ERR(0, 167, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+ }
+ __pyx_v_py_db = values[0];
+ __pyx_v_info = values[1];
+ __pyx_v_breakpoint = values[2];
+ __pyx_v_new_frame = values[3];
+ __pyx_v_default_return_value = values[4];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_condition", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 167, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_condition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_6handle_breakpoint_condition(__pyx_self, __pyx_v_py_db, __pyx_v_info, __pyx_v_breakpoint, __pyx_v_new_frame, __pyx_v_default_return_value);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_6handle_breakpoint_condition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_db, PyObject *__pyx_v_info, PyObject *__pyx_v_breakpoint, PyObject *__pyx_v_new_frame, PyObject *__pyx_v_default_return_value) {
+ PyObject *__pyx_v_condition = NULL;
+ PyObject *__pyx_v_val = NULL;
+ PyObject *__pyx_v_msg = NULL;
+ CYTHON_UNUSED int __pyx_v_stop;
+ PyObject *__pyx_v_etype = NULL;
+ PyObject *__pyx_v_value = NULL;
+ PyObject *__pyx_v_tb = NULL;
+ PyObject *__pyx_v_error = NULL;
+ PyObject *__pyx_v_stack = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *(*__pyx_t_17)(PyObject *);
+ int __pyx_t_18;
+ int __pyx_t_19;
+ char const *__pyx_t_20;
+ PyObject *__pyx_t_21 = NULL;
+ PyObject *__pyx_t_22 = NULL;
+ PyObject *__pyx_t_23 = NULL;
+ PyObject *__pyx_t_24 = NULL;
+ PyObject *__pyx_t_25 = NULL;
+ PyObject *__pyx_t_26 = NULL;
+ PyObject *__pyx_t_27 = NULL;
+ __Pyx_RefNannySetupContext("handle_breakpoint_condition", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":168
+ *
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ * condition = breakpoint.condition # <<<<<<<<<<<<<<
+ * try:
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_condition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_condition = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":169
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ * condition = breakpoint.condition
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":170
+ * condition = breakpoint.condition
+ * try:
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals) # <<<<<<<<<<<<<<
+ * if not val:
+ * return default_return_value
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_frame, __pyx_n_s_f_globals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_frame, __pyx_n_s_f_locals); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_condition);
+ __Pyx_GIVEREF(__pyx_v_condition);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_condition);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_eval, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_val = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":171
+ * try:
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val: # <<<<<<<<<<<<<<
+ * return default_return_value
+ *
+ */
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 171, __pyx_L3_error)
+ __pyx_t_8 = ((!__pyx_t_7) != 0);
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":172
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val:
+ * return default_return_value # <<<<<<<<<<<<<<
+ *
+ * except:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_default_return_value);
+ __pyx_r = __pyx_v_default_return_value;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":171
+ * try:
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val: # <<<<<<<<<<<<<<
+ * return default_return_value
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":169
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ * condition = breakpoint.condition
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L8_try_end;
+ __pyx_L3_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":174
+ * return default_return_value
+ *
+ * except: # <<<<<<<<<<<<<<
+ * if type(condition) != type(''):
+ * if hasattr(condition, 'encode'):
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_condition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 174, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":175
+ *
+ * except:
+ * if type(condition) != type(''): # <<<<<<<<<<<<<<
+ * if hasattr(condition, 'encode'):
+ * condition = condition.encode('utf-8')
+ */
+ __pyx_t_9 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_condition)), ((PyObject *)Py_TYPE(__pyx_kp_s_)), Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L5_except_error)
+ __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 175, __pyx_L5_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":176
+ * except:
+ * if type(condition) != type(''):
+ * if hasattr(condition, 'encode'): # <<<<<<<<<<<<<<
+ * condition = condition.encode('utf-8')
+ *
+ */
+ __pyx_t_8 = __Pyx_HasAttr(__pyx_v_condition, __pyx_n_s_encode); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 176, __pyx_L5_except_error)
+ __pyx_t_7 = (__pyx_t_8 != 0);
+ if (__pyx_t_7) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":177
+ * if type(condition) != type(''):
+ * if hasattr(condition, 'encode'):
+ * condition = condition.encode('utf-8') # <<<<<<<<<<<<<<
+ *
+ * msg = 'Error while evaluating expression: %s\n' % (condition,)
+ */
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_condition, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 177, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 177, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF_SET(__pyx_v_condition, __pyx_t_10);
+ __pyx_t_10 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":176
+ * except:
+ * if type(condition) != type(''):
+ * if hasattr(condition, 'encode'): # <<<<<<<<<<<<<<
+ * condition = condition.encode('utf-8')
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":175
+ *
+ * except:
+ * if type(condition) != type(''): # <<<<<<<<<<<<<<
+ * if hasattr(condition, 'encode'):
+ * condition = condition.encode('utf-8')
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":179
+ * condition = condition.encode('utf-8')
+ *
+ * msg = 'Error while evaluating expression: %s\n' % (condition,) # <<<<<<<<<<<<<<
+ * sys.stderr.write(msg)
+ * traceback.print_exc()
+ */
+ __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 179, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_INCREF(__pyx_v_condition);
+ __Pyx_GIVEREF(__pyx_v_condition);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_condition);
+ __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_evaluating_expressio, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_v_msg = ((PyObject*)__pyx_t_9);
+ __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":180
+ *
+ * msg = 'Error while evaluating expression: %s\n' % (condition,)
+ * sys.stderr.write(msg) # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * if not py_db.suspend_on_breakpoint_exception:
+ */
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_stderr); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_msg); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_msg};
+ __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_msg};
+ __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ } else
+ #endif
+ {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
+ __Pyx_INCREF(__pyx_v_msg);
+ __Pyx_GIVEREF(__pyx_v_msg);
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_msg);
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":181
+ * msg = 'Error while evaluating expression: %s\n' % (condition,)
+ * sys.stderr.write(msg)
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * if not py_db.suspend_on_breakpoint_exception:
+ * return default_return_value
+ */
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 181, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L5_except_error)
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L5_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":182
+ * sys.stderr.write(msg)
+ * traceback.print_exc()
+ * if not py_db.suspend_on_breakpoint_exception: # <<<<<<<<<<<<<<
+ * return default_return_value
+ * else:
+ */
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_suspend_on_breakpoint_exception); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 182, __pyx_L5_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_8 = ((!__pyx_t_7) != 0);
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":183
+ * traceback.print_exc()
+ * if not py_db.suspend_on_breakpoint_exception:
+ * return default_return_value # <<<<<<<<<<<<<<
+ * else:
+ * stop = True
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_default_return_value);
+ __pyx_r = __pyx_v_default_return_value;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L6_except_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":182
+ * sys.stderr.write(msg)
+ * traceback.print_exc()
+ * if not py_db.suspend_on_breakpoint_exception: # <<<<<<<<<<<<<<
+ * return default_return_value
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":185
+ * return default_return_value
+ * else:
+ * stop = True # <<<<<<<<<<<<<<
+ * try:
+ * # add exception_type and stacktrace into thread additional info
+ */
+ /*else*/ {
+ __pyx_v_stop = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":186
+ * else:
+ * stop = True
+ * try: # <<<<<<<<<<<<<<
+ * # add exception_type and stacktrace into thread additional info
+ * etype, value, tb = sys.exc_info()
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":188
+ * try:
+ * # add exception_type and stacktrace into thread additional info
+ * etype, value, tb = sys.exc_info() # <<<<<<<<<<<<<<
+ * try:
+ * error = ''.join(traceback.format_exception_only(etype, value))
+ */
+ __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (__pyx_t_12) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ } else {
+ __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 188, __pyx_L15_error)
+ }
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
+ PyObject* sequence = __pyx_t_9;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 188, __pyx_L15_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
+ } else {
+ __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
+ }
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_11);
+ #else
+ __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ #endif
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_16 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 188, __pyx_L15_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
+ index = 0; __pyx_t_10 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_10)) goto __pyx_L23_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_10);
+ index = 1; __pyx_t_12 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_12)) goto __pyx_L23_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ index = 2; __pyx_t_11 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_11)) goto __pyx_L23_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_11);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 3) < 0) __PYX_ERR(0, 188, __pyx_L15_error)
+ __pyx_t_17 = NULL;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L24_unpacking_done;
+ __pyx_L23_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_17 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 188, __pyx_L15_error)
+ __pyx_L24_unpacking_done:;
+ }
+ __pyx_v_etype = __pyx_t_10;
+ __pyx_t_10 = 0;
+ __pyx_v_value = __pyx_t_12;
+ __pyx_t_12 = 0;
+ __pyx_v_tb = __pyx_t_11;
+ __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":189
+ * # add exception_type and stacktrace into thread additional info
+ * etype, value, tb = sys.exc_info()
+ * try: # <<<<<<<<<<<<<<
+ * error = ''.join(traceback.format_exception_only(etype, value))
+ * stack = traceback.extract_stack(f=tb.tb_frame.f_back)
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":190
+ * etype, value, tb = sys.exc_info()
+ * try:
+ * error = ''.join(traceback.format_exception_only(etype, value)) # <<<<<<<<<<<<<<
+ * stack = traceback.extract_stack(f=tb.tb_frame.f_back)
+ *
+ */
+ __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exception_only); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = NULL;
+ __pyx_t_18 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ __pyx_t_18 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_12)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_etype, __pyx_v_value};
+ __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_etype, __pyx_v_value};
+ __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ if (__pyx_t_11) {
+ __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_etype);
+ __Pyx_GIVEREF(__pyx_v_etype);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_18, __pyx_v_etype);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_18, __pyx_v_value);
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 190, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_v_error = ((PyObject*)__pyx_t_12);
+ __pyx_t_12 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":191
+ * try:
+ * error = ''.join(traceback.format_exception_only(etype, value))
+ * stack = traceback.extract_stack(f=tb.tb_frame.f_back) # <<<<<<<<<<<<<<
+ *
+ * # On self.set_suspend(thread, CMD_SET_BREAK) this info will be
+ */
+ __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_extract_stack); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_tb, __pyx_n_s_tb_frame); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_f_back); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_f, __pyx_t_11) < 0) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 191, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_v_stack = __pyx_t_11;
+ __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":196
+ * # sent to the client.
+ * info.conditional_breakpoint_exception = \
+ * ('Condition:\n' + condition + '\n\nError:\n' + error, stack) # <<<<<<<<<<<<<<
+ * finally:
+ * etype, value, tb = None, None, None
+ */
+ __pyx_t_11 = PyNumber_Add(__pyx_kp_s_Condition, __pyx_v_condition); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_12 = PyNumber_Add(__pyx_t_11, __pyx_kp_s_Error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 196, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyNumber_Add(__pyx_t_12, __pyx_v_error); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 196, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
+ __Pyx_INCREF(__pyx_v_stack);
+ __Pyx_GIVEREF(__pyx_v_stack);
+ PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_stack);
+ __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":195
+ * # On self.set_suspend(thread, CMD_SET_BREAK) this info will be
+ * # sent to the client.
+ * info.conditional_breakpoint_exception = \ # <<<<<<<<<<<<<<
+ * ('Condition:\n' + condition + '\n\nError:\n' + error, stack)
+ * finally:
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_info, __pyx_n_s_conditional_breakpoint_exception, __pyx_t_12) < 0) __PYX_ERR(0, 195, __pyx_L28_error)
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":198
+ * ('Condition:\n' + condition + '\n\nError:\n' + error, stack)
+ * finally:
+ * etype, value, tb = None, None, None # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __pyx_t_12 = Py_None;
+ __Pyx_INCREF(__pyx_t_12);
+ __pyx_t_11 = Py_None;
+ __Pyx_INCREF(__pyx_t_11);
+ __pyx_t_9 = Py_None;
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_DECREF_SET(__pyx_v_etype, __pyx_t_12);
+ __pyx_t_12 = 0;
+ __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_11);
+ __pyx_t_11 = 0;
+ __Pyx_DECREF_SET(__pyx_v_tb, __pyx_t_9);
+ __pyx_t_9 = 0;
+ goto __pyx_L29;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L28_error:;
+ __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_21);
+ __Pyx_XGOTREF(__pyx_t_22);
+ __Pyx_XGOTREF(__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_24);
+ __Pyx_XGOTREF(__pyx_t_25);
+ __Pyx_XGOTREF(__pyx_t_26);
+ __pyx_t_18 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
+ {
+ __pyx_t_9 = Py_None;
+ __Pyx_INCREF(__pyx_t_9);
+ __pyx_t_11 = Py_None;
+ __Pyx_INCREF(__pyx_t_11);
+ __pyx_t_12 = Py_None;
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_DECREF_SET(__pyx_v_etype, __pyx_t_9);
+ __pyx_t_9 = 0;
+ __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_11);
+ __pyx_t_11 = 0;
+ __Pyx_DECREF_SET(__pyx_v_tb, __pyx_t_12);
+ __pyx_t_12 = 0;
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
+ }
+ __Pyx_XGIVEREF(__pyx_t_21);
+ __Pyx_XGIVEREF(__pyx_t_22);
+ __Pyx_XGIVEREF(__pyx_t_23);
+ __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
+ __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
+ goto __pyx_L15_error;
+ }
+ __pyx_L29:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":186
+ * else:
+ * stop = True
+ * try: # <<<<<<<<<<<<<<
+ * # add exception_type and stacktrace into thread additional info
+ * etype, value, tb = sys.exc_info()
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L22_try_end;
+ __pyx_L15_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":199
+ * finally:
+ * etype, value, tb = None, None, None
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_condition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_9) < 0) __PYX_ERR(0, 199, __pyx_L17_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GOTREF(__pyx_t_9);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":200
+ * etype, value, tb = None, None, None
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 200, __pyx_L17_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 200, __pyx_L17_except_error)
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_27);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_27, function);
+ }
+ }
+ if (__pyx_t_16) {
+ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_27, __pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L17_except_error)
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ } else {
+ __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_27); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L17_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L16_exception_handled;
+ }
+ __pyx_L17_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":186
+ * else:
+ * stop = True
+ * try: # <<<<<<<<<<<<<<
+ * # add exception_type and stacktrace into thread additional info
+ * etype, value, tb = sys.exc_info()
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ goto __pyx_L5_except_error;
+ __pyx_L16_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ __pyx_L22_try_end:;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L4_exception_handled;
+ }
+ __pyx_L5_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":169
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ * condition = breakpoint.condition
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ * if not val:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L7_try_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L0;
+ __pyx_L6_except_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L0;
+ __pyx_L4_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ __pyx_L8_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":167
+ *
+ *
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value): # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * try:
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_XDECREF(__pyx_t_27);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_condition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_condition);
+ __Pyx_XDECREF(__pyx_v_val);
+ __Pyx_XDECREF(__pyx_v_msg);
+ __Pyx_XDECREF(__pyx_v_etype);
+ __Pyx_XDECREF(__pyx_v_value);
+ __Pyx_XDECREF(__pyx_v_tb);
+ __Pyx_XDECREF(__pyx_v_error);
+ __Pyx_XDECREF(__pyx_v_stack);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":203
+ *
+ *
+ * def handle_breakpoint_expression(breakpoint, info, new_frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9handle_breakpoint_expression(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_9handle_breakpoint_expression = {"handle_breakpoint_expression", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9handle_breakpoint_expression, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9handle_breakpoint_expression(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_breakpoint = 0;
+ PyObject *__pyx_v_info = 0;
+ PyObject *__pyx_v_new_frame = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("handle_breakpoint_expression (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_breakpoint,&__pyx_n_s_info,&__pyx_n_s_new_frame,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_breakpoint)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_expression", 1, 3, 3, 1); __PYX_ERR(0, 203, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_frame)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_expression", 1, 3, 3, 2); __PYX_ERR(0, 203, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "handle_breakpoint_expression") < 0)) __PYX_ERR(0, 203, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_breakpoint = values[0];
+ __pyx_v_info = values[1];
+ __pyx_v_new_frame = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("handle_breakpoint_expression", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_8handle_breakpoint_expression(__pyx_self, __pyx_v_breakpoint, __pyx_v_info, __pyx_v_new_frame);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_8handle_breakpoint_expression(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_breakpoint, PyObject *__pyx_v_info, PyObject *__pyx_v_new_frame) {
+ PyObject *__pyx_v_val = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ int __pyx_t_11;
+ int __pyx_t_12;
+ int __pyx_t_13;
+ char const *__pyx_t_14;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ __Pyx_RefNannySetupContext("handle_breakpoint_expression", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":204
+ *
+ * def handle_breakpoint_expression(breakpoint, info, new_frame):
+ * try: # <<<<<<<<<<<<<<
+ * try:
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":205
+ * def handle_breakpoint_expression(breakpoint, info, new_frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":206
+ * try:
+ * try:
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals) # <<<<<<<<<<<<<<
+ * except:
+ * val = sys.exc_info()[1]
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_frame, __pyx_n_s_f_globals); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_frame, __pyx_n_s_f_locals); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_eval, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_v_val = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":205
+ * def handle_breakpoint_expression(breakpoint, info, new_frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L11_try_end;
+ __pyx_L6_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":207
+ * try:
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ * except: # <<<<<<<<<<<<<<
+ * val = sys.exc_info()[1]
+ * finally:
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 207, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_5);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":208
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ * except:
+ * val = sys.exc_info()[1] # <<<<<<<<<<<<<<
+ * finally:
+ * if val is not None:
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (__pyx_t_8) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L8_except_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L8_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_9);
+ __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L7_exception_handled;
+ }
+ __pyx_L8_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":205
+ * def handle_breakpoint_expression(breakpoint, info, new_frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L4_error;
+ __pyx_L7_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ __pyx_L11_try_end:;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":210
+ * val = sys.exc_info()[1]
+ * finally:
+ * if val is not None: # <<<<<<<<<<<<<<
+ * info.pydev_message = str(val)
+ *
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __pyx_t_10 = (__pyx_v_val != Py_None);
+ __pyx_t_11 = (__pyx_t_10 != 0);
+ if (__pyx_t_11) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":211
+ * finally:
+ * if val is not None:
+ * info.pydev_message = str(val) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_val);
+ __Pyx_GIVEREF(__pyx_v_val);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_val);
+ __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_info, __pyx_n_s_pydev_message, __pyx_t_7) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":210
+ * val = sys.exc_info()[1]
+ * finally:
+ * if val is not None: # <<<<<<<<<<<<<<
+ * info.pydev_message = str(val)
+ *
+ */
+ }
+ goto __pyx_L5;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L4_error:;
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
+ {
+ if (unlikely(!__pyx_v_val)) { __Pyx_RaiseUnboundLocalError("val"); __PYX_ERR(0, 210, __pyx_L16_error) }
+ __pyx_t_11 = (__pyx_v_val != Py_None);
+ __pyx_t_10 = (__pyx_t_11 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":211
+ * finally:
+ * if val is not None:
+ * info.pydev_message = str(val) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ if (unlikely(!__pyx_v_val)) { __Pyx_RaiseUnboundLocalError("val"); __PYX_ERR(0, 211, __pyx_L16_error) }
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L16_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_val);
+ __Pyx_GIVEREF(__pyx_v_val);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_val);
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L16_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_info, __pyx_n_s_pydev_message, __pyx_t_5) < 0) __PYX_ERR(0, 211, __pyx_L16_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":210
+ * val = sys.exc_info()[1]
+ * finally:
+ * if val is not None: # <<<<<<<<<<<<<<
+ * info.pydev_message = str(val)
+ *
+ */
+ }
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
+ }
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
+ goto __pyx_L1_error;
+ __pyx_L16_error:;
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
+ }
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ goto __pyx_L1_error;
+ }
+ __pyx_L5:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":203
+ *
+ *
+ * def handle_breakpoint_expression(breakpoint, info, new_frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.handle_breakpoint_expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_val);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":238
+ * cdef tuple _args
+ * cdef int should_skip
+ * def __init__(self, tuple args): # <<<<<<<<<<<<<<
+ * self._args = args # In the cython version we don't need to pass the frame
+ * self.should_skip = -1 # On cythonized version, put in instance.
+ */
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_args = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,0};
+ PyObject* values[1] = {0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 238, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ }
+ __pyx_v_args = ((PyObject*)values[0]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 238, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 238, __pyx_L1_error)
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame___init__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_args);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":239
+ * cdef int should_skip
+ * def __init__(self, tuple args):
+ * self._args = args # In the cython version we don't need to pass the frame # <<<<<<<<<<<<<<
+ * self.should_skip = -1 # On cythonized version, put in instance.
+ * # ELSE
+ */
+ __Pyx_INCREF(__pyx_v_args);
+ __Pyx_GIVEREF(__pyx_v_args);
+ __Pyx_GOTREF(__pyx_v_self->_args);
+ __Pyx_DECREF(__pyx_v_self->_args);
+ __pyx_v_self->_args = __pyx_v_args;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":240
+ * def __init__(self, tuple args):
+ * self._args = args # In the cython version we don't need to pass the frame
+ * self.should_skip = -1 # On cythonized version, put in instance. # <<<<<<<<<<<<<<
+ * # ELSE
+ * # should_skip = -1 # Default value in class (put in instance on set).
+ */
+ __pyx_v_self->should_skip = -1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":238
+ * cdef tuple _args
+ * cdef int should_skip
+ * def __init__(self, tuple args): # <<<<<<<<<<<<<<
+ * self._args = args # In the cython version we don't need to pass the frame
+ * self.should_skip = -1 # On cythonized version, put in instance.
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":250
+ * # ENDIF
+ *
+ * def set_suspend(self, *args, **kwargs): # <<<<<<<<<<<<<<
+ * self._args[0].set_suspend(*args, **kwargs)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_3set_suspend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_3set_suspend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_args = 0;
+ PyObject *__pyx_v_kwargs = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("set_suspend (wrapper)", 0);
+ if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_suspend", 1))) return NULL;
+ if (unlikely(__pyx_kwds)) {
+ __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL;
+ __Pyx_GOTREF(__pyx_v_kwargs);
+ } else {
+ __pyx_v_kwargs = NULL;
+ }
+ __Pyx_INCREF(__pyx_args);
+ __pyx_v_args = __pyx_args;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_2set_suspend(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_2set_suspend(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ __Pyx_RefNannySetupContext("set_suspend", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":251
+ *
+ * def set_suspend(self, *args, **kwargs):
+ * self._args[0].set_suspend(*args, **kwargs) # <<<<<<<<<<<<<<
+ *
+ * def do_wait_suspend(self, *args, **kwargs):
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 251, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_set_suspend); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":250
+ * # ENDIF
+ *
+ * def set_suspend(self, *args, **kwargs): # <<<<<<<<<<<<<<
+ * self._args[0].set_suspend(*args, **kwargs)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.set_suspend", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":253
+ * self._args[0].set_suspend(*args, **kwargs)
+ *
+ * def do_wait_suspend(self, *args, **kwargs): # <<<<<<<<<<<<<<
+ * self._args[0].do_wait_suspend(*args, **kwargs)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_5do_wait_suspend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_5do_wait_suspend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_args = 0;
+ PyObject *__pyx_v_kwargs = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("do_wait_suspend (wrapper)", 0);
+ if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "do_wait_suspend", 1))) return NULL;
+ if (unlikely(__pyx_kwds)) {
+ __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL;
+ __Pyx_GOTREF(__pyx_v_kwargs);
+ } else {
+ __pyx_v_kwargs = NULL;
+ }
+ __Pyx_INCREF(__pyx_args);
+ __pyx_v_args = __pyx_args;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_4do_wait_suspend(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_4do_wait_suspend(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ __Pyx_RefNannySetupContext("do_wait_suspend", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":254
+ *
+ * def do_wait_suspend(self, *args, **kwargs):
+ * self._args[0].do_wait_suspend(*args, **kwargs) # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 254, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_do_wait_suspend); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":253
+ * self._args[0].set_suspend(*args, **kwargs)
+ *
+ * def do_wait_suspend(self, *args, **kwargs): # <<<<<<<<<<<<<<
+ * self._args[0].do_wait_suspend(*args, **kwargs)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.do_wait_suspend", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":257
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * def trace_exception(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef bint flag;
+ * # ELSE
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_7trace_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_7trace_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("trace_exception (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_exception", 1, 3, 3, 1); __PYX_ERR(0, 257, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_exception", 1, 3, 3, 2); __PYX_ERR(0, 257, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace_exception") < 0)) __PYX_ERR(0, 257, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = ((PyObject*)values[1]);
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("trace_exception", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 257, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event), (&PyString_Type), 1, "event", 1))) __PYX_ERR(0, 257, __pyx_L1_error)
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_6trace_exception(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_6trace_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ int __pyx_v_flag;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *(*__pyx_t_8)(PyObject *);
+ __Pyx_RefNannySetupContext("trace_exception", 0);
+ __Pyx_INCREF(__pyx_v_frame);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":262
+ * # def trace_exception(self, frame, event, arg):
+ * # ENDIF
+ * if event == 'exception': # <<<<<<<<<<<<<<
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ *
+ */
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_exception, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":263
+ * # ENDIF
+ * if event == 'exception':
+ * flag, frame = self.should_stop_on_exception(frame, event, arg) # <<<<<<<<<<<<<<
+ *
+ * if flag:
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_should_stop_on_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_5) {
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_arg);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 263, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
+ index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 263, __pyx_L1_error)
+ __pyx_t_8 = NULL;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L5_unpacking_done;
+ __pyx_L4_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_8 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 263, __pyx_L1_error)
+ __pyx_L5_unpacking_done:;
+ }
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_flag = __pyx_t_2;
+ __Pyx_DECREF_SET(__pyx_v_frame, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":265
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ *
+ * if flag: # <<<<<<<<<<<<<<
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch
+ */
+ __pyx_t_2 = (__pyx_v_flag != 0);
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":266
+ *
+ * if flag:
+ * self.handle_exception(frame, event, arg) # <<<<<<<<<<<<<<
+ * return self.trace_dispatch
+ *
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle_exception); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 266, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_arg);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":267
+ * if flag:
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ *
+ * return self.trace_exception
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":265
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ *
+ * if flag: # <<<<<<<<<<<<<<
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":262
+ * # def trace_exception(self, frame, event, arg):
+ * # ENDIF
+ * if event == 'exception': # <<<<<<<<<<<<<<
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":269
+ * return self.trace_dispatch
+ *
+ * return self.trace_exception # <<<<<<<<<<<<<<
+ *
+ * def trace_return(self, frame, event, arg):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":257
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * def trace_exception(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef bint flag;
+ * # ELSE
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_frame);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":271
+ * return self.trace_exception
+ *
+ * def trace_return(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * if event == 'return':
+ * main_debugger, filename = self._args[0], self._args[1]
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_9trace_return(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_9trace_return(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("trace_return (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_return", 1, 3, 3, 1); __PYX_ERR(0, 271, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_return", 1, 3, 3, 2); __PYX_ERR(0, 271, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace_return") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = values[1];
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("trace_return", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_return", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_8trace_return(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_8trace_return(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_v_main_debugger = NULL;
+ PyObject *__pyx_v_filename = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ __Pyx_RefNannySetupContext("trace_return", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":272
+ *
+ * def trace_return(self, frame, event, arg):
+ * if event == 'return': # <<<<<<<<<<<<<<
+ * main_debugger, filename = self._args[0], self._args[1]
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ */
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_return, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
+ if (__pyx_t_1) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":273
+ * def trace_return(self, frame, event, arg):
+ * if event == 'return':
+ * main_debugger, filename = self._args[0], self._args[1] # <<<<<<<<<<<<<<
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ * return self.trace_return
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 273, __pyx_L1_error)
+ }
+ __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 273, __pyx_L1_error)
+ }
+ __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_v_main_debugger = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __pyx_v_filename = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":274
+ * if event == 'return':
+ * main_debugger, filename = self._args[0], self._args[1]
+ * send_signature_return_trace(main_debugger, frame, filename, arg) # <<<<<<<<<<<<<<
+ * return self.trace_return
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_send_signature_return_trace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 274, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_filename);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":272
+ *
+ * def trace_return(self, frame, event, arg):
+ * if event == 'return': # <<<<<<<<<<<<<<
+ * main_debugger, filename = self._args[0], self._args[1]
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":275
+ * main_debugger, filename = self._args[0], self._args[1]
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ * return self.trace_return # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_return); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":271
+ * return self.trace_exception
+ *
+ * def trace_return(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * if event == 'return':
+ * main_debugger, filename = self._args[0], self._args[1]
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_return", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_main_debugger);
+ __Pyx_XDECREF(__pyx_v_filename);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":278
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * def should_stop_on_exception(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef PyDBAdditionalThreadInfo info;
+ * cdef bint flag;
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_11should_stop_on_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_11should_stop_on_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("should_stop_on_exception (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("should_stop_on_exception", 1, 3, 3, 1); __PYX_ERR(0, 278, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("should_stop_on_exception", 1, 3, 3, 2); __PYX_ERR(0, 278, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "should_stop_on_exception") < 0)) __PYX_ERR(0, 278, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = ((PyObject*)values[1]);
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("should_stop_on_exception", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 278, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.should_stop_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event), (&PyString_Type), 1, "event", 1))) __PYX_ERR(0, 278, __pyx_L1_error)
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_10should_stop_on_exception(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_10should_stop_on_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, CYTHON_UNUSED PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_info = 0;
+ int __pyx_v_flag;
+ PyObject *__pyx_v_main_debugger = NULL;
+ PyObject *__pyx_v_exception = NULL;
+ PyObject *__pyx_v_value = NULL;
+ PyObject *__pyx_v_trace = NULL;
+ PyObject *__pyx_v_exception_breakpoint = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *(*__pyx_t_6)(PyObject *);
+ int __pyx_t_7;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ int __pyx_t_13;
+ __Pyx_RefNannySetupContext("should_stop_on_exception", 0);
+ __Pyx_INCREF(__pyx_v_frame);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":286
+ *
+ * # main_debugger, _filename, info, _thread = self._args
+ * main_debugger = self._args[0] # <<<<<<<<<<<<<<
+ * info = self._args[2]
+ * flag = False
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 286, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_main_debugger = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":287
+ * # main_debugger, _filename, info, _thread = self._args
+ * main_debugger = self._args[0]
+ * info = self._args[2] # <<<<<<<<<<<<<<
+ * flag = False
+ *
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 287, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo))))) __PYX_ERR(0, 287, __pyx_L1_error)
+ __pyx_v_info = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":288
+ * main_debugger = self._args[0]
+ * info = self._args[2]
+ * flag = False # <<<<<<<<<<<<<<
+ *
+ * # STATE_SUSPEND = 2
+ */
+ __pyx_v_flag = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":291
+ *
+ * # STATE_SUSPEND = 2
+ * if info.pydev_state != 2: #and breakpoint is not None: # <<<<<<<<<<<<<<
+ * exception, value, trace = arg
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_info->pydev_state != 2) != 0);
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":292
+ * # STATE_SUSPEND = 2
+ * if info.pydev_state != 2: #and breakpoint is not None:
+ * exception, value, trace = arg # <<<<<<<<<<<<<<
+ *
+ * if trace is not None: #on jython trace is None on the first event
+ */
+ if ((likely(PyTuple_CheckExact(__pyx_v_arg))) || (PyList_CheckExact(__pyx_v_arg))) {
+ PyObject* sequence = __pyx_v_arg;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 292, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
+ } else {
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
+ }
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ #else
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ #endif
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_5 = PyObject_GetIter(__pyx_v_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 292, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_1);
+ index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
+ __pyx_t_6 = NULL;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L5_unpacking_done;
+ __pyx_L4_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_6 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 292, __pyx_L1_error)
+ __pyx_L5_unpacking_done:;
+ }
+ __pyx_v_exception = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __pyx_v_value = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_v_trace = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":294
+ * exception, value, trace = arg
+ *
+ * if trace is not None: #on jython trace is None on the first event # <<<<<<<<<<<<<<
+ * exception_breakpoint = get_exception_breakpoint(
+ * exception, main_debugger.break_on_caught_exceptions)
+ */
+ __pyx_t_2 = (__pyx_v_trace != Py_None);
+ __pyx_t_7 = (__pyx_t_2 != 0);
+ if (__pyx_t_7) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":295
+ *
+ * if trace is not None: #on jython trace is None on the first event
+ * exception_breakpoint = get_exception_breakpoint( # <<<<<<<<<<<<<<
+ * exception, main_debugger.break_on_caught_exceptions)
+ *
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_exception_breakpoint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":296
+ * if trace is not None: #on jython trace is None on the first event
+ * exception_breakpoint = get_exception_breakpoint(
+ * exception, main_debugger.break_on_caught_exceptions) # <<<<<<<<<<<<<<
+ *
+ * if exception_breakpoint is not None:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_break_on_caught_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_exception, __pyx_t_1};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_exception, __pyx_t_1};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_5) {
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_v_exception);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_exception_breakpoint = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":298
+ * exception, main_debugger.break_on_caught_exceptions)
+ *
+ * if exception_breakpoint is not None: # <<<<<<<<<<<<<<
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only:
+ */
+ __pyx_t_7 = (__pyx_v_exception_breakpoint != Py_None);
+ __pyx_t_2 = (__pyx_t_7 != 0);
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":299
+ *
+ * if exception_breakpoint is not None:
+ * if exception_breakpoint.ignore_libraries: # <<<<<<<<<<<<<<
+ * if exception_breakpoint.notify_on_first_raise_only:
+ * if main_debugger.first_appearance_in_scope(trace):
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_ignore_libraries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 299, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":300
+ * if exception_breakpoint is not None:
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only: # <<<<<<<<<<<<<<
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_notify_on_first_raise_only); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":301
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only:
+ * if main_debugger.first_appearance_in_scope(trace): # <<<<<<<<<<<<<<
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_first_appearance_in_scope); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_9) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_trace};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_trace};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ __Pyx_INCREF(__pyx_v_trace);
+ __Pyx_GIVEREF(__pyx_v_trace);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_trace);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 301, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":302
+ * if exception_breakpoint.notify_on_first_raise_only:
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace)) # <<<<<<<<<<<<<<
+ * try:
+ * info.pydev_message = exception_breakpoint.qname
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_add_exception_to_frame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_v_exception);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
+ __Pyx_INCREF(__pyx_v_trace);
+ __Pyx_GIVEREF(__pyx_v_trace);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_trace);
+ __pyx_t_9 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_frame, __pyx_t_1};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_frame, __pyx_t_1};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_9) {
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":303
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":304
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ * info.pydev_message = exception_breakpoint.qname # <<<<<<<<<<<<<<
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_qname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L11_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 304, __pyx_L11_error)
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_v_info->pydev_message);
+ __Pyx_DECREF(__pyx_v_info->pydev_message);
+ __pyx_v_info->pydev_message = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":303
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ goto __pyx_L16_try_end;
+ __pyx_L11_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":305
+ * try:
+ * info.pydev_message = exception_breakpoint.qname
+ * except: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ * flag = True
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.should_stop_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 305, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_5);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":306
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8') # <<<<<<<<<<<<<<
+ * flag = True
+ * else:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_qname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 306, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 306, __pyx_L13_except_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_info->pydev_message);
+ __Pyx_DECREF(__pyx_v_info->pydev_message);
+ __pyx_v_info->pydev_message = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L12_exception_handled;
+ }
+ __pyx_L13_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":303
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ goto __pyx_L1_error;
+ __pyx_L12_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_L16_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":307
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ * flag = True # <<<<<<<<<<<<<<
+ * else:
+ * pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
+ */
+ __pyx_v_flag = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":301
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only:
+ * if main_debugger.first_appearance_in_scope(trace): # <<<<<<<<<<<<<<
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ */
+ goto __pyx_L10;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":309
+ * flag = True
+ * else:
+ * pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename)) # <<<<<<<<<<<<<<
+ * flag = False
+ * else:
+ */
+ /*else*/ {
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydev_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_v_exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Ignore_exception_s_in_library_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":310
+ * else:
+ * pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
+ * flag = False # <<<<<<<<<<<<<<
+ * else:
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ */
+ __pyx_v_flag = 0;
+ }
+ __pyx_L10:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":300
+ * if exception_breakpoint is not None:
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only: # <<<<<<<<<<<<<<
+ * if main_debugger.first_appearance_in_scope(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":299
+ *
+ * if exception_breakpoint is not None:
+ * if exception_breakpoint.ignore_libraries: # <<<<<<<<<<<<<<
+ * if exception_breakpoint.notify_on_first_raise_only:
+ * if main_debugger.first_appearance_in_scope(trace):
+ */
+ goto __pyx_L8;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":312
+ * flag = False
+ * else:
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace): # <<<<<<<<<<<<<<
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ */
+ /*else*/ {
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_notify_on_first_raise_only); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_13 = ((!__pyx_t_7) != 0);
+ if (!__pyx_t_13) {
+ } else {
+ __pyx_t_2 = __pyx_t_13;
+ goto __pyx_L20_bool_binop_done;
+ }
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_just_raised); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_9) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_trace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_trace};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_trace};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ __Pyx_INCREF(__pyx_v_trace);
+ __Pyx_GIVEREF(__pyx_v_trace);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_trace);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 312, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_t_13;
+ __pyx_L20_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":313
+ * else:
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ * add_exception_to_frame(frame, (exception, value, trace)) # <<<<<<<<<<<<<<
+ * try:
+ * info.pydev_message = exception_breakpoint.qname
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_add_exception_to_frame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_exception);
+ __Pyx_GIVEREF(__pyx_v_exception);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
+ __Pyx_INCREF(__pyx_v_trace);
+ __Pyx_GIVEREF(__pyx_v_trace);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_trace);
+ __pyx_t_9 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_frame, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_frame, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_9) {
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":314
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_10);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":315
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ * info.pydev_message = exception_breakpoint.qname # <<<<<<<<<<<<<<
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_qname); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 315, __pyx_L22_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 315, __pyx_L22_error)
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_v_info->pydev_message);
+ __Pyx_DECREF(__pyx_v_info->pydev_message);
+ __pyx_v_info->pydev_message = ((PyObject*)__pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":314
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L27_try_end;
+ __pyx_L22_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":316
+ * try:
+ * info.pydev_message = exception_breakpoint.qname
+ * except: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ * flag = True
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.should_stop_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(0, 316, __pyx_L24_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_3);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":317
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8') # <<<<<<<<<<<<<<
+ * flag = True
+ * else:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception_breakpoint, __pyx_n_s_qname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L24_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 317, __pyx_L24_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L24_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 317, __pyx_L24_except_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_info->pydev_message);
+ __Pyx_DECREF(__pyx_v_info->pydev_message);
+ __pyx_v_info->pydev_message = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L23_exception_handled;
+ }
+ __pyx_L24_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":314
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try: # <<<<<<<<<<<<<<
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
+ goto __pyx_L1_error;
+ __pyx_L23_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
+ __pyx_L27_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":318
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ * flag = True # <<<<<<<<<<<<<<
+ * else:
+ * flag = False
+ */
+ __pyx_v_flag = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":312
+ * flag = False
+ * else:
+ * if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace): # <<<<<<<<<<<<<<
+ * add_exception_to_frame(frame, (exception, value, trace))
+ * try:
+ */
+ goto __pyx_L19;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":320
+ * flag = True
+ * else:
+ * flag = False # <<<<<<<<<<<<<<
+ * else:
+ * try:
+ */
+ /*else*/ {
+ __pyx_v_flag = 0;
+ }
+ __pyx_L19:;
+ }
+ __pyx_L8:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":298
+ * exception, main_debugger.break_on_caught_exceptions)
+ *
+ * if exception_breakpoint is not None: # <<<<<<<<<<<<<<
+ * if exception_breakpoint.ignore_libraries:
+ * if exception_breakpoint.notify_on_first_raise_only:
+ */
+ goto __pyx_L7;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":322
+ * flag = False
+ * else:
+ * try: # <<<<<<<<<<<<<<
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ */
+ /*else*/ {
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":323
+ * else:
+ * try:
+ * if main_debugger.plugin is not None: # <<<<<<<<<<<<<<
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ * if result:
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_plugin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = (__pyx_t_3 != Py_None);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_13 = (__pyx_t_2 != 0);
+ if (__pyx_t_13) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":324
+ * try:
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg) # <<<<<<<<<<<<<<
+ * if result:
+ * flag, frame = result
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_plugin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exception_break); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame, __pyx_v_self->_args, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame, __pyx_v_self->_args, __pyx_v_arg};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_8, __pyx_v_main_debugger);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_8, ((PyObject *)__pyx_v_self));
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_8, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_8, __pyx_v_self->_args);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_1, 4+__pyx_t_8, __pyx_v_arg);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_result = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":325
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ * if result: # <<<<<<<<<<<<<<
+ * flag, frame = result
+ * except:
+ */
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 325, __pyx_L30_error)
+ if (__pyx_t_13) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":326
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ * if result:
+ * flag, frame = result # <<<<<<<<<<<<<<
+ * except:
+ * flag = False
+ */
+ if ((likely(PyTuple_CheckExact(__pyx_v_result))) || (PyList_CheckExact(__pyx_v_result))) {
+ PyObject* sequence = __pyx_v_result;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 326, __pyx_L30_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ #else
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ #endif
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_1 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L30_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L38_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L38_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 326, __pyx_L30_error)
+ __pyx_t_6 = NULL;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L39_unpacking_done;
+ __pyx_L38_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 326, __pyx_L30_error)
+ __pyx_L39_unpacking_done:;
+ }
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L30_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_flag = __pyx_t_13;
+ __Pyx_DECREF_SET(__pyx_v_frame, __pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":325
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ * if result: # <<<<<<<<<<<<<<
+ * flag, frame = result
+ * except:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":323
+ * else:
+ * try:
+ * if main_debugger.plugin is not None: # <<<<<<<<<<<<<<
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ * if result:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":322
+ * flag = False
+ * else:
+ * try: # <<<<<<<<<<<<<<
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ goto __pyx_L35_try_end;
+ __pyx_L30_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":327
+ * if result:
+ * flag, frame = result
+ * except: # <<<<<<<<<<<<<<
+ * flag = False
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.should_stop_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 327, __pyx_L32_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":328
+ * flag, frame = result
+ * except:
+ * flag = False # <<<<<<<<<<<<<<
+ *
+ * return flag, frame
+ */
+ __pyx_v_flag = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L31_exception_handled;
+ }
+ __pyx_L32_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":322
+ * flag = False
+ * else:
+ * try: # <<<<<<<<<<<<<<
+ * if main_debugger.plugin is not None:
+ * result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ goto __pyx_L1_error;
+ __pyx_L31_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_L35_try_end:;
+ }
+ }
+ __pyx_L7:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":294
+ * exception, value, trace = arg
+ *
+ * if trace is not None: #on jython trace is None on the first event # <<<<<<<<<<<<<<
+ * exception_breakpoint = get_exception_breakpoint(
+ * exception, main_debugger.break_on_caught_exceptions)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":291
+ *
+ * # STATE_SUSPEND = 2
+ * if info.pydev_state != 2: #and breakpoint is not None: # <<<<<<<<<<<<<<
+ * exception, value, trace = arg
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":330
+ * flag = False
+ *
+ * return flag, frame # <<<<<<<<<<<<<<
+ *
+ * def handle_exception(self, frame, event, arg):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_frame);
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":278
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * def should_stop_on_exception(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef PyDBAdditionalThreadInfo info;
+ * cdef bint flag;
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.should_stop_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_info);
+ __Pyx_XDECREF(__pyx_v_main_debugger);
+ __Pyx_XDECREF(__pyx_v_exception);
+ __Pyx_XDECREF(__pyx_v_value);
+ __Pyx_XDECREF(__pyx_v_trace);
+ __Pyx_XDECREF(__pyx_v_exception_breakpoint);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_frame);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":332
+ * return flag, frame
+ *
+ * def handle_exception(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * try:
+ * # print 'handle_exception', frame.f_lineno, frame.f_code.co_name
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_13handle_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_13handle_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("handle_exception (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_exception", 1, 3, 3, 1); __PYX_ERR(0, 332, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("handle_exception", 1, 3, 3, 2); __PYX_ERR(0, 332, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "handle_exception") < 0)) __PYX_ERR(0, 332, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = values[1];
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("handle_exception", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 332, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_12handle_exception(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_12handle_exception(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_v_trace_obj = NULL;
+ PyObject *__pyx_v_main_debugger = NULL;
+ PyObject *__pyx_v_initial_trace_obj = NULL;
+ PyObject *__pyx_v_check_trace_obj = NULL;
+ PyObject *__pyx_v_filename = NULL;
+ PyObject *__pyx_v_filename_to_lines_where_exceptions_are_ignored = NULL;
+ PyObject *__pyx_v_lines_ignored = NULL;
+ PyObject *__pyx_v_curr_stat = NULL;
+ PyObject *__pyx_v_last_stat = NULL;
+ PyObject *__pyx_v_from_user_input = NULL;
+ PyObject *__pyx_v_merged = NULL;
+ PyObject *__pyx_v_exc_lineno = NULL;
+ PyObject *__pyx_v_line = NULL;
+ PyObject *__pyx_v_thread = NULL;
+ PyObject *__pyx_v_frame_id_to_frame = NULL;
+ PyObject *__pyx_v_f = NULL;
+ PyObject *__pyx_v_thread_id = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ int __pyx_t_15;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
+ char const *__pyx_t_18;
+ PyObject *__pyx_t_19 = NULL;
+ PyObject *__pyx_t_20 = NULL;
+ PyObject *__pyx_t_21 = NULL;
+ PyObject *__pyx_t_22 = NULL;
+ PyObject *__pyx_t_23 = NULL;
+ PyObject *__pyx_t_24 = NULL;
+ char const *__pyx_t_25;
+ __Pyx_RefNannySetupContext("handle_exception", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":333
+ *
+ * def handle_exception(self, frame, event, arg):
+ * try: # <<<<<<<<<<<<<<
+ * # print 'handle_exception', frame.f_lineno, frame.f_code.co_name
+ *
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":337
+ *
+ * # We have 3 things in arg: exception type, description, traceback object
+ * trace_obj = arg[2] # <<<<<<<<<<<<<<
+ * main_debugger = self._args[0]
+ *
+ */
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arg, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_trace_obj = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":338
+ * # We have 3 things in arg: exception type, description, traceback object
+ * trace_obj = arg[2]
+ * main_debugger = self._args[0] # <<<<<<<<<<<<<<
+ *
+ * if not hasattr(trace_obj, 'tb_next'):
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 338, __pyx_L4_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_main_debugger = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":340
+ * main_debugger = self._args[0]
+ *
+ * if not hasattr(trace_obj, 'tb_next'): # <<<<<<<<<<<<<<
+ * return #Not always there on Jython...
+ *
+ */
+ __pyx_t_2 = __Pyx_HasAttr(__pyx_v_trace_obj, __pyx_n_s_tb_next); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 340, __pyx_L4_error)
+ __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":341
+ *
+ * if not hasattr(trace_obj, 'tb_next'):
+ * return #Not always there on Jython... # <<<<<<<<<<<<<<
+ *
+ * initial_trace_obj = trace_obj
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":340
+ * main_debugger = self._args[0]
+ *
+ * if not hasattr(trace_obj, 'tb_next'): # <<<<<<<<<<<<<<
+ * return #Not always there on Jython...
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":343
+ * return #Not always there on Jython...
+ *
+ * initial_trace_obj = trace_obj # <<<<<<<<<<<<<<
+ * if trace_obj.tb_next is None and trace_obj.tb_frame is frame:
+ * #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+ */
+ __Pyx_INCREF(__pyx_v_trace_obj);
+ __pyx_v_initial_trace_obj = __pyx_v_trace_obj;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":344
+ *
+ * initial_trace_obj = trace_obj
+ * if trace_obj.tb_next is None and trace_obj.tb_frame is frame: # <<<<<<<<<<<<<<
+ * #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trace_obj, __pyx_n_s_tb_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = (__pyx_t_1 == Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = (__pyx_t_2 != 0);
+ if (__pyx_t_4) {
+ } else {
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L8_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trace_obj, __pyx_n_s_tb_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = (__pyx_t_1 == __pyx_v_frame);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = (__pyx_t_4 != 0);
+ __pyx_t_3 = __pyx_t_2;
+ __pyx_L8_bool_binop_done:;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":347
+ * #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+ *
+ * if main_debugger.break_on_exceptions_thrown_in_same_context: # <<<<<<<<<<<<<<
+ * #Option: Don't break if an exception is caught in the same function from which it is thrown
+ * return
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_break_on_exceptions_thrown_in_sa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 347, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":349
+ * if main_debugger.break_on_exceptions_thrown_in_same_context:
+ * #Option: Don't break if an exception is caught in the same function from which it is thrown
+ * return # <<<<<<<<<<<<<<
+ * else:
+ * #Get the trace_obj from where the exception was raised...
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":347
+ * #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+ *
+ * if main_debugger.break_on_exceptions_thrown_in_same_context: # <<<<<<<<<<<<<<
+ * #Option: Don't break if an exception is caught in the same function from which it is thrown
+ * return
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":344
+ *
+ * initial_trace_obj = trace_obj
+ * if trace_obj.tb_next is None and trace_obj.tb_frame is frame: # <<<<<<<<<<<<<<
+ * #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+ *
+ */
+ goto __pyx_L7;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":352
+ * else:
+ * #Get the trace_obj from where the exception was raised...
+ * while trace_obj.tb_next is not None: # <<<<<<<<<<<<<<
+ * trace_obj = trace_obj.tb_next
+ *
+ */
+ /*else*/ {
+ while (1) {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trace_obj, __pyx_n_s_tb_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = (__pyx_t_1 != Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (!__pyx_t_2) break;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":353
+ * #Get the trace_obj from where the exception was raised...
+ * while trace_obj.tb_next is not None:
+ * trace_obj = trace_obj.tb_next # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trace_obj, __pyx_n_s_tb_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_trace_obj, __pyx_t_1);
+ __pyx_t_1 = 0;
+ }
+ }
+ __pyx_L7:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":356
+ *
+ *
+ * if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception: # <<<<<<<<<<<<<<
+ * for check_trace_obj in (initial_trace_obj, trace_obj):
+ * filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_ignore_exceptions_thrown_in_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 356, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":357
+ *
+ * if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception:
+ * for check_trace_obj in (initial_trace_obj, trace_obj): # <<<<<<<<<<<<<<
+ * filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+ *
+ */
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_initial_trace_obj);
+ __Pyx_GIVEREF(__pyx_v_initial_trace_obj);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_initial_trace_obj);
+ __Pyx_INCREF(__pyx_v_trace_obj);
+ __Pyx_GIVEREF(__pyx_v_trace_obj);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_trace_obj);
+ __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ for (;;) {
+ if (__pyx_t_6 >= 2) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 357, __pyx_L4_error)
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ #endif
+ __Pyx_XDECREF_SET(__pyx_v_check_trace_obj, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":358
+ * if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception:
+ * for check_trace_obj in (initial_trace_obj, trace_obj):
+ * filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1] # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_check_trace_obj, __pyx_n_s_tb_frame); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_9) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":361
+ *
+ *
+ * filename_to_lines_where_exceptions_are_ignored = self.filename_to_lines_where_exceptions_are_ignored # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename_to_lines_where_exceptio); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 361, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_XDECREF_SET(__pyx_v_filename_to_lines_where_exceptions_are_ignored, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":364
+ *
+ *
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename) # <<<<<<<<<<<<<<
+ * if lines_ignored is None:
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_to_lines_where_exceptions_are_ignored, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_filename); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_filename);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_lines_ignored, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":365
+ *
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if lines_ignored is None: # <<<<<<<<<<<<<<
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ *
+ */
+ __pyx_t_2 = (__pyx_v_lines_ignored == Py_None);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":366
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if lines_ignored is None:
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {} # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 366, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_DECREF_SET(__pyx_v_lines_ignored, __pyx_t_7);
+ if (unlikely(PyObject_SetItem(__pyx_v_filename_to_lines_where_exceptions_are_ignored, __pyx_v_filename, __pyx_t_7) < 0)) __PYX_ERR(0, 366, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":365
+ *
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if lines_ignored is None: # <<<<<<<<<<<<<<
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":368
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ *
+ * try: # <<<<<<<<<<<<<<
+ * curr_stat = os.stat(filename)
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":369
+ *
+ * try:
+ * curr_stat = os.stat(filename) # <<<<<<<<<<<<<<
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ * except:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_stat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_filename); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_filename);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_curr_stat, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":370
+ * try:
+ * curr_stat = os.stat(filename)
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime) # <<<<<<<<<<<<<<
+ * except:
+ * curr_stat = None
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr_stat, __pyx_n_s_st_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr_stat, __pyx_n_s_st_mtime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 370, __pyx_L17_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8);
+ __pyx_t_7 = 0;
+ __pyx_t_8 = 0;
+ __Pyx_DECREF_SET(__pyx_v_curr_stat, __pyx_t_10);
+ __pyx_t_10 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":368
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ *
+ * try: # <<<<<<<<<<<<<<
+ * curr_stat = os.stat(filename)
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L24_try_end;
+ __pyx_L17_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":371
+ * curr_stat = os.stat(filename)
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ * except: # <<<<<<<<<<<<<<
+ * curr_stat = None
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_7) < 0) __PYX_ERR(0, 371, __pyx_L19_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":372
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ * except:
+ * curr_stat = None # <<<<<<<<<<<<<<
+ *
+ * last_stat = self.filename_to_stat_info.get(filename)
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_curr_stat, Py_None);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L18_exception_handled;
+ }
+ __pyx_L19_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":368
+ * lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ *
+ * try: # <<<<<<<<<<<<<<
+ * curr_stat = os.stat(filename)
+ * curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ goto __pyx_L4_error;
+ __pyx_L18_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_L24_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":374
+ * curr_stat = None
+ *
+ * last_stat = self.filename_to_stat_info.get(filename) # <<<<<<<<<<<<<<
+ * if last_stat != curr_stat:
+ * self.filename_to_stat_info[filename] = curr_stat
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename_to_stat_info); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_filename); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_filename);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_last_stat, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":375
+ *
+ * last_stat = self.filename_to_stat_info.get(filename)
+ * if last_stat != curr_stat: # <<<<<<<<<<<<<<
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear()
+ */
+ __pyx_t_7 = PyObject_RichCompare(__pyx_v_last_stat, __pyx_v_curr_stat, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L4_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 375, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":376
+ * last_stat = self.filename_to_stat_info.get(filename)
+ * if last_stat != curr_stat:
+ * self.filename_to_stat_info[filename] = curr_stat # <<<<<<<<<<<<<<
+ * lines_ignored.clear()
+ * try:
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename_to_stat_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_v_filename, __pyx_v_curr_stat) < 0)) __PYX_ERR(0, 376, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":377
+ * if last_stat != curr_stat:
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear() # <<<<<<<<<<<<<<
+ * try:
+ * linecache.checkcache(filename)
+ */
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_lines_ignored, __pyx_n_s_clear); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 377, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (__pyx_t_1) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L4_error)
+ }
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":378
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear()
+ * try: # <<<<<<<<<<<<<<
+ * linecache.checkcache(filename)
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_11);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":379
+ * lines_ignored.clear()
+ * try:
+ * linecache.checkcache(filename) # <<<<<<<<<<<<<<
+ * except:
+ * #Jython 2.1
+ */
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_linecache); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_checkcache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_filename); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_filename};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_filename);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 379, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":378
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear()
+ * try: # <<<<<<<<<<<<<<
+ * linecache.checkcache(filename)
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ goto __pyx_L35_try_end;
+ __pyx_L28_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":380
+ * try:
+ * linecache.checkcache(filename)
+ * except: # <<<<<<<<<<<<<<
+ * #Jython 2.1
+ * linecache.checkcache()
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 380, __pyx_L30_except_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_8);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":382
+ * except:
+ * #Jython 2.1
+ * linecache.checkcache() # <<<<<<<<<<<<<<
+ *
+ * from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_linecache); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 382, __pyx_L30_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_checkcache); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 382, __pyx_L30_except_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (__pyx_t_9) {
+ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 382, __pyx_L30_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else {
+ __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 382, __pyx_L30_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L29_exception_handled;
+ }
+ __pyx_L30_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":378
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear()
+ * try: # <<<<<<<<<<<<<<
+ * linecache.checkcache(filename)
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
+ goto __pyx_L4_error;
+ __pyx_L29_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
+ __pyx_L35_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":375
+ *
+ * last_stat = self.filename_to_stat_info.get(filename)
+ * if last_stat != curr_stat: # <<<<<<<<<<<<<<
+ * self.filename_to_stat_info[filename] = curr_stat
+ * lines_ignored.clear()
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":384
+ * linecache.checkcache()
+ *
+ * from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename) # <<<<<<<<<<<<<<
+ * if from_user_input:
+ * merged = {}
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_filename_to_lines_where_exceptio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filename); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_filename);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 384, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_from_user_input, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":385
+ *
+ * from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if from_user_input: # <<<<<<<<<<<<<<
+ * merged = {}
+ * merged.update(lines_ignored)
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_from_user_input); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 385, __pyx_L4_error)
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":386
+ * from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if from_user_input:
+ * merged = {} # <<<<<<<<<<<<<<
+ * merged.update(lines_ignored)
+ * #Override what we have with the related entries that the user entered
+ */
+ __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 386, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF_SET(__pyx_v_merged, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":387
+ * if from_user_input:
+ * merged = {}
+ * merged.update(lines_ignored) # <<<<<<<<<<<<<<
+ * #Override what we have with the related entries that the user entered
+ * merged.update(from_user_input)
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_merged, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_lines_ignored); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_lines_ignored};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_lines_ignored};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_INCREF(__pyx_v_lines_ignored);
+ __Pyx_GIVEREF(__pyx_v_lines_ignored);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_lines_ignored);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 387, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":389
+ * merged.update(lines_ignored)
+ * #Override what we have with the related entries that the user entered
+ * merged.update(from_user_input) # <<<<<<<<<<<<<<
+ * else:
+ * merged = lines_ignored
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_merged, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_from_user_input); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_from_user_input};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_from_user_input};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_from_user_input);
+ __Pyx_GIVEREF(__pyx_v_from_user_input);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_from_user_input);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 389, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":385
+ *
+ * from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ * if from_user_input: # <<<<<<<<<<<<<<
+ * merged = {}
+ * merged.update(lines_ignored)
+ */
+ goto __pyx_L38;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":391
+ * merged.update(from_user_input)
+ * else:
+ * merged = lines_ignored # <<<<<<<<<<<<<<
+ *
+ * exc_lineno = check_trace_obj.tb_lineno
+ */
+ /*else*/ {
+ __Pyx_INCREF(__pyx_v_lines_ignored);
+ __Pyx_XDECREF_SET(__pyx_v_merged, __pyx_v_lines_ignored);
+ }
+ __pyx_L38:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":393
+ * merged = lines_ignored
+ *
+ * exc_lineno = check_trace_obj.tb_lineno # <<<<<<<<<<<<<<
+ *
+ * # print ('lines ignored', lines_ignored)
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_check_trace_obj, __pyx_n_s_tb_lineno); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 393, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF_SET(__pyx_v_exc_lineno, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":399
+ * # print ('merged', merged, 'curr', exc_lineno)
+ *
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored. # <<<<<<<<<<<<<<
+ * try:
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ */
+ __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_exc_lineno, __pyx_v_merged, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 399, __pyx_L4_error)
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (__pyx_t_2) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":400
+ *
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ * try: # <<<<<<<<<<<<<<
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":401
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ * try:
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals) # <<<<<<<<<<<<<<
+ * except:
+ * #Jython 2.1
+ */
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_linecache); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_getline); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_check_trace_obj, __pyx_n_s_tb_frame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_f_globals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_filename, __pyx_v_exc_lineno, __pyx_t_1};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_filename, __pyx_v_exc_lineno, __pyx_t_1};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_14 = PyTuple_New(3+__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_15, __pyx_v_filename);
+ __Pyx_INCREF(__pyx_v_exc_lineno);
+ __Pyx_GIVEREF(__pyx_v_exc_lineno);
+ PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_15, __pyx_v_exc_lineno);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_15, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 401, __pyx_L40_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":400
+ *
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ * try: # <<<<<<<<<<<<<<
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L47_try_end;
+ __pyx_L40_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":402
+ * try:
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ * except: # <<<<<<<<<<<<<<
+ * #Jython 2.1
+ * line = linecache.getline(filename, exc_lineno)
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_10, &__pyx_t_14) < 0) __PYX_ERR(0, 402, __pyx_L42_except_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GOTREF(__pyx_t_14);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":404
+ * except:
+ * #Jython 2.1
+ * line = linecache.getline(filename, exc_lineno) # <<<<<<<<<<<<<<
+ *
+ * if IGNORE_EXCEPTION_TAG.match(line) is not None:
+ */
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_linecache); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_getline); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_9)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_v_exc_lineno};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_v_exc_lineno};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_v_filename);
+ __Pyx_INCREF(__pyx_v_exc_lineno);
+ __Pyx_GIVEREF(__pyx_v_exc_lineno);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_exc_lineno);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L42_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ goto __pyx_L41_exception_handled;
+ }
+ __pyx_L42_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":400
+ *
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ * try: # <<<<<<<<<<<<<<
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ goto __pyx_L4_error;
+ __pyx_L41_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_L47_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":406
+ * line = linecache.getline(filename, exc_lineno)
+ *
+ * if IGNORE_EXCEPTION_TAG.match(line) is not None: # <<<<<<<<<<<<<<
+ * lines_ignored[exc_lineno] = 1
+ * return
+ */
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_IGNORE_EXCEPTION_TAG); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_match); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_line); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_line};
+ __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_14);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_line};
+ __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_14);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_INCREF(__pyx_v_line);
+ __Pyx_GIVEREF(__pyx_v_line);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_line);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 406, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_2 = (__pyx_t_14 != Py_None);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":407
+ *
+ * if IGNORE_EXCEPTION_TAG.match(line) is not None:
+ * lines_ignored[exc_lineno] = 1 # <<<<<<<<<<<<<<
+ * return
+ * else:
+ */
+ if (unlikely(PyObject_SetItem(__pyx_v_lines_ignored, __pyx_v_exc_lineno, __pyx_int_1) < 0)) __PYX_ERR(0, 407, __pyx_L4_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":408
+ * if IGNORE_EXCEPTION_TAG.match(line) is not None:
+ * lines_ignored[exc_lineno] = 1
+ * return # <<<<<<<<<<<<<<
+ * else:
+ * #Put in the cache saying not to ignore
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":406
+ * line = linecache.getline(filename, exc_lineno)
+ *
+ * if IGNORE_EXCEPTION_TAG.match(line) is not None: # <<<<<<<<<<<<<<
+ * lines_ignored[exc_lineno] = 1
+ * return
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":411
+ * else:
+ * #Put in the cache saying not to ignore
+ * lines_ignored[exc_lineno] = 0 # <<<<<<<<<<<<<<
+ * else:
+ * #Ok, dict has it already cached, so, let's check it...
+ */
+ /*else*/ {
+ if (unlikely(PyObject_SetItem(__pyx_v_lines_ignored, __pyx_v_exc_lineno, __pyx_int_0) < 0)) __PYX_ERR(0, 411, __pyx_L4_error)
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":399
+ * # print ('merged', merged, 'curr', exc_lineno)
+ *
+ * if exc_lineno not in merged: #Note: check on merged but update lines_ignored. # <<<<<<<<<<<<<<
+ * try:
+ * line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ */
+ goto __pyx_L39;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":414
+ * else:
+ * #Ok, dict has it already cached, so, let's check it...
+ * if merged.get(exc_lineno, 0): # <<<<<<<<<<<<<<
+ * return
+ *
+ */
+ /*else*/ {
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_merged, __pyx_n_s_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_exc_lineno, __pyx_int_0};
+ __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_14);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_exc_lineno, __pyx_int_0};
+ __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_14);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_exc_lineno);
+ __Pyx_GIVEREF(__pyx_v_exc_lineno);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_15, __pyx_v_exc_lineno);
+ __Pyx_INCREF(__pyx_int_0);
+ __Pyx_GIVEREF(__pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_15, __pyx_int_0);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 414, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":415
+ * #Ok, dict has it already cached, so, let's check it...
+ * if merged.get(exc_lineno, 0):
+ * return # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":414
+ * else:
+ * #Ok, dict has it already cached, so, let's check it...
+ * if merged.get(exc_lineno, 0): # <<<<<<<<<<<<<<
+ * return
+ *
+ */
+ }
+ }
+ __pyx_L39:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":357
+ *
+ * if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception:
+ * for check_trace_obj in (initial_trace_obj, trace_obj): # <<<<<<<<<<<<<<
+ * filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+ *
+ */
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":356
+ *
+ *
+ * if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception: # <<<<<<<<<<<<<<
+ * for check_trace_obj in (initial_trace_obj, trace_obj):
+ * filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":418
+ *
+ *
+ * thread = self._args[3] # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ if (unlikely(__pyx_v_self->_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 418, __pyx_L4_error)
+ }
+ __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_args, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_v_thread = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":420
+ * thread = self._args[3]
+ *
+ * try: # <<<<<<<<<<<<<<
+ * frame_id_to_frame = {}
+ * frame_id_to_frame[id(frame)] = frame
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_11);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":421
+ *
+ * try:
+ * frame_id_to_frame = {} # <<<<<<<<<<<<<<
+ * frame_id_to_frame[id(frame)] = frame
+ * f = trace_obj.tb_frame
+ */
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 421, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_v_frame_id_to_frame = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":422
+ * try:
+ * frame_id_to_frame = {}
+ * frame_id_to_frame[id(frame)] = frame # <<<<<<<<<<<<<<
+ * f = trace_obj.tb_frame
+ * while f is not None:
+ */
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_frame);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_5, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 422, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_v_frame_id_to_frame, __pyx_t_14, __pyx_v_frame) < 0)) __PYX_ERR(0, 422, __pyx_L52_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":423
+ * frame_id_to_frame = {}
+ * frame_id_to_frame[id(frame)] = frame
+ * f = trace_obj.tb_frame # <<<<<<<<<<<<<<
+ * while f is not None:
+ * frame_id_to_frame[id(f)] = f
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_trace_obj, __pyx_n_s_tb_frame); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 423, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_v_f = __pyx_t_14;
+ __pyx_t_14 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":424
+ * frame_id_to_frame[id(frame)] = frame
+ * f = trace_obj.tb_frame
+ * while f is not None: # <<<<<<<<<<<<<<
+ * frame_id_to_frame[id(f)] = f
+ * f = f.f_back
+ */
+ while (1) {
+ __pyx_t_3 = (__pyx_v_f != Py_None);
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (!__pyx_t_2) break;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":425
+ * f = trace_obj.tb_frame
+ * while f is not None:
+ * frame_id_to_frame[id(f)] = f # <<<<<<<<<<<<<<
+ * f = f.f_back
+ * f = None
+ */
+ __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 425, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_INCREF(__pyx_v_f);
+ __Pyx_GIVEREF(__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_f);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_v_frame_id_to_frame, __pyx_t_5, __pyx_v_f) < 0)) __PYX_ERR(0, 425, __pyx_L52_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":426
+ * while f is not None:
+ * frame_id_to_frame[id(f)] = f
+ * f = f.f_back # <<<<<<<<<<<<<<
+ * f = None
+ *
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_f_back); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
+ __pyx_t_5 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":427
+ * frame_id_to_frame[id(f)] = f
+ * f = f.f_back
+ * f = None # <<<<<<<<<<<<<<
+ *
+ * thread_id = get_thread_id(thread)
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_f, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":429
+ * f = None
+ *
+ * thread_id = get_thread_id(thread) # <<<<<<<<<<<<<<
+ * pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame)
+ * try:
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_thread_id); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_thread);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_v_thread_id = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":430
+ *
+ * thread_id = get_thread_id(thread)
+ * pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame) # <<<<<<<<<<<<<<
+ * try:
+ * main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_vars); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_add_additional_frame_by_id); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_thread_id, __pyx_v_frame_id_to_frame};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_thread_id, __pyx_v_frame_id_to_frame};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_14) {
+ __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14); __pyx_t_14 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread_id);
+ __Pyx_GIVEREF(__pyx_v_thread_id);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_15, __pyx_v_thread_id);
+ __Pyx_INCREF(__pyx_v_frame_id_to_frame);
+ __Pyx_GIVEREF(__pyx_v_frame_id_to_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_15, __pyx_v_frame_id_to_frame);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":431
+ * thread_id = get_thread_id(thread)
+ * pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame)
+ * try: # <<<<<<<<<<<<<<
+ * main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ * self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":432
+ * pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame)
+ * try:
+ * main_debugger.send_caught_exception_stack(thread, arg, id(frame)) # <<<<<<<<<<<<<<
+ * self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ * self.do_wait_suspend(thread, frame, event, arg)
+ */
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_send_caught_exception_stack); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_frame);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_8, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_thread, __pyx_v_arg, __pyx_t_14};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_thread, __pyx_v_arg, __pyx_t_14};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(3+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_15, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_15, __pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_15, __pyx_t_14);
+ __pyx_t_14 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":433
+ * try:
+ * main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ * self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION) # <<<<<<<<<<<<<<
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * main_debugger.send_caught_exception_stack_proceeded(thread)
+ */
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_suspend); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_14 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_thread, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_thread, __pyx_t_1};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_14) {
+ __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14); __pyx_t_14 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_15, __pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_15, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":434
+ * main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ * self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ * self.do_wait_suspend(thread, frame, event, arg) # <<<<<<<<<<<<<<
+ * main_debugger.send_caught_exception_stack_proceeded(thread)
+ *
+ */
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_wait_suspend); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 434, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = NULL;
+ __pyx_t_15 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_15 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(4+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_15, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_15, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_15, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_15, __pyx_v_arg);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":435
+ * self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * main_debugger.send_caught_exception_stack_proceeded(thread) # <<<<<<<<<<<<<<
+ *
+ * finally:
+ */
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_send_caught_exception_stack_proc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_thread};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_thread};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_thread);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L61_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":438
+ *
+ * finally:
+ * pydevd_vars.remove_additional_frame_by_id(thread_id) # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_vars); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_remove_additional_frame_by_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_thread_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_thread_id};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_thread_id};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_INCREF(__pyx_v_thread_id);
+ __Pyx_GIVEREF(__pyx_v_thread_id);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_thread_id);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L52_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L62;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L61_error:;
+ __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
+ __Pyx_XGOTREF(__pyx_t_19);
+ __Pyx_XGOTREF(__pyx_t_20);
+ __Pyx_XGOTREF(__pyx_t_21);
+ __Pyx_XGOTREF(__pyx_t_22);
+ __Pyx_XGOTREF(__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_24);
+ __pyx_t_15 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
+ {
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_vars); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_remove_additional_frame_by_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_thread_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread_id};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread_id};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_thread_id);
+ __Pyx_GIVEREF(__pyx_v_thread_id);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_thread_id);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L64_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_22);
+ __Pyx_XGIVEREF(__pyx_t_23);
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
+ }
+ __Pyx_XGIVEREF(__pyx_t_19);
+ __Pyx_XGIVEREF(__pyx_t_20);
+ __Pyx_XGIVEREF(__pyx_t_21);
+ __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
+ __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
+ __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
+ goto __pyx_L52_error;
+ __pyx_L64_error:;
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_22);
+ __Pyx_XGIVEREF(__pyx_t_23);
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
+ }
+ __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
+ __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
+ __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
+ goto __pyx_L52_error;
+ }
+ __pyx_L62:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":420
+ * thread = self._args[3]
+ *
+ * try: # <<<<<<<<<<<<<<
+ * frame_id_to_frame = {}
+ * frame_id_to_frame[id(frame)] = frame
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ goto __pyx_L57_try_end;
+ __pyx_L52_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":439
+ * finally:
+ * pydevd_vars.remove_additional_frame_by_id(thread_id)
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_10) < 0) __PYX_ERR(0, 439, __pyx_L54_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_10);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":440
+ * pydevd_vars.remove_additional_frame_by_id(thread_id)
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ *
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 440, __pyx_L54_except_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 440, __pyx_L54_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (__pyx_t_14) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 440, __pyx_L54_except_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else {
+ __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 440, __pyx_L54_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L53_exception_handled;
+ }
+ __pyx_L54_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":420
+ * thread = self._args[3]
+ *
+ * try: # <<<<<<<<<<<<<<
+ * frame_id_to_frame = {}
+ * frame_id_to_frame[id(frame)] = frame
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
+ goto __pyx_L4_error;
+ __pyx_L53_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
+ __pyx_L57_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":442
+ * traceback.print_exc()
+ *
+ * main_debugger.set_trace_for_frame_and_parents(frame) # <<<<<<<<<<<<<<
+ * finally:
+ * #Clear some local variables...
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_set_trace_for_frame_and_parents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_frame); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_frame};
+ __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_10);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_frame};
+ __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_10);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_frame);
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 442, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":445
+ * finally:
+ * #Clear some local variables...
+ * trace_obj = None # <<<<<<<<<<<<<<
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":446
+ * #Clear some local variables...
+ * trace_obj = None
+ * initial_trace_obj = None # <<<<<<<<<<<<<<
+ * check_trace_obj = None
+ * f = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_initial_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":447
+ * trace_obj = None
+ * initial_trace_obj = None
+ * check_trace_obj = None # <<<<<<<<<<<<<<
+ * f = None
+ * frame_id_to_frame = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_check_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":448
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ * f = None # <<<<<<<<<<<<<<
+ * frame_id_to_frame = None
+ * main_debugger = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":449
+ * check_trace_obj = None
+ * f = None
+ * frame_id_to_frame = None # <<<<<<<<<<<<<<
+ * main_debugger = None
+ * thread = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_frame_id_to_frame, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":450
+ * f = None
+ * frame_id_to_frame = None
+ * main_debugger = None # <<<<<<<<<<<<<<
+ * thread = None
+ *
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_main_debugger, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":451
+ * frame_id_to_frame = None
+ * main_debugger = None
+ * thread = None # <<<<<<<<<<<<<<
+ *
+ * def get_func_name(self, frame):
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_thread, Py_None);
+ goto __pyx_L5;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L4_error:;
+ __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_24);
+ __Pyx_XGOTREF(__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_22);
+ __pyx_t_17 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_25 = __pyx_filename;
+ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":445
+ * finally:
+ * #Clear some local variables...
+ * trace_obj = None # <<<<<<<<<<<<<<
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":446
+ * #Clear some local variables...
+ * trace_obj = None
+ * initial_trace_obj = None # <<<<<<<<<<<<<<
+ * check_trace_obj = None
+ * f = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_initial_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":447
+ * trace_obj = None
+ * initial_trace_obj = None
+ * check_trace_obj = None # <<<<<<<<<<<<<<
+ * f = None
+ * frame_id_to_frame = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_check_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":448
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ * f = None # <<<<<<<<<<<<<<
+ * frame_id_to_frame = None
+ * main_debugger = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":449
+ * check_trace_obj = None
+ * f = None
+ * frame_id_to_frame = None # <<<<<<<<<<<<<<
+ * main_debugger = None
+ * thread = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_frame_id_to_frame, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":450
+ * f = None
+ * frame_id_to_frame = None
+ * main_debugger = None # <<<<<<<<<<<<<<
+ * thread = None
+ *
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_main_debugger, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":451
+ * frame_id_to_frame = None
+ * main_debugger = None
+ * thread = None # <<<<<<<<<<<<<<
+ *
+ * def get_func_name(self, frame):
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_thread, Py_None);
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_XGIVEREF(__pyx_t_23);
+ __Pyx_XGIVEREF(__pyx_t_22);
+ __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
+ }
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
+ __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_25;
+ goto __pyx_L1_error;
+ }
+ __pyx_L3_return: {
+ __pyx_t_22 = __pyx_r;
+ __pyx_r = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":445
+ * finally:
+ * #Clear some local variables...
+ * trace_obj = None # <<<<<<<<<<<<<<
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":446
+ * #Clear some local variables...
+ * trace_obj = None
+ * initial_trace_obj = None # <<<<<<<<<<<<<<
+ * check_trace_obj = None
+ * f = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_initial_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":447
+ * trace_obj = None
+ * initial_trace_obj = None
+ * check_trace_obj = None # <<<<<<<<<<<<<<
+ * f = None
+ * frame_id_to_frame = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_check_trace_obj, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":448
+ * initial_trace_obj = None
+ * check_trace_obj = None
+ * f = None # <<<<<<<<<<<<<<
+ * frame_id_to_frame = None
+ * main_debugger = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":449
+ * check_trace_obj = None
+ * f = None
+ * frame_id_to_frame = None # <<<<<<<<<<<<<<
+ * main_debugger = None
+ * thread = None
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_frame_id_to_frame, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":450
+ * f = None
+ * frame_id_to_frame = None
+ * main_debugger = None # <<<<<<<<<<<<<<
+ * thread = None
+ *
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_main_debugger, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":451
+ * frame_id_to_frame = None
+ * main_debugger = None
+ * thread = None # <<<<<<<<<<<<<<
+ *
+ * def get_func_name(self, frame):
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_thread, Py_None);
+ __pyx_r = __pyx_t_22;
+ __pyx_t_22 = 0;
+ goto __pyx_L0;
+ }
+ __pyx_L5:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":332
+ * return flag, frame
+ *
+ * def handle_exception(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * try:
+ * # print 'handle_exception', frame.f_lineno, frame.f_code.co_name
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.handle_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_trace_obj);
+ __Pyx_XDECREF(__pyx_v_main_debugger);
+ __Pyx_XDECREF(__pyx_v_initial_trace_obj);
+ __Pyx_XDECREF(__pyx_v_check_trace_obj);
+ __Pyx_XDECREF(__pyx_v_filename);
+ __Pyx_XDECREF(__pyx_v_filename_to_lines_where_exceptions_are_ignored);
+ __Pyx_XDECREF(__pyx_v_lines_ignored);
+ __Pyx_XDECREF(__pyx_v_curr_stat);
+ __Pyx_XDECREF(__pyx_v_last_stat);
+ __Pyx_XDECREF(__pyx_v_from_user_input);
+ __Pyx_XDECREF(__pyx_v_merged);
+ __Pyx_XDECREF(__pyx_v_exc_lineno);
+ __Pyx_XDECREF(__pyx_v_line);
+ __Pyx_XDECREF(__pyx_v_thread);
+ __Pyx_XDECREF(__pyx_v_frame_id_to_frame);
+ __Pyx_XDECREF(__pyx_v_f);
+ __Pyx_XDECREF(__pyx_v_thread_id);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":453
+ * thread = None
+ *
+ * def get_func_name(self, frame): # <<<<<<<<<<<<<<
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_15get_func_name(PyObject *__pyx_v_self, PyObject *__pyx_v_frame); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_15get_func_name(PyObject *__pyx_v_self, PyObject *__pyx_v_frame) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("get_func_name (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_14get_func_name(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), ((PyObject *)__pyx_v_frame));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_14get_func_name(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame) {
+ PyObject *__pyx_v_code_obj = NULL;
+ PyObject *__pyx_v_func_name = NULL;
+ PyObject *__pyx_v_cls_name = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_9;
+ int __pyx_t_10;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ __Pyx_RefNannySetupContext("get_func_name", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":454
+ *
+ * def get_func_name(self, frame):
+ * code_obj = frame.f_code # <<<<<<<<<<<<<<
+ * func_name = code_obj.co_name
+ * try:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_code_obj = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":455
+ * def get_func_name(self, frame):
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name # <<<<<<<<<<<<<<
+ * try:
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_code_obj, __pyx_n_s_co_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_func_name = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":456
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name
+ * try: # <<<<<<<<<<<<<<
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":457
+ * func_name = code_obj.co_name
+ * try:
+ * cls_name = get_clsname_for_code(code_obj, frame) # <<<<<<<<<<<<<<
+ * if cls_name is not None:
+ * return "%s.%s" % (cls_name, func_name)
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_clsname_for_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_code_obj, __pyx_v_frame};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_code_obj, __pyx_v_frame};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 457, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_6) {
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_code_obj);
+ __Pyx_GIVEREF(__pyx_v_code_obj);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_code_obj);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_frame);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_cls_name = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":458
+ * try:
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None: # <<<<<<<<<<<<<<
+ * return "%s.%s" % (cls_name, func_name)
+ * else:
+ */
+ __pyx_t_9 = (__pyx_v_cls_name != Py_None);
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":459
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None:
+ * return "%s.%s" % (cls_name, func_name) # <<<<<<<<<<<<<<
+ * else:
+ * return func_name
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_cls_name);
+ __Pyx_GIVEREF(__pyx_v_cls_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_cls_name);
+ __Pyx_INCREF(__pyx_v_func_name);
+ __Pyx_GIVEREF(__pyx_v_func_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_func_name);
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":458
+ * try:
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None: # <<<<<<<<<<<<<<
+ * return "%s.%s" % (cls_name, func_name)
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":461
+ * return "%s.%s" % (cls_name, func_name)
+ * else:
+ * return func_name # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_func_name);
+ __pyx_r = __pyx_v_func_name;
+ goto __pyx_L7_try_return;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":456
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name
+ * try: # <<<<<<<<<<<<<<
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None:
+ */
+ }
+ __pyx_L3_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":462
+ * else:
+ * return func_name
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * return func_name
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.get_func_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 462, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_8);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":463
+ * return func_name
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * return func_name
+ *
+ */
+ __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 463, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 463, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (__pyx_t_11) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 463, __pyx_L5_except_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ } else {
+ __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 463, __pyx_L5_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":464
+ * except:
+ * traceback.print_exc()
+ * return func_name # <<<<<<<<<<<<<<
+ *
+ * def show_return_values(self, frame, arg):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_func_name);
+ __pyx_r = __pyx_v_func_name;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L6_except_return;
+ }
+ __pyx_L5_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":456
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name
+ * try: # <<<<<<<<<<<<<<
+ * cls_name = get_clsname_for_code(code_obj, frame)
+ * if cls_name is not None:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L7_try_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L0;
+ __pyx_L6_except_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":453
+ * thread = None
+ *
+ * def get_func_name(self, frame): # <<<<<<<<<<<<<<
+ * code_obj = frame.f_code
+ * func_name = code_obj.co_name
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.get_func_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_code_obj);
+ __Pyx_XDECREF(__pyx_v_func_name);
+ __Pyx_XDECREF(__pyx_v_cls_name);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":466
+ * return func_name
+ *
+ * def show_return_values(self, frame, arg): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_17show_return_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_17show_return_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("show_return_values (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_arg,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("show_return_values", 1, 2, 2, 1); __PYX_ERR(0, 466, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "show_return_values") < 0)) __PYX_ERR(0, 466, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_arg = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("show_return_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 466, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.show_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_16show_return_values(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_16show_return_values(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_v_f_locals_back = NULL;
+ PyObject *__pyx_v_return_values_dict = NULL;
+ PyObject *__pyx_v_name = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ int __pyx_t_13;
+ char const *__pyx_t_14;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ __Pyx_RefNannySetupContext("show_return_values", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":467
+ *
+ * def show_return_values(self, frame, arg):
+ * try: # <<<<<<<<<<<<<<
+ * try:
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":468
+ * def show_return_values(self, frame, arg):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":469
+ * try:
+ * try:
+ * f_locals_back = getattr(frame.f_back, "f_locals", None) # <<<<<<<<<<<<<<
+ * if f_locals_back is not None:
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_GetAttr3(__pyx_t_4, __pyx_n_s_f_locals, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_f_locals_back = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":470
+ * try:
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None: # <<<<<<<<<<<<<<
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ * if return_values_dict is None:
+ */
+ __pyx_t_6 = (__pyx_v_f_locals_back != Py_None);
+ __pyx_t_7 = (__pyx_t_6 != 0);
+ if (__pyx_t_7) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":471
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None:
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None) # <<<<<<<<<<<<<<
+ * if return_values_dict is None:
+ * return_values_dict = {}
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f_locals_back, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_RETURN_VALUES_DICT); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, Py_None};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, Py_None};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (__pyx_t_9) {
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ }
+ __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_8);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, Py_None);
+ __pyx_t_8 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_return_values_dict = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":472
+ * if f_locals_back is not None:
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ * if return_values_dict is None: # <<<<<<<<<<<<<<
+ * return_values_dict = {}
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ */
+ __pyx_t_7 = (__pyx_v_return_values_dict == Py_None);
+ __pyx_t_6 = (__pyx_t_7 != 0);
+ if (__pyx_t_6) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":473
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ * if return_values_dict is None:
+ * return_values_dict = {} # <<<<<<<<<<<<<<
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ * name = self.get_func_name(frame)
+ */
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF_SET(__pyx_v_return_values_dict, __pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":474
+ * if return_values_dict is None:
+ * return_values_dict = {}
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict # <<<<<<<<<<<<<<
+ * name = self.get_func_name(frame)
+ * return_values_dict[name] = arg
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_RETURN_VALUES_DICT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (unlikely(PyObject_SetItem(__pyx_v_f_locals_back, __pyx_t_5, __pyx_v_return_values_dict) < 0)) __PYX_ERR(0, 474, __pyx_L6_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":472
+ * if f_locals_back is not None:
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ * if return_values_dict is None: # <<<<<<<<<<<<<<
+ * return_values_dict = {}
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":475
+ * return_values_dict = {}
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ * name = self.get_func_name(frame) # <<<<<<<<<<<<<<
+ * return_values_dict[name] = arg
+ * except:
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_func_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_frame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); __pyx_t_11 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_frame);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_name = __pyx_t_5;
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":476
+ * f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ * name = self.get_func_name(frame)
+ * return_values_dict[name] = arg # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ if (unlikely(PyObject_SetItem(__pyx_v_return_values_dict, __pyx_v_name, __pyx_v_arg) < 0)) __PYX_ERR(0, 476, __pyx_L6_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":470
+ * try:
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None: # <<<<<<<<<<<<<<
+ * return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ * if return_values_dict is None:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":468
+ * def show_return_values(self, frame, arg):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L11_try_end;
+ __pyx_L6_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":477
+ * name = self.get_func_name(frame)
+ * return_values_dict[name] = arg
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * finally:
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.show_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_8) < 0) __PYX_ERR(0, 477, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_8);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":478
+ * return_values_dict[name] = arg
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * finally:
+ * f_locals_back = None
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 478, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (__pyx_t_9) {
+ __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L8_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else {
+ __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 478, __pyx_L8_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L7_exception_handled;
+ }
+ __pyx_L8_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":468
+ * def show_return_values(self, frame, arg):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L4_error;
+ __pyx_L7_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ __pyx_L11_try_end:;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":480
+ * traceback.print_exc()
+ * finally:
+ * f_locals_back = None # <<<<<<<<<<<<<<
+ *
+ * def remove_return_values(self, main_debugger, frame):
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f_locals_back, Py_None);
+ goto __pyx_L5;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L4_error:;
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __pyx_t_10 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
+ {
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f_locals_back, Py_None);
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
+ }
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
+ goto __pyx_L1_error;
+ }
+ __pyx_L5:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":466
+ * return func_name
+ *
+ * def show_return_values(self, frame, arg): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.show_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_f_locals_back);
+ __Pyx_XDECREF(__pyx_v_return_values_dict);
+ __Pyx_XDECREF(__pyx_v_name);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":482
+ * f_locals_back = None
+ *
+ * def remove_return_values(self, main_debugger, frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_19remove_return_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_19remove_return_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_main_debugger = 0;
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("remove_return_values (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_main_debugger,&__pyx_n_s_frame,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_main_debugger)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("remove_return_values", 1, 2, 2, 1); __PYX_ERR(0, 482, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_return_values") < 0)) __PYX_ERR(0, 482, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_main_debugger = values[0];
+ __pyx_v_frame = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("remove_return_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 482, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.remove_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_18remove_return_values(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_main_debugger, __pyx_v_frame);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_18remove_return_values(CYTHON_UNUSED struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_main_debugger, PyObject *__pyx_v_frame) {
+ PyObject *__pyx_v_f_locals_back = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ int __pyx_t_11;
+ PyObject *__pyx_t_12 = NULL;
+ int __pyx_t_13;
+ char const *__pyx_t_14;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ __Pyx_RefNannySetupContext("remove_return_values", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":483
+ *
+ * def remove_return_values(self, main_debugger, frame):
+ * try: # <<<<<<<<<<<<<<
+ * try:
+ * # Showing return values was turned off, we should remove them from locals dict.
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":484
+ * def remove_return_values(self, main_debugger, frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * # Showing return values was turned off, we should remove them from locals dict.
+ * # The values can be in the current frame or in the back one
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":487
+ * # Showing return values was turned off, we should remove them from locals dict.
+ * # The values can be in the current frame or in the back one
+ * frame.f_locals.pop(RETURN_VALUES_DICT, None) # <<<<<<<<<<<<<<
+ *
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_locals); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_pop); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_RETURN_VALUES_DICT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, Py_None};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, Py_None};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, Py_None);
+ __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":489
+ * frame.f_locals.pop(RETURN_VALUES_DICT, None)
+ *
+ * f_locals_back = getattr(frame.f_back, "f_locals", None) # <<<<<<<<<<<<<<
+ * if f_locals_back is not None:
+ * f_locals_back.pop(RETURN_VALUES_DICT, None)
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_GetAttr3(__pyx_t_4, __pyx_n_s_f_locals, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_f_locals_back = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":490
+ *
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None: # <<<<<<<<<<<<<<
+ * f_locals_back.pop(RETURN_VALUES_DICT, None)
+ * except:
+ */
+ __pyx_t_10 = (__pyx_v_f_locals_back != Py_None);
+ __pyx_t_11 = (__pyx_t_10 != 0);
+ if (__pyx_t_11) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":491
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None:
+ * f_locals_back.pop(RETURN_VALUES_DICT, None) # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f_locals_back, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_RETURN_VALUES_DICT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_5 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_9, Py_None};
+ __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_9, Py_None};
+ __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_5) {
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ }
+ __Pyx_GIVEREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_9);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, Py_None);
+ __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":490
+ *
+ * f_locals_back = getattr(frame.f_back, "f_locals", None)
+ * if f_locals_back is not None: # <<<<<<<<<<<<<<
+ * f_locals_back.pop(RETURN_VALUES_DICT, None)
+ * except:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":484
+ * def remove_return_values(self, main_debugger, frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * # Showing return values was turned off, we should remove them from locals dict.
+ * # The values can be in the current frame or in the back one
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L11_try_end;
+ __pyx_L6_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":492
+ * if f_locals_back is not None:
+ * f_locals_back.pop(RETURN_VALUES_DICT, None)
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * finally:
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.remove_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 492, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":493
+ * f_locals_back.pop(RETURN_VALUES_DICT, None)
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * finally:
+ * f_locals_back = None
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 493, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 493, __pyx_L8_except_error)
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 493, __pyx_L8_except_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 493, __pyx_L8_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L7_exception_handled;
+ }
+ __pyx_L8_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":484
+ * def remove_return_values(self, main_debugger, frame):
+ * try:
+ * try: # <<<<<<<<<<<<<<
+ * # Showing return values was turned off, we should remove them from locals dict.
+ * # The values can be in the current frame or in the back one
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L4_error;
+ __pyx_L7_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ __pyx_L11_try_end:;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":495
+ * traceback.print_exc()
+ * finally:
+ * f_locals_back = None # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f_locals_back, Py_None);
+ goto __pyx_L5;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L4_error:;
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __pyx_t_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
+ {
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_f_locals_back, Py_None);
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
+ }
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
+ __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
+ __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
+ goto __pyx_L1_error;
+ }
+ __pyx_L5:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":482
+ * f_locals_back = None
+ *
+ * def remove_return_values(self, main_debugger, frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.remove_return_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_f_locals_back);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":498
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cpdef trace_dispatch(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef str filename;
+ * cdef bint is_exception_event;
+ */
+
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_21trace_dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_trace_dispatch(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg, int __pyx_skip_dispatch) {
+ PyObject *__pyx_v_filename = 0;
+ int __pyx_v_is_exception_event;
+ int __pyx_v_has_exception_breakpoints;
+ int __pyx_v_can_skip;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_info = 0;
+ int __pyx_v_step_cmd;
+ int __pyx_v_line;
+ int __pyx_v_is_line;
+ int __pyx_v_is_call;
+ int __pyx_v_is_return;
+ PyObject *__pyx_v_curr_func_name = 0;
+ int __pyx_v_exist_result;
+ PyObject *__pyx_v_frame_skips_cache = 0;
+ PyObject *__pyx_v_frame_cache_key = 0;
+ PyObject *__pyx_v_line_cache_key = 0;
+ int __pyx_v_breakpoints_in_line_cache;
+ int __pyx_v_breakpoints_in_frame_cache;
+ int __pyx_v_has_breakpoint_in_frame;
+ PyObject *__pyx_v_main_debugger = NULL;
+ PyObject *__pyx_v_thread = NULL;
+ PyObject *__pyx_v_plugin_manager = NULL;
+ PyObject *__pyx_v_flag = NULL;
+ PyObject *__pyx_v_need_trace_return = NULL;
+ PyObject *__pyx_v_stop_frame = NULL;
+ PyObject *__pyx_v_breakpoints_for_file = NULL;
+ PyObject *__pyx_v_breakpoint = NULL;
+ PyObject *__pyx_v_stop_info = NULL;
+ PyObject *__pyx_v_stop = NULL;
+ PyObject *__pyx_v_bp_type = NULL;
+ PyObject *__pyx_v_new_frame = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_v_condition = NULL;
+ PyObject *__pyx_v_back = NULL;
+ CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
+ PyObject *__pyx_v_back_filename = NULL;
+ PyObject *__pyx_v_base = NULL;
+ long __pyx_v_should_skip;
+ PyObject *__pyx_v_plugin_stop = NULL;
+ PyObject *__pyx_v_f_code = NULL;
+ PyObject *__pyx_v_file_type = NULL;
+ CYTHON_UNUSED PyObject *__pyx_v_stopped_on_plugin = NULL;
+ PyObject *__pyx_v_retVal = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_9;
+ int __pyx_t_10;
+ PyObject *(*__pyx_t_11)(PyObject *);
+ int __pyx_t_12;
+ PyObject *__pyx_t_13 = NULL;
+ Py_ssize_t __pyx_t_14;
+ PyObject *(*__pyx_t_15)(PyObject *);
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ PyObject *__pyx_t_18 = NULL;
+ int __pyx_t_19;
+ char const *__pyx_t_20;
+ PyObject *__pyx_t_21 = NULL;
+ PyObject *__pyx_t_22 = NULL;
+ PyObject *__pyx_t_23 = NULL;
+ PyObject *__pyx_t_24 = NULL;
+ PyObject *__pyx_t_25 = NULL;
+ PyObject *__pyx_t_26 = NULL;
+ int __pyx_t_27;
+ char const *__pyx_t_28;
+ __Pyx_RefNannySetupContext("trace_dispatch", 0);
+ __Pyx_INCREF(__pyx_v_frame);
+ /* Check if called by wrapper */
+ if (unlikely(__pyx_skip_dispatch)) ;
+ /* Check if overridden in Python */
+ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_21trace_dispatch)) {
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":521
+ * # ENDIF
+ *
+ * main_debugger, filename, info, thread, frame_skips_cache, frame_cache_key = self._args # <<<<<<<<<<<<<<
+ * # print('frame trace_dispatch', frame.f_lineno, frame.f_code.co_name, event, info.pydev_step_cmd)
+ * try:
+ */
+ __pyx_t_1 = __pyx_v_self->_args;
+ __Pyx_INCREF(__pyx_t_1);
+ if (likely(__pyx_t_1 != Py_None)) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 6)) {
+ if (size > 6) __Pyx_RaiseTooManyValuesError(6);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 521, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4);
+ __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ #else
+ {
+ Py_ssize_t i;
+ PyObject** temps[6] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_6,&__pyx_t_4,&__pyx_t_7,&__pyx_t_8};
+ for (i=0; i < 6; i++) {
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 521, __pyx_L1_error)
+ __Pyx_GOTREF(item);
+ *(temps[i]) = item;
+ }
+ }
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 521, __pyx_L1_error)
+ }
+ if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 521, __pyx_L1_error)
+ if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo))))) __PYX_ERR(0, 521, __pyx_L1_error)
+ if (!(likely(PyDict_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 521, __pyx_L1_error)
+ if (!(likely(PyTuple_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 521, __pyx_L1_error)
+ __pyx_v_main_debugger = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __pyx_v_filename = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_v_info = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_v_thread = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __pyx_v_frame_skips_cache = ((PyObject*)__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_v_frame_cache_key = ((PyObject*)__pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":523
+ * main_debugger, filename, info, thread, frame_skips_cache, frame_cache_key = self._args
+ * # print('frame trace_dispatch', frame.f_lineno, frame.f_code.co_name, event, info.pydev_step_cmd)
+ * try: # <<<<<<<<<<<<<<
+ * info.is_tracing = True
+ * line = frame.f_lineno
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":524
+ * # print('frame trace_dispatch', frame.f_lineno, frame.f_code.co_name, event, info.pydev_step_cmd)
+ * try:
+ * info.is_tracing = True # <<<<<<<<<<<<<<
+ * line = frame.f_lineno
+ * line_cache_key = (frame_cache_key, line)
+ */
+ __pyx_v_info->is_tracing = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":525
+ * try:
+ * info.is_tracing = True
+ * line = frame.f_lineno # <<<<<<<<<<<<<<
+ * line_cache_key = (frame_cache_key, line)
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_lineno); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 525, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_line = __pyx_t_5;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":526
+ * info.is_tracing = True
+ * line = frame.f_lineno
+ * line_cache_key = (frame_cache_key, line) # <<<<<<<<<<<<<<
+ *
+ * if main_debugger._finish_debugging_session:
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 526, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_frame_cache_key);
+ __Pyx_GIVEREF(__pyx_v_frame_cache_key);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_frame_cache_key);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_v_line_cache_key = ((PyObject*)__pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":528
+ * line_cache_key = (frame_cache_key, line)
+ *
+ * if main_debugger._finish_debugging_session: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_finish_debugging_session); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 528, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":529
+ *
+ * if main_debugger._finish_debugging_session:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * plugin_manager = main_debugger.plugin
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":528
+ * line_cache_key = (frame_cache_key, line)
+ *
+ * if main_debugger._finish_debugging_session: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":531
+ * return None
+ *
+ * plugin_manager = main_debugger.plugin # <<<<<<<<<<<<<<
+ *
+ * is_exception_event = event == 'exception'
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_plugin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 531, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_v_plugin_manager = __pyx_t_8;
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":533
+ * plugin_manager = main_debugger.plugin
+ *
+ * is_exception_event = event == 'exception' # <<<<<<<<<<<<<<
+ * has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks
+ *
+ */
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_exception, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 533, __pyx_L4_error)
+ __pyx_v_is_exception_event = __pyx_t_9;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":534
+ *
+ * is_exception_event = event == 'exception'
+ * has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks # <<<<<<<<<<<<<<
+ *
+ * if is_exception_event:
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_break_on_caught_exceptions); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 534, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 534, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L7_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_has_plugin_exception_breaks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 534, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 534, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L7_bool_binop_done:;
+ __pyx_v_has_exception_breakpoints = __pyx_t_9;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":536
+ * has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks
+ *
+ * if is_exception_event: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ */
+ __pyx_t_9 = (__pyx_v_is_exception_event != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":537
+ *
+ * if is_exception_event:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ * if flag:
+ */
+ __pyx_t_9 = (__pyx_v_has_exception_breakpoints != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":538
+ * if is_exception_event:
+ * if has_exception_breakpoints:
+ * flag, frame = self.should_stop_on_exception(frame, event, arg) # <<<<<<<<<<<<<<
+ * if flag:
+ * self.handle_exception(frame, event, arg)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_should_stop_on_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
+ PyObject* sequence = __pyx_t_8;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 538, __pyx_L4_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ #else
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ #endif
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 538, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_11 = Py_TYPE(__pyx_t_7)->tp_iternext;
+ index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_1);
+ index = 1; __pyx_t_4 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_7), 2) < 0) __PYX_ERR(0, 538, __pyx_L4_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L12_unpacking_done;
+ __pyx_L11_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 538, __pyx_L4_error)
+ __pyx_L12_unpacking_done:;
+ }
+ __pyx_v_flag = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_frame, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":539
+ * if has_exception_breakpoints:
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ * if flag: # <<<<<<<<<<<<<<
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch
+ */
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 539, __pyx_L4_error)
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":540
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ * if flag:
+ * self.handle_exception(frame, event, arg) # <<<<<<<<<<<<<<
+ * return self.trace_dispatch
+ * is_line = False
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 540, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 540, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 540, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 540, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":541
+ * if flag:
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ * is_line = False
+ * is_return = False
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 541, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":539
+ * if has_exception_breakpoints:
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ * if flag: # <<<<<<<<<<<<<<
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":537
+ *
+ * if is_exception_event:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ * if flag:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":542
+ * self.handle_exception(frame, event, arg)
+ * return self.trace_dispatch
+ * is_line = False # <<<<<<<<<<<<<<
+ * is_return = False
+ * is_call = False
+ */
+ __pyx_v_is_line = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":543
+ * return self.trace_dispatch
+ * is_line = False
+ * is_return = False # <<<<<<<<<<<<<<
+ * is_call = False
+ * else:
+ */
+ __pyx_v_is_return = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":544
+ * is_line = False
+ * is_return = False
+ * is_call = False # <<<<<<<<<<<<<<
+ * else:
+ * is_line = event == 'line'
+ */
+ __pyx_v_is_call = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":536
+ * has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks
+ *
+ * if is_exception_event: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * flag, frame = self.should_stop_on_exception(frame, event, arg)
+ */
+ goto __pyx_L9;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":546
+ * is_call = False
+ * else:
+ * is_line = event == 'line' # <<<<<<<<<<<<<<
+ * is_return = event == 'return'
+ * is_call = event == 'call'
+ */
+ /*else*/ {
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_line, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 546, __pyx_L4_error)
+ __pyx_v_is_line = __pyx_t_9;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":547
+ * else:
+ * is_line = event == 'line'
+ * is_return = event == 'return' # <<<<<<<<<<<<<<
+ * is_call = event == 'call'
+ * if not is_line and not is_return and not is_call:
+ */
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_return, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 547, __pyx_L4_error)
+ __pyx_v_is_return = __pyx_t_9;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":548
+ * is_line = event == 'line'
+ * is_return = event == 'return'
+ * is_call = event == 'call' # <<<<<<<<<<<<<<
+ * if not is_line and not is_return and not is_call:
+ * # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ */
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_call, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 548, __pyx_L4_error)
+ __pyx_v_is_call = __pyx_t_9;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":549
+ * is_return = event == 'return'
+ * is_call = event == 'call'
+ * if not is_line and not is_return and not is_call: # <<<<<<<<<<<<<<
+ * # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ * return None
+ */
+ __pyx_t_10 = ((!(__pyx_v_is_line != 0)) != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L15_bool_binop_done;
+ }
+ __pyx_t_10 = ((!(__pyx_v_is_return != 0)) != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L15_bool_binop_done;
+ }
+ __pyx_t_10 = ((!(__pyx_v_is_call != 0)) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L15_bool_binop_done:;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":551
+ * if not is_line and not is_return and not is_call:
+ * # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ * return None # <<<<<<<<<<<<<<
+ *
+ * need_trace_return = False
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":549
+ * is_return = event == 'return'
+ * is_call = event == 'call'
+ * if not is_line and not is_return and not is_call: # <<<<<<<<<<<<<<
+ * # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ * return None
+ */
+ }
+ }
+ __pyx_L9:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":553
+ * return None
+ *
+ * need_trace_return = False # <<<<<<<<<<<<<<
+ * if is_call and main_debugger.signature_factory:
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ */
+ __Pyx_INCREF(Py_False);
+ __pyx_v_need_trace_return = Py_False;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":554
+ *
+ * need_trace_return = False
+ * if is_call and main_debugger.signature_factory: # <<<<<<<<<<<<<<
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ * if is_return and main_debugger.signature_factory:
+ */
+ __pyx_t_10 = (__pyx_v_is_call != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L19_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_signature_factory); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 554, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 554, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L19_bool_binop_done:;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":555
+ * need_trace_return = False
+ * if is_call and main_debugger.signature_factory:
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename) # <<<<<<<<<<<<<<
+ * if is_return and main_debugger.signature_factory:
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_send_signature_call_trace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 555, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 555, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_5, __pyx_v_filename);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 555, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF_SET(__pyx_v_need_trace_return, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":554
+ *
+ * need_trace_return = False
+ * if is_call and main_debugger.signature_factory: # <<<<<<<<<<<<<<
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ * if is_return and main_debugger.signature_factory:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":556
+ * if is_call and main_debugger.signature_factory:
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ * if is_return and main_debugger.signature_factory: # <<<<<<<<<<<<<<
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ *
+ */
+ __pyx_t_10 = (__pyx_v_is_return != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L22_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_signature_factory); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 556, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L22_bool_binop_done:;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":557
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ * if is_return and main_debugger.signature_factory:
+ * send_signature_return_trace(main_debugger, frame, filename, arg) # <<<<<<<<<<<<<<
+ *
+ * stop_frame = info.pydev_step_stop
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_send_signature_return_trace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 557, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_filename, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 557, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 557, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_5, __pyx_v_filename);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 557, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":556
+ * if is_call and main_debugger.signature_factory:
+ * need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ * if is_return and main_debugger.signature_factory: # <<<<<<<<<<<<<<
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":559
+ * send_signature_return_trace(main_debugger, frame, filename, arg)
+ *
+ * stop_frame = info.pydev_step_stop # <<<<<<<<<<<<<<
+ * step_cmd = info.pydev_step_cmd
+ *
+ */
+ __pyx_t_8 = __pyx_v_info->pydev_step_stop;
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_v_stop_frame = __pyx_t_8;
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":560
+ *
+ * stop_frame = info.pydev_step_stop
+ * step_cmd = info.pydev_step_cmd # <<<<<<<<<<<<<<
+ *
+ * if is_exception_event:
+ */
+ __pyx_t_5 = __pyx_v_info->pydev_step_cmd;
+ __pyx_v_step_cmd = __pyx_t_5;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":562
+ * step_cmd = info.pydev_step_cmd
+ *
+ * if is_exception_event: # <<<<<<<<<<<<<<
+ * breakpoints_for_file = None
+ * # CMD_STEP_OVER = 108
+ */
+ __pyx_t_9 = (__pyx_v_is_exception_event != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":563
+ *
+ * if is_exception_event:
+ * breakpoints_for_file = None # <<<<<<<<<<<<<<
+ * # CMD_STEP_OVER = 108
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_breakpoints_for_file = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":565
+ * breakpoints_for_file = None
+ * # CMD_STEP_OVER = 108
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \ # <<<<<<<<<<<<<<
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_stop_frame); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 565, __pyx_L4_error)
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L26_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_stop_frame != __pyx_v_frame);
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_9 = __pyx_t_12;
+ goto __pyx_L26_bool_binop_done;
+ }
+ __pyx_t_12 = ((__pyx_v_step_cmd == 0x6C) != 0);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_9 = __pyx_t_12;
+ goto __pyx_L26_bool_binop_done;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":566
+ * # CMD_STEP_OVER = 108
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None: # <<<<<<<<<<<<<<
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ * info.pydev_step_stop = None
+ */
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_arg, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_builtin_StopIteration, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L31_bool_binop_done;
+ }
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_builtin_GeneratorExit, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L31_bool_binop_done:;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L26_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_arg, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 566, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = (__pyx_t_8 == Py_None);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ __pyx_t_9 = __pyx_t_12;
+ __pyx_L26_bool_binop_done:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":565
+ * breakpoints_for_file = None
+ * # CMD_STEP_OVER = 108
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \ # <<<<<<<<<<<<<<
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ */
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":567
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107 # <<<<<<<<<<<<<<
+ * info.pydev_step_stop = None
+ * else:
+ */
+ __pyx_v_info->pydev_step_cmd = 0x6B;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":568
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ * info.pydev_step_stop = None # <<<<<<<<<<<<<<
+ * else:
+ * # If we are in single step mode and something causes us to exit the current frame, we need to make sure we break
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_info->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_info->pydev_step_stop);
+ __pyx_v_info->pydev_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":565
+ * breakpoints_for_file = None
+ * # CMD_STEP_OVER = 108
+ * if stop_frame and stop_frame is not frame and step_cmd == 108 and \ # <<<<<<<<<<<<<<
+ * arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":562
+ * step_cmd = info.pydev_step_cmd
+ *
+ * if is_exception_event: # <<<<<<<<<<<<<<
+ * breakpoints_for_file = None
+ * # CMD_STEP_OVER = 108
+ */
+ goto __pyx_L24;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":576
+ * # Note: this is especially troublesome when we're skipping code with the
+ * # @DontTrace comment.
+ * if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108 # <<<<<<<<<<<<<<
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ */
+ /*else*/ {
+ __pyx_t_12 = (__pyx_v_stop_frame == __pyx_v_frame);
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L34_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_is_return != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L34_bool_binop_done;
+ }
+ switch (__pyx_v_step_cmd) {
+ case 0x6D:
+ case 0x6C:
+ __pyx_t_10 = 1;
+ break;
+ default:
+ __pyx_t_10 = 0;
+ break;
+ }
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ __pyx_t_9 = __pyx_t_12;
+ __pyx_L34_bool_binop_done:;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":577
+ * # @DontTrace comment.
+ * if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR) # <<<<<<<<<<<<<<
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ * info.pydev_step_stop = None
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 577, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_co_flags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_32, 0x20, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 577, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 577, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = ((!__pyx_t_9) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":578
+ * if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107 # <<<<<<<<<<<<<<
+ * info.pydev_step_stop = None
+ *
+ */
+ __pyx_v_info->pydev_step_cmd = 0x6B;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":579
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ * info.pydev_step_stop = None # <<<<<<<<<<<<<<
+ *
+ * breakpoints_for_file = main_debugger.breakpoints.get(filename)
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_info->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_info->pydev_step_stop);
+ __pyx_v_info->pydev_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":577
+ * # @DontTrace comment.
+ * if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR) # <<<<<<<<<<<<<<
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ * info.pydev_step_stop = None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":576
+ * # Note: this is especially troublesome when we're skipping code with the
+ * # @DontTrace comment.
+ * if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108 # <<<<<<<<<<<<<<
+ * if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ * info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":581
+ * info.pydev_step_stop = None
+ *
+ * breakpoints_for_file = main_debugger.breakpoints.get(filename) # <<<<<<<<<<<<<<
+ *
+ * can_skip = False
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_breakpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filename); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_filename};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_filename);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_v_breakpoints_for_file = __pyx_t_8;
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":583
+ * breakpoints_for_file = main_debugger.breakpoints.get(filename)
+ *
+ * can_skip = False # <<<<<<<<<<<<<<
+ *
+ * if info.pydev_state == 1: # STATE_RUN = 1
+ */
+ __pyx_v_can_skip = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":585
+ * can_skip = False
+ *
+ * if info.pydev_state == 1: # STATE_RUN = 1 # <<<<<<<<<<<<<<
+ * #we can skip if:
+ * #- we have no stop marked
+ */
+ __pyx_t_12 = ((__pyx_v_info->pydev_state == 1) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":590
+ * #- we should make a step return/step over and we're not in the current frame
+ * # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ * can_skip = (step_cmd == -1 and stop_frame is None)\ # <<<<<<<<<<<<<<
+ * or (step_cmd in (109, 108) and stop_frame is not frame)
+ *
+ */
+ __pyx_t_9 = ((__pyx_v_step_cmd == -1L) != 0);
+ if (!__pyx_t_9) {
+ goto __pyx_L40_next_or;
+ } else {
+ }
+ __pyx_t_9 = (__pyx_v_stop_frame == Py_None);
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L39_bool_binop_done;
+ }
+ __pyx_L40_next_or:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":591
+ * # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ * can_skip = (step_cmd == -1 and stop_frame is None)\
+ * or (step_cmd in (109, 108) and stop_frame is not frame) # <<<<<<<<<<<<<<
+ *
+ * if can_skip:
+ */
+ switch (__pyx_v_step_cmd) {
+ case 0x6D:
+ case 0x6C:
+ __pyx_t_10 = 1;
+ break;
+ default:
+ __pyx_t_10 = 0;
+ break;
+ }
+ __pyx_t_9 = (__pyx_t_10 != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L39_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_stop_frame != __pyx_v_frame);
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L39_bool_binop_done:;
+ __pyx_v_can_skip = __pyx_t_12;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":593
+ * or (step_cmd in (109, 108) and stop_frame is not frame)
+ *
+ * if can_skip: # <<<<<<<<<<<<<<
+ * if plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+ */
+ __pyx_t_12 = (__pyx_v_can_skip != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":594
+ *
+ * if can_skip:
+ * if plugin_manager is not None and main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+ *
+ */
+ __pyx_t_10 = (__pyx_v_plugin_manager != Py_None);
+ __pyx_t_9 = (__pyx_t_10 != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L45_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_has_plugin_line_breaks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 594, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 594, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = __pyx_t_9;
+ __pyx_L45_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":595
+ * if can_skip:
+ * if plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame) # <<<<<<<<<<<<<<
+ *
+ * # CMD_STEP_OVER = 108
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_can_not_skip); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, ((PyObject *)__pyx_v_self));
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_frame);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 595, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_can_skip = (!__pyx_t_12);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":594
+ *
+ * if can_skip:
+ * if plugin_manager is not None and main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":598
+ *
+ * # CMD_STEP_OVER = 108
+ * if can_skip and is_return and main_debugger.show_return_values and info.pydev_step_cmd == 108 and frame.f_back is info.pydev_step_stop: # <<<<<<<<<<<<<<
+ * # trace function for showing return values after step over
+ * can_skip = False
+ */
+ __pyx_t_9 = (__pyx_v_can_skip != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L48_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_is_return != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L48_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_show_return_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 598, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L48_bool_binop_done;
+ }
+ __pyx_t_9 = ((__pyx_v_info->pydev_step_cmd == 0x6C) != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L48_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = (__pyx_t_8 == __pyx_v_info->pydev_step_stop);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L48_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":600
+ * if can_skip and is_return and main_debugger.show_return_values and info.pydev_step_cmd == 108 and frame.f_back is info.pydev_step_stop:
+ * # trace function for showing return values after step over
+ * can_skip = False # <<<<<<<<<<<<<<
+ *
+ * # Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint,
+ */
+ __pyx_v_can_skip = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":598
+ *
+ * # CMD_STEP_OVER = 108
+ * if can_skip and is_return and main_debugger.show_return_values and info.pydev_step_cmd == 108 and frame.f_back is info.pydev_step_stop: # <<<<<<<<<<<<<<
+ * # trace function for showing return values after step over
+ * can_skip = False
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":593
+ * or (step_cmd in (109, 108) and stop_frame is not frame)
+ *
+ * if can_skip: # <<<<<<<<<<<<<<
+ * if plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":585
+ * can_skip = False
+ *
+ * if info.pydev_state == 1: # STATE_RUN = 1 # <<<<<<<<<<<<<<
+ * #we can skip if:
+ * #- we have no stop marked
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":606
+ * # also, after we hit a breakpoint and go to some other debugging state, we have to force the set trace anyway,
+ * # so, that's why the additional checks are there.
+ * if not breakpoints_for_file: # <<<<<<<<<<<<<<
+ * if can_skip:
+ * if has_exception_breakpoints:
+ */
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_breakpoints_for_file); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 606, __pyx_L4_error)
+ __pyx_t_10 = ((!__pyx_t_12) != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":607
+ * # so, that's why the additional checks are there.
+ * if not breakpoints_for_file:
+ * if can_skip: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * return self.trace_exception
+ */
+ __pyx_t_10 = (__pyx_v_can_skip != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":608
+ * if not breakpoints_for_file:
+ * if can_skip:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * return self.trace_exception
+ * else:
+ */
+ __pyx_t_10 = (__pyx_v_has_exception_breakpoints != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":609
+ * if can_skip:
+ * if has_exception_breakpoints:
+ * return self.trace_exception # <<<<<<<<<<<<<<
+ * else:
+ * if need_trace_return:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_exception); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":608
+ * if not breakpoints_for_file:
+ * if can_skip:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * return self.trace_exception
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":611
+ * return self.trace_exception
+ * else:
+ * if need_trace_return: # <<<<<<<<<<<<<<
+ * return self.trace_return
+ * else:
+ */
+ /*else*/ {
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_need_trace_return); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 611, __pyx_L4_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":612
+ * else:
+ * if need_trace_return:
+ * return self.trace_return # <<<<<<<<<<<<<<
+ * else:
+ * return None
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_return); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 612, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":611
+ * return self.trace_exception
+ * else:
+ * if need_trace_return: # <<<<<<<<<<<<<<
+ * return self.trace_return
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":614
+ * return self.trace_return
+ * else:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * else:
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L3_return;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":607
+ * # so, that's why the additional checks are there.
+ * if not breakpoints_for_file:
+ * if can_skip: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * return self.trace_exception
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":606
+ * # also, after we hit a breakpoint and go to some other debugging state, we have to force the set trace anyway,
+ * # so, that's why the additional checks are there.
+ * if not breakpoints_for_file: # <<<<<<<<<<<<<<
+ * if can_skip:
+ * if has_exception_breakpoints:
+ */
+ goto __pyx_L53;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":618
+ * else:
+ * # When cached, 0 means we don't have a breakpoint and 1 means we have.
+ * if can_skip: # <<<<<<<<<<<<<<
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ * if breakpoints_in_line_cache == 0:
+ */
+ /*else*/ {
+ __pyx_t_10 = (__pyx_v_can_skip != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":619
+ * # When cached, 0 means we don't have a breakpoint and 1 means we have.
+ * if can_skip:
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1) # <<<<<<<<<<<<<<
+ * if breakpoints_in_line_cache == 0:
+ * return self.trace_dispatch
+ */
+ if (unlikely(__pyx_v_frame_skips_cache == Py_None)) {
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
+ __PYX_ERR(0, 619, __pyx_L4_error)
+ }
+ __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_frame_skips_cache, __pyx_v_line_cache_key, __pyx_int_neg_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 619, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 619, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_breakpoints_in_line_cache = __pyx_t_5;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":620
+ * if can_skip:
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ * if breakpoints_in_line_cache == 0: # <<<<<<<<<<<<<<
+ * return self.trace_dispatch
+ *
+ */
+ __pyx_t_10 = ((__pyx_v_breakpoints_in_line_cache == 0) != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":621
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ * if breakpoints_in_line_cache == 0:
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ *
+ * breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 621, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":620
+ * if can_skip:
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ * if breakpoints_in_line_cache == 0: # <<<<<<<<<<<<<<
+ * return self.trace_dispatch
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":618
+ * else:
+ * # When cached, 0 means we don't have a breakpoint and 1 means we have.
+ * if can_skip: # <<<<<<<<<<<<<<
+ * breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ * if breakpoints_in_line_cache == 0:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":623
+ * return self.trace_dispatch
+ *
+ * breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1) # <<<<<<<<<<<<<<
+ * if breakpoints_in_frame_cache != -1:
+ * # Gotten from cache.
+ */
+ if (unlikely(__pyx_v_frame_skips_cache == Py_None)) {
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
+ __PYX_ERR(0, 623, __pyx_L4_error)
+ }
+ __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_frame_skips_cache, __pyx_v_frame_cache_key, __pyx_int_neg_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 623, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_breakpoints_in_frame_cache = __pyx_t_5;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":624
+ *
+ * breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1)
+ * if breakpoints_in_frame_cache != -1: # <<<<<<<<<<<<<<
+ * # Gotten from cache.
+ * has_breakpoint_in_frame = breakpoints_in_frame_cache == 1
+ */
+ __pyx_t_10 = ((__pyx_v_breakpoints_in_frame_cache != -1L) != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":626
+ * if breakpoints_in_frame_cache != -1:
+ * # Gotten from cache.
+ * has_breakpoint_in_frame = breakpoints_in_frame_cache == 1 # <<<<<<<<<<<<<<
+ *
+ * else:
+ */
+ __pyx_v_has_breakpoint_in_frame = (__pyx_v_breakpoints_in_frame_cache == 1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":624
+ *
+ * breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1)
+ * if breakpoints_in_frame_cache != -1: # <<<<<<<<<<<<<<
+ * # Gotten from cache.
+ * has_breakpoint_in_frame = breakpoints_in_frame_cache == 1
+ */
+ goto __pyx_L59;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":629
+ *
+ * else:
+ * has_breakpoint_in_frame = False # <<<<<<<<<<<<<<
+ * # Checks the breakpoint to see if there is a context match in some function
+ * curr_func_name = frame.f_code.co_name
+ */
+ /*else*/ {
+ __pyx_v_has_breakpoint_in_frame = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":631
+ * has_breakpoint_in_frame = False
+ * # Checks the breakpoint to see if there is a context match in some function
+ * curr_func_name = frame.f_code.co_name # <<<<<<<<<<<<<<
+ *
+ * #global context is set with an empty name
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 631, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_co_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 631, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 631, __pyx_L4_error)
+ __pyx_v_curr_func_name = ((PyObject*)__pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":634
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''): # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ __Pyx_INCREF(__pyx_v_curr_func_name);
+ __pyx_t_13 = __pyx_v_curr_func_name;
+ __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s__5, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 634, __pyx_L4_error)
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L61_bool_binop_done;
+ }
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s_module, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 634, __pyx_L4_error)
+ __pyx_t_12 = (__pyx_t_9 != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L61_bool_binop_done:;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":635
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''):
+ * curr_func_name = '' # <<<<<<<<<<<<<<
+ *
+ * for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues()
+ */
+ __Pyx_INCREF(__pyx_kp_s_);
+ __Pyx_DECREF_SET(__pyx_v_curr_func_name, __pyx_kp_s_);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":634
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''): # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":637
+ * curr_func_name = ''
+ *
+ * for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues() # <<<<<<<<<<<<<<
+ * #will match either global or some function
+ * if breakpoint.func_name in ('None', curr_func_name):
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_iter_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_breakpoints_for_file); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_breakpoints_for_file};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_breakpoints_for_file};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_breakpoints_for_file);
+ __Pyx_GIVEREF(__pyx_v_breakpoints_for_file);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_breakpoints_for_file);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
+ __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
+ __pyx_t_15 = NULL;
+ } else {
+ __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 637, __pyx_L4_error)
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ for (;;) {
+ if (likely(!__pyx_t_15)) {
+ if (likely(PyList_CheckExact(__pyx_t_8))) {
+ if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 637, __pyx_L4_error)
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ } else {
+ if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 637, __pyx_L4_error)
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ }
+ } else {
+ __pyx_t_7 = __pyx_t_15(__pyx_t_8);
+ if (unlikely(!__pyx_t_7)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 637, __pyx_L4_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_7);
+ }
+ __Pyx_XDECREF_SET(__pyx_v_breakpoint, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":639
+ * for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues()
+ * #will match either global or some function
+ * if breakpoint.func_name in ('None', curr_func_name): # <<<<<<<<<<<<<<
+ * has_breakpoint_in_frame = True
+ * break
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_func_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 639, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_None, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 639, __pyx_L4_error)
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L66_bool_binop_done;
+ }
+ __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_v_curr_func_name, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 639, __pyx_L4_error)
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L66_bool_binop_done:;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":640
+ * #will match either global or some function
+ * if breakpoint.func_name in ('None', curr_func_name):
+ * has_breakpoint_in_frame = True # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_has_breakpoint_in_frame = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":641
+ * if breakpoint.func_name in ('None', curr_func_name):
+ * has_breakpoint_in_frame = True
+ * break # <<<<<<<<<<<<<<
+ *
+ * # Cache the value (1 or 0 or -1 for default because of cython).
+ */
+ goto __pyx_L64_break;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":639
+ * for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues()
+ * #will match either global or some function
+ * if breakpoint.func_name in ('None', curr_func_name): # <<<<<<<<<<<<<<
+ * has_breakpoint_in_frame = True
+ * break
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":637
+ * curr_func_name = ''
+ *
+ * for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues() # <<<<<<<<<<<<<<
+ * #will match either global or some function
+ * if breakpoint.func_name in ('None', curr_func_name):
+ */
+ }
+ __pyx_L64_break:;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":644
+ *
+ * # Cache the value (1 or 0 or -1 for default because of cython).
+ * if has_breakpoint_in_frame: # <<<<<<<<<<<<<<
+ * frame_skips_cache[frame_cache_key] = 1
+ * else:
+ */
+ __pyx_t_10 = (__pyx_v_has_breakpoint_in_frame != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":645
+ * # Cache the value (1 or 0 or -1 for default because of cython).
+ * if has_breakpoint_in_frame:
+ * frame_skips_cache[frame_cache_key] = 1 # <<<<<<<<<<<<<<
+ * else:
+ * frame_skips_cache[frame_cache_key] = 0
+ */
+ if (unlikely(__pyx_v_frame_skips_cache == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 645, __pyx_L4_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_frame_skips_cache, __pyx_v_frame_cache_key, __pyx_int_1) < 0)) __PYX_ERR(0, 645, __pyx_L4_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":644
+ *
+ * # Cache the value (1 or 0 or -1 for default because of cython).
+ * if has_breakpoint_in_frame: # <<<<<<<<<<<<<<
+ * frame_skips_cache[frame_cache_key] = 1
+ * else:
+ */
+ goto __pyx_L68;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":647
+ * frame_skips_cache[frame_cache_key] = 1
+ * else:
+ * frame_skips_cache[frame_cache_key] = 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ /*else*/ {
+ if (unlikely(__pyx_v_frame_skips_cache == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 647, __pyx_L4_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_frame_skips_cache, __pyx_v_frame_cache_key, __pyx_int_0) < 0)) __PYX_ERR(0, 647, __pyx_L4_error)
+ }
+ __pyx_L68:;
+ }
+ __pyx_L59:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":650
+ *
+ *
+ * if can_skip and not has_breakpoint_in_frame: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * return self.trace_exception
+ */
+ __pyx_t_12 = (__pyx_v_can_skip != 0);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L70_bool_binop_done;
+ }
+ __pyx_t_12 = ((!(__pyx_v_has_breakpoint_in_frame != 0)) != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L70_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":651
+ *
+ * if can_skip and not has_breakpoint_in_frame:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * return self.trace_exception
+ * else:
+ */
+ __pyx_t_10 = (__pyx_v_has_exception_breakpoints != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":652
+ * if can_skip and not has_breakpoint_in_frame:
+ * if has_exception_breakpoints:
+ * return self.trace_exception # <<<<<<<<<<<<<<
+ * else:
+ * if need_trace_return:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_exception); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 652, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":651
+ *
+ * if can_skip and not has_breakpoint_in_frame:
+ * if has_exception_breakpoints: # <<<<<<<<<<<<<<
+ * return self.trace_exception
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":654
+ * return self.trace_exception
+ * else:
+ * if need_trace_return: # <<<<<<<<<<<<<<
+ * return self.trace_return
+ * else:
+ */
+ /*else*/ {
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_need_trace_return); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 654, __pyx_L4_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":655
+ * else:
+ * if need_trace_return:
+ * return self.trace_return # <<<<<<<<<<<<<<
+ * else:
+ * return None
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_return); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 655, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L3_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":654
+ * return self.trace_exception
+ * else:
+ * if need_trace_return: # <<<<<<<<<<<<<<
+ * return self.trace_return
+ * else:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":657
+ * return self.trace_return
+ * else:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * #We may have hit a breakpoint or we are already in step mode. Either way, let's check what we should do in this frame
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L3_return;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":650
+ *
+ *
+ * if can_skip and not has_breakpoint_in_frame: # <<<<<<<<<<<<<<
+ * if has_exception_breakpoints:
+ * return self.trace_exception
+ */
+ }
+ }
+ __pyx_L53:;
+ }
+ __pyx_L24:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":662
+ * # print('NOT skipped', frame.f_lineno, frame.f_code.co_name, event)
+ *
+ * try: # <<<<<<<<<<<<<<
+ * flag = False
+ * #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __Pyx_XGOTREF(__pyx_t_18);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":663
+ *
+ * try:
+ * flag = False # <<<<<<<<<<<<<<
+ * #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ * #(one for the line and the other for the return).
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_XDECREF_SET(__pyx_v_flag, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":667
+ * #(one for the line and the other for the return).
+ *
+ * stop_info = {} # <<<<<<<<<<<<<<
+ * breakpoint = None
+ * exist_result = False
+ */
+ __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 667, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_v_stop_info = ((PyObject*)__pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":668
+ *
+ * stop_info = {}
+ * breakpoint = None # <<<<<<<<<<<<<<
+ * exist_result = False
+ * stop = False
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_XDECREF_SET(__pyx_v_breakpoint, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":669
+ * stop_info = {}
+ * breakpoint = None
+ * exist_result = False # <<<<<<<<<<<<<<
+ * stop = False
+ * bp_type = None
+ */
+ __pyx_v_exist_result = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":670
+ * breakpoint = None
+ * exist_result = False
+ * stop = False # <<<<<<<<<<<<<<
+ * bp_type = None
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ */
+ __Pyx_INCREF(Py_False);
+ __pyx_v_stop = Py_False;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":671
+ * exist_result = False
+ * stop = False
+ * bp_type = None # <<<<<<<<<<<<<<
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ * breakpoint = breakpoints_for_file[line]
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_bp_type = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":672
+ * stop = False
+ * bp_type = None
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file: # <<<<<<<<<<<<<<
+ * breakpoint = breakpoints_for_file[line]
+ * new_frame = frame
+ */
+ __pyx_t_12 = ((!(__pyx_v_is_return != 0)) != 0);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L81_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_info->pydev_state); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_STATE_SUSPEND); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L81_bool_binop_done;
+ }
+ __pyx_t_12 = (__pyx_v_breakpoints_for_file != Py_None);
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L81_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_breakpoints_for_file, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 672, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = (__pyx_t_9 != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L81_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":673
+ * bp_type = None
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ * breakpoint = breakpoints_for_file[line] # <<<<<<<<<<<<<<
+ * new_frame = frame
+ * stop = True
+ */
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_breakpoints_for_file, __pyx_v_line, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_breakpoint, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":674
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ * breakpoint = breakpoints_for_file[line]
+ * new_frame = frame # <<<<<<<<<<<<<<
+ * stop = True
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ */
+ __Pyx_INCREF(__pyx_v_frame);
+ __pyx_v_new_frame = __pyx_v_frame;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":675
+ * breakpoint = breakpoints_for_file[line]
+ * new_frame = frame
+ * stop = True # <<<<<<<<<<<<<<
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ */
+ __Pyx_INCREF(Py_True);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_True);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":676
+ * new_frame = frame
+ * stop = True
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return): # <<<<<<<<<<<<<<
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_OVER); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 676, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 676, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 676, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L86_bool_binop_done;
+ }
+ __pyx_t_12 = (__pyx_v_stop_frame == __pyx_v_frame);
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L86_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_is_line != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L86_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_is_return != 0);
+ __pyx_t_10 = __pyx_t_9;
+ __pyx_L86_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":677
+ * stop = True
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later) # <<<<<<<<<<<<<<
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":676
+ * new_frame = frame
+ * stop = True
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return): # <<<<<<<<<<<<<<
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":672
+ * stop = False
+ * bp_type = None
+ * if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file: # <<<<<<<<<<<<<<
+ * breakpoint = breakpoints_for_file[line]
+ * new_frame = frame
+ */
+ goto __pyx_L80;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":678
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ * if result:
+ */
+ __pyx_t_9 = (__pyx_v_plugin_manager != Py_None);
+ __pyx_t_12 = (__pyx_t_9 != 0);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L90_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_has_plugin_line_breaks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 678, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 678, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L90_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":679
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args) # <<<<<<<<<<<<<<
+ * if result:
+ * exist_result = True
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_get_breakpoint); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 679, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 679, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_main_debugger, ((PyObject *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 679, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, ((PyObject *)__pyx_v_self));
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_5, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_5, __pyx_v_self->_args);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 679, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_v_result = __pyx_t_8;
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":680
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ * if result: # <<<<<<<<<<<<<<
+ * exist_result = True
+ * flag, breakpoint, new_frame, bp_type = result
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 680, __pyx_L74_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":681
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ * if result:
+ * exist_result = True # <<<<<<<<<<<<<<
+ * flag, breakpoint, new_frame, bp_type = result
+ *
+ */
+ __pyx_v_exist_result = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":682
+ * if result:
+ * exist_result = True
+ * flag, breakpoint, new_frame, bp_type = result # <<<<<<<<<<<<<<
+ *
+ * if breakpoint:
+ */
+ if ((likely(PyTuple_CheckExact(__pyx_v_result))) || (PyList_CheckExact(__pyx_v_result))) {
+ PyObject* sequence = __pyx_v_result;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 4)) {
+ if (size > 4) __Pyx_RaiseTooManyValuesError(4);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 682, __pyx_L74_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3);
+ } else {
+ __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 3);
+ }
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
+ #else
+ {
+ Py_ssize_t i;
+ PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_7,&__pyx_t_4,&__pyx_t_1};
+ for (i=0; i < 4; i++) {
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 682, __pyx_L74_error)
+ __Pyx_GOTREF(item);
+ *(temps[i]) = item;
+ }
+ }
+ #endif
+ } else {
+ Py_ssize_t index = -1;
+ PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_7,&__pyx_t_4,&__pyx_t_1};
+ __pyx_t_6 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 682, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ for (index=0; index < 4; index++) {
+ PyObject* item = __pyx_t_11(__pyx_t_6); if (unlikely(!item)) goto __pyx_L93_unpacking_failed;
+ __Pyx_GOTREF(item);
+ *(temps[index]) = item;
+ }
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 4) < 0) __PYX_ERR(0, 682, __pyx_L74_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L94_unpacking_done;
+ __pyx_L93_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 682, __pyx_L74_error)
+ __pyx_L94_unpacking_done:;
+ }
+ __Pyx_DECREF_SET(__pyx_v_flag, __pyx_t_8);
+ __pyx_t_8 = 0;
+ __Pyx_DECREF_SET(__pyx_v_breakpoint, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_v_new_frame = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __Pyx_DECREF_SET(__pyx_v_bp_type, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":680
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ * if result: # <<<<<<<<<<<<<<
+ * exist_result = True
+ * flag, breakpoint, new_frame, bp_type = result
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":678
+ * if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ * stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ * elif plugin_manager is not None and main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ * if result:
+ */
+ }
+ __pyx_L80:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":684
+ * flag, breakpoint, new_frame, bp_type = result
+ *
+ * if breakpoint: # <<<<<<<<<<<<<<
+ * #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ * # lets do the conditional stuff here
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_breakpoint); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 684, __pyx_L74_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":687
+ * #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ * # lets do the conditional stuff here
+ * if stop or exist_result: # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * if condition is not None:
+ */
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_stop); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 687, __pyx_L74_error)
+ if (!__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L97_bool_binop_done;
+ }
+ __pyx_t_12 = (__pyx_v_exist_result != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L97_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":688
+ * # lets do the conditional stuff here
+ * if stop or exist_result:
+ * condition = breakpoint.condition # <<<<<<<<<<<<<<
+ * if condition is not None:
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_condition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_condition = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":689
+ * if stop or exist_result:
+ * condition = breakpoint.condition
+ * if condition is not None: # <<<<<<<<<<<<<<
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ * self.trace_dispatch)
+ */
+ __pyx_t_10 = (__pyx_v_condition != Py_None);
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":690
+ * condition = breakpoint.condition
+ * if condition is not None:
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame, # <<<<<<<<<<<<<<
+ * self.trace_dispatch)
+ * if result is not None:
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_handle_breakpoint_condition); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_v_new_frame)) { __Pyx_RaiseUnboundLocalError("new_frame"); __PYX_ERR(0, 690, __pyx_L74_error) }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":691
+ * if condition is not None:
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ * self.trace_dispatch) # <<<<<<<<<<<<<<
+ * if result is not None:
+ * return result
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 691, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_main_debugger, ((PyObject *)__pyx_v_info), __pyx_v_breakpoint, __pyx_v_new_frame, __pyx_t_7};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_main_debugger, ((PyObject *)__pyx_v_info), __pyx_v_breakpoint, __pyx_v_new_frame, __pyx_t_7};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 690, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(((PyObject *)__pyx_v_info));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_info));
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_info));
+ __Pyx_INCREF(__pyx_v_breakpoint);
+ __Pyx_GIVEREF(__pyx_v_breakpoint);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_breakpoint);
+ __Pyx_INCREF(__pyx_v_new_frame);
+ __Pyx_GIVEREF(__pyx_v_new_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_new_frame);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":692
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ * self.trace_dispatch)
+ * if result is not None: # <<<<<<<<<<<<<<
+ * return result
+ *
+ */
+ __pyx_t_12 = (__pyx_v_result != Py_None);
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":693
+ * self.trace_dispatch)
+ * if result is not None:
+ * return result # <<<<<<<<<<<<<<
+ *
+ * if breakpoint.expression is not None:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L78_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":692
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ * self.trace_dispatch)
+ * if result is not None: # <<<<<<<<<<<<<<
+ * return result
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":689
+ * if stop or exist_result:
+ * condition = breakpoint.condition
+ * if condition is not None: # <<<<<<<<<<<<<<
+ * result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ * self.trace_dispatch)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":695
+ * return result
+ *
+ * if breakpoint.expression is not None: # <<<<<<<<<<<<<<
+ * handle_breakpoint_expression(breakpoint, info, new_frame)
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = (__pyx_t_1 != Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":696
+ *
+ * if breakpoint.expression is not None:
+ * handle_breakpoint_expression(breakpoint, info, new_frame) # <<<<<<<<<<<<<<
+ *
+ * if not main_debugger.first_breakpoint_reached:
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_handle_breakpoint_expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_v_new_frame)) { __Pyx_RaiseUnboundLocalError("new_frame"); __PYX_ERR(0, 696, __pyx_L74_error) }
+ __pyx_t_6 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_breakpoint, ((PyObject *)__pyx_v_info), __pyx_v_new_frame};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_breakpoint, ((PyObject *)__pyx_v_info), __pyx_v_new_frame};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_6) {
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_breakpoint);
+ __Pyx_GIVEREF(__pyx_v_breakpoint);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_breakpoint);
+ __Pyx_INCREF(((PyObject *)__pyx_v_info));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_info));
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, ((PyObject *)__pyx_v_info));
+ __Pyx_INCREF(__pyx_v_new_frame);
+ __Pyx_GIVEREF(__pyx_v_new_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_5, __pyx_v_new_frame);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":695
+ * return result
+ *
+ * if breakpoint.expression is not None: # <<<<<<<<<<<<<<
+ * handle_breakpoint_expression(breakpoint, info, new_frame)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":698
+ * handle_breakpoint_expression(breakpoint, info, new_frame)
+ *
+ * if not main_debugger.first_breakpoint_reached: # <<<<<<<<<<<<<<
+ * if is_call:
+ * back = frame.f_back
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_first_breakpoint_reached); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 698, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_10 = ((!__pyx_t_12) != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":699
+ *
+ * if not main_debugger.first_breakpoint_reached:
+ * if is_call: # <<<<<<<<<<<<<<
+ * back = frame.f_back
+ * if back is not None:
+ */
+ __pyx_t_10 = (__pyx_v_is_call != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":700
+ * if not main_debugger.first_breakpoint_reached:
+ * if is_call:
+ * back = frame.f_back # <<<<<<<<<<<<<<
+ * if back is not None:
+ * # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_back = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":701
+ * if is_call:
+ * back = frame.f_back
+ * if back is not None: # <<<<<<<<<<<<<<
+ * # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ */
+ __pyx_t_10 = (__pyx_v_back != Py_None);
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":704
+ * # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back) # <<<<<<<<<<<<<<
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_back};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_back};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_v_back);
+ __Pyx_GIVEREF(__pyx_v_back);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_back);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 704, __pyx_L74_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
+ } else {
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
+ }
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 704, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext;
+ index = 0; __pyx_t_4 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L105_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
+ index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L105_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ index = 2; __pyx_t_7 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L105_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_8), 3) < 0) __PYX_ERR(0, 704, __pyx_L74_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L106_unpacking_done;
+ __pyx_L105_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 704, __pyx_L74_error)
+ __pyx_L106_unpacking_done:;
+ }
+ __pyx_v__ = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __pyx_v_back_filename = __pyx_t_6;
+ __pyx_t_6 = 0;
+ __pyx_v_base = __pyx_t_7;
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":705
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \ # <<<<<<<<<<<<<<
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ * stop = False
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_base, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!__pyx_t_10) {
+ goto __pyx_L109_next_or;
+ } else {
+ }
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_back, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_co_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 705, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L108_bool_binop_done;
+ }
+ __pyx_L109_next_or:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":706
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]): # <<<<<<<<<<<<<<
+ * stop = False
+ * main_debugger.first_breakpoint_reached = True
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START_PY3K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_base, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L108_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_back, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_co_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START_PY3K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 706, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L108_bool_binop_done:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":705
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \ # <<<<<<<<<<<<<<
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ * stop = False
+ */
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":707
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ * stop = False # <<<<<<<<<<<<<<
+ * main_debugger.first_breakpoint_reached = True
+ * else:
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":708
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ * stop = False
+ * main_debugger.first_breakpoint_reached = True # <<<<<<<<<<<<<<
+ * else:
+ * # if the frame is traced after breakpoint stop,
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_main_debugger, __pyx_n_s_first_breakpoint_reached, Py_True) < 0) __PYX_ERR(0, 708, __pyx_L74_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":705
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \ # <<<<<<<<<<<<<<
+ * (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ * stop = False
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":701
+ * if is_call:
+ * back = frame.f_back
+ * if back is not None: # <<<<<<<<<<<<<<
+ * # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ * # 'call' event for tracing and we stop on the first line of code twice.
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":699
+ *
+ * if not main_debugger.first_breakpoint_reached:
+ * if is_call: # <<<<<<<<<<<<<<
+ * back = frame.f_back
+ * if back is not None:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":698
+ * handle_breakpoint_expression(breakpoint, info, new_frame)
+ *
+ * if not main_debugger.first_breakpoint_reached: # <<<<<<<<<<<<<<
+ * if is_call:
+ * back = frame.f_back
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":687
+ * #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ * # lets do the conditional stuff here
+ * if stop or exist_result: # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * if condition is not None:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":684
+ * flag, breakpoint, new_frame, bp_type = result
+ *
+ * if breakpoint: # <<<<<<<<<<<<<<
+ * #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ * # lets do the conditional stuff here
+ */
+ goto __pyx_L95;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":712
+ * # if the frame is traced after breakpoint stop,
+ * # but the file should be ignored while stepping because of filters
+ * if step_cmd != -1: # <<<<<<<<<<<<<<
+ * if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ */
+ /*else*/ {
+ __pyx_t_12 = ((__pyx_v_step_cmd != -1L) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":713
+ * # but the file should be ignored while stepping because of filters
+ * if step_cmd != -1:
+ * if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename): # <<<<<<<<<<<<<<
+ * # ignore files matching stepping filters
+ * return self.trace_dispatch
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_is_filter_enabled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L114_bool_binop_done;
+ }
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_is_ignored_by_filters); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_filename};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_filename};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_filename);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 713, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L114_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":715
+ * if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ * if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename):
+ * # ignore library files while stepping
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L78_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":713
+ * # but the file should be ignored while stepping because of filters
+ * if step_cmd != -1:
+ * if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename): # <<<<<<<<<<<<<<
+ * # ignore files matching stepping filters
+ * return self.trace_dispatch
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":716
+ * # ignore files matching stepping filters
+ * return self.trace_dispatch
+ * if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # ignore library files while stepping
+ * return self.trace_dispatch
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_is_filter_libraries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L117_bool_binop_done;
+ }
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_not_in_scope); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_filename};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_filename};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_filename);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 716, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L117_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":718
+ * if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename):
+ * # ignore library files while stepping
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ *
+ * if main_debugger.show_return_values:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L78_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":716
+ * # ignore files matching stepping filters
+ * return self.trace_dispatch
+ * if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # ignore library files while stepping
+ * return self.trace_dispatch
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":712
+ * # if the frame is traced after breakpoint stop,
+ * # but the file should be ignored while stepping because of filters
+ * if step_cmd != -1: # <<<<<<<<<<<<<<
+ * if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ */
+ }
+ }
+ __pyx_L95:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":720
+ * return self.trace_dispatch
+ *
+ * if main_debugger.show_return_values: # <<<<<<<<<<<<<<
+ * if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
+ * self.show_return_values(frame, arg)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_show_return_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 720, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":721
+ *
+ * if main_debugger.show_return_values:
+ * if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop: # <<<<<<<<<<<<<<
+ * self.show_return_values(frame, arg)
+ *
+ */
+ __pyx_t_10 = (__pyx_v_is_return != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L121_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_info->pydev_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_OVER); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L121_bool_binop_done;
+ }
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_v_info->pydev_step_stop, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 721, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L121_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":722
+ * if main_debugger.show_return_values:
+ * if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
+ * self.show_return_values(frame, arg) # <<<<<<<<<<<<<<
+ *
+ * elif main_debugger.remove_return_values_flag:
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_show_return_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 722, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_frame, __pyx_v_arg};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 722, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_frame, __pyx_v_arg};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 722, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_arg);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 722, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":721
+ *
+ * if main_debugger.show_return_values:
+ * if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop: # <<<<<<<<<<<<<<
+ * self.show_return_values(frame, arg)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":720
+ * return self.trace_dispatch
+ *
+ * if main_debugger.show_return_values: # <<<<<<<<<<<<<<
+ * if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
+ * self.show_return_values(frame, arg)
+ */
+ goto __pyx_L119;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":724
+ * self.show_return_values(frame, arg)
+ *
+ * elif main_debugger.remove_return_values_flag: # <<<<<<<<<<<<<<
+ * try:
+ * self.remove_return_values(main_debugger, frame)
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_remove_return_values_flag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 724, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":725
+ *
+ * elif main_debugger.remove_return_values_flag:
+ * try: # <<<<<<<<<<<<<<
+ * self.remove_return_values(main_debugger, frame)
+ * finally:
+ */
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":726
+ * elif main_debugger.remove_return_values_flag:
+ * try:
+ * self.remove_return_values(main_debugger, frame) # <<<<<<<<<<<<<<
+ * finally:
+ * main_debugger.remove_return_values_flag = False
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_return_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L125_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_main_debugger, __pyx_v_frame};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L125_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_main_debugger, __pyx_v_frame};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L125_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L125_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_v_frame);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L125_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":728
+ * self.remove_return_values(main_debugger, frame)
+ * finally:
+ * main_debugger.remove_return_values_flag = False # <<<<<<<<<<<<<<
+ *
+ * if stop:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_main_debugger, __pyx_n_s_remove_return_values_flag, Py_False) < 0) __PYX_ERR(0, 728, __pyx_L74_error)
+ goto __pyx_L126;
+ }
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L125_error:;
+ __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_21);
+ __Pyx_XGOTREF(__pyx_t_22);
+ __Pyx_XGOTREF(__pyx_t_23);
+ __Pyx_XGOTREF(__pyx_t_24);
+ __Pyx_XGOTREF(__pyx_t_25);
+ __Pyx_XGOTREF(__pyx_t_26);
+ __pyx_t_5 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
+ {
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_main_debugger, __pyx_n_s_remove_return_values_flag, Py_False) < 0) __PYX_ERR(0, 728, __pyx_L128_error)
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
+ }
+ __Pyx_XGIVEREF(__pyx_t_21);
+ __Pyx_XGIVEREF(__pyx_t_22);
+ __Pyx_XGIVEREF(__pyx_t_23);
+ __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
+ __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
+ goto __pyx_L74_error;
+ __pyx_L128_error:;
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
+ }
+ __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
+ __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
+ __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ goto __pyx_L74_error;
+ }
+ __pyx_L126:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":724
+ * self.show_return_values(frame, arg)
+ *
+ * elif main_debugger.remove_return_values_flag: # <<<<<<<<<<<<<<
+ * try:
+ * self.remove_return_values(main_debugger, frame)
+ */
+ }
+ __pyx_L119:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":730
+ * main_debugger.remove_return_values_flag = False
+ *
+ * if stop: # <<<<<<<<<<<<<<
+ * self.set_suspend(thread, CMD_SET_BREAK)
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ */
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_stop); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 730, __pyx_L74_error)
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":731
+ *
+ * if stop:
+ * self.set_suspend(thread, CMD_SET_BREAK) # <<<<<<<<<<<<<<
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ * main_debugger.suspend_all_other_threads(thread)
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_suspend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_SET_BREAK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_thread, __pyx_t_1};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_thread, __pyx_t_1};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_4) {
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_19, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 731, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":732
+ * if stop:
+ * self.set_suspend(thread, CMD_SET_BREAK)
+ * if breakpoint and breakpoint.suspend_policy == "ALL": # <<<<<<<<<<<<<<
+ * main_debugger.suspend_all_other_threads(thread)
+ * elif flag and plugin_manager is not None:
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_breakpoint); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 732, __pyx_L74_error)
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L131_bool_binop_done;
+ }
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_suspend_policy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 732, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_ALL, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 732, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L131_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":733
+ * self.set_suspend(thread, CMD_SET_BREAK)
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ * main_debugger.suspend_all_other_threads(thread) # <<<<<<<<<<<<<<
+ * elif flag and plugin_manager is not None:
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_suspend_all_other_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_thread); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_thread};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_thread);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":732
+ * if stop:
+ * self.set_suspend(thread, CMD_SET_BREAK)
+ * if breakpoint and breakpoint.suspend_policy == "ALL": # <<<<<<<<<<<<<<
+ * main_debugger.suspend_all_other_threads(thread)
+ * elif flag and plugin_manager is not None:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":730
+ * main_debugger.remove_return_values_flag = False
+ *
+ * if stop: # <<<<<<<<<<<<<<
+ * self.set_suspend(thread, CMD_SET_BREAK)
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ */
+ goto __pyx_L129;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":734
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ * main_debugger.suspend_all_other_threads(thread)
+ * elif flag and plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ * if result:
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 734, __pyx_L74_error)
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L133_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_plugin_manager != Py_None);
+ __pyx_t_9 = (__pyx_t_10 != 0);
+ __pyx_t_12 = __pyx_t_9;
+ __pyx_L133_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":735
+ * main_debugger.suspend_all_other_threads(thread)
+ * elif flag and plugin_manager is not None:
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type) # <<<<<<<<<<<<<<
+ * if result:
+ * frame = result
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_suspend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 735, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_main_debugger, __pyx_v_thread, __pyx_v_frame, __pyx_v_bp_type};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_main_debugger, __pyx_v_thread, __pyx_v_frame, __pyx_v_bp_type};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 735, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_19, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_19, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_bp_type);
+ __Pyx_GIVEREF(__pyx_v_bp_type);
+ PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_19, __pyx_v_bp_type);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":736
+ * elif flag and plugin_manager is not None:
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ * if result: # <<<<<<<<<<<<<<
+ * frame = result
+ *
+ */
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 736, __pyx_L74_error)
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":737
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ * if result:
+ * frame = result # <<<<<<<<<<<<<<
+ *
+ * # if thread has a suspend flag, we suspend with a busy wait
+ */
+ __Pyx_INCREF(__pyx_v_result);
+ __Pyx_DECREF_SET(__pyx_v_frame, __pyx_v_result);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":736
+ * elif flag and plugin_manager is not None:
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ * if result: # <<<<<<<<<<<<<<
+ * frame = result
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":734
+ * if breakpoint and breakpoint.suspend_policy == "ALL":
+ * main_debugger.suspend_all_other_threads(thread)
+ * elif flag and plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ * if result:
+ */
+ }
+ __pyx_L129:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":740
+ *
+ * # if thread has a suspend flag, we suspend with a busy wait
+ * if info.pydev_state == STATE_SUSPEND: # <<<<<<<<<<<<<<
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * return self.trace_dispatch
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_info->pydev_state); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 740, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_STATE_SUSPEND); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 740, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 740, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 740, __pyx_L74_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":741
+ * # if thread has a suspend flag, we suspend with a busy wait
+ * if info.pydev_state == STATE_SUSPEND:
+ * self.do_wait_suspend(thread, frame, event, arg) # <<<<<<<<<<<<<<
+ * return self.trace_dispatch
+ * else:
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_wait_suspend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 741, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 741, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 741, __pyx_L74_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_19, __pyx_v_arg);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 741, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":742
+ * if info.pydev_state == STATE_SUSPEND:
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * return self.trace_dispatch # <<<<<<<<<<<<<<
+ * else:
+ * if not breakpoint and not is_return:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 742, __pyx_L74_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L78_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":740
+ *
+ * # if thread has a suspend flag, we suspend with a busy wait
+ * if info.pydev_state == STATE_SUSPEND: # <<<<<<<<<<<<<<
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * return self.trace_dispatch
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":744
+ * return self.trace_dispatch
+ * else:
+ * if not breakpoint and not is_return: # <<<<<<<<<<<<<<
+ * # No stop from anyone and no breakpoint found in line (cache that).
+ * frame_skips_cache[line_cache_key] = 0
+ */
+ /*else*/ {
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_breakpoint); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 744, __pyx_L74_error)
+ __pyx_t_10 = ((!__pyx_t_9) != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L138_bool_binop_done;
+ }
+ __pyx_t_10 = ((!(__pyx_v_is_return != 0)) != 0);
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L138_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":746
+ * if not breakpoint and not is_return:
+ * # No stop from anyone and no breakpoint found in line (cache that).
+ * frame_skips_cache[line_cache_key] = 0 # <<<<<<<<<<<<<<
+ *
+ * except:
+ */
+ if (unlikely(__pyx_v_frame_skips_cache == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 746, __pyx_L74_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_frame_skips_cache, __pyx_v_line_cache_key, __pyx_int_0) < 0)) __PYX_ERR(0, 746, __pyx_L74_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":744
+ * return self.trace_dispatch
+ * else:
+ * if not breakpoint and not is_return: # <<<<<<<<<<<<<<
+ * # No stop from anyone and no breakpoint found in line (cache that).
+ * frame_skips_cache[line_cache_key] = 0
+ */
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":662
+ * # print('NOT skipped', frame.f_lineno, frame.f_code.co_name, event)
+ *
+ * try: # <<<<<<<<<<<<<<
+ * flag = False
+ * #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
+ goto __pyx_L79_try_end;
+ __pyx_L74_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":748
+ * frame_skips_cache[line_cache_key] = 0
+ *
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * raise
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 748, __pyx_L76_except_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":749
+ *
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * raise
+ *
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L76_except_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L76_except_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 749, __pyx_L76_except_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 749, __pyx_L76_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":750
+ * except:
+ * traceback.print_exc()
+ * raise # <<<<<<<<<<<<<<
+ *
+ * #step handling. We stop when we hit the right frame
+ */
+ __Pyx_GIVEREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_6, __pyx_t_1);
+ __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_1 = 0;
+ __PYX_ERR(0, 750, __pyx_L76_except_error)
+ }
+ __pyx_L76_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":662
+ * # print('NOT skipped', frame.f_lineno, frame.f_code.co_name, event)
+ *
+ * try: # <<<<<<<<<<<<<<
+ * flag = False
+ * #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
+ goto __pyx_L4_error;
+ __pyx_L78_try_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
+ goto __pyx_L3_return;
+ __pyx_L79_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":753
+ *
+ * #step handling. We stop when we hit the right frame
+ * try: # <<<<<<<<<<<<<<
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __Pyx_XGOTREF(__pyx_t_16);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":754
+ * #step handling. We stop when we hit the right frame
+ * try:
+ * should_skip = 0 # <<<<<<<<<<<<<<
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ * if self.should_skip == -1:
+ */
+ __pyx_v_should_skip = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":755
+ * try:
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None: # <<<<<<<<<<<<<<
+ * if self.should_skip == -1:
+ * # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_dont_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_should_trace_hook); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 755, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = (__pyx_t_6 != Py_None);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":756
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ * if self.should_skip == -1: # <<<<<<<<<<<<<<
+ * # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ * # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ */
+ __pyx_t_10 = ((__pyx_v_self->should_skip == -1L) != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":760
+ * # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ * # Which will be handled by this frame is read-only, so, we can cache it safely.
+ * if not pydevd_dont_trace.should_trace_hook(frame, filename): # <<<<<<<<<<<<<<
+ * # -1, 0, 1 to be Cython-friendly
+ * should_skip = self.should_skip = 1
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_dont_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_should_trace_hook); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_19, __pyx_v_filename);
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 760, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_12 = ((!__pyx_t_10) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":762
+ * if not pydevd_dont_trace.should_trace_hook(frame, filename):
+ * # -1, 0, 1 to be Cython-friendly
+ * should_skip = self.should_skip = 1 # <<<<<<<<<<<<<<
+ * else:
+ * should_skip = self.should_skip = 0
+ */
+ __pyx_v_should_skip = 1;
+ __pyx_v_self->should_skip = 1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":760
+ * # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ * # Which will be handled by this frame is read-only, so, we can cache it safely.
+ * if not pydevd_dont_trace.should_trace_hook(frame, filename): # <<<<<<<<<<<<<<
+ * # -1, 0, 1 to be Cython-friendly
+ * should_skip = self.should_skip = 1
+ */
+ goto __pyx_L150;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":764
+ * should_skip = self.should_skip = 1
+ * else:
+ * should_skip = self.should_skip = 0 # <<<<<<<<<<<<<<
+ * else:
+ * should_skip = self.should_skip
+ */
+ /*else*/ {
+ __pyx_v_should_skip = 0;
+ __pyx_v_self->should_skip = 0;
+ }
+ __pyx_L150:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":756
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ * if self.should_skip == -1: # <<<<<<<<<<<<<<
+ * # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ * # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ */
+ goto __pyx_L149;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":766
+ * should_skip = self.should_skip = 0
+ * else:
+ * should_skip = self.should_skip # <<<<<<<<<<<<<<
+ *
+ * plugin_stop = False
+ */
+ /*else*/ {
+ __pyx_t_19 = __pyx_v_self->should_skip;
+ __pyx_v_should_skip = __pyx_t_19;
+ }
+ __pyx_L149:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":755
+ * try:
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None: # <<<<<<<<<<<<<<
+ * if self.should_skip == -1:
+ * # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":768
+ * should_skip = self.should_skip
+ *
+ * plugin_stop = False # <<<<<<<<<<<<<<
+ * if should_skip:
+ * stop = False
+ */
+ __Pyx_INCREF(Py_False);
+ __pyx_v_plugin_stop = Py_False;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":769
+ *
+ * plugin_stop = False
+ * if should_skip: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ __pyx_t_12 = (__pyx_v_should_skip != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":770
+ * plugin_stop = False
+ * if should_skip:
+ * stop = False # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_STEP_INTO:
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":769
+ *
+ * plugin_stop = False
+ * if should_skip: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":772
+ * stop = False
+ *
+ * elif step_cmd == CMD_STEP_INTO: # <<<<<<<<<<<<<<
+ * stop = is_line or is_return
+ * if plugin_manager is not None:
+ */
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 772, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_INTO); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 772, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 772, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 772, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":773
+ *
+ * elif step_cmd == CMD_STEP_INTO:
+ * stop = is_line or is_return # <<<<<<<<<<<<<<
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ */
+ if (!__pyx_v_is_line) {
+ } else {
+ __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_is_line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 773, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __pyx_t_8;
+ __pyx_t_8 = 0;
+ goto __pyx_L152_bool_binop_done;
+ }
+ __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_is_return); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 773, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __pyx_t_8;
+ __pyx_t_8 = 0;
+ __pyx_L152_bool_binop_done:;
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":774
+ * elif step_cmd == CMD_STEP_INTO:
+ * stop = is_line or is_return
+ * if plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ */
+ __pyx_t_12 = (__pyx_v_plugin_manager != Py_None);
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":775
+ * stop = is_line or is_return
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop) # <<<<<<<<<<<<<<
+ * if result:
+ * stop, plugin_stop = result
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_cmd_step_into); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 775, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_6 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_stop};
+ __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_19, 6+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
+ PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_stop};
+ __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_19, 6+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(6+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_6) {
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_19, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_19, __pyx_v_self->_args);
+ __Pyx_INCREF(__pyx_v_stop_info);
+ __Pyx_GIVEREF(__pyx_v_stop_info);
+ PyTuple_SET_ITEM(__pyx_t_1, 4+__pyx_t_19, __pyx_v_stop_info);
+ __Pyx_INCREF(__pyx_v_stop);
+ __Pyx_GIVEREF(__pyx_v_stop);
+ PyTuple_SET_ITEM(__pyx_t_1, 5+__pyx_t_19, __pyx_v_stop);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 775, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":776
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result: # <<<<<<<<<<<<<<
+ * stop, plugin_stop = result
+ *
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 776, __pyx_L142_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":777
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ * stop, plugin_stop = result # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ */
+ if ((likely(PyTuple_CheckExact(__pyx_v_result))) || (PyList_CheckExact(__pyx_v_result))) {
+ PyObject* sequence = __pyx_v_result;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 777, __pyx_L142_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ #else
+ __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 777, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 777, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ #endif
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_1 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L156_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_8)) goto __pyx_L156_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_1), 2) < 0) __PYX_ERR(0, 777, __pyx_L142_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L157_unpacking_done;
+ __pyx_L156_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 777, __pyx_L142_error)
+ __pyx_L157_unpacking_done:;
+ }
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __Pyx_DECREF_SET(__pyx_v_plugin_stop, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":776
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result: # <<<<<<<<<<<<<<
+ * stop, plugin_stop = result
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":774
+ * elif step_cmd == CMD_STEP_INTO:
+ * stop = is_line or is_return
+ * if plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":772
+ * stop = False
+ *
+ * elif step_cmd == CMD_STEP_INTO: # <<<<<<<<<<<<<<
+ * stop = is_line or is_return
+ * if plugin_manager is not None:
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":779
+ * stop, plugin_stop = result
+ *
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE: # <<<<<<<<<<<<<<
+ * if not main_debugger.not_in_scope(frame.f_code.co_filename):
+ * stop = is_line
+ */
+ __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 779, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_INTO_MY_CODE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 779, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 779, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":780
+ *
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ * if not main_debugger.not_in_scope(frame.f_code.co_filename): # <<<<<<<<<<<<<<
+ * stop = is_line
+ *
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_not_in_scope); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 780, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = ((!__pyx_t_10) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":781
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ * if not main_debugger.not_in_scope(frame.f_code.co_filename):
+ * stop = is_line # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_STEP_OVER:
+ */
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_is_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":780
+ *
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ * if not main_debugger.not_in_scope(frame.f_code.co_filename): # <<<<<<<<<<<<<<
+ * stop = is_line
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":779
+ * stop, plugin_stop = result
+ *
+ * elif step_cmd == CMD_STEP_INTO_MY_CODE: # <<<<<<<<<<<<<<
+ * if not main_debugger.not_in_scope(frame.f_code.co_filename):
+ * stop = is_line
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":783
+ * stop = is_line
+ *
+ * elif step_cmd == CMD_STEP_OVER: # <<<<<<<<<<<<<<
+ * stop = stop_frame is frame and (is_line or is_return)
+ *
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_OVER); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 783, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 783, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":784
+ *
+ * elif step_cmd == CMD_STEP_OVER:
+ * stop = stop_frame is frame and (is_line or is_return) # <<<<<<<<<<<<<<
+ *
+ * if frame.f_code.co_flags & CO_GENERATOR:
+ */
+ __pyx_t_12 = (__pyx_v_stop_frame == __pyx_v_frame);
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 784, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ goto __pyx_L159_bool_binop_done;
+ }
+ if (!__pyx_v_is_line) {
+ } else {
+ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_is_line); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 784, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ goto __pyx_L159_bool_binop_done;
+ }
+ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_is_return); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 784, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ __pyx_L159_bool_binop_done:;
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":786
+ * stop = stop_frame is frame and (is_line or is_return)
+ *
+ * if frame.f_code.co_flags & CO_GENERATOR: # <<<<<<<<<<<<<<
+ * if is_return:
+ * stop = False
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_co_flags); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 786, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_CO_GENERATOR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyNumber_And(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 786, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":787
+ *
+ * if frame.f_code.co_flags & CO_GENERATOR:
+ * if is_return: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ __pyx_t_12 = (__pyx_v_is_return != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":788
+ * if frame.f_code.co_flags & CO_GENERATOR:
+ * if is_return:
+ * stop = False # <<<<<<<<<<<<<<
+ *
+ * if plugin_manager is not None:
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":787
+ *
+ * if frame.f_code.co_flags & CO_GENERATOR:
+ * if is_return: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":786
+ * stop = stop_frame is frame and (is_line or is_return)
+ *
+ * if frame.f_code.co_flags & CO_GENERATOR: # <<<<<<<<<<<<<<
+ * if is_return:
+ * stop = False
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":790
+ * stop = False
+ *
+ * if plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ */
+ __pyx_t_12 = (__pyx_v_plugin_manager != Py_None);
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":791
+ *
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop) # <<<<<<<<<<<<<<
+ * if result:
+ * stop, plugin_stop = result
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_cmd_step_over); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_stop};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 6+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_stop};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 6+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(6+__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 791, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_7) {
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_19, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_19, __pyx_v_self->_args);
+ __Pyx_INCREF(__pyx_v_stop_info);
+ __Pyx_GIVEREF(__pyx_v_stop_info);
+ PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_19, __pyx_v_stop_info);
+ __Pyx_INCREF(__pyx_v_stop);
+ __Pyx_GIVEREF(__pyx_v_stop);
+ PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_19, __pyx_v_stop);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":792
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result: # <<<<<<<<<<<<<<
+ * stop, plugin_stop = result
+ *
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 792, __pyx_L142_error)
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":793
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ * stop, plugin_stop = result # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_SMART_STEP_INTO:
+ */
+ if ((likely(PyTuple_CheckExact(__pyx_v_result))) || (PyList_CheckExact(__pyx_v_result))) {
+ PyObject* sequence = __pyx_v_result;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 793, __pyx_L142_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ #else
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ #endif
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_6 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 793, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L166_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_1);
+ index = 1; __pyx_t_3 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L166_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 2) < 0) __PYX_ERR(0, 793, __pyx_L142_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L167_unpacking_done;
+ __pyx_L166_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 793, __pyx_L142_error)
+ __pyx_L167_unpacking_done:;
+ }
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_plugin_stop, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":792
+ * if plugin_manager is not None:
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result: # <<<<<<<<<<<<<<
+ * stop, plugin_stop = result
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":790
+ * stop = False
+ *
+ * if plugin_manager is not None: # <<<<<<<<<<<<<<
+ * result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ * if result:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":783
+ * stop = is_line
+ *
+ * elif step_cmd == CMD_STEP_OVER: # <<<<<<<<<<<<<<
+ * stop = stop_frame is frame and (is_line or is_return)
+ *
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":795
+ * stop, plugin_stop = result
+ *
+ * elif step_cmd == CMD_SMART_STEP_INTO: # <<<<<<<<<<<<<<
+ * stop = False
+ * if info.pydev_smart_step_stop is frame:
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_SMART_STEP_INTO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 795, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 795, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":796
+ *
+ * elif step_cmd == CMD_SMART_STEP_INTO:
+ * stop = False # <<<<<<<<<<<<<<
+ * if info.pydev_smart_step_stop is frame:
+ * info.pydev_func_name = '.invalid.' # Must match the type in cython
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":797
+ * elif step_cmd == CMD_SMART_STEP_INTO:
+ * stop = False
+ * if info.pydev_smart_step_stop is frame: # <<<<<<<<<<<<<<
+ * info.pydev_func_name = '.invalid.' # Must match the type in cython
+ * info.pydev_smart_step_stop = None
+ */
+ __pyx_t_10 = (__pyx_v_info->pydev_smart_step_stop == __pyx_v_frame);
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":798
+ * stop = False
+ * if info.pydev_smart_step_stop is frame:
+ * info.pydev_func_name = '.invalid.' # Must match the type in cython # <<<<<<<<<<<<<<
+ * info.pydev_smart_step_stop = None
+ *
+ */
+ __Pyx_INCREF(__pyx_kp_s_invalid);
+ __Pyx_GIVEREF(__pyx_kp_s_invalid);
+ __Pyx_GOTREF(__pyx_v_info->pydev_func_name);
+ __Pyx_DECREF(__pyx_v_info->pydev_func_name);
+ __pyx_v_info->pydev_func_name = __pyx_kp_s_invalid;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":799
+ * if info.pydev_smart_step_stop is frame:
+ * info.pydev_func_name = '.invalid.' # Must match the type in cython
+ * info.pydev_smart_step_stop = None # <<<<<<<<<<<<<<
+ *
+ * if is_line or is_exception_event:
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_info->pydev_smart_step_stop);
+ __Pyx_DECREF(__pyx_v_info->pydev_smart_step_stop);
+ __pyx_v_info->pydev_smart_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":797
+ * elif step_cmd == CMD_SMART_STEP_INTO:
+ * stop = False
+ * if info.pydev_smart_step_stop is frame: # <<<<<<<<<<<<<<
+ * info.pydev_func_name = '.invalid.' # Must match the type in cython
+ * info.pydev_smart_step_stop = None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":801
+ * info.pydev_smart_step_stop = None
+ *
+ * if is_line or is_exception_event: # <<<<<<<<<<<<<<
+ * curr_func_name = frame.f_code.co_name
+ *
+ */
+ __pyx_t_10 = (__pyx_v_is_line != 0);
+ if (!__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L170_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_is_exception_event != 0);
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L170_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":802
+ *
+ * if is_line or is_exception_event:
+ * curr_func_name = frame.f_code.co_name # <<<<<<<<<<<<<<
+ *
+ * #global context is set with an empty name
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 802, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_co_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 802, __pyx_L142_error)
+ __Pyx_XDECREF_SET(__pyx_v_curr_func_name, ((PyObject*)__pyx_t_1));
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":805
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', '') or curr_func_name is None: # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ __Pyx_INCREF(__pyx_v_curr_func_name);
+ __pyx_t_13 = __pyx_v_curr_func_name;
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s__5, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 805, __pyx_L142_error)
+ __pyx_t_27 = (__pyx_t_9 != 0);
+ if (!__pyx_t_27) {
+ } else {
+ __pyx_t_10 = __pyx_t_27;
+ goto __pyx_L175_bool_binop_done;
+ }
+ __pyx_t_27 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s_module, Py_EQ)); if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 805, __pyx_L142_error)
+ __pyx_t_9 = (__pyx_t_27 != 0);
+ __pyx_t_10 = __pyx_t_9;
+ __pyx_L175_bool_binop_done:;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_9 = (__pyx_t_10 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L173_bool_binop_done;
+ }
+ __pyx_t_9 = (__pyx_v_curr_func_name == ((PyObject*)Py_None));
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ __pyx_t_12 = __pyx_t_10;
+ __pyx_L173_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":806
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', '') or curr_func_name is None:
+ * curr_func_name = '' # <<<<<<<<<<<<<<
+ *
+ * if curr_func_name == info.pydev_func_name:
+ */
+ __Pyx_INCREF(__pyx_kp_s_);
+ __Pyx_DECREF_SET(__pyx_v_curr_func_name, __pyx_kp_s_);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":805
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', '') or curr_func_name is None: # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":808
+ * curr_func_name = ''
+ *
+ * if curr_func_name == info.pydev_func_name: # <<<<<<<<<<<<<<
+ * stop = True
+ *
+ */
+ __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_v_curr_func_name, __pyx_v_info->pydev_func_name, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 808, __pyx_L142_error)
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":809
+ *
+ * if curr_func_name == info.pydev_func_name:
+ * stop = True # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_STEP_RETURN:
+ */
+ __Pyx_INCREF(Py_True);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_True);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":808
+ * curr_func_name = ''
+ *
+ * if curr_func_name == info.pydev_func_name: # <<<<<<<<<<<<<<
+ * stop = True
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":801
+ * info.pydev_smart_step_stop = None
+ *
+ * if is_line or is_exception_event: # <<<<<<<<<<<<<<
+ * curr_func_name = frame.f_code.co_name
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":795
+ * stop, plugin_stop = result
+ *
+ * elif step_cmd == CMD_SMART_STEP_INTO: # <<<<<<<<<<<<<<
+ * stop = False
+ * if info.pydev_smart_step_stop is frame:
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":811
+ * stop = True
+ *
+ * elif step_cmd == CMD_STEP_RETURN: # <<<<<<<<<<<<<<
+ * stop = is_return and stop_frame is frame
+ *
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_STEP_RETURN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 811, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 811, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":812
+ *
+ * elif step_cmd == CMD_STEP_RETURN:
+ * stop = is_return and stop_frame is frame # <<<<<<<<<<<<<<
+ *
+ * elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT:
+ */
+ if (__pyx_v_is_return) {
+ } else {
+ __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_is_return); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 812, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L178_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_stop_frame == __pyx_v_frame);
+ __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 812, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __pyx_t_6;
+ __pyx_t_6 = 0;
+ __pyx_L178_bool_binop_done:;
+ __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":811
+ * stop = True
+ *
+ * elif step_cmd == CMD_STEP_RETURN: # <<<<<<<<<<<<<<
+ * stop = is_return and stop_frame is frame
+ *
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":814
+ * stop = is_return and stop_frame is frame
+ *
+ * elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_RUN_TO_LINE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L180_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_CMD_SET_NEXT_STATEMENT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 814, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L180_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":815
+ *
+ * elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT:
+ * stop = False # <<<<<<<<<<<<<<
+ *
+ * if is_line or is_exception_event:
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":817
+ * stop = False
+ *
+ * if is_line or is_exception_event: # <<<<<<<<<<<<<<
+ * #Yes, we can only act on line events (weird hum?)
+ * #Note: This code is duplicated at pydevd.py
+ */
+ __pyx_t_12 = (__pyx_v_is_line != 0);
+ if (!__pyx_t_12) {
+ } else {
+ __pyx_t_10 = __pyx_t_12;
+ goto __pyx_L183_bool_binop_done;
+ }
+ __pyx_t_12 = (__pyx_v_is_exception_event != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L183_bool_binop_done:;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":821
+ * #Note: This code is duplicated at pydevd.py
+ * #Acting on exception events after debugger breaks with exception
+ * curr_func_name = frame.f_code.co_name # <<<<<<<<<<<<<<
+ *
+ * #global context is set with an empty name
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_co_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 821, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 821, __pyx_L142_error)
+ __Pyx_XDECREF_SET(__pyx_v_curr_func_name, ((PyObject*)__pyx_t_6));
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":824
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''): # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ __Pyx_INCREF(__pyx_v_curr_func_name);
+ __pyx_t_13 = __pyx_v_curr_func_name;
+ __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s__5, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 824, __pyx_L142_error)
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (!__pyx_t_9) {
+ } else {
+ __pyx_t_10 = __pyx_t_9;
+ goto __pyx_L186_bool_binop_done;
+ }
+ __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_13, __pyx_kp_s_module, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 824, __pyx_L142_error)
+ __pyx_t_12 = (__pyx_t_9 != 0);
+ __pyx_t_10 = __pyx_t_12;
+ __pyx_L186_bool_binop_done:;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":825
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''):
+ * curr_func_name = '' # <<<<<<<<<<<<<<
+ *
+ * if curr_func_name == info.pydev_func_name:
+ */
+ __Pyx_INCREF(__pyx_kp_s_);
+ __Pyx_DECREF_SET(__pyx_v_curr_func_name, __pyx_kp_s_);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":824
+ *
+ * #global context is set with an empty name
+ * if curr_func_name in ('?', ''): # <<<<<<<<<<<<<<
+ * curr_func_name = ''
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":827
+ * curr_func_name = ''
+ *
+ * if curr_func_name == info.pydev_func_name: # <<<<<<<<<<<<<<
+ * line = info.pydev_next_line
+ * if frame.f_lineno == line:
+ */
+ __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_v_curr_func_name, __pyx_v_info->pydev_func_name, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 827, __pyx_L142_error)
+ __pyx_t_10 = (__pyx_t_12 != 0);
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":828
+ *
+ * if curr_func_name == info.pydev_func_name:
+ * line = info.pydev_next_line # <<<<<<<<<<<<<<
+ * if frame.f_lineno == line:
+ * stop = True
+ */
+ __pyx_t_19 = __pyx_v_info->pydev_next_line;
+ __pyx_v_line = __pyx_t_19;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":829
+ * if curr_func_name == info.pydev_func_name:
+ * line = info.pydev_next_line
+ * if frame.f_lineno == line: # <<<<<<<<<<<<<<
+ * stop = True
+ * else:
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_lineno); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 829, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":830
+ * line = info.pydev_next_line
+ * if frame.f_lineno == line:
+ * stop = True # <<<<<<<<<<<<<<
+ * else:
+ * if frame.f_trace is None:
+ */
+ __Pyx_INCREF(Py_True);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_True);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":829
+ * if curr_func_name == info.pydev_func_name:
+ * line = info.pydev_next_line
+ * if frame.f_lineno == line: # <<<<<<<<<<<<<<
+ * stop = True
+ * else:
+ */
+ goto __pyx_L189;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":832
+ * stop = True
+ * else:
+ * if frame.f_trace is None: # <<<<<<<<<<<<<<
+ * frame.f_trace = self.trace_dispatch
+ * frame.f_lineno = line
+ */
+ /*else*/ {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = (__pyx_t_1 == Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = (__pyx_t_10 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":833
+ * else:
+ * if frame.f_trace is None:
+ * frame.f_trace = self.trace_dispatch # <<<<<<<<<<<<<<
+ * frame.f_lineno = line
+ * frame.f_trace = None
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_frame, __pyx_n_s_f_trace, __pyx_t_1) < 0) __PYX_ERR(0, 833, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":832
+ * stop = True
+ * else:
+ * if frame.f_trace is None: # <<<<<<<<<<<<<<
+ * frame.f_trace = self.trace_dispatch
+ * frame.f_lineno = line
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":834
+ * if frame.f_trace is None:
+ * frame.f_trace = self.trace_dispatch
+ * frame.f_lineno = line # <<<<<<<<<<<<<<
+ * frame.f_trace = None
+ * stop = True
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_frame, __pyx_n_s_f_lineno, __pyx_t_1) < 0) __PYX_ERR(0, 834, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":835
+ * frame.f_trace = self.trace_dispatch
+ * frame.f_lineno = line
+ * frame.f_trace = None # <<<<<<<<<<<<<<
+ * stop = True
+ *
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_frame, __pyx_n_s_f_trace, Py_None) < 0) __PYX_ERR(0, 835, __pyx_L142_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":836
+ * frame.f_lineno = line
+ * frame.f_trace = None
+ * stop = True # <<<<<<<<<<<<<<
+ *
+ * else:
+ */
+ __Pyx_INCREF(Py_True);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_True);
+ }
+ __pyx_L189:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":827
+ * curr_func_name = ''
+ *
+ * if curr_func_name == info.pydev_func_name: # <<<<<<<<<<<<<<
+ * line = info.pydev_next_line
+ * if frame.f_lineno == line:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":817
+ * stop = False
+ *
+ * if is_line or is_exception_event: # <<<<<<<<<<<<<<
+ * #Yes, we can only act on line events (weird hum?)
+ * #Note: This code is duplicated at pydevd.py
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":814
+ * stop = is_return and stop_frame is frame
+ *
+ * elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ goto __pyx_L151;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":839
+ *
+ * else:
+ * stop = False # <<<<<<<<<<<<<<
+ *
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ */
+ /*else*/ {
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+ }
+ __pyx_L151:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":841
+ * stop = False
+ *
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"): # <<<<<<<<<<<<<<
+ * f_code = getattr(frame.f_back, 'f_code', None)
+ * if f_code is not None:
+ */
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_stop); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 841, __pyx_L142_error)
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L192_bool_binop_done;
+ }
+ __pyx_t_10 = ((__pyx_v_step_cmd != -1L) != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L192_bool_binop_done;
+ }
+ __pyx_t_10 = (__pyx_v_is_return != 0);
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L192_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_IS_PY3K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 841, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+ } else {
+ __pyx_t_12 = __pyx_t_10;
+ goto __pyx_L192_bool_binop_done;
+ }
+ __pyx_t_10 = __Pyx_HasAttr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 841, __pyx_L142_error)
+ __pyx_t_9 = (__pyx_t_10 != 0);
+ __pyx_t_12 = __pyx_t_9;
+ __pyx_L192_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":842
+ *
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ * f_code = getattr(frame.f_back, 'f_code', None) # <<<<<<<<<<<<<<
+ * if f_code is not None:
+ * back_filename = os.path.basename(f_code.co_filename)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_GetAttr3(__pyx_t_1, __pyx_n_s_f_code, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_f_code = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":843
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ * f_code = getattr(frame.f_back, 'f_code', None)
+ * if f_code is not None: # <<<<<<<<<<<<<<
+ * back_filename = os.path.basename(f_code.co_filename)
+ * file_type = get_file_type(back_filename)
+ */
+ __pyx_t_12 = (__pyx_v_f_code != Py_None);
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":844
+ * f_code = getattr(frame.f_back, 'f_code', None)
+ * if f_code is not None:
+ * back_filename = os.path.basename(f_code.co_filename) # <<<<<<<<<<<<<<
+ * file_type = get_file_type(back_filename)
+ * if file_type == PYDEV_FILE:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_basename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f_code, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_back_filename, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":845
+ * if f_code is not None:
+ * back_filename = os.path.basename(f_code.co_filename)
+ * file_type = get_file_type(back_filename) # <<<<<<<<<<<<<<
+ * if file_type == PYDEV_FILE:
+ * stop = False
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_back_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_back_filename};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_back_filename};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_back_filename);
+ __Pyx_GIVEREF(__pyx_v_back_filename);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_back_filename);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_file_type = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":846
+ * back_filename = os.path.basename(f_code.co_filename)
+ * file_type = get_file_type(back_filename)
+ * if file_type == PYDEV_FILE: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PYDEV_FILE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_file_type, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 846, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":847
+ * file_type = get_file_type(back_filename)
+ * if file_type == PYDEV_FILE:
+ * stop = False # <<<<<<<<<<<<<<
+ *
+ * if plugin_stop:
+ */
+ __Pyx_INCREF(Py_False);
+ __Pyx_DECREF_SET(__pyx_v_stop, Py_False);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":846
+ * back_filename = os.path.basename(f_code.co_filename)
+ * file_type = get_file_type(back_filename)
+ * if file_type == PYDEV_FILE: # <<<<<<<<<<<<<<
+ * stop = False
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":843
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ * f_code = getattr(frame.f_back, 'f_code', None)
+ * if f_code is not None: # <<<<<<<<<<<<<<
+ * back_filename = os.path.basename(f_code.co_filename)
+ * file_type = get_file_type(back_filename)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":841
+ * stop = False
+ *
+ * if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"): # <<<<<<<<<<<<<<
+ * f_code = getattr(frame.f_back, 'f_code', None)
+ * if f_code is not None:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":849
+ * stop = False
+ *
+ * if plugin_stop: # <<<<<<<<<<<<<<
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop:
+ */
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_plugin_stop); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 849, __pyx_L142_error)
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":850
+ *
+ * if plugin_stop:
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd) # <<<<<<<<<<<<<<
+ * elif stop:
+ * if is_line:
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_plugin_manager, __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_8 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[8] = {__pyx_t_8, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_arg, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 7+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[8] = {__pyx_t_8, __pyx_v_main_debugger, __pyx_v_frame, __pyx_v_event, __pyx_v_self->_args, __pyx_v_stop_info, __pyx_v_arg, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 7+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(7+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_19, __pyx_v_main_debugger);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_19, __pyx_v_self->_args);
+ __Pyx_INCREF(__pyx_v_stop_info);
+ __Pyx_GIVEREF(__pyx_v_stop_info);
+ PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_19, __pyx_v_stop_info);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 5+__pyx_t_19, __pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_7, 6+__pyx_t_19, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_stopped_on_plugin = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":849
+ * stop = False
+ *
+ * if plugin_stop: # <<<<<<<<<<<<<<
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop:
+ */
+ goto __pyx_L199;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":851
+ * if plugin_stop:
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop: # <<<<<<<<<<<<<<
+ * if is_line:
+ * self.set_suspend(thread, step_cmd)
+ */
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_stop); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 851, __pyx_L142_error)
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":852
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop:
+ * if is_line: # <<<<<<<<<<<<<<
+ * self.set_suspend(thread, step_cmd)
+ * self.do_wait_suspend(thread, frame, event, arg)
+ */
+ __pyx_t_9 = (__pyx_v_is_line != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":853
+ * elif stop:
+ * if is_line:
+ * self.set_suspend(thread, step_cmd) # <<<<<<<<<<<<<<
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * else: #return event
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_suspend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_thread, __pyx_t_7};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_thread, __pyx_t_7};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_6) {
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_19, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":854
+ * if is_line:
+ * self.set_suspend(thread, step_cmd)
+ * self.do_wait_suspend(thread, frame, event, arg) # <<<<<<<<<<<<<<
+ * else: #return event
+ * back = frame.f_back
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_wait_suspend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_8 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_thread, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_19, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_19, __pyx_v_arg);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":852
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop:
+ * if is_line: # <<<<<<<<<<<<<<
+ * self.set_suspend(thread, step_cmd)
+ * self.do_wait_suspend(thread, frame, event, arg)
+ */
+ goto __pyx_L200;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":856
+ * self.do_wait_suspend(thread, frame, event, arg)
+ * else: #return event
+ * back = frame.f_back # <<<<<<<<<<<<<<
+ * if back is not None:
+ * #When we get to the pydevd run function, the debugging has actually finished for the main thread
+ */
+ /*else*/ {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_back, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":857
+ * else: #return event
+ * back = frame.f_back
+ * if back is not None: # <<<<<<<<<<<<<<
+ * #When we get to the pydevd run function, the debugging has actually finished for the main thread
+ * #(note that it can still go on for other threads, but for this one, we just make it finish)
+ */
+ __pyx_t_9 = (__pyx_v_back != Py_None);
+ __pyx_t_12 = (__pyx_t_9 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":861
+ * #(note that it can still go on for other threads, but for this one, we just make it finish)
+ * #So, just setting it to None should be OK
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back) # <<<<<<<<<<<<<<
+ * if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]:
+ * back = None
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_back};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_back};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_v_back);
+ __Pyx_GIVEREF(__pyx_v_back);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_back);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 861, __pyx_L142_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
+ } else {
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
+ }
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 861, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L202_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_8)) goto __pyx_L202_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_8);
+ index = 2; __pyx_t_7 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L202_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 3) < 0) __PYX_ERR(0, 861, __pyx_L142_error)
+ __pyx_t_11 = NULL;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L203_unpacking_done;
+ __pyx_L202_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_11 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 861, __pyx_L142_error)
+ __pyx_L203_unpacking_done:;
+ }
+ __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_back_filename, __pyx_t_8);
+ __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_base, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":862
+ * #So, just setting it to None should be OK
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]: # <<<<<<<<<<<<<<
+ * back = None
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_base, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_9) {
+ } else {
+ __pyx_t_12 = __pyx_t_9;
+ goto __pyx_L205_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_back, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_co_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_START); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 862, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __pyx_t_9;
+ __pyx_L205_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":863
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]:
+ * back = None # <<<<<<<<<<<<<<
+ *
+ * elif base == TRACE_PROPERTY:
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_back, Py_None);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":862
+ * #So, just setting it to None should be OK
+ * _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ * if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]: # <<<<<<<<<<<<<<
+ * back = None
+ *
+ */
+ goto __pyx_L204;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":865
+ * back = None
+ *
+ * elif base == TRACE_PROPERTY: # <<<<<<<<<<<<<<
+ * # We dont want to trace the return event of pydevd_traceproperty (custom property for debugging)
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_TRACE_PROPERTY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = PyObject_RichCompare(__pyx_v_base, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 865, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 865, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":868
+ * # We dont want to trace the return event of pydevd_traceproperty (custom property for debugging)
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ * return None # <<<<<<<<<<<<<<
+ *
+ * elif pydevd_dont_trace.should_trace_hook is not None:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L146_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":865
+ * back = None
+ *
+ * elif base == TRACE_PROPERTY: # <<<<<<<<<<<<<<
+ * # We dont want to trace the return event of pydevd_traceproperty (custom property for debugging)
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":870
+ * return None
+ *
+ * elif pydevd_dont_trace.should_trace_hook is not None: # <<<<<<<<<<<<<<
+ * if not pydevd_dont_trace.should_trace_hook(back, back_filename):
+ * # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_dont_trace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 870, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_should_trace_hook); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = (__pyx_t_1 != Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":871
+ *
+ * elif pydevd_dont_trace.should_trace_hook is not None:
+ * if not pydevd_dont_trace.should_trace_hook(back, back_filename): # <<<<<<<<<<<<<<
+ * # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ * # Also, we have to reset the tracing, because if the parent's parent (or some
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydevd_dont_trace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_should_trace_hook); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_back, __pyx_v_back_filename};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_back, __pyx_v_back_filename};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_8) {
+ __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_back);
+ __Pyx_GIVEREF(__pyx_v_back);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_19, __pyx_v_back);
+ __Pyx_INCREF(__pyx_v_back_filename);
+ __Pyx_GIVEREF(__pyx_v_back_filename);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_19, __pyx_v_back_filename);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 871, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = ((!__pyx_t_9) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":877
+ * # we should anymore (so, a step in/over/return may not stop anywhere if no parent is traced).
+ * # Related test: _debugger_case17a.py
+ * main_debugger.set_trace_for_frame_and_parents(back, overwrite_prev_trace=True) # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_set_trace_for_frame_and_parents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 877, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_back);
+ __Pyx_GIVEREF(__pyx_v_back);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_back);
+ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_overwrite_prev_trace, Py_True) < 0) __PYX_ERR(0, 877, __pyx_L142_error)
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 877, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":878
+ * # Related test: _debugger_case17a.py
+ * main_debugger.set_trace_for_frame_and_parents(back, overwrite_prev_trace=True)
+ * return None # <<<<<<<<<<<<<<
+ *
+ * if back is not None:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L146_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":871
+ *
+ * elif pydevd_dont_trace.should_trace_hook is not None:
+ * if not pydevd_dont_trace.should_trace_hook(back, back_filename): # <<<<<<<<<<<<<<
+ * # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ * # Also, we have to reset the tracing, because if the parent's parent (or some
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":870
+ * return None
+ *
+ * elif pydevd_dont_trace.should_trace_hook is not None: # <<<<<<<<<<<<<<
+ * if not pydevd_dont_trace.should_trace_hook(back, back_filename):
+ * # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ */
+ }
+ __pyx_L204:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":857
+ * else: #return event
+ * back = frame.f_back
+ * if back is not None: # <<<<<<<<<<<<<<
+ * #When we get to the pydevd run function, the debugging has actually finished for the main thread
+ * #(note that it can still go on for other threads, but for this one, we just make it finish)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":880
+ * return None
+ *
+ * if back is not None: # <<<<<<<<<<<<<<
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ * self.set_suspend(thread, step_cmd)
+ */
+ __pyx_t_12 = (__pyx_v_back != Py_None);
+ __pyx_t_9 = (__pyx_t_12 != 0);
+ if (__pyx_t_9) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":882
+ * if back is not None:
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ * self.set_suspend(thread, step_cmd) # <<<<<<<<<<<<<<
+ * self.do_wait_suspend(thread, back, event, arg)
+ * else:
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_suspend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step_cmd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_thread, __pyx_t_7};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_thread, __pyx_t_7};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_19, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":883
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ * self.set_suspend(thread, step_cmd)
+ * self.do_wait_suspend(thread, back, event, arg) # <<<<<<<<<<<<<<
+ * else:
+ * #in jython we may not have a back frame
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_wait_suspend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = NULL;
+ __pyx_t_19 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_19 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_thread, __pyx_v_back, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 883, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_thread, __pyx_v_back, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 883, __pyx_L142_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_8);
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 883, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_6) {
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_thread);
+ __Pyx_GIVEREF(__pyx_v_thread);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_19, __pyx_v_thread);
+ __Pyx_INCREF(__pyx_v_back);
+ __Pyx_GIVEREF(__pyx_v_back);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_19, __pyx_v_back);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_19, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_19, __pyx_v_arg);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 883, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":880
+ * return None
+ *
+ * if back is not None: # <<<<<<<<<<<<<<
+ * #if we're in a return, we want it to appear to the user in the previous frame!
+ * self.set_suspend(thread, step_cmd)
+ */
+ goto __pyx_L208;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":886
+ * else:
+ * #in jython we may not have a back frame
+ * info.pydev_step_stop = None # <<<<<<<<<<<<<<
+ * info.pydev_step_cmd = -1
+ * info.pydev_state = STATE_RUN
+ */
+ /*else*/ {
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_info->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_info->pydev_step_stop);
+ __pyx_v_info->pydev_step_stop = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":887
+ * #in jython we may not have a back frame
+ * info.pydev_step_stop = None
+ * info.pydev_step_cmd = -1 # <<<<<<<<<<<<<<
+ * info.pydev_state = STATE_RUN
+ *
+ */
+ __pyx_v_info->pydev_step_cmd = -1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":888
+ * info.pydev_step_stop = None
+ * info.pydev_step_cmd = -1
+ * info.pydev_state = STATE_RUN # <<<<<<<<<<<<<<
+ *
+ * except KeyboardInterrupt:
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_STATE_RUN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 888, __pyx_L142_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L142_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_info->pydev_state = __pyx_t_19;
+ }
+ __pyx_L208:;
+ }
+ __pyx_L200:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":851
+ * if plugin_stop:
+ * stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ * elif stop: # <<<<<<<<<<<<<<
+ * if is_line:
+ * self.set_suspend(thread, step_cmd)
+ */
+ }
+ __pyx_L199:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":753
+ *
+ * #step handling. We stop when we hit the right frame
+ * try: # <<<<<<<<<<<<<<
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L147_try_end;
+ __pyx_L142_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":890
+ * info.pydev_state = STATE_RUN
+ *
+ * except KeyboardInterrupt: # <<<<<<<<<<<<<<
+ * raise
+ * except:
+ */
+ __pyx_t_19 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyboardInterrupt);
+ if (__pyx_t_19) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_3, &__pyx_t_7) < 0) __PYX_ERR(0, 890, __pyx_L144_except_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":891
+ *
+ * except KeyboardInterrupt:
+ * raise # <<<<<<<<<<<<<<
+ * except:
+ * try:
+ */
+ __Pyx_GIVEREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_3, __pyx_t_7);
+ __pyx_t_8 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0;
+ __PYX_ERR(0, 891, __pyx_L144_except_error)
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":892
+ * except KeyboardInterrupt:
+ * raise
+ * except: # <<<<<<<<<<<<<<
+ * try:
+ * traceback.print_exc()
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_8) < 0) __PYX_ERR(0, 892, __pyx_L144_except_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_8);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":893
+ * raise
+ * except:
+ * try: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * info.pydev_step_cmd = -1
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24);
+ __Pyx_XGOTREF(__pyx_t_26);
+ __Pyx_XGOTREF(__pyx_t_25);
+ __Pyx_XGOTREF(__pyx_t_24);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":894
+ * except:
+ * try:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * info.pydev_step_cmd = -1
+ * except:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L213_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L213_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_1) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 894, __pyx_L213_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 894, __pyx_L213_error)
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":895
+ * try:
+ * traceback.print_exc()
+ * info.pydev_step_cmd = -1 # <<<<<<<<<<<<<<
+ * except:
+ * return None
+ */
+ __pyx_v_info->pydev_step_cmd = -1;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":893
+ * raise
+ * except:
+ * try: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * info.pydev_step_cmd = -1
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
+ __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
+ __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
+ goto __pyx_L220_try_end;
+ __pyx_L213_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":896
+ * traceback.print_exc()
+ * info.pydev_step_cmd = -1
+ * except: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_1) < 0) __PYX_ERR(0, 896, __pyx_L215_except_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":897
+ * info.pydev_step_cmd = -1
+ * except:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * #if we are quitting, let's stop the tracing
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L216_except_return;
+ }
+ __pyx_L215_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":893
+ * raise
+ * except:
+ * try: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * info.pydev_step_cmd = -1
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_25, __pyx_t_24);
+ goto __pyx_L144_except_error;
+ __pyx_L216_except_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_25, __pyx_t_24);
+ goto __pyx_L145_except_return;
+ __pyx_L220_try_end:;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L143_exception_handled;
+ }
+ __pyx_L144_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":753
+ *
+ * #step handling. We stop when we hit the right frame
+ * try: # <<<<<<<<<<<<<<
+ * should_skip = 0
+ * if pydevd_dont_trace.should_trace_hook is not None:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+ goto __pyx_L4_error;
+ __pyx_L146_try_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+ goto __pyx_L3_return;
+ __pyx_L145_except_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+ goto __pyx_L3_return;
+ __pyx_L143_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+ __pyx_L147_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":900
+ *
+ * #if we are quitting, let's stop the tracing
+ * retVal = None # <<<<<<<<<<<<<<
+ * if not main_debugger.quitting:
+ * retVal = self.trace_dispatch
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_retVal = Py_None;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":901
+ * #if we are quitting, let's stop the tracing
+ * retVal = None
+ * if not main_debugger.quitting: # <<<<<<<<<<<<<<
+ * retVal = self.trace_dispatch
+ *
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_quitting); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 901, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 901, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_12 = ((!__pyx_t_9) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":902
+ * retVal = None
+ * if not main_debugger.quitting:
+ * retVal = self.trace_dispatch # <<<<<<<<<<<<<<
+ *
+ * return retVal
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF_SET(__pyx_v_retVal, __pyx_t_8);
+ __pyx_t_8 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":901
+ * #if we are quitting, let's stop the tracing
+ * retVal = None
+ * if not main_debugger.quitting: # <<<<<<<<<<<<<<
+ * retVal = self.trace_dispatch
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":904
+ * retVal = self.trace_dispatch
+ *
+ * return retVal # <<<<<<<<<<<<<<
+ * finally:
+ * info.is_tracing = False
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_retVal);
+ __pyx_r = __pyx_v_retVal;
+ goto __pyx_L3_return;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":906
+ * return retVal
+ * finally:
+ * info.is_tracing = False # <<<<<<<<<<<<<<
+ *
+ * #end trace_dispatch
+ */
+ /*finally:*/ {
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __pyx_L4_error:;
+ __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __Pyx_XGOTREF(__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_24);
+ __Pyx_XGOTREF(__pyx_t_25);
+ __Pyx_XGOTREF(__pyx_t_26);
+ __pyx_t_19 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
+ {
+ __pyx_v_info->is_tracing = 0;
+ }
+ __Pyx_PyThreadState_assign
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_24);
+ __Pyx_XGIVEREF(__pyx_t_25);
+ __Pyx_XGIVEREF(__pyx_t_26);
+ __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
+ }
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
+ __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
+ __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_28;
+ goto __pyx_L1_error;
+ }
+ __pyx_L3_return: {
+ __pyx_t_26 = __pyx_r;
+ __pyx_r = 0;
+ __pyx_v_info->is_tracing = 0;
+ __pyx_r = __pyx_t_26;
+ __pyx_t_26 = 0;
+ goto __pyx_L0;
+ }
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":498
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * cpdef trace_dispatch(self, frame, str event, arg): # <<<<<<<<<<<<<<
+ * cdef str filename;
+ * cdef bint is_exception_event;
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_13);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_filename);
+ __Pyx_XDECREF((PyObject *)__pyx_v_info);
+ __Pyx_XDECREF(__pyx_v_curr_func_name);
+ __Pyx_XDECREF(__pyx_v_frame_skips_cache);
+ __Pyx_XDECREF(__pyx_v_frame_cache_key);
+ __Pyx_XDECREF(__pyx_v_line_cache_key);
+ __Pyx_XDECREF(__pyx_v_main_debugger);
+ __Pyx_XDECREF(__pyx_v_thread);
+ __Pyx_XDECREF(__pyx_v_plugin_manager);
+ __Pyx_XDECREF(__pyx_v_flag);
+ __Pyx_XDECREF(__pyx_v_need_trace_return);
+ __Pyx_XDECREF(__pyx_v_stop_frame);
+ __Pyx_XDECREF(__pyx_v_breakpoints_for_file);
+ __Pyx_XDECREF(__pyx_v_breakpoint);
+ __Pyx_XDECREF(__pyx_v_stop_info);
+ __Pyx_XDECREF(__pyx_v_stop);
+ __Pyx_XDECREF(__pyx_v_bp_type);
+ __Pyx_XDECREF(__pyx_v_new_frame);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_condition);
+ __Pyx_XDECREF(__pyx_v_back);
+ __Pyx_XDECREF(__pyx_v__);
+ __Pyx_XDECREF(__pyx_v_back_filename);
+ __Pyx_XDECREF(__pyx_v_base);
+ __Pyx_XDECREF(__pyx_v_plugin_stop);
+ __Pyx_XDECREF(__pyx_v_f_code);
+ __Pyx_XDECREF(__pyx_v_file_type);
+ __Pyx_XDECREF(__pyx_v_stopped_on_plugin);
+ __Pyx_XDECREF(__pyx_v_retVal);
+ __Pyx_XDECREF(__pyx_v_frame);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_21trace_dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_21trace_dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("trace_dispatch (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 3, 3, 1); __PYX_ERR(0, 498, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 3, 3, 2); __PYX_ERR(0, 498, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace_dispatch") < 0)) __PYX_ERR(0, 498, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = ((PyObject*)values[1]);
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 498, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event), (&PyString_Type), 1, "event", 1))) __PYX_ERR(0, 498, __pyx_L1_error)
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_20trace_dispatch(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_20trace_dispatch(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("trace_dispatch", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_trace_dispatch(__pyx_v_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self._args, self.should_skip)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_22__reduce_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_22__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self) {
+ int __pyx_v_use_setstate;
+ PyObject *__pyx_v_state = NULL;
+ PyObject *__pyx_v__dict = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 0);
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * cdef bint use_setstate
+ * state = (self._args, self.should_skip) # <<<<<<<<<<<<<<
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->should_skip); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_v_state = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "(tree fragment)":4
+ * cdef bint use_setstate
+ * state = (self._args, self.should_skip)
+ * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
+ * if _dict is not None:
+ * state += _dict,
+ */
+ __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v__dict = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "(tree fragment)":5
+ * state = (self._args, self.should_skip)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ __pyx_t_3 = (__pyx_v__dict != Py_None);
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "(tree fragment)":6
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ * state += _dict, # <<<<<<<<<<<<<<
+ * use_setstate = True
+ * else:
+ */
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v__dict);
+ __Pyx_GIVEREF(__pyx_v__dict);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":7
+ * if _dict is not None:
+ * state += _dict,
+ * use_setstate = True # <<<<<<<<<<<<<<
+ * else:
+ * use_setstate = self._args is not None
+ */
+ __pyx_v_use_setstate = 1;
+
+ /* "(tree fragment)":5
+ * state = (self._args, self.should_skip)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ goto __pyx_L3;
+ }
+
+ /* "(tree fragment)":9
+ * use_setstate = True
+ * else:
+ * use_setstate = self._args is not None # <<<<<<<<<<<<<<
+ * if use_setstate:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, None), state
+ */
+ /*else*/ {
+ __pyx_t_4 = (__pyx_v_self->_args != ((PyObject*)Py_None));
+ __pyx_v_use_setstate = __pyx_t_4;
+ }
+ __pyx_L3:;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self._args is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, None), state
+ * else:
+ */
+ __pyx_t_4 = (__pyx_v_use_setstate != 0);
+ if (__pyx_t_4) {
+
+ /* "(tree fragment)":11
+ * use_setstate = self._args is not None
+ * if use_setstate:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, None), state # <<<<<<<<<<<<<<
+ * else:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, state)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_PyDBFrame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_262582659);
+ __Pyx_GIVEREF(__pyx_int_262582659);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_262582659);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self._args is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, None), state
+ * else:
+ */
+ }
+
+ /* "(tree fragment)":13
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, None), state
+ * else:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, state) # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_PyDBFrame__set_state(self, __pyx_state)
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_PyDBFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_262582659);
+ __Pyx_GIVEREF(__pyx_int_262582659);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_262582659);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
+ __pyx_t_5 = 0;
+ __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self._args, self.should_skip)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_state);
+ __Pyx_XDECREF(__pyx_v__dict);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBFrame__set_state(self, __pyx_state)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_24__setstate_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_24__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 0);
+
+ /* "(tree fragment)":15
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, state)
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_PyDBFrame__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
+ __pyx_t_1 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBFrame__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_PyDBFrame, (type(self), 0xfa6b183, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBFrame__set_state(self, __pyx_state)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.PyDBFrame.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":931
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_11send_signature_call_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_11send_signature_call_trace = {"send_signature_call_trace", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_11send_signature_call_trace, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_11send_signature_call_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_args = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("send_signature_call_trace (wrapper)", 0);
+ if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "send_signature_call_trace", 1))) return NULL;
+ __Pyx_INCREF(__pyx_args);
+ __pyx_v_args = __pyx_args;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_10send_signature_call_trace(__pyx_self, __pyx_v_args, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_10send_signature_call_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("send_signature_call_trace", 0);
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":951
+ * global_cache_frame_skips = {}
+ *
+ * def trace_dispatch(py_db, frame, event, arg): # <<<<<<<<<<<<<<
+ * t = threadingCurrentThread()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_13trace_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_13trace_dispatch = {"trace_dispatch", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_13trace_dispatch, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_13trace_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_py_db = 0;
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("trace_dispatch (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_db,&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[4] = {0,0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ CYTHON_FALLTHROUGH;
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_py_db)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 4, 4, 1); __PYX_ERR(0, 951, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 4, 4, 2); __PYX_ERR(0, 951, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 3:
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 4, 4, 3); __PYX_ERR(0, 951, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace_dispatch") < 0)) __PYX_ERR(0, 951, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ }
+ __pyx_v_py_db = values[0];
+ __pyx_v_frame = values[1];
+ __pyx_v_event = values[2];
+ __pyx_v_arg = values[3];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("trace_dispatch", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 951, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12trace_dispatch(__pyx_self, __pyx_v_py_db, __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12trace_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_db, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_v_t = NULL;
+ PyObject *__pyx_v_additional_info = NULL;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_thread_tracer = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ int __pyx_t_11;
+ __Pyx_RefNannySetupContext("trace_dispatch", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":952
+ *
+ * def trace_dispatch(py_db, frame, event, arg):
+ * t = threadingCurrentThread() # <<<<<<<<<<<<<<
+ *
+ * if getattr(t, 'pydev_do_not_trace', None):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threadingCurrentThread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_t = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":954
+ * t = threadingCurrentThread()
+ *
+ * if getattr(t, 'pydev_do_not_trace', None): # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_t, __pyx_n_s_pydev_do_not_trace, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_4) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":955
+ *
+ * if getattr(t, 'pydev_do_not_trace', None):
+ * return None # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":954
+ * t = threadingCurrentThread()
+ *
+ * if getattr(t, 'pydev_do_not_trace', None): # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":957
+ * return None
+ *
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_7);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":958
+ *
+ * try:
+ * additional_info = t.additional_info # <<<<<<<<<<<<<<
+ * if additional_info is None:
+ * raise AttributeError()
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_additional_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_additional_info = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":959
+ * try:
+ * additional_info = t.additional_info
+ * if additional_info is None: # <<<<<<<<<<<<<<
+ * raise AttributeError()
+ * except:
+ */
+ __pyx_t_4 = (__pyx_v_additional_info == Py_None);
+ __pyx_t_8 = (__pyx_t_4 != 0);
+ if (__pyx_t_8) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":960
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ * raise AttributeError() # <<<<<<<<<<<<<<
+ * except:
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ */
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_AttributeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __PYX_ERR(0, 960, __pyx_L4_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":959
+ * try:
+ * additional_info = t.additional_info
+ * if additional_info is None: # <<<<<<<<<<<<<<
+ * raise AttributeError()
+ * except:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":957
+ * return None
+ *
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L9_try_end;
+ __pyx_L4_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":961
+ * if additional_info is None:
+ * raise AttributeError()
+ * except: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 961, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_3);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":962
+ * raise AttributeError()
+ * except:
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo() # <<<<<<<<<<<<<<
+ *
+ * thread_tracer = ThreadTracer((py_db, t, additional_info, global_cache_skips, global_cache_frame_skips))
+ */
+ __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 962, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_XDECREF_SET(__pyx_v_additional_info, __pyx_t_9);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_t, __pyx_n_s_additional_info, __pyx_t_9) < 0) __PYX_ERR(0, 962, __pyx_L6_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L5_exception_handled;
+ }
+ __pyx_L6_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":957
+ * return None
+ *
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ goto __pyx_L1_error;
+ __pyx_L5_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __pyx_L9_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":964
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ *
+ * thread_tracer = ThreadTracer((py_db, t, additional_info, global_cache_skips, global_cache_frame_skips)) # <<<<<<<<<<<<<<
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_global_cache_skips); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_global_cache_frame_skips); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_py_db);
+ __Pyx_GIVEREF(__pyx_v_py_db);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_py_db);
+ __Pyx_INCREF(__pyx_v_t);
+ __Pyx_GIVEREF(__pyx_v_t);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_t);
+ __Pyx_INCREF(__pyx_v_additional_info);
+ __Pyx_GIVEREF(__pyx_v_additional_info);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_additional_info);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_2);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_thread_tracer = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":966
+ * thread_tracer = ThreadTracer((py_db, t, additional_info, global_cache_skips, global_cache_frame_skips))
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough). # <<<<<<<<<<<<<<
+ * # ELSE
+ * # ENDIF
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_t, __pyx_n_s_tracer, ((PyObject *)__pyx_v_thread_tracer)) < 0) __PYX_ERR(0, 966, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":969
+ * # ELSE
+ * # ENDIF
+ * SetTrace(thread_tracer.__call__) # <<<<<<<<<<<<<<
+ * return thread_tracer.__call__(frame, event, arg)
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SetTrace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thread_tracer), __pyx_n_s_call_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_9) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_3};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_3};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":970
+ * # ENDIF
+ * SetTrace(thread_tracer.__call__)
+ * return thread_tracer.__call__(frame, event, arg) # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thread_tracer), __pyx_n_s_call_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_10 = NULL;
+ __pyx_t_11 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_11 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_10) {
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_v_arg);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":951
+ * global_cache_frame_skips = {}
+ *
+ * def trace_dispatch(py_db, frame, event, arg): # <<<<<<<<<<<<<<
+ * t = threadingCurrentThread()
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_t);
+ __Pyx_XDECREF(__pyx_v_additional_info);
+ __Pyx_XDECREF((PyObject *)__pyx_v_thread_tracer);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":975
+ * cdef class SafeCallWrapper:
+ * cdef method_object
+ * def __init__(self, method_object): # <<<<<<<<<<<<<<
+ * self.method_object = method_object
+ * def __call__(self, *args):
+ */
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_method_object = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method_object,0};
+ PyObject* values[1] = {0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_object)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 975, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ }
+ __pyx_v_method_object = values[0];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 975, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.SafeCallWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper___init__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)__pyx_v_self), __pyx_v_method_object);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v_method_object) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":976
+ * cdef method_object
+ * def __init__(self, method_object):
+ * self.method_object = method_object # <<<<<<<<<<<<<<
+ * def __call__(self, *args):
+ * #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+ */
+ __Pyx_INCREF(__pyx_v_method_object);
+ __Pyx_GIVEREF(__pyx_v_method_object);
+ __Pyx_GOTREF(__pyx_v_self->method_object);
+ __Pyx_DECREF(__pyx_v_self->method_object);
+ __pyx_v_self->method_object = __pyx_v_method_object;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":975
+ * cdef class SafeCallWrapper:
+ * cdef method_object
+ * def __init__(self, method_object): # <<<<<<<<<<<<<<
+ * self.method_object = method_object
+ * def __call__(self, *args):
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":977
+ * def __init__(self, method_object):
+ * self.method_object = method_object
+ * def __call__(self, *args): # <<<<<<<<<<<<<<
+ * #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+ * #in the frame, and that reference might get destroyed by set trace on frame and parents
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_args = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;
+ __Pyx_INCREF(__pyx_args);
+ __pyx_v_args = __pyx_args;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_2__call__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)__pyx_v_self), __pyx_v_args);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_2__call__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v_args) {
+ PyObject *__pyx_v_method_obj;
+ PyObject *__pyx_v_ret = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ __Pyx_RefNannySetupContext("__call__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":980
+ * #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+ * #in the frame, and that reference might get destroyed by set trace on frame and parents
+ * cdef PyObject* method_obj = self.method_object # <<<<<<<<<<<<<<
+ * Py_INCREF(method_obj)
+ * ret = (method_obj)(*args)
+ */
+ __pyx_v_method_obj = ((PyObject *)__pyx_v_self->method_object);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":981
+ * #in the frame, and that reference might get destroyed by set trace on frame and parents
+ * cdef PyObject* method_obj = self.method_object
+ * Py_INCREF(method_obj) # <<<<<<<<<<<<<<
+ * ret = (method_obj)(*args)
+ * Py_XDECREF (method_obj)
+ */
+ Py_INCREF(((PyObject *)__pyx_v_method_obj));
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":982
+ * cdef PyObject* method_obj = self.method_object
+ * Py_INCREF(method_obj)
+ * ret = (method_obj)(*args) # <<<<<<<<<<<<<<
+ * Py_XDECREF (method_obj)
+ * return SafeCallWrapper(ret) if ret is not None else None
+ */
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_method_obj), __pyx_v_args, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_ret = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":983
+ * Py_INCREF(method_obj)
+ * ret = (method_obj)(*args)
+ * Py_XDECREF (method_obj) # <<<<<<<<<<<<<<
+ * return SafeCallWrapper(ret) if ret is not None else None
+ * cdef class ThreadTracer:
+ */
+ Py_XDECREF(__pyx_v_method_obj);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":984
+ * ret = (method_obj)(*args)
+ * Py_XDECREF (method_obj)
+ * return SafeCallWrapper(ret) if ret is not None else None # <<<<<<<<<<<<<<
+ * cdef class ThreadTracer:
+ * cdef public tuple _args;
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = (__pyx_v_ret != Py_None);
+ if ((__pyx_t_2 != 0)) {
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_ret);
+ __Pyx_GIVEREF(__pyx_v_ret);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ret);
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_t_4 = 0;
+ } else {
+ __Pyx_INCREF(Py_None);
+ __pyx_t_1 = Py_None;
+ }
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":977
+ * def __init__(self, method_object):
+ * self.method_object = method_object
+ * def __call__(self, *args): # <<<<<<<<<<<<<<
+ * #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+ * #in the frame, and that reference might get destroyed by set trace on frame and parents
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.SafeCallWrapper.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_ret);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self.method_object,)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_4__reduce_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_4__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self) {
+ int __pyx_v_use_setstate;
+ PyObject *__pyx_v_state = NULL;
+ PyObject *__pyx_v__dict = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 0);
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * cdef bint use_setstate
+ * state = (self.method_object,) # <<<<<<<<<<<<<<
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_self->method_object);
+ __Pyx_GIVEREF(__pyx_v_self->method_object);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->method_object);
+ __pyx_v_state = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":4
+ * cdef bint use_setstate
+ * state = (self.method_object,)
+ * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
+ * if _dict is not None:
+ * state += _dict,
+ */
+ __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v__dict = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":5
+ * state = (self.method_object,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ __pyx_t_2 = (__pyx_v__dict != Py_None);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":6
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ * state += _dict, # <<<<<<<<<<<<<<
+ * use_setstate = True
+ * else:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v__dict);
+ __Pyx_GIVEREF(__pyx_v__dict);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
+ __pyx_t_4 = 0;
+
+ /* "(tree fragment)":7
+ * if _dict is not None:
+ * state += _dict,
+ * use_setstate = True # <<<<<<<<<<<<<<
+ * else:
+ * use_setstate = self.method_object is not None
+ */
+ __pyx_v_use_setstate = 1;
+
+ /* "(tree fragment)":5
+ * state = (self.method_object,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ goto __pyx_L3;
+ }
+
+ /* "(tree fragment)":9
+ * use_setstate = True
+ * else:
+ * use_setstate = self.method_object is not None # <<<<<<<<<<<<<<
+ * if use_setstate:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, None), state
+ */
+ /*else*/ {
+ __pyx_t_3 = (__pyx_v_self->method_object != Py_None);
+ __pyx_v_use_setstate = __pyx_t_3;
+ }
+ __pyx_L3:;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self.method_object is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, None), state
+ * else:
+ */
+ __pyx_t_3 = (__pyx_v_use_setstate != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":11
+ * use_setstate = self.method_object is not None
+ * if use_setstate:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, None), state # <<<<<<<<<<<<<<
+ * else:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, state)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_SafeCallWrapper); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_125568891);
+ __Pyx_GIVEREF(__pyx_int_125568891);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_125568891);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self.method_object is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, None), state
+ * else:
+ */
+ }
+
+ /* "(tree fragment)":13
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, None), state
+ * else:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, state) # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_SafeCallWrapper__set_state(self, __pyx_state)
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_SafeCallWrapper); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_125568891);
+ __Pyx_GIVEREF(__pyx_int_125568891);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_125568891);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self.method_object,)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.SafeCallWrapper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_state);
+ __Pyx_XDECREF(__pyx_v__dict);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_SafeCallWrapper__set_state(self, __pyx_state)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_6__setstate_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_6__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 0);
+
+ /* "(tree fragment)":15
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, state)
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_SafeCallWrapper__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
+ __pyx_t_1 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_SafeCallWrapper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_SafeCallWrapper, (type(self), 0x77c077b, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_SafeCallWrapper__set_state(self, __pyx_state)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.SafeCallWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":987
+ * cdef class ThreadTracer:
+ * cdef public tuple _args;
+ * def __init__(self, tuple args): # <<<<<<<<<<<<<<
+ * self._args = args
+ * # ELSE
+ */
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_args = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,0};
+ PyObject* values[1] = {0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 987, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ }
+ __pyx_v_args = ((PyObject*)values[0]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 987, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 987, __pyx_L1_error)
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer___init__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self), __pyx_v_args);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer___init__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_args) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":988
+ * cdef public tuple _args;
+ * def __init__(self, tuple args):
+ * self._args = args # <<<<<<<<<<<<<<
+ * # ELSE
+ * # class ThreadTracer:
+ */
+ __Pyx_INCREF(__pyx_v_args);
+ __Pyx_GIVEREF(__pyx_v_args);
+ __Pyx_GOTREF(__pyx_v_self->_args);
+ __Pyx_DECREF(__pyx_v_self->_args);
+ __pyx_v_self->_args = __pyx_v_args;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":987
+ * cdef class ThreadTracer:
+ * cdef public tuple _args;
+ * def __init__(self, tuple args): # <<<<<<<<<<<<<<
+ * self._args = args
+ * # ELSE
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":996
+ *
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * ''' This is the callback used when we enter some context in the debugger.
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__[] = " This is the callback used when we enter some context in the debugger.\n\n We also decorate the thread we are in with info about the debugging.\n The attributes added are:\n pydev_state\n pydev_step_stop\n pydev_step_cmd\n pydev_notify_kill\n\n :param PyDB py_db:\n This is the global debugger (this method should actually be added as a method to it).\n ";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__;
+#endif
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, 1); __PYX_ERR(0, 996, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, 2); __PYX_ERR(0, 996, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 996, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = values[1];
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 996, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self), __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_v_filename = 0;
+ int __pyx_v_pydev_step_cmd;
+ PyObject *__pyx_v_cache_key = 0;
+ PyObject *__pyx_v_cache_skips = 0;
+ int __pyx_v_is_stepping;
+ PyObject *__pyx_v_abs_path_real_path_and_base = 0;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_additional_info = 0;
+ PyObject *__pyx_v_py_db = NULL;
+ PyObject *__pyx_v_t = NULL;
+ PyObject *__pyx_v_frame_skips_cache = NULL;
+ PyObject *__pyx_v_file_type = NULL;
+ PyObject *__pyx_v_ret = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ int __pyx_t_11;
+ int __pyx_t_12;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
+ __Pyx_RefNannySetupContext("__call__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1020
+ * # ENDIF
+ * # print('ENTER: trace_dispatch', frame.f_code.co_filename, frame.f_lineno, event, frame.f_code.co_name)
+ * py_db, t, additional_info, cache_skips, frame_skips_cache = self._args # <<<<<<<<<<<<<<
+ * pydev_step_cmd = additional_info.pydev_step_cmd
+ * is_stepping = pydev_step_cmd != -1
+ */
+ __pyx_t_1 = __pyx_v_self->_args;
+ __Pyx_INCREF(__pyx_t_1);
+ if (likely(__pyx_t_1 != Py_None)) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 5)) {
+ if (size > 5) __Pyx_RaiseTooManyValuesError(5);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 1020, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ #else
+ {
+ Py_ssize_t i;
+ PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
+ for (i=0; i < 5; i++) {
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1020, __pyx_L1_error)
+ __Pyx_GOTREF(item);
+ *(temps[i]) = item;
+ }
+ }
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1020, __pyx_L1_error)
+ }
+ if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo))))) __PYX_ERR(0, 1020, __pyx_L1_error)
+ if (!(likely(PyDict_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 1020, __pyx_L1_error)
+ __pyx_v_py_db = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __pyx_v_t = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_v_additional_info = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_v_cache_skips = ((PyObject*)__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_v_frame_skips_cache = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1021
+ * # print('ENTER: trace_dispatch', frame.f_code.co_filename, frame.f_lineno, event, frame.f_code.co_name)
+ * py_db, t, additional_info, cache_skips, frame_skips_cache = self._args
+ * pydev_step_cmd = additional_info.pydev_step_cmd # <<<<<<<<<<<<<<
+ * is_stepping = pydev_step_cmd != -1
+ *
+ */
+ __pyx_t_7 = __pyx_v_additional_info->pydev_step_cmd;
+ __pyx_v_pydev_step_cmd = __pyx_t_7;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1022
+ * py_db, t, additional_info, cache_skips, frame_skips_cache = self._args
+ * pydev_step_cmd = additional_info.pydev_step_cmd
+ * is_stepping = pydev_step_cmd != -1 # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __pyx_v_is_stepping = (__pyx_v_pydev_step_cmd != -1L);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1024
+ * is_stepping = pydev_step_cmd != -1
+ *
+ * try: # <<<<<<<<<<<<<<
+ * if py_db._finish_debugging_session:
+ * if not py_db._termination_event_set:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1025
+ *
+ * try:
+ * if py_db._finish_debugging_session: # <<<<<<<<<<<<<<
+ * if not py_db._termination_event_set:
+ * #that was not working very well because jython gave some socket errors
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_finish_debugging_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1025, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1025, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_11) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1026
+ * try:
+ * if py_db._finish_debugging_session:
+ * if not py_db._termination_event_set: # <<<<<<<<<<<<<<
+ * #that was not working very well because jython gave some socket errors
+ * try:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_termination_event_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1026, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = ((!__pyx_t_11) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1028
+ * if not py_db._termination_event_set:
+ * #that was not working very well because jython gave some socket errors
+ * try: # <<<<<<<<<<<<<<
+ * if py_db.output_checker is None:
+ * kill_all_pydev_threads()
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1029
+ * #that was not working very well because jython gave some socket errors
+ * try:
+ * if py_db.output_checker is None: # <<<<<<<<<<<<<<
+ * kill_all_pydev_threads()
+ * except:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_output_checker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L11_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_12 = (__pyx_t_1 == Py_None);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = (__pyx_t_12 != 0);
+ if (__pyx_t_11) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1030
+ * try:
+ * if py_db.output_checker is None:
+ * kill_all_pydev_threads() # <<<<<<<<<<<<<<
+ * except:
+ * traceback.print_exc()
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_kill_all_pydev_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1030, __pyx_L11_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L11_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L11_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1029
+ * #that was not working very well because jython gave some socket errors
+ * try:
+ * if py_db.output_checker is None: # <<<<<<<<<<<<<<
+ * kill_all_pydev_threads()
+ * except:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1028
+ * if not py_db._termination_event_set:
+ * #that was not working very well because jython gave some socket errors
+ * try: # <<<<<<<<<<<<<<
+ * if py_db.output_checker is None:
+ * kill_all_pydev_threads()
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L16_try_end;
+ __pyx_L11_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1031
+ * if py_db.output_checker is None:
+ * kill_all_pydev_threads()
+ * except: # <<<<<<<<<<<<<<
+ * traceback.print_exc()
+ * py_db._termination_event_set = True
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1031, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_5);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1032
+ * kill_all_pydev_threads()
+ * except:
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * py_db._termination_event_set = True
+ * return None
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L13_except_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L13_except_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L13_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L12_exception_handled;
+ }
+ __pyx_L13_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1028
+ * if not py_db._termination_event_set:
+ * #that was not working very well because jython gave some socket errors
+ * try: # <<<<<<<<<<<<<<
+ * if py_db.output_checker is None:
+ * kill_all_pydev_threads()
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ goto __pyx_L3_error;
+ __pyx_L12_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ __pyx_L16_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1033
+ * except:
+ * traceback.print_exc()
+ * py_db._termination_event_set = True # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_py_db, __pyx_n_s_termination_event_set, Py_True) < 0) __PYX_ERR(0, 1033, __pyx_L3_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1026
+ * try:
+ * if py_db._finish_debugging_session:
+ * if not py_db._termination_event_set: # <<<<<<<<<<<<<<
+ * #that was not working very well because jython gave some socket errors
+ * try:
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1034
+ * traceback.print_exc()
+ * py_db._termination_event_set = True
+ * return None # <<<<<<<<<<<<<<
+ *
+ * # if thread is not alive, cancel trace_dispatch processing
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1025
+ *
+ * try:
+ * if py_db._finish_debugging_session: # <<<<<<<<<<<<<<
+ * if not py_db._termination_event_set:
+ * #that was not working very well because jython gave some socket errors
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1037
+ *
+ * # if thread is not alive, cancel trace_dispatch processing
+ * if not is_thread_alive(t): # <<<<<<<<<<<<<<
+ * py_db._process_thread_not_alive(get_thread_id(t))
+ * return None # suspend tracing
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_thread_alive); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_t};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_t};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_t);
+ __Pyx_GIVEREF(__pyx_v_t);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_t);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1037, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_12 = ((!__pyx_t_11) != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1038
+ * # if thread is not alive, cancel trace_dispatch processing
+ * if not is_thread_alive(t):
+ * py_db._process_thread_not_alive(get_thread_id(t)) # <<<<<<<<<<<<<<
+ * return None # suspend tracing
+ *
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_process_thread_not_alive); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_thread_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_t};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_t};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_INCREF(__pyx_v_t);
+ __Pyx_GIVEREF(__pyx_v_t);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_t);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1039
+ * if not is_thread_alive(t):
+ * py_db._process_thread_not_alive(get_thread_id(t))
+ * return None # suspend tracing # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1037
+ *
+ * # if thread is not alive, cancel trace_dispatch processing
+ * if not is_thread_alive(t): # <<<<<<<<<<<<<<
+ * py_db._process_thread_not_alive(get_thread_id(t))
+ * return None # suspend tracing
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1041
+ * return None # suspend tracing
+ *
+ * try: # <<<<<<<<<<<<<<
+ * # Make fast path faster!
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1043
+ * try:
+ * # Make fast path faster!
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename] # <<<<<<<<<<<<<<
+ * except:
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1043, __pyx_L21_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1043, __pyx_L21_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1043, __pyx_L21_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1043, __pyx_L21_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (!(likely(PyTuple_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 1043, __pyx_L21_error)
+ __pyx_v_abs_path_real_path_and_base = ((PyObject*)__pyx_t_6);
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1041
+ * return None # suspend tracing
+ *
+ * try: # <<<<<<<<<<<<<<
+ * # Make fast path faster!
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L26_try_end;
+ __pyx_L21_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1044
+ * # Make fast path faster!
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except: # <<<<<<<<<<<<<<
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 1044, __pyx_L23_except_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_5);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1045
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except:
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame) # <<<<<<<<<<<<<<
+ *
+ * if py_db.thread_analyser is not None:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_frame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_frame};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_frame};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_v_frame);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 1045, __pyx_L23_except_error)
+ __Pyx_XDECREF_SET(__pyx_v_abs_path_real_path_and_base, ((PyObject*)__pyx_t_4));
+ __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L22_exception_handled;
+ }
+ __pyx_L23_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1041
+ * return None # suspend tracing
+ *
+ * try: # <<<<<<<<<<<<<<
+ * # Make fast path faster!
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
+ goto __pyx_L3_error;
+ __pyx_L22_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
+ __pyx_L26_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1047
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ *
+ * if py_db.thread_analyser is not None: # <<<<<<<<<<<<<<
+ * py_db.thread_analyser.log_event(frame)
+ *
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_thread_analyser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = (__pyx_t_5 != Py_None);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_11 = (__pyx_t_12 != 0);
+ if (__pyx_t_11) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1048
+ *
+ * if py_db.thread_analyser is not None:
+ * py_db.thread_analyser.log_event(frame) # <<<<<<<<<<<<<<
+ *
+ * if py_db.asyncio_analyser is not None:
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_thread_analyser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log_event); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_frame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_frame);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1047
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ *
+ * if py_db.thread_analyser is not None: # <<<<<<<<<<<<<<
+ * py_db.thread_analyser.log_event(frame)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1050
+ * py_db.thread_analyser.log_event(frame)
+ *
+ * if py_db.asyncio_analyser is not None: # <<<<<<<<<<<<<<
+ * py_db.asyncio_analyser.log_event(frame)
+ *
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_asyncio_analyser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = (__pyx_t_5 != Py_None);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_12 = (__pyx_t_11 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1051
+ *
+ * if py_db.asyncio_analyser is not None:
+ * py_db.asyncio_analyser.log_event(frame) # <<<<<<<<<<<<<<
+ *
+ * filename = abs_path_real_path_and_base[1]
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_asyncio_analyser); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_log_event); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_frame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_frame};
+ __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else
+ #endif
+ {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_frame);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1050
+ * py_db.thread_analyser.log_event(frame)
+ *
+ * if py_db.asyncio_analyser is not None: # <<<<<<<<<<<<<<
+ * py_db.asyncio_analyser.log_event(frame)
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1053
+ * py_db.asyncio_analyser.log_event(frame)
+ *
+ * filename = abs_path_real_path_and_base[1] # <<<<<<<<<<<<<<
+ * # Note: it's important that the context name is also given because we may hit something once
+ * # in the global context and another in the local context.
+ */
+ if (unlikely(__pyx_v_abs_path_real_path_and_base == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 1053, __pyx_L3_error)
+ }
+ __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_abs_path_real_path_and_base, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1053, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 1053, __pyx_L3_error)
+ __pyx_v_filename = ((PyObject*)__pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1056
+ * # Note: it's important that the context name is also given because we may hit something once
+ * # in the global context and another in the local context.
+ * cache_key = (frame.f_lineno, frame.f_code.co_name, filename) # <<<<<<<<<<<<<<
+ * if not is_stepping and cache_key in cache_skips:
+ * # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_lineno); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1056, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_co_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_filename);
+ __pyx_t_5 = 0;
+ __pyx_t_3 = 0;
+ __pyx_v_cache_key = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1057
+ * # in the global context and another in the local context.
+ * cache_key = (frame.f_lineno, frame.f_code.co_name, filename)
+ * if not is_stepping and cache_key in cache_skips: # <<<<<<<<<<<<<<
+ * # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ * return None
+ */
+ __pyx_t_11 = ((!(__pyx_v_is_stepping != 0)) != 0);
+ if (__pyx_t_11) {
+ } else {
+ __pyx_t_12 = __pyx_t_11;
+ goto __pyx_L32_bool_binop_done;
+ }
+ if (unlikely(__pyx_v_cache_skips == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+ __PYX_ERR(0, 1057, __pyx_L3_error)
+ }
+ __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_cache_skips, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1057, __pyx_L3_error)
+ __pyx_t_17 = (__pyx_t_11 != 0);
+ __pyx_t_12 = __pyx_t_17;
+ __pyx_L32_bool_binop_done:;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1059
+ * if not is_stepping and cache_key in cache_skips:
+ * # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ * return None # <<<<<<<<<<<<<<
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1057
+ * # in the global context and another in the local context.
+ * cache_key = (frame.f_lineno, frame.f_code.co_name, filename)
+ * if not is_stepping and cache_key in cache_skips: # <<<<<<<<<<<<<<
+ * # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ * return None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1061
+ * return None
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd # <<<<<<<<<<<<<<
+ *
+ * if file_type is not None:
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_file_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (unlikely(__pyx_v_abs_path_real_path_and_base == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 1061, __pyx_L3_error)
+ }
+ __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_abs_path_real_path_and_base, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_file_type = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1063
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd
+ *
+ * if file_type is not None: # <<<<<<<<<<<<<<
+ * if file_type == 1: # inlining LIB_FILE = 1
+ * if py_db.not_in_scope(filename):
+ */
+ __pyx_t_12 = (__pyx_v_file_type != Py_None);
+ __pyx_t_17 = (__pyx_t_12 != 0);
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1064
+ *
+ * if file_type is not None:
+ * if file_type == 1: # inlining LIB_FILE = 1 # <<<<<<<<<<<<<<
+ * if py_db.not_in_scope(filename):
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ */
+ __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_file_type, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 1064, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1065
+ * if file_type is not None:
+ * if file_type == 1: # inlining LIB_FILE = 1
+ * if py_db.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_not_in_scope); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_filename);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 1065, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1067
+ * if py_db.not_in_scope(filename):
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1 # <<<<<<<<<<<<<<
+ * return None
+ * else:
+ */
+ if (unlikely(__pyx_v_cache_skips == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 1067, __pyx_L3_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_cache_skips, __pyx_v_cache_key, __pyx_int_1) < 0)) __PYX_ERR(0, 1067, __pyx_L3_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1068
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1
+ * return None # <<<<<<<<<<<<<<
+ * else:
+ * # print('skipped: trace_dispatch', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1065
+ * if file_type is not None:
+ * if file_type == 1: # inlining LIB_FILE = 1
+ * if py_db.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1064
+ *
+ * if file_type is not None:
+ * if file_type == 1: # inlining LIB_FILE = 1 # <<<<<<<<<<<<<<
+ * if py_db.not_in_scope(filename):
+ * # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ */
+ goto __pyx_L35;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1071
+ * else:
+ * # print('skipped: trace_dispatch', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1 # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ /*else*/ {
+ if (unlikely(__pyx_v_cache_skips == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 1071, __pyx_L3_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_cache_skips, __pyx_v_cache_key, __pyx_int_1) < 0)) __PYX_ERR(0, 1071, __pyx_L3_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1072
+ * # print('skipped: trace_dispatch', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * cache_skips[cache_key] = 1
+ * return None # <<<<<<<<<<<<<<
+ *
+ * if is_stepping:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+ }
+ __pyx_L35:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1063
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd
+ *
+ * if file_type is not None: # <<<<<<<<<<<<<<
+ * if file_type == 1: # inlining LIB_FILE = 1
+ * if py_db.not_in_scope(filename):
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1074
+ * return None
+ *
+ * if is_stepping: # <<<<<<<<<<<<<<
+ * if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ */
+ __pyx_t_17 = (__pyx_v_is_stepping != 0);
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1075
+ *
+ * if is_stepping:
+ * if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename): # <<<<<<<<<<<<<<
+ * # ignore files matching stepping filters
+ * return None
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_is_filter_enabled); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_17 = __pyx_t_12;
+ goto __pyx_L39_bool_binop_done;
+ }
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_is_ignored_by_filters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_filename);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1075, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_17 = __pyx_t_12;
+ __pyx_L39_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1077
+ * if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ * return None # <<<<<<<<<<<<<<
+ * if py_db.is_filter_libraries and py_db.not_in_scope(filename):
+ * # ignore library files while stepping
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1075
+ *
+ * if is_stepping:
+ * if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename): # <<<<<<<<<<<<<<
+ * # ignore files matching stepping filters
+ * return None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1078
+ * # ignore files matching stepping filters
+ * return None
+ * if py_db.is_filter_libraries and py_db.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # ignore library files while stepping
+ * return None
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_is_filter_libraries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_17 = __pyx_t_12;
+ goto __pyx_L42_bool_binop_done;
+ }
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_not_in_scope); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_filename);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1078, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_17 = __pyx_t_12;
+ __pyx_L42_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1080
+ * if py_db.is_filter_libraries and py_db.not_in_scope(filename):
+ * # ignore library files while stepping
+ * return None # <<<<<<<<<<<<<<
+ *
+ * # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1078
+ * # ignore files matching stepping filters
+ * return None
+ * if py_db.is_filter_libraries and py_db.not_in_scope(filename): # <<<<<<<<<<<<<<
+ * # ignore library files while stepping
+ * return None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1074
+ * return None
+ *
+ * if is_stepping: # <<<<<<<<<<<<<<
+ * if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename):
+ * # ignore files matching stepping filters
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1083
+ *
+ * # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * if additional_info.is_tracing: # <<<<<<<<<<<<<<
+ * return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+ *
+ */
+ __pyx_t_17 = (__pyx_v_additional_info->is_tracing != 0);
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1084
+ * # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * if additional_info.is_tracing:
+ * return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch # <<<<<<<<<<<<<<
+ *
+ * if event == 'call' and py_db.signature_factory:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1083
+ *
+ * # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ * if additional_info.is_tracing: # <<<<<<<<<<<<<<
+ * return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+ *
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1086
+ * return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+ *
+ * if event == 'call' and py_db.signature_factory: # <<<<<<<<<<<<<<
+ * # We can only have a call when entering a context, so, check at this level, not at the PyDBFrame.
+ * send_signature_call_trace(py_db, frame, filename)
+ */
+ __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_call, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1086, __pyx_L3_error)
+ if (__pyx_t_12) {
+ } else {
+ __pyx_t_17 = __pyx_t_12;
+ goto __pyx_L46_bool_binop_done;
+ }
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_signature_factory); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1086, __pyx_L3_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_17 = __pyx_t_12;
+ __pyx_L46_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1088
+ * if event == 'call' and py_db.signature_factory:
+ * # We can only have a call when entering a context, so, check at this level, not at the PyDBFrame.
+ * send_signature_call_trace(py_db, frame, filename) # <<<<<<<<<<<<<<
+ *
+ * # Just create PyDBFrame directly (removed support for Python versions < 2.5, which required keeping a weak
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_send_signature_call_trace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_py_db, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_py_db, __pyx_v_frame, __pyx_v_filename};
+ __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L3_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else
+ #endif
+ {
+ __pyx_t_1 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_5) {
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_py_db);
+ __Pyx_GIVEREF(__pyx_v_py_db);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_7, __pyx_v_py_db);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_7, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_7, __pyx_v_filename);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1086
+ * return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+ *
+ * if event == 'call' and py_db.signature_factory: # <<<<<<<<<<<<<<
+ * # We can only have a call when entering a context, so, check at this level, not at the PyDBFrame.
+ * send_signature_call_trace(py_db, frame, filename)
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1092
+ * # Just create PyDBFrame directly (removed support for Python versions < 2.5, which required keeping a weak
+ * # reference to the frame).
+ * ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg) # <<<<<<<<<<<<<<
+ * if ret is None:
+ * cache_skips[cache_key] = 1
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_co_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_co_firstlineno); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_filename);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_py_db);
+ __Pyx_GIVEREF(__pyx_v_py_db);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_py_db);
+ __Pyx_INCREF(__pyx_v_filename);
+ __Pyx_GIVEREF(__pyx_v_filename);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_filename);
+ __Pyx_INCREF(((PyObject *)__pyx_v_additional_info));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_additional_info));
+ PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_additional_info));
+ __Pyx_INCREF(__pyx_v_t);
+ __Pyx_GIVEREF(__pyx_v_t);
+ PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_t);
+ __Pyx_INCREF(__pyx_v_frame_skips_cache);
+ __Pyx_GIVEREF(__pyx_v_frame_skips_cache);
+ PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_frame_skips_cache);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_v_event))||((__pyx_v_event) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_event)->tp_name), 0))) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __pyx_t_4 = ((struct __pyx_vtabstruct_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_t_1)->__pyx_vtab)->trace_dispatch(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_t_1), __pyx_v_frame, ((PyObject*)__pyx_v_event), __pyx_v_arg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_ret = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1093
+ * # reference to the frame).
+ * ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg)
+ * if ret is None: # <<<<<<<<<<<<<<
+ * cache_skips[cache_key] = 1
+ * return None
+ */
+ __pyx_t_17 = (__pyx_v_ret == Py_None);
+ __pyx_t_12 = (__pyx_t_17 != 0);
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1094
+ * ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg)
+ * if ret is None:
+ * cache_skips[cache_key] = 1 # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ if (unlikely(__pyx_v_cache_skips == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(0, 1094, __pyx_L3_error)
+ }
+ if (unlikely(PyDict_SetItem(__pyx_v_cache_skips, __pyx_v_cache_key, __pyx_int_1) < 0)) __PYX_ERR(0, 1094, __pyx_L3_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1095
+ * if ret is None:
+ * cache_skips[cache_key] = 1
+ * return None # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1093
+ * # reference to the frame).
+ * ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg)
+ * if ret is None: # <<<<<<<<<<<<<<
+ * cache_skips[cache_key] = 1
+ * return None
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1098
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * return SafeCallWrapper(ret) # <<<<<<<<<<<<<<
+ * # ELSE
+ * # return ret
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1098, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_ret);
+ __Pyx_GIVEREF(__pyx_v_ret);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ret);
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L7_try_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1024
+ * is_stepping = pydev_step_cmd != -1
+ *
+ * try: # <<<<<<<<<<<<<<
+ * if py_db._finish_debugging_session:
+ * if not py_db._termination_event_set:
+ */
+ }
+ __pyx_L3_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1103
+ * # ENDIF
+ *
+ * except SystemExit: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_SystemExit);
+ if (__pyx_t_7) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(0, 1103, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_3);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1104
+ *
+ * except SystemExit:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * except Exception:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L6_except_return;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1106
+ * return None
+ *
+ * except Exception: # <<<<<<<<<<<<<<
+ * if py_db._finish_debugging_session:
+ * return None # Don't log errors when we're shutting down.
+ */
+ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
+ if (__pyx_t_7) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) __PYX_ERR(0, 1106, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1107
+ *
+ * except Exception:
+ * if py_db._finish_debugging_session: # <<<<<<<<<<<<<<
+ * return None # Don't log errors when we're shutting down.
+ * # Log it
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_db, __pyx_n_s_finish_debugging_session); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1107, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1107, __pyx_L5_except_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_12) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1108
+ * except Exception:
+ * if py_db._finish_debugging_session:
+ * return None # Don't log errors when we're shutting down. # <<<<<<<<<<<<<<
+ * # Log it
+ * try:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L6_except_return;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1107
+ *
+ * except Exception:
+ * if py_db._finish_debugging_session: # <<<<<<<<<<<<<<
+ * return None # Don't log errors when we're shutting down.
+ * # Log it
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1110
+ * return None # Don't log errors when we're shutting down.
+ * # Log it
+ * try: # <<<<<<<<<<<<<<
+ * if traceback is not None:
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1111
+ * # Log it
+ * try:
+ * if traceback is not None: # <<<<<<<<<<<<<<
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ * traceback.print_exc()
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L54_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = (__pyx_t_5 != Py_None);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_17 = (__pyx_t_12 != 0);
+ if (__pyx_t_17) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1113
+ * if traceback is not None:
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ * traceback.print_exc() # <<<<<<<<<<<<<<
+ * except:
+ * # Error logging? We're really in the interpreter shutdown...
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1113, __pyx_L54_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1113, __pyx_L54_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L54_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L54_error)
+ }
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1111
+ * # Log it
+ * try:
+ * if traceback is not None: # <<<<<<<<<<<<<<
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ * traceback.print_exc()
+ */
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1110
+ * return None # Don't log errors when we're shutting down.
+ * # Log it
+ * try: # <<<<<<<<<<<<<<
+ * if traceback is not None:
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L61_try_end;
+ __pyx_L54_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1114
+ * # This can actually happen during the interpreter shutdown in Python 2.7
+ * traceback.print_exc()
+ * except: # <<<<<<<<<<<<<<
+ * # Error logging? We're really in the interpreter shutdown...
+ * # (https://github.com/fabioz/PyDev.Debugger/issues/8)
+ */
+ /*except:*/ {
+ __Pyx_ErrRestore(0,0,0);
+ goto __pyx_L55_exception_handled;
+ }
+ __pyx_L55_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ __pyx_L61_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1118
+ * # (https://github.com/fabioz/PyDev.Debugger/issues/8)
+ * pass
+ * return None # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L6_except_return;
+ }
+ goto __pyx_L5_except_error;
+ __pyx_L5_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1024
+ * is_stepping = pydev_step_cmd != -1
+ *
+ * try: # <<<<<<<<<<<<<<
+ * if py_db._finish_debugging_session:
+ * if not py_db._termination_event_set:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L1_error;
+ __pyx_L7_try_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L0;
+ __pyx_L6_except_return:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L0;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":996
+ *
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * ''' This is the callback used when we enter some context in the debugger.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_filename);
+ __Pyx_XDECREF(__pyx_v_cache_key);
+ __Pyx_XDECREF(__pyx_v_cache_skips);
+ __Pyx_XDECREF(__pyx_v_abs_path_real_path_and_base);
+ __Pyx_XDECREF((PyObject *)__pyx_v_additional_info);
+ __Pyx_XDECREF(__pyx_v_py_db);
+ __Pyx_XDECREF(__pyx_v_t);
+ __Pyx_XDECREF(__pyx_v_frame_skips_cache);
+ __Pyx_XDECREF(__pyx_v_file_type);
+ __Pyx_XDECREF(__pyx_v_ret);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":986
+ * return SafeCallWrapper(ret) if ret is not None else None
+ * cdef class ThreadTracer:
+ * cdef public tuple _args; # <<<<<<<<<<<<<<
+ * def __init__(self, tuple args):
+ * self._args = args
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args___get__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args___get__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __pyx_r = __pyx_v_self->_args;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_2__set__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_2__set__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 986, __pyx_L1_error)
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_self->_args);
+ __Pyx_DECREF(__pyx_v_self->_args);
+ __pyx_v_self->_args = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer._args.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_4__del__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_4__del__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->_args);
+ __Pyx_DECREF(__pyx_v_self->_args);
+ __pyx_v_self->_args = ((PyObject*)Py_None);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self._args,)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_4__reduce_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_4__reduce_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self) {
+ int __pyx_v_use_setstate;
+ PyObject *__pyx_v_state = NULL;
+ PyObject *__pyx_v__dict = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 0);
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * cdef bint use_setstate
+ * state = (self._args,) # <<<<<<<<<<<<<<
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_self->_args);
+ __Pyx_GIVEREF(__pyx_v_self->_args);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_args);
+ __pyx_v_state = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":4
+ * cdef bint use_setstate
+ * state = (self._args,)
+ * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
+ * if _dict is not None:
+ * state += _dict,
+ */
+ __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v__dict = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":5
+ * state = (self._args,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ __pyx_t_2 = (__pyx_v__dict != Py_None);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":6
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ * state += _dict, # <<<<<<<<<<<<<<
+ * use_setstate = True
+ * else:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v__dict);
+ __Pyx_GIVEREF(__pyx_v__dict);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
+ __pyx_t_4 = 0;
+
+ /* "(tree fragment)":7
+ * if _dict is not None:
+ * state += _dict,
+ * use_setstate = True # <<<<<<<<<<<<<<
+ * else:
+ * use_setstate = self._args is not None
+ */
+ __pyx_v_use_setstate = 1;
+
+ /* "(tree fragment)":5
+ * state = (self._args,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += _dict,
+ * use_setstate = True
+ */
+ goto __pyx_L3;
+ }
+
+ /* "(tree fragment)":9
+ * use_setstate = True
+ * else:
+ * use_setstate = self._args is not None # <<<<<<<<<<<<<<
+ * if use_setstate:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, None), state
+ */
+ /*else*/ {
+ __pyx_t_3 = (__pyx_v_self->_args != ((PyObject*)Py_None));
+ __pyx_v_use_setstate = __pyx_t_3;
+ }
+ __pyx_L3:;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self._args is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, None), state
+ * else:
+ */
+ __pyx_t_3 = (__pyx_v_use_setstate != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":11
+ * use_setstate = self._args is not None
+ * if use_setstate:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, None), state # <<<<<<<<<<<<<<
+ * else:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, state)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_ThreadTracer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_64458794);
+ __Pyx_GIVEREF(__pyx_int_64458794);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_64458794);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":10
+ * else:
+ * use_setstate = self._args is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, None), state
+ * else:
+ */
+ }
+
+ /* "(tree fragment)":13
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, None), state
+ * else:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, state) # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_ThreadTracer__set_state(self, __pyx_state)
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_ThreadTracer); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_INCREF(__pyx_int_64458794);
+ __Pyx_GIVEREF(__pyx_int_64458794);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_64458794);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef bint use_setstate
+ * state = (self._args,)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_state);
+ __Pyx_XDECREF(__pyx_v__dict);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_ThreadTracer__set_state(self, __pyx_state)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_6__setstate_cython__(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_6__setstate_cython__(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 0);
+
+ /* "(tree fragment)":15
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, state)
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_ThreadTracer__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
+ __pyx_t_1 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_ThreadTracer__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":14
+ * else:
+ * return __pyx_unpickle_ThreadTracer, (type(self), 0x3d7902a, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_ThreadTracer__set_state(self, __pyx_state)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.ThreadTracer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_bundle/pydevd_cython.pyx":1133
+ * _original_call = ThreadTracer.__call__
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * _tid_to_last_frame[self._args[1].ident] = frame
+ * return _original_call(self, frame, event, arg)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_15__call__ = {"__call__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_15__call__, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_15__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_self = 0;
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[4] = {0,0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ CYTHON_FALLTHROUGH;
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 4, 4, 1); __PYX_ERR(0, 1133, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 4, 4, 2); __PYX_ERR(0, 1133, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 3:
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 4, 4, 3); __PYX_ERR(0, 1133, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 1133, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ }
+ __pyx_v_self = values[0];
+ __pyx_v_frame = values[1];
+ __pyx_v_event = values[2];
+ __pyx_v_arg = values[3];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1133, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_14__call__(__pyx_self, __pyx_v_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_14__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ __Pyx_RefNannySetupContext("__call__", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1134
+ *
+ * def __call__(self, frame, event, arg):
+ * _tid_to_last_frame[self._args[1].ident] = frame # <<<<<<<<<<<<<<
+ * return _original_call(self, frame, event, arg)
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_tid_to_last_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_args_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ident); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_v_frame) < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1135
+ * def __call__(self, frame, event, arg):
+ * _tid_to_last_frame[self._args[1].ident] = frame
+ * return _original_call(self, frame, event, arg) # <<<<<<<<<<<<<<
+ *
+ * ThreadTracer.__call__ = __call__
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_original_call); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = NULL;
+ __pyx_t_4 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_4 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg};
+ __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_3) {
+ __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_self);
+ __Pyx_GIVEREF(__pyx_v_self);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_frame);
+ __Pyx_INCREF(__pyx_v_event);
+ __Pyx_GIVEREF(__pyx_v_event);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_event);
+ __Pyx_INCREF(__pyx_v_arg);
+ __Pyx_GIVEREF(__pyx_v_arg);
+ PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_arg);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1133
+ * _original_call = ThreadTracer.__call__
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * _tid_to_last_frame[self._args[1].ident] = frame
+ * return _original_call(self, frame, event, arg)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_17__pyx_unpickle_PyDBAdditionalThreadInfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_17__pyx_unpickle_PyDBAdditionalThreadInfo = {"__pyx_unpickle_PyDBAdditionalThreadInfo", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_17__pyx_unpickle_PyDBAdditionalThreadInfo, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_17__pyx_unpickle_PyDBAdditionalThreadInfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v___pyx_type = 0;
+ long __pyx_v___pyx_checksum;
+ PyObject *__pyx_v___pyx_state = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBAdditionalThreadInfo (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBAdditionalThreadInfo", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBAdditionalThreadInfo", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_PyDBAdditionalThreadInfo") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v___pyx_type = values[0];
+ __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_v___pyx_state = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBAdditionalThreadInfo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBAdditionalThreadInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_16__pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_16__pyx_unpickle_PyDBAdditionalThreadInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_v_PickleError = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBAdditionalThreadInfo", 0);
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xa9a4341: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ */
+ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xa9a4341) != 0);
+ if (__pyx_t_1) {
+
+ /* "(tree fragment)":3
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError # <<<<<<<<<<<<<<
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type)
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_PickleError);
+ __Pyx_GIVEREF(__pyx_n_s_PickleError);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_PickleError = __pyx_t_2;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":4
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum) # <<<<<<<<<<<<<<
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xa9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_v_PickleError);
+ __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(1, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xa9a4341: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ */
+ }
+
+ /* "(tree fragment)":5
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type) # <<<<<<<<<<<<<<
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v___pyx_type);
+ __Pyx_GIVEREF(__pyx_v___pyx_type);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_result = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result
+ */
+ __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
+ __pyx_t_7 = (__pyx_t_1 != 0);
+ if (__pyx_t_7) {
+
+ /* "(tree fragment)":7
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state) # <<<<<<<<<<<<<<
+ * return result
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state):
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
+ __pyx_t_3 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBAdditionalThreadInfo__set_state(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0xa9a4341 = (conditional_breakpoint_exception, is_tracing, pydev_call_from_jinja2, pydev_call_inside_jinja2, pydev_django_resolve_frame, pydev_func_name, pydev_message, pydev_next_line, pydev_notify_kill, pydev_smart_step_stop, pydev_state, pydev_step_cmd, pydev_step_stop, suspend_type))" % __pyx_checksum)
+ * result = PyDBAdditionalThreadInfo.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result
+ */
+ }
+
+ /* "(tree fragment)":8
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result # <<<<<<<<<<<<<<
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state):
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBAdditionalThreadInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_PickleError);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":9
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'):
+ */
+
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBAdditionalThreadInfo__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *__pyx_v_result, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBAdditionalThreadInfo__set_state", 0);
+
+ /* "(tree fragment)":10
+ * return result
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state):
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13] # <<<<<<<<<<<<<<
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[14])
+ */
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->conditional_breakpoint_exception);
+ __Pyx_DECREF(__pyx_v_result->conditional_breakpoint_exception);
+ __pyx_v_result->conditional_breakpoint_exception = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->is_tracing = __pyx_t_2;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_call_from_jinja2);
+ __Pyx_DECREF(__pyx_v_result->pydev_call_from_jinja2);
+ __pyx_v_result->pydev_call_from_jinja2 = __pyx_t_1;
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_call_inside_jinja2);
+ __Pyx_DECREF(__pyx_v_result->pydev_call_inside_jinja2);
+ __pyx_v_result->pydev_call_inside_jinja2 = __pyx_t_1;
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->pydev_django_resolve_frame = __pyx_t_2;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_func_name);
+ __Pyx_DECREF(__pyx_v_result->pydev_func_name);
+ __pyx_v_result->pydev_func_name = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_message);
+ __Pyx_DECREF(__pyx_v_result->pydev_message);
+ __pyx_v_result->pydev_message = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->pydev_next_line = __pyx_t_3;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->pydev_notify_kill = __pyx_t_2;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_smart_step_stop);
+ __Pyx_DECREF(__pyx_v_result->pydev_smart_step_stop);
+ __pyx_v_result->pydev_smart_step_stop = __pyx_t_1;
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->pydev_state = __pyx_t_3;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->pydev_step_cmd = __pyx_t_3;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->pydev_step_stop);
+ __Pyx_DECREF(__pyx_v_result->pydev_step_stop);
+ __pyx_v_result->pydev_step_stop = __pyx_t_1;
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->suspend_type = __pyx_t_3;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state):
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[14])
+ */
+ __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __pyx_t_4 = (__pyx_t_2 != 0);
+ if (__pyx_t_4) {
+
+ /* "(tree fragment)":12
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[14]) # <<<<<<<<<<<<<<
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 12, __pyx_L1_error)
+ }
+ __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state):
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[14])
+ */
+ }
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'):
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBAdditionalThreadInfo__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBFrame(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xfa6b183:
+ * from pickle import PickleError
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_19__pyx_unpickle_PyDBFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_19__pyx_unpickle_PyDBFrame = {"__pyx_unpickle_PyDBFrame", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_19__pyx_unpickle_PyDBFrame, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_19__pyx_unpickle_PyDBFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v___pyx_type = 0;
+ long __pyx_v___pyx_checksum;
+ PyObject *__pyx_v___pyx_state = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBFrame (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBFrame", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBFrame", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_PyDBFrame") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v___pyx_type = values[0];
+ __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_v___pyx_state = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PyDBFrame", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBFrame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_18__pyx_unpickle_PyDBFrame(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_18__pyx_unpickle_PyDBFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_v_PickleError = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBFrame", 0);
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_PyDBFrame(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xfa6b183: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ */
+ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xfa6b183) != 0);
+ if (__pyx_t_1) {
+
+ /* "(tree fragment)":3
+ * def __pyx_unpickle_PyDBFrame(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xfa6b183:
+ * from pickle import PickleError # <<<<<<<<<<<<<<
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ * result = PyDBFrame.__new__(__pyx_type)
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_PickleError);
+ __Pyx_GIVEREF(__pyx_n_s_PickleError);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_PickleError = __pyx_t_2;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":4
+ * if __pyx_checksum != 0xfa6b183:
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum) # <<<<<<<<<<<<<<
+ * result = PyDBFrame.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xfa, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_v_PickleError);
+ __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(1, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_PyDBFrame(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0xfa6b183: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ */
+ }
+
+ /* "(tree fragment)":5
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ * result = PyDBFrame.__new__(__pyx_type) # <<<<<<<<<<<<<<
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v___pyx_type);
+ __Pyx_GIVEREF(__pyx_v___pyx_type);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_result = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ * result = PyDBFrame.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ * return result
+ */
+ __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
+ __pyx_t_7 = (__pyx_t_1 != 0);
+ if (__pyx_t_7) {
+
+ /* "(tree fragment)":7
+ * result = PyDBFrame.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state) # <<<<<<<<<<<<<<
+ * return result
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state):
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
+ __pyx_t_3 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBFrame__set_state(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0xfa6b183 = (_args, should_skip))" % __pyx_checksum)
+ * result = PyDBFrame.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ * return result
+ */
+ }
+
+ /* "(tree fragment)":8
+ * if __pyx_state is not None:
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ * return result # <<<<<<<<<<<<<<
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state):
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBFrame(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xfa6b183:
+ * from pickle import PickleError
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBFrame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_PickleError);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":9
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ * if hasattr(result, '__dict__'):
+ */
+
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_PyDBFrame__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *__pyx_v_result, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_PyDBFrame__set_state", 0);
+
+ /* "(tree fragment)":10
+ * return result
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state):
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1] # <<<<<<<<<<<<<<
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[2])
+ */
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->_args);
+ __Pyx_DECREF(__pyx_v_result->_args);
+ __pyx_v_result->_args = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_result->should_skip = __pyx_t_2;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state):
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[2])
+ */
+ __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "(tree fragment)":12
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<<
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 12, __pyx_L1_error)
+ }
+ __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state):
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[2])
+ */
+ }
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_PyDBFrame__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_PyDBFrame__set_state(PyDBFrame result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result._args = __pyx_state[0]; result.should_skip = __pyx_state[1]
+ * if hasattr(result, '__dict__'):
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_PyDBFrame__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0x77c077b:
+ * from pickle import PickleError
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_21__pyx_unpickle_SafeCallWrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_21__pyx_unpickle_SafeCallWrapper = {"__pyx_unpickle_SafeCallWrapper", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_21__pyx_unpickle_SafeCallWrapper, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_21__pyx_unpickle_SafeCallWrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v___pyx_type = 0;
+ long __pyx_v___pyx_checksum;
+ PyObject *__pyx_v___pyx_state = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__pyx_unpickle_SafeCallWrapper (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SafeCallWrapper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SafeCallWrapper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SafeCallWrapper") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v___pyx_type = values[0];
+ __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_v___pyx_state = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SafeCallWrapper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_SafeCallWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_20__pyx_unpickle_SafeCallWrapper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_20__pyx_unpickle_SafeCallWrapper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_v_PickleError = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_SafeCallWrapper", 0);
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x77c077b: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ */
+ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x77c077b) != 0);
+ if (__pyx_t_1) {
+
+ /* "(tree fragment)":3
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x77c077b:
+ * from pickle import PickleError # <<<<<<<<<<<<<<
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ * result = SafeCallWrapper.__new__(__pyx_type)
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_PickleError);
+ __Pyx_GIVEREF(__pyx_n_s_PickleError);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_PickleError = __pyx_t_2;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":4
+ * if __pyx_checksum != 0x77c077b:
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum) # <<<<<<<<<<<<<<
+ * result = SafeCallWrapper.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x77, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_v_PickleError);
+ __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(1, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x77c077b: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ */
+ }
+
+ /* "(tree fragment)":5
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ * result = SafeCallWrapper.__new__(__pyx_type) # <<<<<<<<<<<<<<
+ * if __pyx_state is not None:
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v___pyx_type);
+ __Pyx_GIVEREF(__pyx_v___pyx_type);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_result = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ * result = SafeCallWrapper.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result
+ */
+ __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
+ __pyx_t_7 = (__pyx_t_1 != 0);
+ if (__pyx_t_7) {
+
+ /* "(tree fragment)":7
+ * result = SafeCallWrapper.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state) # <<<<<<<<<<<<<<
+ * return result
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state):
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
+ __pyx_t_3 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_SafeCallWrapper__set_state(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0x77c077b = (method_object))" % __pyx_checksum)
+ * result = SafeCallWrapper.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result
+ */
+ }
+
+ /* "(tree fragment)":8
+ * if __pyx_state is not None:
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result # <<<<<<<<<<<<<<
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state):
+ * result.method_object = __pyx_state[0]
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0x77c077b:
+ * from pickle import PickleError
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_SafeCallWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_PickleError);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":9
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ */
+
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_SafeCallWrapper__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *__pyx_v_result, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_SafeCallWrapper__set_state", 0);
+
+ /* "(tree fragment)":10
+ * return result
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state):
+ * result.method_object = __pyx_state[0] # <<<<<<<<<<<<<<
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[1])
+ */
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->method_object);
+ __Pyx_DECREF(__pyx_v_result->method_object);
+ __pyx_v_result->method_object = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state):
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[1])
+ */
+ __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":12
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_update); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 12, __pyx_L1_error)
+ }
+ __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state):
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[1])
+ */
+ }
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_SafeCallWrapper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __pyx_unpickle_ThreadTracer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0x3d7902a:
+ * from pickle import PickleError
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_23__pyx_unpickle_ThreadTracer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_14_pydevd_bundle_13pydevd_cython_23__pyx_unpickle_ThreadTracer = {"__pyx_unpickle_ThreadTracer", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_23__pyx_unpickle_ThreadTracer, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_14_pydevd_bundle_13pydevd_cython_23__pyx_unpickle_ThreadTracer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v___pyx_type = 0;
+ long __pyx_v___pyx_checksum;
+ PyObject *__pyx_v___pyx_state = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__pyx_unpickle_ThreadTracer (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ThreadTracer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ThreadTracer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ThreadTracer") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v___pyx_type = values[0];
+ __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_v___pyx_state = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ThreadTracer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_ThreadTracer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_14_pydevd_bundle_13pydevd_cython_22__pyx_unpickle_ThreadTracer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_14_pydevd_bundle_13pydevd_cython_22__pyx_unpickle_ThreadTracer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_v_PickleError = NULL;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_ThreadTracer", 0);
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_ThreadTracer(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x3d7902a: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ */
+ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x3d7902a) != 0);
+ if (__pyx_t_1) {
+
+ /* "(tree fragment)":3
+ * def __pyx_unpickle_ThreadTracer(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x3d7902a:
+ * from pickle import PickleError # <<<<<<<<<<<<<<
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ * result = ThreadTracer.__new__(__pyx_type)
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_PickleError);
+ __Pyx_GIVEREF(__pyx_n_s_PickleError);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_PickleError = __pyx_t_2;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":4
+ * if __pyx_checksum != 0x3d7902a:
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum) # <<<<<<<<<<<<<<
+ * result = ThreadTracer.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x3d, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_v_PickleError);
+ __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(1, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":2
+ * def __pyx_unpickle_ThreadTracer(__pyx_type, long __pyx_checksum, __pyx_state):
+ * if __pyx_checksum != 0x3d7902a: # <<<<<<<<<<<<<<
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ */
+ }
+
+ /* "(tree fragment)":5
+ * from pickle import PickleError
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ * result = ThreadTracer.__new__(__pyx_type) # <<<<<<<<<<<<<<
+ * if __pyx_state is not None:
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
+ __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else
+ #endif
+ {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v___pyx_type);
+ __Pyx_GIVEREF(__pyx_v___pyx_type);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_result = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ * result = ThreadTracer.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ * return result
+ */
+ __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
+ __pyx_t_7 = (__pyx_t_1 != 0);
+ if (__pyx_t_7) {
+
+ /* "(tree fragment)":7
+ * result = ThreadTracer.__new__(__pyx_type)
+ * if __pyx_state is not None:
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state) # <<<<<<<<<<<<<<
+ * return result
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state):
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
+ __pyx_t_3 = __pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_ThreadTracer__set_state(((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "(tree fragment)":6
+ * raise PickleError("Incompatible checksums (%s vs 0x3d7902a = (_args))" % __pyx_checksum)
+ * result = ThreadTracer.__new__(__pyx_type)
+ * if __pyx_state is not None: # <<<<<<<<<<<<<<
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ * return result
+ */
+ }
+
+ /* "(tree fragment)":8
+ * if __pyx_state is not None:
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ * return result # <<<<<<<<<<<<<<
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state):
+ * result._args = __pyx_state[0]
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_ThreadTracer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0x3d7902a:
+ * from pickle import PickleError
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_ThreadTracer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_PickleError);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":9
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result._args = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ */
+
+static PyObject *__pyx_f_14_pydevd_bundle_13pydevd_cython___pyx_unpickle_ThreadTracer__set_state(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *__pyx_v_result, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ __Pyx_RefNannySetupContext("__pyx_unpickle_ThreadTracer__set_state", 0);
+
+ /* "(tree fragment)":10
+ * return result
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state):
+ * result._args = __pyx_state[0] # <<<<<<<<<<<<<<
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[1])
+ */
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 10, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_result->_args);
+ __Pyx_DECREF(__pyx_v_result->_args);
+ __pyx_v_result->_args = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state):
+ * result._args = __pyx_state[0]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[1])
+ */
+ __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 11, __pyx_L1_error)
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "(tree fragment)":12
+ * result._args = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ * result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_update); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(__pyx_v___pyx_state == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ __PYX_ERR(1, 12, __pyx_L1_error)
+ }
+ __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":11
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state):
+ * result._args = __pyx_state[0]
+ * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<<
+ * result.__dict__.update(__pyx_state[1])
+ */
+ }
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_ThreadTracer__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_ThreadTracer__set_state(ThreadTracer result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result._args = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython.__pyx_unpickle_ThreadTracer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)o);
+ p->pydev_step_stop = Py_None; Py_INCREF(Py_None);
+ p->pydev_smart_step_stop = Py_None; Py_INCREF(Py_None);
+ p->pydev_call_from_jinja2 = Py_None; Py_INCREF(Py_None);
+ p->pydev_call_inside_jinja2 = Py_None; Py_INCREF(Py_None);
+ p->conditional_breakpoint_exception = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ p->pydev_message = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ p->pydev_func_name = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo(PyObject *o) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->pydev_step_stop);
+ Py_CLEAR(p->pydev_smart_step_stop);
+ Py_CLEAR(p->pydev_call_from_jinja2);
+ Py_CLEAR(p->pydev_call_inside_jinja2);
+ Py_CLEAR(p->conditional_breakpoint_exception);
+ Py_CLEAR(p->pydev_message);
+ Py_CLEAR(p->pydev_func_name);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)o;
+ if (p->pydev_step_stop) {
+ e = (*v)(p->pydev_step_stop, a); if (e) return e;
+ }
+ if (p->pydev_smart_step_stop) {
+ e = (*v)(p->pydev_smart_step_stop, a); if (e) return e;
+ }
+ if (p->pydev_call_from_jinja2) {
+ e = (*v)(p->pydev_call_from_jinja2, a); if (e) return e;
+ }
+ if (p->pydev_call_inside_jinja2) {
+ e = (*v)(p->pydev_call_inside_jinja2, a); if (e) return e;
+ }
+ if (p->conditional_breakpoint_exception) {
+ e = (*v)(p->conditional_breakpoint_exception, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo *)o;
+ tmp = ((PyObject*)p->pydev_step_stop);
+ p->pydev_step_stop = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->pydev_smart_step_stop);
+ p->pydev_smart_step_stop = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->pydev_call_from_jinja2);
+ p->pydev_call_from_jinja2 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->pydev_call_inside_jinja2);
+ p->pydev_call_inside_jinja2 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->conditional_breakpoint_exception);
+ p->conditional_breakpoint_exception = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_state(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_state(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_11pydev_state_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_stop(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_stop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_step_stop_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_cmd(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_cmd(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_14pydev_step_cmd_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_notify_kill(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_notify_kill(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_17pydev_notify_kill_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_smart_step_stop(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_smart_step_stop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_21pydev_smart_step_stop_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_django_resolve_frame(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_django_resolve_frame(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_26pydev_django_resolve_frame_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_from_jinja2(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_from_jinja2(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_22pydev_call_from_jinja2_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_inside_jinja2(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_inside_jinja2(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_24pydev_call_inside_jinja2_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_is_tracing(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_is_tracing(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_10is_tracing_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_conditional_breakpoint_exception(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_conditional_breakpoint_exception(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_32conditional_breakpoint_exception_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_message(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_message(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_13pydev_message_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_suspend_type(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_suspend_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_12suspend_type_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_next_line(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_next_line(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_next_line_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_func_name(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_func_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_15pydev_func_name_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo[] = {
+ {"iter_frames", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_3iter_frames, METH_O, 0},
+ {"__reduce_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_7__reduce_cython__, METH_NOARGS, 0},
+ {"__setstate_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_9__setstate_cython__, METH_O, 0},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo[] = {
+ {(char *)"pydev_state", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_state, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_state, (char *)0, 0},
+ {(char *)"pydev_step_stop", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_stop, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_stop, (char *)0, 0},
+ {(char *)"pydev_step_cmd", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_cmd, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_step_cmd, (char *)0, 0},
+ {(char *)"pydev_notify_kill", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_notify_kill, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_notify_kill, (char *)0, 0},
+ {(char *)"pydev_smart_step_stop", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_smart_step_stop, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_smart_step_stop, (char *)0, 0},
+ {(char *)"pydev_django_resolve_frame", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_django_resolve_frame, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_django_resolve_frame, (char *)0, 0},
+ {(char *)"pydev_call_from_jinja2", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_from_jinja2, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_from_jinja2, (char *)0, 0},
+ {(char *)"pydev_call_inside_jinja2", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_inside_jinja2, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_call_inside_jinja2, (char *)0, 0},
+ {(char *)"is_tracing", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_is_tracing, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_is_tracing, (char *)0, 0},
+ {(char *)"conditional_breakpoint_exception", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_conditional_breakpoint_exception, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_conditional_breakpoint_exception, (char *)0, 0},
+ {(char *)"pydev_message", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_message, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_message, (char *)0, 0},
+ {(char *)"suspend_type", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_suspend_type, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_suspend_type, (char *)0, 0},
+ {(char *)"pydev_next_line", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_next_line, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_next_line, (char *)0, 0},
+ {(char *)"pydev_func_name", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_func_name, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_pydev_func_name, (char *)0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "_pydevd_bundle.pydevd_cython.PyDBAdditionalThreadInfo", /*tp_name*/
+ sizeof(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #endif
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*tp_as_async*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_5__str__, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_traverse*/
+ __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_24PyDBAdditionalThreadInfo_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+static struct __pyx_vtabstruct_14_pydevd_bundle_13pydevd_cython_PyDBFrame __pyx_vtable_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBFrame(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)o);
+ p->__pyx_vtab = __pyx_vtabptr_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+ p->_args = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_PyDBFrame(PyObject *o) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->_args);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_PyDBFrame(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)o;
+ if (p->_args) {
+ e = (*v)(p->_args, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_PyDBFrame(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *)o;
+ tmp = ((PyObject*)p->_args);
+ p->_args = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_14_pydevd_bundle_13pydevd_cython_PyDBFrame[] = {
+ {"set_suspend", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_3set_suspend, METH_VARARGS|METH_KEYWORDS, 0},
+ {"do_wait_suspend", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_5do_wait_suspend, METH_VARARGS|METH_KEYWORDS, 0},
+ {"trace_exception", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_7trace_exception, METH_VARARGS|METH_KEYWORDS, 0},
+ {"trace_return", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_9trace_return, METH_VARARGS|METH_KEYWORDS, 0},
+ {"should_stop_on_exception", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_11should_stop_on_exception, METH_VARARGS|METH_KEYWORDS, 0},
+ {"handle_exception", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_13handle_exception, METH_VARARGS|METH_KEYWORDS, 0},
+ {"get_func_name", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_15get_func_name, METH_O, 0},
+ {"show_return_values", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_17show_return_values, METH_VARARGS|METH_KEYWORDS, 0},
+ {"remove_return_values", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_19remove_return_values, METH_VARARGS|METH_KEYWORDS, 0},
+ {"trace_dispatch", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_21trace_dispatch, METH_VARARGS|METH_KEYWORDS, 0},
+ {"__reduce_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_23__reduce_cython__, METH_NOARGS, 0},
+ {"__setstate_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_25__setstate_cython__, METH_O, 0},
+ {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "_pydevd_bundle.pydevd_cython.PyDBFrame", /*tp_name*/
+ sizeof(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_PyDBFrame, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #endif
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*tp_as_async*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_PyDBFrame, /*tp_traverse*/
+ __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_PyDBFrame, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_14_pydevd_bundle_13pydevd_cython_PyDBFrame, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_14_pydevd_bundle_13pydevd_cython_PyDBFrame, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)o);
+ p->method_object = Py_None; Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper(PyObject *o) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->method_object);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)o;
+ if (p->method_object) {
+ e = (*v)(p->method_object, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper *)o;
+ tmp = ((PyObject*)p->method_object);
+ p->method_object = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper[] = {
+ {"__reduce_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_5__reduce_cython__, METH_NOARGS, 0},
+ {"__setstate_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_7__setstate_cython__, METH_O, 0},
+ {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "_pydevd_bundle.pydevd_cython.SafeCallWrapper", /*tp_name*/
+ sizeof(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #endif
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*tp_as_async*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_3__call__, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper, /*tp_traverse*/
+ __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_15SafeCallWrapper_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_14_pydevd_bundle_13pydevd_cython_ThreadTracer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)o);
+ p->_args = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_ThreadTracer(PyObject *o) {
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->_args);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_ThreadTracer(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)o;
+ if (p->_args) {
+ e = (*v)(p->_args, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_ThreadTracer(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *p = (struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer *)o;
+ tmp = ((PyObject*)p->_args);
+ p->_args = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyObject *__pyx_getprop_14_pydevd_bundle_13pydevd_cython_12ThreadTracer__args(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_1__get__(o);
+}
+
+static int __pyx_setprop_14_pydevd_bundle_13pydevd_cython_12ThreadTracer__args(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5_args_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_14_pydevd_bundle_13pydevd_cython_ThreadTracer[] = {
+ {"__reduce_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_5__reduce_cython__, METH_NOARGS, 0},
+ {"__setstate_cython__", (PyCFunction)__pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_7__setstate_cython__, METH_O, 0},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_14_pydevd_bundle_13pydevd_cython_ThreadTracer[] = {
+ {(char *)"_args", __pyx_getprop_14_pydevd_bundle_13pydevd_cython_12ThreadTracer__args, __pyx_setprop_14_pydevd_bundle_13pydevd_cython_12ThreadTracer__args, (char *)0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "_pydevd_bundle.pydevd_cython.ThreadTracer", /*tp_name*/
+ sizeof(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_ThreadTracer), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #endif
+ #if PY_MAJOR_VERSION >= 3
+ 0, /*tp_as_async*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_3__call__, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_traverse*/
+ __pyx_tp_clear_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_14_pydevd_bundle_13pydevd_cython_ThreadTracer, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "pydevd_cython",
+ 0, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
+ {&__pyx_n_s_ALL, __pyx_k_ALL, sizeof(__pyx_k_ALL), 0, 0, 1, 1},
+ {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_RUN_TO_LINE, __pyx_k_CMD_RUN_TO_LINE, sizeof(__pyx_k_CMD_RUN_TO_LINE), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_SET_BREAK, __pyx_k_CMD_SET_BREAK, sizeof(__pyx_k_CMD_SET_BREAK), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_SET_NEXT_STATEMENT, __pyx_k_CMD_SET_NEXT_STATEMENT, sizeof(__pyx_k_CMD_SET_NEXT_STATEMENT), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_SMART_STEP_INTO, __pyx_k_CMD_SMART_STEP_INTO, sizeof(__pyx_k_CMD_SMART_STEP_INTO), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION, __pyx_k_CMD_STEP_CAUGHT_EXCEPTION, sizeof(__pyx_k_CMD_STEP_CAUGHT_EXCEPTION), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_STEP_INTO, __pyx_k_CMD_STEP_INTO, sizeof(__pyx_k_CMD_STEP_INTO), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_STEP_INTO_MY_CODE, __pyx_k_CMD_STEP_INTO_MY_CODE, sizeof(__pyx_k_CMD_STEP_INTO_MY_CODE), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_STEP_OVER, __pyx_k_CMD_STEP_OVER, sizeof(__pyx_k_CMD_STEP_OVER), 0, 0, 1, 1},
+ {&__pyx_n_s_CMD_STEP_RETURN, __pyx_k_CMD_STEP_RETURN, sizeof(__pyx_k_CMD_STEP_RETURN), 0, 0, 1, 1},
+ {&__pyx_n_s_CO_GENERATOR, __pyx_k_CO_GENERATOR, sizeof(__pyx_k_CO_GENERATOR), 0, 0, 1, 1},
+ {&__pyx_kp_s_Condition, __pyx_k_Condition, sizeof(__pyx_k_Condition), 0, 0, 1, 0},
+ {&__pyx_n_s_DEBUG_START, __pyx_k_DEBUG_START, sizeof(__pyx_k_DEBUG_START), 0, 0, 1, 1},
+ {&__pyx_n_s_DEBUG_START_PY3K, __pyx_k_DEBUG_START_PY3K, sizeof(__pyx_k_DEBUG_START_PY3K), 0, 0, 1, 1},
+ {&__pyx_n_s_DONT_TRACE, __pyx_k_DONT_TRACE, sizeof(__pyx_k_DONT_TRACE), 0, 0, 1, 1},
+ {&__pyx_kp_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 0},
+ {&__pyx_kp_s_Error_while_evaluating_expressio, __pyx_k_Error_while_evaluating_expressio, sizeof(__pyx_k_Error_while_evaluating_expressio), 0, 0, 1, 0},
+ {&__pyx_n_s_GeneratorExit, __pyx_k_GeneratorExit, sizeof(__pyx_k_GeneratorExit), 0, 0, 1, 1},
+ {&__pyx_n_s_IGNORE_EXCEPTION_TAG, __pyx_k_IGNORE_EXCEPTION_TAG, sizeof(__pyx_k_IGNORE_EXCEPTION_TAG), 0, 0, 1, 1},
+ {&__pyx_n_s_IS_IRONPYTHON, __pyx_k_IS_IRONPYTHON, sizeof(__pyx_k_IS_IRONPYTHON), 0, 0, 1, 1},
+ {&__pyx_n_s_IS_JYTHON, __pyx_k_IS_JYTHON, sizeof(__pyx_k_IS_JYTHON), 0, 0, 1, 1},
+ {&__pyx_n_s_IS_PY3K, __pyx_k_IS_PY3K, sizeof(__pyx_k_IS_PY3K), 0, 0, 1, 1},
+ {&__pyx_kp_s_IgnoreException, __pyx_k_IgnoreException, sizeof(__pyx_k_IgnoreException), 0, 0, 1, 0},
+ {&__pyx_kp_s_Ignore_exception_s_in_library_s, __pyx_k_Ignore_exception_s_in_library_s, sizeof(__pyx_k_Ignore_exception_s_in_library_s), 0, 0, 1, 0},
+ {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Incompatible_checksums_s_vs_0x3d, __pyx_k_Incompatible_checksums_s_vs_0x3d, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x3d), 0, 0, 1, 0},
+ {&__pyx_kp_s_Incompatible_checksums_s_vs_0x77, __pyx_k_Incompatible_checksums_s_vs_0x77, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x77), 0, 0, 1, 0},
+ {&__pyx_kp_s_Incompatible_checksums_s_vs_0xa9, __pyx_k_Incompatible_checksums_s_vs_0xa9, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xa9), 0, 0, 1, 0},
+ {&__pyx_kp_s_Incompatible_checksums_s_vs_0xfa, __pyx_k_Incompatible_checksums_s_vs_0xfa, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xfa), 0, 0, 1, 0},
+ {&__pyx_n_s_KeyboardInterrupt, __pyx_k_KeyboardInterrupt, sizeof(__pyx_k_KeyboardInterrupt), 0, 0, 1, 1},
+ {&__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER, __pyx_k_NORM_PATHS_AND_BASE_CONTAINER, sizeof(__pyx_k_NORM_PATHS_AND_BASE_CONTAINER), 0, 0, 1, 1},
+ {&__pyx_n_s_NoSuchFieldException, __pyx_k_NoSuchFieldException, sizeof(__pyx_k_NoSuchFieldException), 0, 0, 1, 1},
+ {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1},
+ {&__pyx_n_s_PYDEV_FILE, __pyx_k_PYDEV_FILE, sizeof(__pyx_k_PYDEV_FILE), 0, 0, 1, 1},
+ {&__pyx_n_s_PYTHON_SUSPEND, __pyx_k_PYTHON_SUSPEND, sizeof(__pyx_k_PYTHON_SUSPEND), 0, 0, 1, 1},
+ {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
+ {&__pyx_n_s_RETURN_VALUES_DICT, __pyx_k_RETURN_VALUES_DICT, sizeof(__pyx_k_RETURN_VALUES_DICT), 0, 0, 1, 1},
+ {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
+ {&__pyx_n_s_STATE_RUN, __pyx_k_STATE_RUN, sizeof(__pyx_k_STATE_RUN), 0, 0, 1, 1},
+ {&__pyx_n_s_STATE_SUSPEND, __pyx_k_STATE_SUSPEND, sizeof(__pyx_k_STATE_SUSPEND), 0, 0, 1, 1},
+ {&__pyx_n_s_SetTrace, __pyx_k_SetTrace, sizeof(__pyx_k_SetTrace), 0, 0, 1, 1},
+ {&__pyx_kp_s_State_s_Stop_s_Cmd_s_Kill_s, __pyx_k_State_s_Stop_s_Cmd_s_Kill_s, sizeof(__pyx_k_State_s_Stop_s_Cmd_s_Kill_s), 0, 0, 1, 0},
+ {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
+ {&__pyx_n_s_SystemExit, __pyx_k_SystemExit, sizeof(__pyx_k_SystemExit), 0, 0, 1, 1},
+ {&__pyx_n_s_TRACE_PROPERTY, __pyx_k_TRACE_PROPERTY, sizeof(__pyx_k_TRACE_PROPERTY), 0, 0, 1, 1},
+ {&__pyx_n_s_ThreadStateMapping, __pyx_k_ThreadStateMapping, sizeof(__pyx_k_ThreadStateMapping), 0, 0, 1, 1},
+ {&__pyx_kp_s_Unable_to_proceed_sys__current_f, __pyx_k_Unable_to_proceed_sys__current_f, sizeof(__pyx_k_Unable_to_proceed_sys__current_f), 0, 0, 1, 0},
+ {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
+ {&__pyx_n_s_accessible, __pyx_k_accessible, sizeof(__pyx_k_accessible), 0, 0, 1, 1},
+ {&__pyx_n_s_add_additional_frame_by_id, __pyx_k_add_additional_frame_by_id, sizeof(__pyx_k_add_additional_frame_by_id), 0, 0, 1, 1},
+ {&__pyx_n_s_add_exception_to_frame, __pyx_k_add_exception_to_frame, sizeof(__pyx_k_add_exception_to_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_additional_info, __pyx_k_additional_info, sizeof(__pyx_k_additional_info), 0, 0, 1, 1},
+ {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
+ {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
+ {&__pyx_n_s_args_2, __pyx_k_args_2, sizeof(__pyx_k_args_2), 0, 0, 1, 1},
+ {&__pyx_n_s_as_array, __pyx_k_as_array, sizeof(__pyx_k_as_array), 0, 0, 1, 1},
+ {&__pyx_n_s_asyncio_analyser, __pyx_k_asyncio_analyser, sizeof(__pyx_k_asyncio_analyser), 0, 0, 1, 1},
+ {&__pyx_n_s_basename, __pyx_k_basename, sizeof(__pyx_k_basename), 0, 0, 1, 1},
+ {&__pyx_n_s_break_on_caught_exceptions, __pyx_k_break_on_caught_exceptions, sizeof(__pyx_k_break_on_caught_exceptions), 0, 0, 1, 1},
+ {&__pyx_n_s_break_on_exceptions_thrown_in_sa, __pyx_k_break_on_exceptions_thrown_in_sa, sizeof(__pyx_k_break_on_exceptions_thrown_in_sa), 0, 0, 1, 1},
+ {&__pyx_n_s_breakpoint, __pyx_k_breakpoint, sizeof(__pyx_k_breakpoint), 0, 0, 1, 1},
+ {&__pyx_n_s_breakpoints, __pyx_k_breakpoints, sizeof(__pyx_k_breakpoints), 0, 0, 1, 1},
+ {&__pyx_n_s_cachedThreadState, __pyx_k_cachedThreadState, sizeof(__pyx_k_cachedThreadState), 0, 0, 1, 1},
+ {&__pyx_n_s_call, __pyx_k_call, sizeof(__pyx_k_call), 0, 0, 1, 1},
+ {&__pyx_n_s_call_2, __pyx_k_call_2, sizeof(__pyx_k_call_2), 0, 0, 1, 1},
+ {&__pyx_n_s_can_not_skip, __pyx_k_can_not_skip, sizeof(__pyx_k_can_not_skip), 0, 0, 1, 1},
+ {&__pyx_n_s_checkcache, __pyx_k_checkcache, sizeof(__pyx_k_checkcache), 0, 0, 1, 1},
+ {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
+ {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
+ {&__pyx_n_s_cmd_step_into, __pyx_k_cmd_step_into, sizeof(__pyx_k_cmd_step_into), 0, 0, 1, 1},
+ {&__pyx_n_s_cmd_step_over, __pyx_k_cmd_step_over, sizeof(__pyx_k_cmd_step_over), 0, 0, 1, 1},
+ {&__pyx_n_s_co_filename, __pyx_k_co_filename, sizeof(__pyx_k_co_filename), 0, 0, 1, 1},
+ {&__pyx_n_s_co_firstlineno, __pyx_k_co_firstlineno, sizeof(__pyx_k_co_firstlineno), 0, 0, 1, 1},
+ {&__pyx_n_s_co_flags, __pyx_k_co_flags, sizeof(__pyx_k_co_flags), 0, 0, 1, 1},
+ {&__pyx_n_s_co_name, __pyx_k_co_name, sizeof(__pyx_k_co_name), 0, 0, 1, 1},
+ {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
+ {&__pyx_n_s_condition, __pyx_k_condition, sizeof(__pyx_k_condition), 0, 0, 1, 1},
+ {&__pyx_n_s_conditional_breakpoint_exception, __pyx_k_conditional_breakpoint_exception, sizeof(__pyx_k_conditional_breakpoint_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_currentThread, __pyx_k_currentThread, sizeof(__pyx_k_currentThread), 0, 0, 1, 1},
+ {&__pyx_n_s_current_frames, __pyx_k_current_frames, sizeof(__pyx_k_current_frames), 0, 0, 1, 1},
+ {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
+ {&__pyx_n_s_default_return_value, __pyx_k_default_return_value, sizeof(__pyx_k_default_return_value), 0, 0, 1, 1},
+ {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
+ {&__pyx_n_s_dict_iter_values, __pyx_k_dict_iter_values, sizeof(__pyx_k_dict_iter_values), 0, 0, 1, 1},
+ {&__pyx_n_s_do_wait_suspend, __pyx_k_do_wait_suspend, sizeof(__pyx_k_do_wait_suspend), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_n_s_entrySet, __pyx_k_entrySet, sizeof(__pyx_k_entrySet), 0, 0, 1, 1},
+ {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
+ {&__pyx_n_s_etype, __pyx_k_etype, sizeof(__pyx_k_etype), 0, 0, 1, 1},
+ {&__pyx_n_s_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 1, 1},
+ {&__pyx_n_s_event, __pyx_k_event, sizeof(__pyx_k_event), 0, 0, 1, 1},
+ {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
+ {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_exception_break, __pyx_k_exception_break, sizeof(__pyx_k_exception_break), 0, 0, 1, 1},
+ {&__pyx_n_s_execfile, __pyx_k_execfile, sizeof(__pyx_k_execfile), 0, 0, 1, 1},
+ {&__pyx_n_s_expression, __pyx_k_expression, sizeof(__pyx_k_expression), 0, 0, 1, 1},
+ {&__pyx_n_s_extract_stack, __pyx_k_extract_stack, sizeof(__pyx_k_extract_stack), 0, 0, 1, 1},
+ {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
+ {&__pyx_n_s_f_back, __pyx_k_f_back, sizeof(__pyx_k_f_back), 0, 0, 1, 1},
+ {&__pyx_n_s_f_code, __pyx_k_f_code, sizeof(__pyx_k_f_code), 0, 0, 1, 1},
+ {&__pyx_n_s_f_globals, __pyx_k_f_globals, sizeof(__pyx_k_f_globals), 0, 0, 1, 1},
+ {&__pyx_n_s_f_lineno, __pyx_k_f_lineno, sizeof(__pyx_k_f_lineno), 0, 0, 1, 1},
+ {&__pyx_n_s_f_locals, __pyx_k_f_locals, sizeof(__pyx_k_f_locals), 0, 0, 1, 1},
+ {&__pyx_n_s_f_trace, __pyx_k_f_trace, sizeof(__pyx_k_f_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_filename_to_lines_where_exceptio, __pyx_k_filename_to_lines_where_exceptio, sizeof(__pyx_k_filename_to_lines_where_exceptio), 0, 0, 1, 1},
+ {&__pyx_n_s_filename_to_stat_info, __pyx_k_filename_to_stat_info, sizeof(__pyx_k_filename_to_stat_info), 0, 0, 1, 1},
+ {&__pyx_n_s_finish_debugging_session, __pyx_k_finish_debugging_session, sizeof(__pyx_k_finish_debugging_session), 0, 0, 1, 1},
+ {&__pyx_n_s_first_appearance_in_scope, __pyx_k_first_appearance_in_scope, sizeof(__pyx_k_first_appearance_in_scope), 0, 0, 1, 1},
+ {&__pyx_n_s_first_breakpoint_reached, __pyx_k_first_breakpoint_reached, sizeof(__pyx_k_first_breakpoint_reached), 0, 0, 1, 1},
+ {&__pyx_n_s_format_exception_only, __pyx_k_format_exception_only, sizeof(__pyx_k_format_exception_only), 0, 0, 1, 1},
+ {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_func_name, __pyx_k_func_name, sizeof(__pyx_k_func_name), 0, 0, 1, 1},
+ {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
+ {&__pyx_n_s_getDeclaredField, __pyx_k_getDeclaredField, sizeof(__pyx_k_getDeclaredField), 0, 0, 1, 1},
+ {&__pyx_n_s_getId, __pyx_k_getId, sizeof(__pyx_k_getId), 0, 0, 1, 1},
+ {&__pyx_n_s_getKey, __pyx_k_getKey, sizeof(__pyx_k_getKey), 0, 0, 1, 1},
+ {&__pyx_n_s_getValue, __pyx_k_getValue, sizeof(__pyx_k_getValue), 0, 0, 1, 1},
+ {&__pyx_n_s_get_abs_path_real_path_and_base, __pyx_k_get_abs_path_real_path_and_base, sizeof(__pyx_k_get_abs_path_real_path_and_base), 0, 0, 1, 1},
+ {&__pyx_n_s_get_breakpoint, __pyx_k_get_breakpoint, sizeof(__pyx_k_get_breakpoint), 0, 0, 1, 1},
+ {&__pyx_n_s_get_clsname_for_code, __pyx_k_get_clsname_for_code, sizeof(__pyx_k_get_clsname_for_code), 0, 0, 1, 1},
+ {&__pyx_n_s_get_exception_breakpoint, __pyx_k_get_exception_breakpoint, sizeof(__pyx_k_get_exception_breakpoint), 0, 0, 1, 1},
+ {&__pyx_n_s_get_file_type, __pyx_k_get_file_type, sizeof(__pyx_k_get_file_type), 0, 0, 1, 1},
+ {&__pyx_n_s_get_func_name, __pyx_k_get_func_name, sizeof(__pyx_k_get_func_name), 0, 0, 1, 1},
+ {&__pyx_n_s_get_thread_id, __pyx_k_get_thread_id, sizeof(__pyx_k_get_thread_id), 0, 0, 1, 1},
+ {&__pyx_n_s_getline, __pyx_k_getline, sizeof(__pyx_k_getline), 0, 0, 1, 1},
+ {&__pyx_n_s_globalThreadStates, __pyx_k_globalThreadStates, sizeof(__pyx_k_globalThreadStates), 0, 0, 1, 1},
+ {&__pyx_n_s_global_cache_frame_skips, __pyx_k_global_cache_frame_skips, sizeof(__pyx_k_global_cache_frame_skips), 0, 0, 1, 1},
+ {&__pyx_n_s_global_cache_skips, __pyx_k_global_cache_skips, sizeof(__pyx_k_global_cache_skips), 0, 0, 1, 1},
+ {&__pyx_n_s_handle_breakpoint_condition, __pyx_k_handle_breakpoint_condition, sizeof(__pyx_k_handle_breakpoint_condition), 0, 0, 1, 1},
+ {&__pyx_n_s_handle_breakpoint_expression, __pyx_k_handle_breakpoint_expression, sizeof(__pyx_k_handle_breakpoint_expression), 0, 0, 1, 1},
+ {&__pyx_n_s_handle_exception, __pyx_k_handle_exception, sizeof(__pyx_k_handle_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_has_plugin_exception_breaks, __pyx_k_has_plugin_exception_breaks, sizeof(__pyx_k_has_plugin_exception_breaks), 0, 0, 1, 1},
+ {&__pyx_n_s_has_plugin_line_breaks, __pyx_k_has_plugin_line_breaks, sizeof(__pyx_k_has_plugin_line_breaks), 0, 0, 1, 1},
+ {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
+ {&__pyx_n_s_ident, __pyx_k_ident, sizeof(__pyx_k_ident), 0, 0, 1, 1},
+ {&__pyx_n_s_ignore_exceptions_thrown_in_line, __pyx_k_ignore_exceptions_thrown_in_line, sizeof(__pyx_k_ignore_exceptions_thrown_in_line), 0, 0, 1, 1},
+ {&__pyx_n_s_ignore_libraries, __pyx_k_ignore_libraries, sizeof(__pyx_k_ignore_libraries), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
+ {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
+ {&__pyx_kp_s_invalid, __pyx_k_invalid, sizeof(__pyx_k_invalid), 0, 0, 1, 0},
+ {&__pyx_n_s_is_filter_enabled, __pyx_k_is_filter_enabled, sizeof(__pyx_k_is_filter_enabled), 0, 0, 1, 1},
+ {&__pyx_n_s_is_filter_libraries, __pyx_k_is_filter_libraries, sizeof(__pyx_k_is_filter_libraries), 0, 0, 1, 1},
+ {&__pyx_n_s_is_ignored_by_filters, __pyx_k_is_ignored_by_filters, sizeof(__pyx_k_is_ignored_by_filters), 0, 0, 1, 1},
+ {&__pyx_n_s_is_thread_alive, __pyx_k_is_thread_alive, sizeof(__pyx_k_is_thread_alive), 0, 0, 1, 1},
+ {&__pyx_n_s_java_lang, __pyx_k_java_lang, sizeof(__pyx_k_java_lang), 0, 0, 1, 1},
+ {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
+ {&__pyx_n_s_just_raised, __pyx_k_just_raised, sizeof(__pyx_k_just_raised), 0, 0, 1, 1},
+ {&__pyx_n_s_kill_all_pydev_threads, __pyx_k_kill_all_pydev_threads, sizeof(__pyx_k_kill_all_pydev_threads), 0, 0, 1, 1},
+ {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
+ {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
+ {&__pyx_n_s_linecache, __pyx_k_linecache, sizeof(__pyx_k_linecache), 0, 0, 1, 1},
+ {&__pyx_n_s_log_event, __pyx_k_log_event, sizeof(__pyx_k_log_event), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_main_debugger, __pyx_k_main_debugger, sizeof(__pyx_k_main_debugger), 0, 0, 1, 1},
+ {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
+ {&__pyx_n_s_method_object, __pyx_k_method_object, sizeof(__pyx_k_method_object), 0, 0, 1, 1},
+ {&__pyx_kp_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 0},
+ {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
+ {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
+ {&__pyx_n_s_new_frame, __pyx_k_new_frame, sizeof(__pyx_k_new_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_not_in_scope, __pyx_k_not_in_scope, sizeof(__pyx_k_not_in_scope), 0, 0, 1, 1},
+ {&__pyx_n_s_notify_on_first_raise_only, __pyx_k_notify_on_first_raise_only, sizeof(__pyx_k_notify_on_first_raise_only), 0, 0, 1, 1},
+ {&__pyx_n_s_org_python_core, __pyx_k_org_python_core, sizeof(__pyx_k_org_python_core), 0, 0, 1, 1},
+ {&__pyx_n_s_original_call, __pyx_k_original_call, sizeof(__pyx_k_original_call), 0, 0, 1, 1},
+ {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
+ {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
+ {&__pyx_n_s_output_checker, __pyx_k_output_checker, sizeof(__pyx_k_output_checker), 0, 0, 1, 1},
+ {&__pyx_n_s_overwrite_prev_trace, __pyx_k_overwrite_prev_trace, sizeof(__pyx_k_overwrite_prev_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
+ {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
+ {&__pyx_n_s_plugin, __pyx_k_plugin, sizeof(__pyx_k_plugin), 0, 0, 1, 1},
+ {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
+ {&__pyx_n_s_print_exc, __pyx_k_print_exc, sizeof(__pyx_k_print_exc), 0, 0, 1, 1},
+ {&__pyx_n_s_process_thread_not_alive, __pyx_k_process_thread_not_alive, sizeof(__pyx_k_process_thread_not_alive), 0, 0, 1, 1},
+ {&__pyx_n_s_py_db, __pyx_k_py_db, sizeof(__pyx_k_py_db), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_bundle, __pyx_k_pydev_bundle, sizeof(__pyx_k_pydev_bundle), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_bundle_pydev_is_thread_al, __pyx_k_pydev_bundle_pydev_is_thread_al, sizeof(__pyx_k_pydev_bundle_pydev_is_thread_al), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_do_not_trace, __pyx_k_pydev_do_not_trace, sizeof(__pyx_k_pydev_do_not_trace), 0, 0, 1, 1},
+ {&__pyx_kp_s_pydev_execfile_py, __pyx_k_pydev_execfile_py, sizeof(__pyx_k_pydev_execfile_py), 0, 0, 1, 0},
+ {&__pyx_n_s_pydev_imps__pydev_saved_modules, __pyx_k_pydev_imps__pydev_saved_modules, sizeof(__pyx_k_pydev_imps__pydev_saved_modules), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_log, __pyx_k_pydev_log, sizeof(__pyx_k_pydev_log), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_message, __pyx_k_pydev_message, sizeof(__pyx_k_pydev_message), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle, __pyx_k_pydevd_bundle, sizeof(__pyx_k_pydevd_bundle), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_additional, __pyx_k_pydevd_bundle_pydevd_additional, sizeof(__pyx_k_pydevd_bundle_pydevd_additional), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_breakpoint, __pyx_k_pydevd_bundle_pydevd_breakpoint, sizeof(__pyx_k_pydevd_bundle_pydevd_breakpoint), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_comm, __pyx_k_pydevd_bundle_pydevd_comm, sizeof(__pyx_k_pydevd_bundle_pydevd_comm), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_constants, __pyx_k_pydevd_bundle_pydevd_constants, sizeof(__pyx_k_pydevd_bundle_pydevd_constants), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_cython, __pyx_k_pydevd_bundle_pydevd_cython, sizeof(__pyx_k_pydevd_bundle_pydevd_cython), 0, 0, 1, 1},
+ {&__pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_k_pydevd_bundle_pydevd_cython_pyx, sizeof(__pyx_k_pydevd_bundle_pydevd_cython_pyx), 0, 0, 1, 0},
+ {&__pyx_n_s_pydevd_bundle_pydevd_dont_trace, __pyx_k_pydevd_bundle_pydevd_dont_trace, sizeof(__pyx_k_pydevd_bundle_pydevd_dont_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_frame_util, __pyx_k_pydevd_bundle_pydevd_frame_util, sizeof(__pyx_k_pydevd_bundle_pydevd_frame_util), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_kill_all_p, __pyx_k_pydevd_bundle_pydevd_kill_all_p, sizeof(__pyx_k_pydevd_bundle_pydevd_kill_all_p), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_signature, __pyx_k_pydevd_bundle_pydevd_signature, sizeof(__pyx_k_pydevd_bundle_pydevd_signature), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_utils, __pyx_k_pydevd_bundle_pydevd_utils, sizeof(__pyx_k_pydevd_bundle_pydevd_utils), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_dont_trace, __pyx_k_pydevd_dont_trace, sizeof(__pyx_k_pydevd_dont_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_file_utils, __pyx_k_pydevd_file_utils, sizeof(__pyx_k_pydevd_file_utils), 0, 0, 1, 1},
+ {&__pyx_kp_s_pydevd_py, __pyx_k_pydevd_py, sizeof(__pyx_k_pydevd_py), 0, 0, 1, 0},
+ {&__pyx_kp_s_pydevd_traceproperty_py, __pyx_k_pydevd_traceproperty_py, sizeof(__pyx_k_pydevd_traceproperty_py), 0, 0, 1, 0},
+ {&__pyx_n_s_pydevd_tracing, __pyx_k_pydevd_tracing, sizeof(__pyx_k_pydevd_tracing), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_vars, __pyx_k_pydevd_vars, sizeof(__pyx_k_pydevd_vars), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_unpickle_PyDBAdditionalThr, __pyx_k_pyx_unpickle_PyDBAdditionalThr, sizeof(__pyx_k_pyx_unpickle_PyDBAdditionalThr), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_unpickle_PyDBFrame, __pyx_k_pyx_unpickle_PyDBFrame, sizeof(__pyx_k_pyx_unpickle_PyDBFrame), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_unpickle_SafeCallWrapper, __pyx_k_pyx_unpickle_SafeCallWrapper, sizeof(__pyx_k_pyx_unpickle_SafeCallWrapper), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_unpickle_ThreadTracer, __pyx_k_pyx_unpickle_ThreadTracer, sizeof(__pyx_k_pyx_unpickle_ThreadTracer), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_n_s_qname, __pyx_k_qname, sizeof(__pyx_k_qname), 0, 0, 1, 1},
+ {&__pyx_n_s_quitting, __pyx_k_quitting, sizeof(__pyx_k_quitting), 0, 0, 1, 1},
+ {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
+ {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
+ {&__pyx_n_s_remove_additional_frame_by_id, __pyx_k_remove_additional_frame_by_id, sizeof(__pyx_k_remove_additional_frame_by_id), 0, 0, 1, 1},
+ {&__pyx_n_s_remove_return_values, __pyx_k_remove_return_values, sizeof(__pyx_k_remove_return_values), 0, 0, 1, 1},
+ {&__pyx_n_s_remove_return_values_flag, __pyx_k_remove_return_values_flag, sizeof(__pyx_k_remove_return_values_flag), 0, 0, 1, 1},
+ {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
+ {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
+ {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
+ {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1},
+ {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
+ {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
+ {&__pyx_n_s_send_caught_exception_stack, __pyx_k_send_caught_exception_stack, sizeof(__pyx_k_send_caught_exception_stack), 0, 0, 1, 1},
+ {&__pyx_n_s_send_caught_exception_stack_proc, __pyx_k_send_caught_exception_stack_proc, sizeof(__pyx_k_send_caught_exception_stack_proc), 0, 0, 1, 1},
+ {&__pyx_n_s_send_signature_call_trace, __pyx_k_send_signature_call_trace, sizeof(__pyx_k_send_signature_call_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_send_signature_return_trace, __pyx_k_send_signature_return_trace, sizeof(__pyx_k_send_signature_return_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_set_suspend, __pyx_k_set_suspend, sizeof(__pyx_k_set_suspend), 0, 0, 1, 1},
+ {&__pyx_n_s_set_trace_for_frame_and_parents, __pyx_k_set_trace_for_frame_and_parents, sizeof(__pyx_k_set_trace_for_frame_and_parents), 0, 0, 1, 1},
+ {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
+ {&__pyx_n_s_should_stop_on_exception, __pyx_k_should_stop_on_exception, sizeof(__pyx_k_should_stop_on_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_should_trace_hook, __pyx_k_should_trace_hook, sizeof(__pyx_k_should_trace_hook), 0, 0, 1, 1},
+ {&__pyx_n_s_show_return_values, __pyx_k_show_return_values, sizeof(__pyx_k_show_return_values), 0, 0, 1, 1},
+ {&__pyx_n_s_signature_factory, __pyx_k_signature_factory, sizeof(__pyx_k_signature_factory), 0, 0, 1, 1},
+ {&__pyx_n_s_st_mtime, __pyx_k_st_mtime, sizeof(__pyx_k_st_mtime), 0, 0, 1, 1},
+ {&__pyx_n_s_st_size, __pyx_k_st_size, sizeof(__pyx_k_st_size), 0, 0, 1, 1},
+ {&__pyx_n_s_stack, __pyx_k_stack, sizeof(__pyx_k_stack), 0, 0, 1, 1},
+ {&__pyx_n_s_stat, __pyx_k_stat, sizeof(__pyx_k_stat), 0, 0, 1, 1},
+ {&__pyx_n_s_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 0, 1, 1},
+ {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
+ {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
+ {&__pyx_n_s_suspend, __pyx_k_suspend, sizeof(__pyx_k_suspend), 0, 0, 1, 1},
+ {&__pyx_n_s_suspend_all_other_threads, __pyx_k_suspend_all_other_threads, sizeof(__pyx_k_suspend_all_other_threads), 0, 0, 1, 1},
+ {&__pyx_n_s_suspend_on_breakpoint_exception, __pyx_k_suspend_on_breakpoint_exception, sizeof(__pyx_k_suspend_on_breakpoint_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_suspend_policy, __pyx_k_suspend_policy, sizeof(__pyx_k_suspend_policy), 0, 0, 1, 1},
+ {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
+ {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
+ {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
+ {&__pyx_n_s_tb_frame, __pyx_k_tb_frame, sizeof(__pyx_k_tb_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_tb_lineno, __pyx_k_tb_lineno, sizeof(__pyx_k_tb_lineno), 0, 0, 1, 1},
+ {&__pyx_n_s_tb_next, __pyx_k_tb_next, sizeof(__pyx_k_tb_next), 0, 0, 1, 1},
+ {&__pyx_n_s_termination_event_set, __pyx_k_termination_event_set, sizeof(__pyx_k_termination_event_set), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_thread, __pyx_k_thread, sizeof(__pyx_k_thread), 0, 0, 1, 1},
+ {&__pyx_n_s_thread_analyser, __pyx_k_thread_analyser, sizeof(__pyx_k_thread_analyser), 0, 0, 1, 1},
+ {&__pyx_n_s_thread_state, __pyx_k_thread_state, sizeof(__pyx_k_thread_state), 0, 0, 1, 1},
+ {&__pyx_n_s_thread_states, __pyx_k_thread_states, sizeof(__pyx_k_thread_states), 0, 0, 1, 1},
+ {&__pyx_n_s_thread_to_state, __pyx_k_thread_to_state, sizeof(__pyx_k_thread_to_state), 0, 0, 1, 1},
+ {&__pyx_n_s_thread_tracer, __pyx_k_thread_tracer, sizeof(__pyx_k_thread_tracer), 0, 0, 1, 1},
+ {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
+ {&__pyx_n_s_threadingCurrentThread, __pyx_k_threadingCurrentThread, sizeof(__pyx_k_threadingCurrentThread), 0, 0, 1, 1},
+ {&__pyx_n_s_tid_to_last_frame, __pyx_k_tid_to_last_frame, sizeof(__pyx_k_tid_to_last_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_toArray, __pyx_k_toArray, sizeof(__pyx_k_toArray), 0, 0, 1, 1},
+ {&__pyx_n_s_trace_dispatch, __pyx_k_trace_dispatch, sizeof(__pyx_k_trace_dispatch), 0, 0, 1, 1},
+ {&__pyx_n_s_trace_exception, __pyx_k_trace_exception, sizeof(__pyx_k_trace_exception), 0, 0, 1, 1},
+ {&__pyx_n_s_trace_return, __pyx_k_trace_return, sizeof(__pyx_k_trace_return), 0, 0, 1, 1},
+ {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
+ {&__pyx_n_s_tracer, __pyx_k_tracer, sizeof(__pyx_k_tracer), 0, 0, 1, 1},
+ {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
+ {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
+ {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
+ {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
+ {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
+ {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 53, __pyx_L1_error)
+ __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 154, __pyx_L1_error)
+ __pyx_builtin_eval = __Pyx_GetBuiltinName(__pyx_n_s_eval); if (!__pyx_builtin_eval) __PYX_ERR(0, 170, __pyx_L1_error)
+ __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 422, __pyx_L1_error)
+ __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 566, __pyx_L1_error)
+ __pyx_builtin_GeneratorExit = __Pyx_GetBuiltinName(__pyx_n_s_GeneratorExit); if (!__pyx_builtin_GeneratorExit) __PYX_ERR(0, 566, __pyx_L1_error)
+ __pyx_builtin_KeyboardInterrupt = __Pyx_GetBuiltinName(__pyx_n_s_KeyboardInterrupt); if (!__pyx_builtin_KeyboardInterrupt) __PYX_ERR(0, 890, __pyx_L1_error)
+ __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 960, __pyx_L1_error)
+ __pyx_builtin_SystemExit = __Pyx_GetBuiltinName(__pyx_n_s_SystemExit); if (!__pyx_builtin_SystemExit) __PYX_ERR(0, 1103, __pyx_L1_error)
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":177
+ * if type(condition) != type(''):
+ * if hasattr(condition, 'encode'):
+ * condition = condition.encode('utf-8') # <<<<<<<<<<<<<<
+ *
+ * msg = 'Error while evaluating expression: %s\n' % (condition,)
+ */
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 177, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":306
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8') # <<<<<<<<<<<<<<
+ * flag = True
+ * else:
+ */
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 306, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":317
+ * info.pydev_message = exception_breakpoint.qname
+ * except:
+ * info.pydev_message = exception_breakpoint.qname.encode('utf-8') # <<<<<<<<<<<<<<
+ * flag = True
+ * else:
+ */
+ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 317, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":21
+ * from org.python.core import ThreadStateMapping
+ * try:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version # <<<<<<<<<<<<<<
+ * except NoSuchFieldException:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ */
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_globalThreadStates); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 21, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__6);
+ __Pyx_GIVEREF(__pyx_tuple__6);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":23
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0 # <<<<<<<<<<<<<<
+ * cachedThreadState.accessible = True
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ */
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_cachedThreadState); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 23, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":27
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ *
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ */
+ __pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_as_array, __pyx_n_s_ret, __pyx_n_s_thread_to_state, __pyx_n_s_thread, __pyx_n_s_thread_state, __pyx_n_s_frame); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 27, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
+ __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(0, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_current_frames, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 27, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":49
+ *
+ * # IronPython doesn't have it. Let's use our workaround...
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * return _tid_to_last_frame
+ *
+ */
+ __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_current_frames, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 49, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":53
+ *
+ * else:
+ * raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).') # <<<<<<<<<<<<<<
+ * else:
+ * _current_frames = sys._current_frames
+ */
+ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_proceed_sys__current_f); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 53, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__11);
+ __Pyx_GIVEREF(__pyx_tuple__11);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":155
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+ __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__12);
+ __Pyx_GIVEREF(__pyx_tuple__12);
+ __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_send_signature_call_trace, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 155, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":160
+ * basename = os.path.basename
+ *
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException') # <<<<<<<<<<<<<<
+ * DEBUG_START = ('pydevd.py', 'run')
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ */
+ __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_IgnoreException); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 160, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__14);
+ __Pyx_GIVEREF(__pyx_tuple__14);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":161
+ *
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+ * DEBUG_START = ('pydevd.py', 'run') # <<<<<<<<<<<<<<
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py'
+ */
+ __pyx_tuple__15 = PyTuple_Pack(2, __pyx_kp_s_pydevd_py, __pyx_n_s_run); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__15);
+ __Pyx_GIVEREF(__pyx_tuple__15);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":162
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+ * DEBUG_START = ('pydevd.py', 'run')
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile') # <<<<<<<<<<<<<<
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py'
+ * get_file_type = DONT_TRACE.get
+ */
+ __pyx_tuple__16 = PyTuple_Pack(2, __pyx_kp_s_pydev_execfile_py, __pyx_n_s_execfile); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 162, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__16);
+ __Pyx_GIVEREF(__pyx_tuple__16);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":167
+ *
+ *
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value): # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * try:
+ */
+ __pyx_tuple__17 = PyTuple_Pack(14, __pyx_n_s_py_db, __pyx_n_s_info, __pyx_n_s_breakpoint, __pyx_n_s_new_frame, __pyx_n_s_default_return_value, __pyx_n_s_condition, __pyx_n_s_val, __pyx_n_s_msg, __pyx_n_s_stop, __pyx_n_s_etype, __pyx_n_s_value, __pyx_n_s_tb, __pyx_n_s_error, __pyx_n_s_stack); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 167, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__17);
+ __Pyx_GIVEREF(__pyx_tuple__17);
+ __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_handle_breakpoint_condition, 167, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 167, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":203
+ *
+ *
+ * def handle_breakpoint_expression(breakpoint, info, new_frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+ __pyx_tuple__19 = PyTuple_Pack(4, __pyx_n_s_breakpoint, __pyx_n_s_info, __pyx_n_s_new_frame, __pyx_n_s_val); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 203, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__19);
+ __Pyx_GIVEREF(__pyx_tuple__19);
+ __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_handle_breakpoint_expression, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 203, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":931
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+ __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 931, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__21);
+ __Pyx_GIVEREF(__pyx_tuple__21);
+ __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_send_signature_call_trace, 931, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 931, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":951
+ * global_cache_frame_skips = {}
+ *
+ * def trace_dispatch(py_db, frame, event, arg): # <<<<<<<<<<<<<<
+ * t = threadingCurrentThread()
+ *
+ */
+ __pyx_tuple__23 = PyTuple_Pack(7, __pyx_n_s_py_db, __pyx_n_s_frame, __pyx_n_s_event, __pyx_n_s_arg, __pyx_n_s_t, __pyx_n_s_additional_info, __pyx_n_s_thread_tracer); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 951, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__23);
+ __Pyx_GIVEREF(__pyx_tuple__23);
+ __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_trace_dispatch, 951, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 951, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1133
+ * _original_call = ThreadTracer.__call__
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * _tid_to_last_frame[self._args[1].ident] = frame
+ * return _original_call(self, frame, event, arg)
+ */
+ __pyx_tuple__25 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_frame, __pyx_n_s_event, __pyx_n_s_arg); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1133, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__25);
+ __Pyx_GIVEREF(__pyx_tuple__25);
+ __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pydevd_bundle_pydevd_cython_pyx, __pyx_n_s_call_2, 1133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1133, __pyx_L1_error)
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError
+ */
+ __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__27);
+ __Pyx_GIVEREF(__pyx_tuple__27);
+ __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_PyDBAdditionalThr, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__29);
+ __Pyx_GIVEREF(__pyx_tuple__29);
+ __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_PyDBFrame, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__31);
+ __Pyx_GIVEREF(__pyx_tuple__31);
+ __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SafeCallWrapper, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__33);
+ __Pyx_GIVEREF(__pyx_tuple__33);
+ __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ThreadTracer, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_64458794 = PyInt_FromLong(64458794L); if (unlikely(!__pyx_int_64458794)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_125568891 = PyInt_FromLong(125568891L); if (unlikely(!__pyx_int_125568891)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_177881921 = PyInt_FromLong(177881921L); if (unlikely(!__pyx_int_177881921)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_262582659 = PyInt_FromLong(262582659L); if (unlikely(!__pyx_int_262582659)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initpydevd_cython(void); /*proto*/
+PyMODINIT_FUNC initpydevd_cython(void)
+#else
+PyMODINIT_FUNC PyInit_pydevd_cython(void); /*proto*/
+PyMODINIT_FUNC PyInit_pydevd_cython(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pydevd_cython(void)", 0);
+ if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
+ #ifdef __Pyx_CyFunction_USED
+ if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_Coroutine_USED
+ if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_StopAsyncIteration_USED
+ if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("pydevd_cython", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
+ /*--- Initialize various global constants etc. ---*/
+ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ if (__pyx_module_is_main__pydevd_bundle__pydevd_cython) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
+ if (!PyDict_GetItemString(modules, "_pydevd_bundle.pydevd_cython")) {
+ if (unlikely(PyDict_SetItemString(modules, "_pydevd_bundle.pydevd_cython", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ /*--- Constants init code ---*/
+ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ if (PyType_Ready(&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
+ __pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "PyDBAdditionalThreadInfo", (PyObject *)&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
+ __pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo = &__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBAdditionalThreadInfo;
+ __pyx_vtabptr_14_pydevd_bundle_13pydevd_cython_PyDBFrame = &__pyx_vtable_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+ __pyx_vtable_14_pydevd_bundle_13pydevd_cython_PyDBFrame.trace_dispatch = (PyObject *(*)(struct __pyx_obj_14_pydevd_bundle_13pydevd_cython_PyDBFrame *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14_pydevd_bundle_13pydevd_cython_9PyDBFrame_trace_dispatch;
+ if (PyType_Ready(&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
+ __pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame.tp_dict, __pyx_vtabptr_14_pydevd_bundle_13pydevd_cython_PyDBFrame) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
+ if (PyObject_SetAttrString(__pyx_m, "PyDBFrame", (PyObject *)&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
+ __pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame = &__pyx_type_14_pydevd_bundle_13pydevd_cython_PyDBFrame;
+ if (PyType_Ready(&__pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
+ __pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "SafeCallWrapper", (PyObject *)&__pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
+ __pyx_ptype_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper = &__pyx_type_14_pydevd_bundle_13pydevd_cython_SafeCallWrapper;
+ if (PyType_Ready(&__pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer) < 0) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 985, __pyx_L1_error)
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__.doc = __pyx_doc_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__;
+ }
+ }
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "ThreadTracer", (PyObject *)&__pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer) < 0) __PYX_ERR(0, 985, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer) < 0) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer = &__pyx_type_14_pydevd_bundle_13pydevd_cython_ThreadTracer;
+ /*--- Type import code ---*/
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
+ if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":5
+ * # DO NOT edit manually!
+ * # DO NOT edit manually!
+ * import sys # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_constants import STATE_RUN, PYTHON_SUSPEND, IS_JYTHON, IS_IRONPYTHON
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":6
+ * # DO NOT edit manually!
+ * import sys
+ * from _pydevd_bundle.pydevd_constants import STATE_RUN, PYTHON_SUSPEND, IS_JYTHON, IS_IRONPYTHON # <<<<<<<<<<<<<<
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * # ELSE
+ */
+ __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_STATE_RUN);
+ __Pyx_GIVEREF(__pyx_n_s_STATE_RUN);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_STATE_RUN);
+ __Pyx_INCREF(__pyx_n_s_PYTHON_SUSPEND);
+ __Pyx_GIVEREF(__pyx_n_s_PYTHON_SUSPEND);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_PYTHON_SUSPEND);
+ __Pyx_INCREF(__pyx_n_s_IS_JYTHON);
+ __Pyx_GIVEREF(__pyx_n_s_IS_JYTHON);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_IS_JYTHON);
+ __Pyx_INCREF(__pyx_n_s_IS_IRONPYTHON);
+ __Pyx_GIVEREF(__pyx_n_s_IS_IRONPYTHON);
+ PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_IS_IRONPYTHON);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_constants, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_STATE_RUN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATE_RUN, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PYTHON_SUSPEND); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PYTHON_SUSPEND, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_IS_JYTHON); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IS_JYTHON, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_IS_IRONPYTHON); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IS_IRONPYTHON, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":12
+ * # ENDIF
+ *
+ * version = 4 # <<<<<<<<<<<<<<
+ *
+ * if not hasattr(sys, '_current_frames'):
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_int_4) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":14
+ * version = 4
+ *
+ * if not hasattr(sys, '_current_frames'): # <<<<<<<<<<<<<<
+ *
+ * # Some versions of Jython don't have it (but we can provide a replacement)
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_current_frames); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
+ if (__pyx_t_4) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":17
+ *
+ * # Some versions of Jython don't have it (but we can provide a replacement)
+ * if IS_JYTHON: # <<<<<<<<<<<<<<
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_IS_JYTHON); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 17, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_4) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":18
+ * # Some versions of Jython don't have it (but we can provide a replacement)
+ * if IS_JYTHON:
+ * from java.lang import NoSuchFieldException # <<<<<<<<<<<<<<
+ * from org.python.core import ThreadStateMapping
+ * try:
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_NoSuchFieldException);
+ __Pyx_GIVEREF(__pyx_n_s_NoSuchFieldException);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_NoSuchFieldException);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_java_lang, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_NoSuchFieldException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_NoSuchFieldException, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":19
+ * if IS_JYTHON:
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping # <<<<<<<<<<<<<<
+ * try:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_ThreadStateMapping);
+ __Pyx_GIVEREF(__pyx_n_s_ThreadStateMapping);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ThreadStateMapping);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_org_python_core, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ThreadStateMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ThreadStateMapping, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":20
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping
+ * try: # <<<<<<<<<<<<<<
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_7);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":21
+ * from org.python.core import ThreadStateMapping
+ * try:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version # <<<<<<<<<<<<<<
+ * except NoSuchFieldException:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ThreadStateMapping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getDeclaredField); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_cachedThreadState, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L4_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":20
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping
+ * try: # <<<<<<<<<<<<<<
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L9_try_end;
+ __pyx_L4_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":22
+ * try:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException: # <<<<<<<<<<<<<<
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ * cachedThreadState.accessible = True
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_NoSuchFieldException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_8) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 22, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_9);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":23
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0 # <<<<<<<<<<<<<<
+ * cachedThreadState.accessible = True
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ */
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_ThreadStateMapping); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 23, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_getDeclaredField); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 23, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 23, __pyx_L6_except_error)
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_cachedThreadState, __pyx_t_10) < 0) __PYX_ERR(0, 23, __pyx_L6_except_error)
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L5_exception_handled;
+ }
+ goto __pyx_L6_except_error;
+ __pyx_L6_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":20
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping
+ * try: # <<<<<<<<<<<<<<
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ * except NoSuchFieldException:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ goto __pyx_L1_error;
+ __pyx_L5_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __pyx_L9_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":24
+ * except NoSuchFieldException:
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ * cachedThreadState.accessible = True # <<<<<<<<<<<<<<
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ *
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_cachedThreadState); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_t_9, __pyx_n_s_accessible, Py_True) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":25
+ * cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ * cachedThreadState.accessible = True
+ * thread_states = cachedThreadState.get(ThreadStateMapping) # <<<<<<<<<<<<<<
+ *
+ * def _current_frames():
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_cachedThreadState); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ThreadStateMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_10) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_1};
+ __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_1};
+ __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_thread_states, __pyx_t_9) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":27
+ * thread_states = cachedThreadState.get(ThreadStateMapping)
+ *
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * as_array = thread_states.entrySet().toArray()
+ * ret = {}
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_1_current_frames, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 27, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_current_frames, __pyx_t_9) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":17
+ *
+ * # Some versions of Jython don't have it (but we can provide a replacement)
+ * if IS_JYTHON: # <<<<<<<<<<<<<<
+ * from java.lang import NoSuchFieldException
+ * from org.python.core import ThreadStateMapping
+ */
+ goto __pyx_L3;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":45
+ * return ret
+ *
+ * elif IS_IRONPYTHON: # <<<<<<<<<<<<<<
+ * _tid_to_last_frame = {}
+ *
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_IS_IRONPYTHON); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 45, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (__pyx_t_4) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":46
+ *
+ * elif IS_IRONPYTHON:
+ * _tid_to_last_frame = {} # <<<<<<<<<<<<<<
+ *
+ * # IronPython doesn't have it. Let's use our workaround...
+ */
+ __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 46, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_tid_to_last_frame, __pyx_t_9) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":49
+ *
+ * # IronPython doesn't have it. Let's use our workaround...
+ * def _current_frames(): # <<<<<<<<<<<<<<
+ * return _tid_to_last_frame
+ *
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_3_current_frames, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_current_frames, __pyx_t_9) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":45
+ * return ret
+ *
+ * elif IS_IRONPYTHON: # <<<<<<<<<<<<<<
+ * _tid_to_last_frame = {}
+ *
+ */
+ goto __pyx_L3;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":53
+ *
+ * else:
+ * raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).') # <<<<<<<<<<<<<<
+ * else:
+ * _current_frames = sys._current_frames
+ */
+ /*else*/ {
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 53, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_Raise(__pyx_t_9, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __PYX_ERR(0, 53, __pyx_L1_error)
+ }
+ __pyx_L3:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":14
+ * version = 4
+ *
+ * if not hasattr(sys, '_current_frames'): # <<<<<<<<<<<<<<
+ *
+ * # Some versions of Jython don't have it (but we can provide a replacement)
+ */
+ goto __pyx_L2;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":55
+ * raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).')
+ * else:
+ * _current_frames = sys._current_frames # <<<<<<<<<<<<<<
+ *
+ * #=======================================================================================================================
+ */
+ /*else*/ {
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_current_frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_current_frames, __pyx_t_2) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+ __pyx_L2:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":129
+ * self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+ *
+ * import linecache # <<<<<<<<<<<<<<
+ * import os.path
+ * import re
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_linecache, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_linecache, __pyx_t_2) < 0) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":130
+ *
+ * import linecache
+ * import os.path # <<<<<<<<<<<<<<
+ * import re
+ * import sys
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_os_path, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":131
+ * import linecache
+ * import os.path
+ * import re # <<<<<<<<<<<<<<
+ * import sys
+ * import traceback # @Reimport
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_re, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":132
+ * import os.path
+ * import re
+ * import sys # <<<<<<<<<<<<<<
+ * import traceback # @Reimport
+ *
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":133
+ * import re
+ * import sys
+ * import traceback # @Reimport # <<<<<<<<<<<<<<
+ *
+ * from _pydev_bundle import pydev_log
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_2) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":135
+ * import traceback # @Reimport
+ *
+ * from _pydev_bundle import pydev_log # <<<<<<<<<<<<<<
+ * from _pydevd_bundle import pydevd_dont_trace
+ * from _pydevd_bundle import pydevd_vars
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_pydev_log);
+ __Pyx_GIVEREF(__pyx_n_s_pydev_log);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_pydev_log);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydev_bundle, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_pydev_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydev_log, __pyx_t_2) < 0) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":136
+ *
+ * from _pydev_bundle import pydev_log
+ * from _pydevd_bundle import pydevd_dont_trace # <<<<<<<<<<<<<<
+ * from _pydevd_bundle import pydevd_vars
+ * from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_pydevd_dont_trace);
+ __Pyx_GIVEREF(__pyx_n_s_pydevd_dont_trace);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_pydevd_dont_trace);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle, __pyx_t_9, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_pydevd_dont_trace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydevd_dont_trace, __pyx_t_9) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":137
+ * from _pydev_bundle import pydev_log
+ * from _pydevd_bundle import pydevd_dont_trace
+ * from _pydevd_bundle import pydevd_vars # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
+ * from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_pydevd_vars);
+ __Pyx_GIVEREF(__pyx_n_s_pydevd_vars);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_pydevd_vars);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_pydevd_vars); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydevd_vars, __pyx_t_2) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":138
+ * from _pydevd_bundle import pydevd_dont_trace
+ * from _pydevd_bundle import pydevd_vars
+ * from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \
+ * CMD_STEP_INTO, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO_MY_CODE
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_get_exception_breakpoint);
+ __Pyx_GIVEREF(__pyx_n_s_get_exception_breakpoint);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_get_exception_breakpoint);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_breakpoint, __pyx_t_9, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_exception_breakpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_exception_breakpoint, __pyx_t_9) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":139
+ * from _pydevd_bundle import pydevd_vars
+ * from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
+ * from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \ # <<<<<<<<<<<<<<
+ * CMD_STEP_INTO, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO_MY_CODE
+ * from _pydevd_bundle.pydevd_constants import STATE_SUSPEND, get_thread_id, STATE_RUN, dict_iter_values, IS_PY3K, \
+ */
+ __pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION);
+ __Pyx_INCREF(__pyx_n_s_CMD_STEP_RETURN);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_STEP_RETURN);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_CMD_STEP_RETURN);
+ __Pyx_INCREF(__pyx_n_s_CMD_STEP_OVER);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_STEP_OVER);
+ PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_CMD_STEP_OVER);
+ __Pyx_INCREF(__pyx_n_s_CMD_SET_BREAK);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_SET_BREAK);
+ PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_CMD_SET_BREAK);
+ __Pyx_INCREF(__pyx_n_s_CMD_STEP_INTO);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_STEP_INTO);
+ PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_CMD_STEP_INTO);
+ __Pyx_INCREF(__pyx_n_s_CMD_SMART_STEP_INTO);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_SMART_STEP_INTO);
+ PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_CMD_SMART_STEP_INTO);
+ __Pyx_INCREF(__pyx_n_s_CMD_RUN_TO_LINE);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_RUN_TO_LINE);
+ PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_CMD_RUN_TO_LINE);
+ __Pyx_INCREF(__pyx_n_s_CMD_SET_NEXT_STATEMENT);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_SET_NEXT_STATEMENT);
+ PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_CMD_SET_NEXT_STATEMENT);
+ __Pyx_INCREF(__pyx_n_s_CMD_STEP_INTO_MY_CODE);
+ __Pyx_GIVEREF(__pyx_n_s_CMD_STEP_INTO_MY_CODE);
+ PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_CMD_STEP_INTO_MY_CODE);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_comm, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_STEP_CAUGHT_EXCEPTION, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_STEP_RETURN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_STEP_RETURN, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_STEP_OVER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_STEP_OVER, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_SET_BREAK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_SET_BREAK, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_STEP_INTO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_STEP_INTO, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_SMART_STEP_INTO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_SMART_STEP_INTO, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_RUN_TO_LINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_RUN_TO_LINE, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_SET_NEXT_STATEMENT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_SET_NEXT_STATEMENT, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CMD_STEP_INTO_MY_CODE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CMD_STEP_INTO_MY_CODE, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":141
+ * from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \
+ * CMD_STEP_INTO, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO_MY_CODE
+ * from _pydevd_bundle.pydevd_constants import STATE_SUSPEND, get_thread_id, STATE_RUN, dict_iter_values, IS_PY3K, \ # <<<<<<<<<<<<<<
+ * RETURN_VALUES_DICT
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE
+ */
+ __pyx_t_9 = PyList_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_STATE_SUSPEND);
+ __Pyx_GIVEREF(__pyx_n_s_STATE_SUSPEND);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_STATE_SUSPEND);
+ __Pyx_INCREF(__pyx_n_s_get_thread_id);
+ __Pyx_GIVEREF(__pyx_n_s_get_thread_id);
+ PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_get_thread_id);
+ __Pyx_INCREF(__pyx_n_s_STATE_RUN);
+ __Pyx_GIVEREF(__pyx_n_s_STATE_RUN);
+ PyList_SET_ITEM(__pyx_t_9, 2, __pyx_n_s_STATE_RUN);
+ __Pyx_INCREF(__pyx_n_s_dict_iter_values);
+ __Pyx_GIVEREF(__pyx_n_s_dict_iter_values);
+ PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_s_dict_iter_values);
+ __Pyx_INCREF(__pyx_n_s_IS_PY3K);
+ __Pyx_GIVEREF(__pyx_n_s_IS_PY3K);
+ PyList_SET_ITEM(__pyx_t_9, 4, __pyx_n_s_IS_PY3K);
+ __Pyx_INCREF(__pyx_n_s_RETURN_VALUES_DICT);
+ __Pyx_GIVEREF(__pyx_n_s_RETURN_VALUES_DICT);
+ PyList_SET_ITEM(__pyx_t_9, 5, __pyx_n_s_RETURN_VALUES_DICT);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_constants, __pyx_t_9, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_STATE_SUSPEND); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATE_SUSPEND, __pyx_t_9) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_thread_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_thread_id, __pyx_t_9) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_STATE_RUN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATE_RUN, __pyx_t_9) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dict_iter_values); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_dict_iter_values, __pyx_t_9) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_IS_PY3K); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IS_PY3K, __pyx_t_9) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RETURN_VALUES_DICT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 141, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RETURN_VALUES_DICT, __pyx_t_9) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":143
+ * from _pydevd_bundle.pydevd_constants import STATE_SUSPEND, get_thread_id, STATE_RUN, dict_iter_values, IS_PY3K, \
+ * RETURN_VALUES_DICT
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ */
+ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_DONT_TRACE);
+ __Pyx_GIVEREF(__pyx_n_s_DONT_TRACE);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DONT_TRACE);
+ __Pyx_INCREF(__pyx_n_s_PYDEV_FILE);
+ __Pyx_GIVEREF(__pyx_n_s_PYDEV_FILE);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_PYDEV_FILE);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_dont_trace, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DONT_TRACE, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_PYDEV_FILE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PYDEV_FILE, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":144
+ * RETURN_VALUES_DICT
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE
+ * from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ */
+ __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_add_exception_to_frame);
+ __Pyx_GIVEREF(__pyx_n_s_add_exception_to_frame);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_add_exception_to_frame);
+ __Pyx_INCREF(__pyx_n_s_just_raised);
+ __Pyx_GIVEREF(__pyx_n_s_just_raised);
+ PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_just_raised);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_frame_util, __pyx_t_9, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_add_exception_to_frame); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_exception_to_frame, __pyx_t_9) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_just_raised); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_just_raised, __pyx_t_9) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":145
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE
+ * from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code # <<<<<<<<<<<<<<
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ * try:
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_get_clsname_for_code);
+ __Pyx_GIVEREF(__pyx_n_s_get_clsname_for_code);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_clsname_for_code);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_utils, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 145, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_get_clsname_for_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_clsname_for_code, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":146
+ * from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame # <<<<<<<<<<<<<<
+ * try:
+ * from inspect import CO_GENERATOR
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 146, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ __Pyx_GIVEREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_get_abs_path_real_path_and_base);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_file_utils, __pyx_t_9, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 146, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_abs_path_real_path_and_base, __pyx_t_9) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":147
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ * try: # <<<<<<<<<<<<<<
+ * from inspect import CO_GENERATOR
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_5);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":148
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ * try:
+ * from inspect import CO_GENERATOR # <<<<<<<<<<<<<<
+ * except:
+ * CO_GENERATOR = 0
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L12_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_CO_GENERATOR);
+ __Pyx_GIVEREF(__pyx_n_s_CO_GENERATOR);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CO_GENERATOR);
+ __pyx_t_9 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, __pyx_t_2, -1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L12_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_CO_GENERATOR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L12_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CO_GENERATOR, __pyx_t_2) < 0) __PYX_ERR(0, 148, __pyx_L12_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":147
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ * try: # <<<<<<<<<<<<<<
+ * from inspect import CO_GENERATOR
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L17_try_end;
+ __pyx_L12_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":149
+ * try:
+ * from inspect import CO_GENERATOR
+ * except: # <<<<<<<<<<<<<<
+ * CO_GENERATOR = 0
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 149, __pyx_L14_except_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_11);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":150
+ * from inspect import CO_GENERATOR
+ * except:
+ * CO_GENERATOR = 0 # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CO_GENERATOR, __pyx_int_0) < 0) __PYX_ERR(0, 150, __pyx_L14_except_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ goto __pyx_L13_exception_handled;
+ }
+ __pyx_L14_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":147
+ * from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+ * try: # <<<<<<<<<<<<<<
+ * from inspect import CO_GENERATOR
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
+ goto __pyx_L1_error;
+ __pyx_L13_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
+ __pyx_L17_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":152
+ * CO_GENERATOR = 0
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_7);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":153
+ *
+ * try:
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace # <<<<<<<<<<<<<<
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs):
+ */
+ __pyx_t_11 = PyList_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_n_s_send_signature_call_trace);
+ __Pyx_GIVEREF(__pyx_n_s_send_signature_call_trace);
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_send_signature_call_trace);
+ __Pyx_INCREF(__pyx_n_s_send_signature_return_trace);
+ __Pyx_GIVEREF(__pyx_n_s_send_signature_return_trace);
+ PyList_SET_ITEM(__pyx_t_11, 1, __pyx_n_s_send_signature_return_trace);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_signature, __pyx_t_11, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_send_signature_call_trace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_signature_call_trace, __pyx_t_11) < 0) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_send_signature_return_trace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_signature_return_trace, __pyx_t_11) < 0) __PYX_ERR(0, 153, __pyx_L20_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":152
+ * CO_GENERATOR = 0
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L25_try_end;
+ __pyx_L20_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":154
+ * try:
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError: # <<<<<<<<<<<<<<
+ * def send_signature_call_trace(*args, **kwargs):
+ * pass
+ */
+ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
+ if (__pyx_t_8) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_11, &__pyx_t_9) < 0) __PYX_ERR(0, 154, __pyx_L22_except_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GOTREF(__pyx_t_9);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":155
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_5send_signature_call_trace, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L22_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_signature_call_trace, __pyx_t_1) < 0) __PYX_ERR(0, 155, __pyx_L22_except_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L21_exception_handled;
+ }
+ goto __pyx_L22_except_error;
+ __pyx_L22_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":152
+ * CO_GENERATOR = 0
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+ * except ImportError:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ goto __pyx_L1_error;
+ __pyx_L21_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __pyx_L25_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":158
+ * pass
+ *
+ * basename = os.path.basename # <<<<<<<<<<<<<<
+ *
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 158, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_path); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 158, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_basename); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 158, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_basename, __pyx_t_9) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":160
+ * basename = os.path.basename
+ *
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException') # <<<<<<<<<<<<<<
+ * DEBUG_START = ('pydevd.py', 'run')
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_re); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 160, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_compile); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 160, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 160, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IGNORE_EXCEPTION_TAG, __pyx_t_9) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":161
+ *
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+ * DEBUG_START = ('pydevd.py', 'run') # <<<<<<<<<<<<<<
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py'
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_START, __pyx_tuple__15) < 0) __PYX_ERR(0, 161, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":162
+ * IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+ * DEBUG_START = ('pydevd.py', 'run')
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile') # <<<<<<<<<<<<<<
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py'
+ * get_file_type = DONT_TRACE.get
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_START_PY3K, __pyx_tuple__16) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":163
+ * DEBUG_START = ('pydevd.py', 'run')
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py' # <<<<<<<<<<<<<<
+ * get_file_type = DONT_TRACE.get
+ *
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TRACE_PROPERTY, __pyx_kp_s_pydevd_traceproperty_py) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":164
+ * DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+ * TRACE_PROPERTY = 'pydevd_traceproperty.py'
+ * get_file_type = DONT_TRACE.get # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 164, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_get); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 164, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_file_type, __pyx_t_11) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":167
+ *
+ *
+ * def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value): # <<<<<<<<<<<<<<
+ * condition = breakpoint.condition
+ * try:
+ */
+ __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_7handle_breakpoint_condition, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_handle_breakpoint_condition, __pyx_t_11) < 0) __PYX_ERR(0, 167, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":203
+ *
+ *
+ * def handle_breakpoint_expression(breakpoint, info, new_frame): # <<<<<<<<<<<<<<
+ * try:
+ * try:
+ */
+ __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_9handle_breakpoint_expression, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 203, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_handle_breakpoint_expression, __pyx_t_11) < 0) __PYX_ERR(0, 203, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":232
+ * #Same thing in the main debugger but only considering the file contents, while the one in the main debugger
+ * #considers the user input (so, the actual result must be a join of both).
+ * filename_to_lines_where_exceptions_are_ignored = {} # <<<<<<<<<<<<<<
+ * filename_to_stat_info = {}
+ *
+ */
+ __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 232, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame->tp_dict, __pyx_n_s_filename_to_lines_where_exceptio, __pyx_t_11) < 0) __PYX_ERR(0, 232, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ PyType_Modified(__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":233
+ * #considers the user input (so, the actual result must be a join of both).
+ * filename_to_lines_where_exceptions_are_ignored = {}
+ * filename_to_stat_info = {} # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 233, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame->tp_dict, __pyx_n_s_filename_to_stat_info, __pyx_t_11) < 0) __PYX_ERR(0, 233, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ PyType_Modified(__pyx_ptype_14_pydevd_bundle_13pydevd_cython_PyDBFrame);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":910
+ * #end trace_dispatch
+ *
+ * import traceback # <<<<<<<<<<<<<<
+ *
+ * from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+ */
+ __pyx_t_11 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_11) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":912
+ * import traceback
+ *
+ * from _pydev_bundle.pydev_is_thread_alive import is_thread_alive # <<<<<<<<<<<<<<
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+ */
+ __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 912, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_n_s_is_thread_alive);
+ __Pyx_GIVEREF(__pyx_n_s_is_thread_alive);
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_is_thread_alive);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydev_bundle_pydev_is_thread_al, __pyx_t_11, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 912, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_is_thread_alive); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 912, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_thread_alive, __pyx_t_11) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":913
+ *
+ * from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+ * from _pydev_imps._pydev_saved_modules import threading # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 913, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_threading);
+ __Pyx_GIVEREF(__pyx_n_s_threading);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_threading);
+ __pyx_t_11 = __Pyx_Import(__pyx_n_s_pydev_imps__pydev_saved_modules, __pyx_t_9, -1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 913, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_11, __pyx_n_s_threading); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 913, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_9) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":914
+ * from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+ */
+ __pyx_t_11 = PyList_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_n_s_get_thread_id);
+ __Pyx_GIVEREF(__pyx_n_s_get_thread_id);
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_get_thread_id);
+ __Pyx_INCREF(__pyx_n_s_IS_IRONPYTHON);
+ __Pyx_GIVEREF(__pyx_n_s_IS_IRONPYTHON);
+ PyList_SET_ITEM(__pyx_t_11, 1, __pyx_n_s_IS_IRONPYTHON);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_constants, __pyx_t_11, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_get_thread_id); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_thread_id, __pyx_t_11) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_IS_IRONPYTHON); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IS_IRONPYTHON, __pyx_t_11) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":915
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 915, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_DONT_TRACE);
+ __Pyx_GIVEREF(__pyx_n_s_DONT_TRACE);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_DONT_TRACE);
+ __pyx_t_11 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_dont_trace, __pyx_t_9, -1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_11, __pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 915, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DONT_TRACE, __pyx_t_9) < 0) __PYX_ERR(0, 915, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":916
+ * from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads # <<<<<<<<<<<<<<
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ * from pydevd_tracing import SetTrace
+ */
+ __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_n_s_kill_all_pydev_threads);
+ __Pyx_GIVEREF(__pyx_n_s_kill_all_pydev_threads);
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_kill_all_pydev_threads);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_kill_all_p, __pyx_t_11, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 916, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_kill_all_pydev_threads); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_kill_all_pydev_threads, __pyx_t_11) < 0) __PYX_ERR(0, 916, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":917
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER # <<<<<<<<<<<<<<
+ * from pydevd_tracing import SetTrace
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ __Pyx_GIVEREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_get_abs_path_real_path_and_base);
+ __Pyx_INCREF(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ __Pyx_GIVEREF(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ __pyx_t_11 = __Pyx_Import(__pyx_n_s_pydevd_file_utils, __pyx_t_9, -1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_11, __pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_abs_path_real_path_and_base, __pyx_t_9) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_11, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER, __pyx_t_9) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":918
+ * from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ * from pydevd_tracing import SetTrace # <<<<<<<<<<<<<<
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ * # In Cython, PyDBAdditionalThreadInfo is bundled in the file.
+ */
+ __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 918, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_n_s_SetTrace);
+ __Pyx_GIVEREF(__pyx_n_s_SetTrace);
+ PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_SetTrace);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_tracing, __pyx_t_11, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 918, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_SetTrace); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 918, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SetTrace, __pyx_t_11) < 0) __PYX_ERR(0, 918, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":928
+ * # ENDIF
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_5);
+ /*try:*/ {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":929
+ *
+ * try:
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace # <<<<<<<<<<<<<<
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs):
+ */
+ __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 929, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_n_s_send_signature_call_trace);
+ __Pyx_GIVEREF(__pyx_n_s_send_signature_call_trace);
+ PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_send_signature_call_trace);
+ __pyx_t_11 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_signature, __pyx_t_9, -1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 929, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_11, __pyx_n_s_send_signature_call_trace); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 929, __pyx_L28_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_signature_call_trace, __pyx_t_9) < 0) __PYX_ERR(0, 929, __pyx_L28_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":928
+ * # ENDIF
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L33_try_end;
+ __pyx_L28_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":930
+ * try:
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError: # <<<<<<<<<<<<<<
+ * def send_signature_call_trace(*args, **kwargs):
+ * pass
+ */
+ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
+ if (__pyx_t_8) {
+ __Pyx_AddTraceback("_pydevd_bundle.pydevd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(0, 930, __pyx_L30_except_error)
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_2);
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":931
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ * def send_signature_call_trace(*args, **kwargs): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_11send_signature_call_trace, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L30_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_signature_call_trace, __pyx_t_1) < 0) __PYX_ERR(0, 931, __pyx_L30_except_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L29_exception_handled;
+ }
+ goto __pyx_L30_except_error;
+ __pyx_L30_except_error:;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":928
+ * # ENDIF
+ *
+ * try: # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+ * except ImportError:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
+ goto __pyx_L1_error;
+ __pyx_L29_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
+ __pyx_L33_try_end:;
+ }
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":934
+ * pass
+ *
+ * threadingCurrentThread = threading.currentThread # <<<<<<<<<<<<<<
+ * get_file_type = DONT_TRACE.get
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_currentThread); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 934, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_threadingCurrentThread, __pyx_t_9) < 0) __PYX_ERR(0, 934, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":935
+ *
+ * threadingCurrentThread = threading.currentThread
+ * get_file_type = DONT_TRACE.get # <<<<<<<<<<<<<<
+ *
+ * # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 935, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_file_type, __pyx_t_2) < 0) __PYX_ERR(0, 935, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":948
+ * # - Breakpoints are changed
+ * # It can be used when running regularly (without step over/step in/step return)
+ * global_cache_skips = {} # <<<<<<<<<<<<<<
+ * global_cache_frame_skips = {}
+ *
+ */
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_global_cache_skips, __pyx_t_2) < 0) __PYX_ERR(0, 948, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":949
+ * # It can be used when running regularly (without step over/step in/step return)
+ * global_cache_skips = {}
+ * global_cache_frame_skips = {} # <<<<<<<<<<<<<<
+ *
+ * def trace_dispatch(py_db, frame, event, arg):
+ */
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_global_cache_frame_skips, __pyx_t_2) < 0) __PYX_ERR(0, 949, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":951
+ * global_cache_frame_skips = {}
+ *
+ * def trace_dispatch(py_db, frame, event, arg): # <<<<<<<<<<<<<<
+ * t = threadingCurrentThread()
+ *
+ */
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_13trace_dispatch, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_trace_dispatch, __pyx_t_2) < 0) __PYX_ERR(0, 951, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1121
+ *
+ *
+ * if IS_IRONPYTHON: # <<<<<<<<<<<<<<
+ * # This is far from ideal, as we'll leak frames (we'll always have the last created frame, not really
+ * # the last topmost frame saved -- this should be Ok for our usage, but it may leak frames and things
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_IS_IRONPYTHON); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1121, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_4) {
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1129
+ * #
+ * # See: https://github.com/IronLanguages/main/issues/1630
+ * from _pydevd_bundle.pydevd_additional_thread_info_regular import _tid_to_last_frame # <<<<<<<<<<<<<<
+ *
+ * _original_call = ThreadTracer.__call__
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_tid_to_last_frame);
+ __Pyx_GIVEREF(__pyx_n_s_tid_to_last_frame);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_tid_to_last_frame);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_additional, __pyx_t_2, -1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_tid_to_last_frame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_tid_to_last_frame, __pyx_t_2) < 0) __PYX_ERR(0, 1129, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1131
+ * from _pydevd_bundle.pydevd_additional_thread_info_regular import _tid_to_last_frame
+ *
+ * _original_call = ThreadTracer.__call__ # <<<<<<<<<<<<<<
+ *
+ * def __call__(self, frame, event, arg):
+ */
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer), __pyx_n_s_call_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1131, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_original_call, __pyx_t_9) < 0) __PYX_ERR(0, 1131, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1133
+ * _original_call = ThreadTracer.__call__
+ *
+ * def __call__(self, frame, event, arg): # <<<<<<<<<<<<<<
+ * _tid_to_last_frame[self._args[1].ident] = frame
+ * return _original_call(self, frame, event, arg)
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_15__call__, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1133, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_call_2, __pyx_t_9) < 0) __PYX_ERR(0, 1133, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1137
+ * return _original_call(self, frame, event, arg)
+ *
+ * ThreadTracer.__call__ = __call__ # <<<<<<<<<<<<<<
+ *
+ */
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_call_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1137, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_14_pydevd_bundle_13pydevd_cython_ThreadTracer), __pyx_n_s_call_2, __pyx_t_9) < 0) __PYX_ERR(0, 1137, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1121
+ *
+ *
+ * if IS_IRONPYTHON: # <<<<<<<<<<<<<<
+ * # This is far from ideal, as we'll leak frames (we'll always have the last created frame, not really
+ * # the last topmost frame saved -- this should be Ok for our usage, but it may leak frames and things
+ */
+ }
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_PyDBAdditionalThreadInfo(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0xa9a4341:
+ * from pickle import PickleError
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_17__pyx_unpickle_PyDBAdditionalThreadInfo, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_PyDBAdditionalThr, __pyx_t_9) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_PyDBAdditionalThreadInfo__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_PyDBAdditionalThreadInfo__set_state(PyDBAdditionalThreadInfo result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.conditional_breakpoint_exception = __pyx_state[0]; result.is_tracing = __pyx_state[1]; result.pydev_call_from_jinja2 = __pyx_state[2]; result.pydev_call_inside_jinja2 = __pyx_state[3]; result.pydev_django_resolve_frame = __pyx_state[4]; result.pydev_func_name = __pyx_state[5]; result.pydev_message = __pyx_state[6]; result.pydev_next_line = __pyx_state[7]; result.pydev_notify_kill = __pyx_state[8]; result.pydev_smart_step_stop = __pyx_state[9]; result.pydev_state = __pyx_state[10]; result.pydev_step_cmd = __pyx_state[11]; result.pydev_step_stop = __pyx_state[12]; result.suspend_type = __pyx_state[13]
+ * if hasattr(result, '__dict__'):
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_19__pyx_unpickle_PyDBFrame, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_PyDBFrame, __pyx_t_9) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "(tree fragment)":1
+ * def __pyx_unpickle_SafeCallWrapper(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
+ * if __pyx_checksum != 0x77c077b:
+ * from pickle import PickleError
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_21__pyx_unpickle_SafeCallWrapper, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SafeCallWrapper, __pyx_t_9) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "(tree fragment)":9
+ * __pyx_unpickle_SafeCallWrapper__set_state( result, __pyx_state)
+ * return result
+ * cdef __pyx_unpickle_SafeCallWrapper__set_state(SafeCallWrapper result, tuple __pyx_state): # <<<<<<<<<<<<<<
+ * result.method_object = __pyx_state[0]
+ * if hasattr(result, '__dict__'):
+ */
+ __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_14_pydevd_bundle_13pydevd_cython_23__pyx_unpickle_ThreadTracer, NULL, __pyx_n_s_pydevd_bundle_pydevd_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ThreadTracer, __pyx_t_9) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /* "_pydevd_bundle/pydevd_cython.pyx":1
+ * # Important: Autogenerated file. # <<<<<<<<<<<<<<
+ *
+ * # DO NOT edit manually!
+ */
+ __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_9) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_11);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init _pydevd_bundle.pydevd_cython", 0, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init _pydevd_bundle.pydevd_cython");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+/* Refnanny */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+/* GetBuiltinName */
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+/* GetModuleGlobalName */
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if !CYTHON_AVOID_BORROWED_REFS
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+/* PyCFunctionFastCall */
+ #if CYTHON_FAST_PYCCALL
+static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
+ PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
+ PyCFunction meth = PyCFunction_GET_FUNCTION(func);
+ PyObject *self = PyCFunction_GET_SELF(func);
+ int flags = PyCFunction_GET_FLAGS(func);
+ assert(PyCFunction_Check(func));
+ assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
+ assert(nargs >= 0);
+ assert(nargs == 0 || args != NULL);
+ /* _PyCFunction_FastCallDict() must not be called with an exception set,
+ because it may clear it (directly or indirectly) and so the
+ caller loses its exception */
+ assert(!PyErr_Occurred());
+ if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
+ return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
+ } else {
+ return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
+ }
+}
+#endif
+
+/* PyFunctionFastCall */
+ #if CYTHON_FAST_PYCALL
+#include "frameobject.h"
+static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
+ PyObject *globals) {
+ PyFrameObject *f;
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject **fastlocals;
+ Py_ssize_t i;
+ PyObject *result;
+ assert(globals != NULL);
+ /* XXX Perhaps we should create a specialized
+ PyFrame_New() that doesn't take locals, but does
+ take builtins without sanity checking them.
+ */
+ assert(tstate != NULL);
+ f = PyFrame_New(tstate, co, globals, NULL);
+ if (f == NULL) {
+ return NULL;
+ }
+ fastlocals = f->f_localsplus;
+ for (i = 0; i < na; i++) {
+ Py_INCREF(*args);
+ fastlocals[i] = *args++;
+ }
+ result = PyEval_EvalFrameEx(f,0);
+ ++tstate->recursion_depth;
+ Py_DECREF(f);
+ --tstate->recursion_depth;
+ return result;
+}
+#if 1 || PY_VERSION_HEX < 0x030600B1
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
+ PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
+ PyObject *globals = PyFunction_GET_GLOBALS(func);
+ PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
+ PyObject *closure;
+#if PY_MAJOR_VERSION >= 3
+ PyObject *kwdefs;
+#endif
+ PyObject *kwtuple, **k;
+ PyObject **d;
+ Py_ssize_t nd;
+ Py_ssize_t nk;
+ PyObject *result;
+ assert(kwargs == NULL || PyDict_Check(kwargs));
+ nk = kwargs ? PyDict_Size(kwargs) : 0;
+ if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
+ return NULL;
+ }
+ if (
+#if PY_MAJOR_VERSION >= 3
+ co->co_kwonlyargcount == 0 &&
+#endif
+ likely(kwargs == NULL || nk == 0) &&
+ co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
+ if (argdefs == NULL && co->co_argcount == nargs) {
+ result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
+ goto done;
+ }
+ else if (nargs == 0 && argdefs != NULL
+ && co->co_argcount == Py_SIZE(argdefs)) {
+ /* function called with no arguments, but all parameters have
+ a default value: use default values as arguments .*/
+ args = &PyTuple_GET_ITEM(argdefs, 0);
+ result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
+ goto done;
+ }
+ }
+ if (kwargs != NULL) {
+ Py_ssize_t pos, i;
+ kwtuple = PyTuple_New(2 * nk);
+ if (kwtuple == NULL) {
+ result = NULL;
+ goto done;
+ }
+ k = &PyTuple_GET_ITEM(kwtuple, 0);
+ pos = i = 0;
+ while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
+ Py_INCREF(k[i]);
+ Py_INCREF(k[i+1]);
+ i += 2;
+ }
+ nk = i / 2;
+ }
+ else {
+ kwtuple = NULL;
+ k = NULL;
+ }
+ closure = PyFunction_GET_CLOSURE(func);
+#if PY_MAJOR_VERSION >= 3
+ kwdefs = PyFunction_GET_KW_DEFAULTS(func);
+#endif
+ if (argdefs != NULL) {
+ d = &PyTuple_GET_ITEM(argdefs, 0);
+ nd = Py_SIZE(argdefs);
+ }
+ else {
+ d = NULL;
+ nd = 0;
+ }
+#if PY_MAJOR_VERSION >= 3
+ result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
+ args, nargs,
+ k, (int)nk,
+ d, (int)nd, kwdefs, closure);
+#else
+ result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
+ args, nargs,
+ k, (int)nk,
+ d, (int)nd, closure);
+#endif
+ Py_XDECREF(kwtuple);
+done:
+ Py_LeaveRecursiveCall();
+ return result;
+}
+#endif
+#endif
+
+/* PyObjectCall */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+/* PyObjectCallMethO */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+/* PyObjectCallOneArg */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(func)) {
+ return __Pyx_PyFunction_FastCall(func, &arg, 1);
+ }
+#endif
+ if (likely(PyCFunction_Check(func))) {
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+#if CYTHON_FAST_PYCCALL
+ } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
+ return __Pyx_PyCFunction_FastCall(func, &arg, 1);
+#endif
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_Pack(1, arg);
+ if (unlikely(!args)) return NULL;
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+#endif
+
+/* PyObjectCallNoArg */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(func)) {
+ return __Pyx_PyFunction_FastCall(func, NULL, 0);
+ }
+#endif
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+/* RaiseArgTupleInvalid */
+ static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+/* KeywordStringCheck */
+ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
+ PyObject *kwdict,
+ const char* function_name,
+ int kw_allowed)
+{
+ PyObject* key = 0;
+ Py_ssize_t pos = 0;
+#if CYTHON_COMPILING_IN_PYPY
+ if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
+ goto invalid_keyword;
+ return 1;
+#else
+ while (PyDict_Next(kwdict, &pos, &key, 0)) {
+ #if PY_MAJOR_VERSION < 3
+ if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
+ #endif
+ if (unlikely(!PyUnicode_Check(key)))
+ goto invalid_keyword_type;
+ }
+ if ((!kw_allowed) && unlikely(key))
+ goto invalid_keyword;
+ return 1;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ return 0;
+#endif
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+ return 0;
+}
+
+/* GetAttr */
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+ if (likely(PyUnicode_Check(n)))
+#else
+ if (likely(PyString_Check(n)))
+#endif
+ return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+ return PyObject_GetAttr(o, n);
+}
+
+/* GetAttr3 */
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
+ PyObject *r = __Pyx_GetAttr(o, n);
+ if (unlikely(!r)) {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+ goto bad;
+ PyErr_Clear();
+ r = d;
+ Py_INCREF(d);
+ }
+ return r;
+bad:
+ return NULL;
+}
+
+/* RaiseDoubleKeywords */
+ static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+/* ParseKeywords */
+ static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+/* SaveResetException */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+}
+static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+}
+#endif
+
+/* GetException */
+ #if CYTHON_FAST_THREAD_STATE
+static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+#else
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+#endif
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_FAST_THREAD_STATE
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_FAST_THREAD_STATE
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_FAST_THREAD_STATE
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+/* HasAttr */
+ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
+ PyObject *r;
+ if (unlikely(!__Pyx_PyBaseString_Check(n))) {
+ PyErr_SetString(PyExc_TypeError,
+ "hasattr(): attribute name must be string");
+ return -1;
+ }
+ r = __Pyx_GetAttr(o, n);
+ if (unlikely(!r)) {
+ PyErr_Clear();
+ return 0;
+ } else {
+ Py_DECREF(r);
+ return 1;
+ }
+}
+
+/* RaiseTooManyValuesToUnpack */
+ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+ PyErr_Format(PyExc_ValueError,
+ "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
+}
+
+/* RaiseNeedMoreValuesToUnpack */
+ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+ PyErr_Format(PyExc_ValueError,
+ "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
+ index, (index == 1) ? "" : "s");
+}
+
+/* IterFinish */
+ static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_FAST_THREAD_STATE
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* exc_type = tstate->curexc_type;
+ if (unlikely(exc_type)) {
+ if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+ PyObject *exc_value, *exc_tb;
+ exc_value = tstate->curexc_value;
+ exc_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+ Py_DECREF(exc_type);
+ Py_XDECREF(exc_value);
+ Py_XDECREF(exc_tb);
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#else
+ if (unlikely(PyErr_Occurred())) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+ PyErr_Clear();
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#endif
+}
+
+/* UnpackItemEndCheck */
+ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
+ if (unlikely(retval)) {
+ Py_DECREF(retval);
+ __Pyx_RaiseTooManyValuesError(expected);
+ return -1;
+ } else {
+ return __Pyx_IterFinish();
+ }
+ return 0;
+}
+
+/* StringJoin */
+ #if !CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
+ return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
+}
+#endif
+
+/* PyErrFetchRestore */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+}
+static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+}
+#endif
+
+/* SwapException */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = *type;
+ tstate->exc_value = *value;
+ tstate->exc_traceback = *tb;
+ *type = tmp_type;
+ *value = tmp_value;
+ *tb = tmp_tb;
+}
+#else
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
+ PyErr_SetExcInfo(*type, *value, *tb);
+ *type = tmp_type;
+ *value = tmp_value;
+ *tb = tmp_tb;
+}
+#endif
+
+/* GetItemInt */
+ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ Py_ssize_t wrapped_i = i;
+ if (wraparound & unlikely(i < 0)) {
+ wrapped_i += PyList_GET_SIZE(o);
+ }
+ if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, wrapped_i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ Py_ssize_t wrapped_i = i;
+ if (wraparound & unlikely(i < 0)) {
+ wrapped_i += PyTuple_GET_SIZE(o);
+ }
+ if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
+ if (is_list || PyList_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+ if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+ PyObject *r = PyList_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ else if (PyTuple_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ } else {
+ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+ if (likely(m && m->sq_item)) {
+ if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (likely(l >= 0)) {
+ i += l;
+ } else {
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return NULL;
+ PyErr_Clear();
+ }
+ }
+ return m->sq_item(o, i);
+ }
+ }
+#else
+ if (is_list || PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+/* None */
+ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
+ PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
+}
+
+/* ArgTypeTest */
+ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact)
+{
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (none_allowed && obj == Py_None) return 1;
+ else if (exact) {
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
+ }
+ else {
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
+ }
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
+ return 0;
+}
+
+/* BytesEquals */
+ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+ if (s1 == s2) {
+ return (equals == Py_EQ);
+ } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+ const char *ps1, *ps2;
+ Py_ssize_t length = PyBytes_GET_SIZE(s1);
+ if (length != PyBytes_GET_SIZE(s2))
+ return (equals == Py_NE);
+ ps1 = PyBytes_AS_STRING(s1);
+ ps2 = PyBytes_AS_STRING(s2);
+ if (ps1[0] != ps2[0]) {
+ return (equals == Py_NE);
+ } else if (length == 1) {
+ return (equals == Py_EQ);
+ } else {
+ int result;
+#if CYTHON_USE_UNICODE_INTERNALS
+ Py_hash_t hash1, hash2;
+ hash1 = ((PyBytesObject*)s1)->ob_shash;
+ hash2 = ((PyBytesObject*)s2)->ob_shash;
+ if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
+ return (equals == Py_NE);
+ }
+#endif
+ result = memcmp(ps1, ps2, (size_t)length);
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+ return (equals == Py_NE);
+ } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+ return (equals == Py_NE);
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+#endif
+}
+
+/* UnicodeEquals */
+ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+#if PY_MAJOR_VERSION < 3
+ PyObject* owned_ref = NULL;
+#endif
+ int s1_is_unicode, s2_is_unicode;
+ if (s1 == s2) {
+ goto return_eq;
+ }
+ s1_is_unicode = PyUnicode_CheckExact(s1);
+ s2_is_unicode = PyUnicode_CheckExact(s2);
+#if PY_MAJOR_VERSION < 3
+ if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
+ owned_ref = PyUnicode_FromObject(s2);
+ if (unlikely(!owned_ref))
+ return -1;
+ s2 = owned_ref;
+ s2_is_unicode = 1;
+ } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
+ owned_ref = PyUnicode_FromObject(s1);
+ if (unlikely(!owned_ref))
+ return -1;
+ s1 = owned_ref;
+ s1_is_unicode = 1;
+ } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
+ return __Pyx_PyBytes_Equals(s1, s2, equals);
+ }
+#endif
+ if (s1_is_unicode & s2_is_unicode) {
+ Py_ssize_t length;
+ int kind;
+ void *data1, *data2;
+ if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
+ return -1;
+ length = __Pyx_PyUnicode_GET_LENGTH(s1);
+ if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
+ goto return_ne;
+ }
+#if CYTHON_USE_UNICODE_INTERNALS
+ {
+ Py_hash_t hash1, hash2;
+ #if CYTHON_PEP393_ENABLED
+ hash1 = ((PyASCIIObject*)s1)->hash;
+ hash2 = ((PyASCIIObject*)s2)->hash;
+ #else
+ hash1 = ((PyUnicodeObject*)s1)->hash;
+ hash2 = ((PyUnicodeObject*)s2)->hash;
+ #endif
+ if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
+ goto return_ne;
+ }
+ }
+#endif
+ kind = __Pyx_PyUnicode_KIND(s1);
+ if (kind != __Pyx_PyUnicode_KIND(s2)) {
+ goto return_ne;
+ }
+ data1 = __Pyx_PyUnicode_DATA(s1);
+ data2 = __Pyx_PyUnicode_DATA(s2);
+ if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
+ goto return_ne;
+ } else if (length == 1) {
+ goto return_eq;
+ } else {
+ int result = memcmp(data1, data2, (size_t)(length * kind));
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & s2_is_unicode) {
+ goto return_ne;
+ } else if ((s2 == Py_None) & s1_is_unicode) {
+ goto return_ne;
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+return_eq:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ);
+return_ne:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_NE);
+#endif
+}
+
+/* ExtTypeTest */
+ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (likely(PyObject_TypeCheck(obj, type)))
+ return 1;
+ PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
+ Py_TYPE(obj)->tp_name, type->tp_name);
+ return 0;
+}
+
+/* RaiseNoneIterError */
+ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+}
+
+/* PyIntBinop */
+ #if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(op1))) {
+ const long b = intval;
+ long a = PyInt_AS_LONG(op1);
+ return PyInt_FromLong(a & b);
+ }
+ #endif
+ #if CYTHON_USE_PYLONG_INTERNALS
+ if (likely(PyLong_CheckExact(op1))) {
+ const long b = intval;
+ long a, x;
+#ifdef HAVE_LONG_LONG
+ const PY_LONG_LONG llb = intval;
+ PY_LONG_LONG lla, llx;
+#endif
+ const digit* digits = ((PyLongObject*)op1)->ob_digit;
+ const Py_ssize_t size = Py_SIZE(op1);
+ if (likely(__Pyx_sst_abs(size) <= 1)) {
+ a = likely(size) ? digits[0] : 0;
+ if (size == -1) a = -a;
+ } else {
+ switch (size) {
+ case -2:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
+ lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ case 2:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
+ lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ case -3:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
+ lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ case 3:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
+ lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ case -4:
+ if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
+ lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ case 4:
+ if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+#ifdef HAVE_LONG_LONG
+ } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
+ lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+ goto long_long;
+#endif
+ }
+ default: return PyLong_Type.tp_as_number->nb_and(op1, op2);
+ }
+ }
+ x = a & b;
+ return PyLong_FromLong(x);
+#ifdef HAVE_LONG_LONG
+ long_long:
+ llx = lla & llb;
+ return PyLong_FromLongLong(llx);
+#endif
+
+
+ }
+ #endif
+ return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2);
+}
+#endif
+
+/* dict_getitem_default */
+ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
+ PyObject* value;
+#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
+ value = PyDict_GetItemWithError(d, key);
+ if (unlikely(!value)) {
+ if (unlikely(PyErr_Occurred()))
+ return NULL;
+ value = default_value;
+ }
+ Py_INCREF(value);
+#else
+ if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
+ value = PyDict_GetItem(d, key);
+ if (unlikely(!value)) {
+ value = default_value;
+ }
+ Py_INCREF(value);
+ } else {
+ if (default_value == Py_None)
+ default_value = NULL;
+ value = PyObject_CallMethodObjArgs(
+ d, __pyx_n_s_get, key, default_value, NULL);
+ }
+#endif
+ return value;
+}
+
+/* PyErrExceptionMatches */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
+ PyObject *exc_type = tstate->curexc_type;
+ if (exc_type == err) return 1;
+ if (unlikely(!exc_type)) return 0;
+ return PyErr_GivenExceptionMatches(exc_type, err);
+}
+#endif
+
+/* RaiseException */
+ #if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ __Pyx_PyThreadState_declare
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_PyThreadState_assign
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ int is_subclass = PyObject_IsSubclass(instance_class, type);
+ if (!is_subclass) {
+ instance_class = NULL;
+ } else if (unlikely(is_subclass == -1)) {
+ goto bad;
+ } else {
+ type = instance_class;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+/* PyIntBinop */
+ #if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
+ if (op1 == op2) {
+ Py_RETURN_TRUE;
+ }
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(op1))) {
+ const long b = intval;
+ long a = PyInt_AS_LONG(op1);
+ if (a == b) {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+ }
+ #endif
+ #if CYTHON_USE_PYLONG_INTERNALS
+ if (likely(PyLong_CheckExact(op1))) {
+ const long b = intval;
+ long a;
+ const digit* digits = ((PyLongObject*)op1)->ob_digit;
+ const Py_ssize_t size = Py_SIZE(op1);
+ if (likely(__Pyx_sst_abs(size) <= 1)) {
+ a = likely(size) ? digits[0] : 0;
+ if (size == -1) a = -a;
+ } else {
+ switch (size) {
+ case -2:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ case 2:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ case -3:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ case 3:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ case -4:
+ if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ case 4:
+ if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+ break;
+ }
+ #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
+ default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
+ #else
+ default: Py_RETURN_FALSE;
+ #endif
+ }
+ }
+ if (a == b) {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+ }
+ #endif
+ if (PyFloat_CheckExact(op1)) {
+ const long b = intval;
+ double a = PyFloat_AS_DOUBLE(op1);
+ if ((double)a == (double)b) {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+ }
+ return PyObject_RichCompare(op1, op2, Py_EQ);
+}
+#endif
+
+/* Import */
+ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+/* ImportFrom */
+ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+/* SetupReduce */
+ #define __Pyx_setup_reduce_GET_ATTR_OR_BAD(res, obj, name) res = PyObject_GetAttrString(obj, name); if (res == NULL) goto BAD;
+static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
+ int ret;
+ PyObject *name_attr;
+ name_attr = PyObject_GetAttrString(meth, "__name__");
+ if (name_attr) {
+ ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
+ } else {
+ ret = -1;
+ }
+ if (ret < 0) {
+ PyErr_Clear();
+ ret = 0;
+ }
+ Py_XDECREF(name_attr);
+ return ret;
+}
+static int __Pyx_setup_reduce(PyObject* type_obj) {
+ int ret = 0;
+ PyObject* builtin_object = NULL;
+ static PyObject *object_reduce = NULL;
+ static PyObject *object_reduce_ex = NULL;
+ PyObject *reduce = NULL;
+ PyObject *reduce_ex = NULL;
+ PyObject *reduce_cython = NULL;
+ PyObject *setstate = NULL;
+ PyObject *setstate_cython = NULL;
+ if (PyObject_HasAttrString(type_obj, "__getstate__")) goto GOOD;
+ if (object_reduce_ex == NULL) {
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(builtin_object, __pyx_b, "object");
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce, builtin_object, "__reduce__");
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce_ex, builtin_object, "__reduce_ex__");
+ }
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_ex, type_obj, "__reduce_ex__");
+ if (reduce_ex == object_reduce_ex) {
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce, type_obj, "__reduce__");
+ if (object_reduce == reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_cython, type_obj, "__reduce_cython__");
+ ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce__", reduce_cython); if (ret < 0) goto BAD;
+ ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce_cython__"); if (ret < 0) goto BAD;
+ setstate = PyObject_GetAttrString(type_obj, "__setstate__");
+ if (!setstate) PyErr_Clear();
+ if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
+ __Pyx_setup_reduce_GET_ATTR_OR_BAD(setstate_cython, type_obj, "__setstate_cython__");
+ ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate__", setstate_cython); if (ret < 0) goto BAD;
+ ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate_cython__"); if (ret < 0) goto BAD;
+ }
+ PyType_Modified((PyTypeObject*)type_obj);
+ }
+ }
+ goto GOOD;
+BAD:
+ if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
+ ret = -1;
+GOOD:
+ Py_XDECREF(builtin_object);
+ Py_XDECREF(reduce);
+ Py_XDECREF(reduce_ex);
+ Py_XDECREF(reduce_cython);
+ Py_XDECREF(setstate);
+ Py_XDECREF(setstate_cython);
+ return ret;
+}
+
+/* SetVTable */
+ static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
+/* PatchModuleWithCoroutine */
+ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
+#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
+ int result;
+ PyObject *globals, *result_obj;
+ globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
+ result = PyDict_SetItemString(globals, "_cython_coroutine_type",
+ #ifdef __Pyx_Coroutine_USED
+ (PyObject*)__pyx_CoroutineType);
+ #else
+ Py_None);
+ #endif
+ if (unlikely(result < 0)) goto ignore;
+ result = PyDict_SetItemString(globals, "_cython_generator_type",
+ #ifdef __Pyx_Generator_USED
+ (PyObject*)__pyx_GeneratorType);
+ #else
+ Py_None);
+ #endif
+ if (unlikely(result < 0)) goto ignore;
+ if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
+ if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
+ result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
+ if (unlikely(!result_obj)) goto ignore;
+ Py_DECREF(result_obj);
+ Py_DECREF(globals);
+ return module;
+ignore:
+ Py_XDECREF(globals);
+ PyErr_WriteUnraisable(module);
+ if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
+ Py_DECREF(module);
+ module = NULL;
+ }
+#else
+ py_code++;
+#endif
+ return module;
+}
+
+/* PatchInspect */
+ static PyObject* __Pyx_patch_inspect(PyObject* module) {
+#if defined(__Pyx_Generator_USED) && (!defined(CYTHON_PATCH_INSPECT) || CYTHON_PATCH_INSPECT)
+ static int inspect_patched = 0;
+ if (unlikely((!inspect_patched) && module)) {
+ module = __Pyx_Coroutine_patch_module(
+ module, ""
+"old_types = getattr(_module.isgenerator, '_cython_generator_types', None)\n"
+"if old_types is None or not isinstance(old_types, set):\n"
+" old_types = set()\n"
+" def cy_wrap(orig_func, type=type, cython_generator_types=old_types):\n"
+" def cy_isgenerator(obj): return type(obj) in cython_generator_types or orig_func(obj)\n"
+" cy_isgenerator._cython_generator_types = cython_generator_types\n"
+" return cy_isgenerator\n"
+" _module.isgenerator = cy_wrap(_module.isgenerator)\n"
+"old_types.add(_cython_generator_type)\n"
+ );
+ inspect_patched = 1;
+ }
+#else
+ if (0) return __Pyx_Coroutine_patch_module(module, NULL);
+#endif
+ return module;
+}
+
+/* CLineInTraceback */
+ static int __Pyx_CLineForTraceback(int c_line) {
+#ifdef CYTHON_CLINE_IN_TRACEBACK
+ return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0;
+#else
+ PyObject **cython_runtime_dict;
+ PyObject *use_cline;
+ cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
+ if (unlikely(!cython_runtime_dict)) {
+ PyObject *ptype, *pvalue, *ptraceback;
+ PyObject *use_cline_obj;
+ PyErr_Fetch(&ptype, &pvalue, &ptraceback);
+ use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
+ if (use_cline_obj) {
+ use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
+ Py_DECREF(use_cline_obj);
+ } else {
+ use_cline = NULL;
+ }
+ PyErr_Restore(ptype, pvalue, ptraceback);
+ } else {
+ use_cline = PyDict_GetItem(*_PyObject_GetDictPtr(__pyx_cython_runtime), __pyx_n_s_cline_in_traceback);
+ }
+ if (!use_cline) {
+ c_line = 0;
+ PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
+ }
+ else if (PyObject_Not(use_cline) != 0) {
+ c_line = 0;
+ }
+ return c_line;
+#endif
+}
+
+/* CodeObjectCache */
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = start + (end - start) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+/* AddTraceback */
+ #include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ if (c_line) {
+ c_line = __Pyx_CLineForTraceback(c_line);
+ }
+ py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+/* CIntToPy */
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = (int) 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+/* CIntFromPyVerify */
+ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
+#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
+#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
+ {\
+ func_type value = func_value;\
+ if (sizeof(target_type) < sizeof(func_type)) {\
+ if (unlikely(value != (func_type) (target_type) value)) {\
+ func_type zero = 0;\
+ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
+ return (target_type) -1;\
+ if (is_unsigned && unlikely(value < zero))\
+ goto raise_neg_overflow;\
+ else\
+ goto raise_overflow;\
+ }\
+ }\
+ return (target_type) value;\
+ }
+
+/* CIntToPy */
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = (long) 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+/* CIntFromPy */
+ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = (int) 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (int) 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
+ case 2:
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ }
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+#else
+ {
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
+ if (unlikely(result < 0))
+ return (int) -1;
+ if (unlikely(result == 1))
+ goto raise_neg_overflow;
+ }
+#endif
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
+#endif
+ }
+ } else {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (int) 0;
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
+ case -2:
+ if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 2:
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case -3:
+ if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case -4:
+ if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ }
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
+#endif
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+/* CIntFromPy */
+ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = (long) 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (long) 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
+ case 2:
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ }
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+#else
+ {
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
+ if (unlikely(result < 0))
+ return (long) -1;
+ if (unlikely(result == 1))
+ goto raise_neg_overflow;
+ }
+#endif
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
+#endif
+ }
+ } else {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (long) 0;
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
+ case -2:
+ if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 2:
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case -3:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case -4:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ }
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
+#endif
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+/* CheckBinaryVersion */
+ static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+/* ModuleImport */
+ #ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+/* TypeImport */
+ #ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
+ module_name, class_name, basicsize, size);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
+ module_name, class_name, basicsize, size);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+/* InitStrings */
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ if (PyObject_Hash(*t->p) == -1)
+ PyErr_Clear();
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
+#if CYTHON_USE_TYPE_SLOTS
+ PyNumberMethods *m;
+#endif
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return __Pyx_NewRef(x);
+#if CYTHON_USE_TYPE_SLOTS
+ m = Py_TYPE(x)->tp_as_number;
+ #if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+ #else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+ #endif
+#else
+ res = PyNumber_Int(x);
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b))) {
+ if (sizeof(Py_ssize_t) >= sizeof(long))
+ return PyInt_AS_LONG(b);
+ else
+ return PyInt_AsSsize_t(x);
+ }
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)b)->ob_digit;
+ const Py_ssize_t size = Py_SIZE(b);
+ if (likely(__Pyx_sst_abs(size) <= 1)) {
+ ival = likely(size) ? digits[0] : 0;
+ if (size == -1) ival = -ival;
+ return ival;
+ } else {
+ switch (size) {
+ case 2:
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -2:
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case 3:
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -3:
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case 4:
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -4:
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ }
+ }
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.pyx b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.pyx
new file mode 100644
index 00000000..29e7a471
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython.pyx
@@ -0,0 +1,1138 @@
+# Important: Autogenerated file.
+
+# DO NOT edit manually!
+# DO NOT edit manually!
+import sys
+from _pydevd_bundle.pydevd_constants import STATE_RUN, PYTHON_SUSPEND, IS_JYTHON, IS_IRONPYTHON
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+# ELSE
+# from _pydevd_bundle.pydevd_frame import PyDBFrame
+# ENDIF
+
+version = 4
+
+if not hasattr(sys, '_current_frames'):
+
+ # Some versions of Jython don't have it (but we can provide a replacement)
+ if IS_JYTHON:
+ from java.lang import NoSuchFieldException
+ from org.python.core import ThreadStateMapping
+ try:
+ cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
+ except NoSuchFieldException:
+ cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
+ cachedThreadState.accessible = True
+ thread_states = cachedThreadState.get(ThreadStateMapping)
+
+ def _current_frames():
+ as_array = thread_states.entrySet().toArray()
+ ret = {}
+ for thread_to_state in as_array:
+ thread = thread_to_state.getKey()
+ if thread is None:
+ continue
+ thread_state = thread_to_state.getValue()
+ if thread_state is None:
+ continue
+
+ frame = thread_state.frame
+ if frame is None:
+ continue
+
+ ret[thread.getId()] = frame
+ return ret
+
+ elif IS_IRONPYTHON:
+ _tid_to_last_frame = {}
+
+ # IronPython doesn't have it. Let's use our workaround...
+ def _current_frames():
+ return _tid_to_last_frame
+
+ else:
+ raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).')
+else:
+ _current_frames = sys._current_frames
+
+#=======================================================================================================================
+# PyDBAdditionalThreadInfo
+#=======================================================================================================================
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+cdef class PyDBAdditionalThreadInfo:
+# ELSE
+# class PyDBAdditionalThreadInfo(object):
+# ENDIF
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ cdef public int pydev_state;
+ cdef public object pydev_step_stop; # Actually, it's a frame or None
+ cdef public int pydev_step_cmd;
+ cdef public bint pydev_notify_kill;
+ cdef public object pydev_smart_step_stop; # Actually, it's a frame or None
+ cdef public bint pydev_django_resolve_frame;
+ cdef public object pydev_call_from_jinja2;
+ cdef public object pydev_call_inside_jinja2;
+ cdef public bint is_tracing;
+ cdef public tuple conditional_breakpoint_exception;
+ cdef public str pydev_message;
+ cdef public int suspend_type;
+ cdef public int pydev_next_line;
+ cdef public str pydev_func_name;
+ # ELSE
+# __slots__ = [
+# 'pydev_state',
+# 'pydev_step_stop',
+# 'pydev_step_cmd',
+# 'pydev_notify_kill',
+# 'pydev_smart_step_stop',
+# 'pydev_django_resolve_frame',
+# 'pydev_call_from_jinja2',
+# 'pydev_call_inside_jinja2',
+# 'is_tracing',
+# 'conditional_breakpoint_exception',
+# 'pydev_message',
+# 'suspend_type',
+# 'pydev_next_line',
+# 'pydev_func_name',
+# ]
+ # ENDIF
+
+ def __init__(self):
+ self.pydev_state = STATE_RUN
+ self.pydev_step_stop = None
+ self.pydev_step_cmd = -1 # Something as CMD_STEP_INTO, CMD_STEP_OVER, etc.
+ self.pydev_notify_kill = False
+ self.pydev_smart_step_stop = None
+ self.pydev_django_resolve_frame = False
+ self.pydev_call_from_jinja2 = None
+ self.pydev_call_inside_jinja2 = None
+ self.is_tracing = False
+ self.conditional_breakpoint_exception = None
+ self.pydev_message = ''
+ self.suspend_type = PYTHON_SUSPEND
+ self.pydev_next_line = -1
+ self.pydev_func_name = '.invalid.' # Must match the type in cython
+
+
+ def iter_frames(self, t):
+ #sys._current_frames(): dictionary with thread id -> topmost frame
+ current_frames = _current_frames()
+ v = current_frames.get(t.ident)
+ if v is not None:
+ return [v]
+ return []
+
+ def __str__(self):
+ return 'State:%s Stop:%s Cmd: %s Kill:%s' % (
+ self.pydev_state, self.pydev_step_stop, self.pydev_step_cmd, self.pydev_notify_kill)
+
+import linecache
+import os.path
+import re
+import sys
+import traceback # @Reimport
+
+from _pydev_bundle import pydev_log
+from _pydevd_bundle import pydevd_dont_trace
+from _pydevd_bundle import pydevd_vars
+from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
+from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \
+ CMD_STEP_INTO, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO_MY_CODE
+from _pydevd_bundle.pydevd_constants import STATE_SUSPEND, get_thread_id, STATE_RUN, dict_iter_values, IS_PY3K, \
+ RETURN_VALUES_DICT
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE
+from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised
+from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+try:
+ from inspect import CO_GENERATOR
+except:
+ CO_GENERATOR = 0
+
+try:
+ from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+except ImportError:
+ def send_signature_call_trace(*args, **kwargs):
+ pass
+
+basename = os.path.basename
+
+IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+DEBUG_START = ('pydevd.py', 'run')
+DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+TRACE_PROPERTY = 'pydevd_traceproperty.py'
+get_file_type = DONT_TRACE.get
+
+
+def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ condition = breakpoint.condition
+ try:
+ val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ if not val:
+ return default_return_value
+
+ except:
+ if type(condition) != type(''):
+ if hasattr(condition, 'encode'):
+ condition = condition.encode('utf-8')
+
+ msg = 'Error while evaluating expression: %s\n' % (condition,)
+ sys.stderr.write(msg)
+ traceback.print_exc()
+ if not py_db.suspend_on_breakpoint_exception:
+ return default_return_value
+ else:
+ stop = True
+ try:
+ # add exception_type and stacktrace into thread additional info
+ etype, value, tb = sys.exc_info()
+ try:
+ error = ''.join(traceback.format_exception_only(etype, value))
+ stack = traceback.extract_stack(f=tb.tb_frame.f_back)
+
+ # On self.set_suspend(thread, CMD_SET_BREAK) this info will be
+ # sent to the client.
+ info.conditional_breakpoint_exception = \
+ ('Condition:\n' + condition + '\n\nError:\n' + error, stack)
+ finally:
+ etype, value, tb = None, None, None
+ except:
+ traceback.print_exc()
+
+
+def handle_breakpoint_expression(breakpoint, info, new_frame):
+ try:
+ try:
+ val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ except:
+ val = sys.exc_info()[1]
+ finally:
+ if val is not None:
+ info.pydev_message = str(val)
+
+
+#=======================================================================================================================
+# PyDBFrame
+#=======================================================================================================================
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+cdef class PyDBFrame:
+# ELSE
+# class PyDBFrame:
+# '''This makes the tracing for a given frame, so, the trace_dispatch
+# is used initially when we enter into a new context ('call') and then
+# is reused for the entire context.
+# '''
+# ENDIF
+
+
+ #Note: class (and not instance) attributes.
+
+ #Same thing in the main debugger but only considering the file contents, while the one in the main debugger
+ #considers the user input (so, the actual result must be a join of both).
+ filename_to_lines_where_exceptions_are_ignored = {}
+ filename_to_stat_info = {}
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ cdef tuple _args
+ cdef int should_skip
+ def __init__(self, tuple args):
+ self._args = args # In the cython version we don't need to pass the frame
+ self.should_skip = -1 # On cythonized version, put in instance.
+ # ELSE
+# should_skip = -1 # Default value in class (put in instance on set).
+#
+# def __init__(self, args):
+# #args = main_debugger, filename, base, info, t, frame
+# #yeap, much faster than putting in self and then getting it from self later on
+# self._args = args
+ # ENDIF
+
+ def set_suspend(self, *args, **kwargs):
+ self._args[0].set_suspend(*args, **kwargs)
+
+ def do_wait_suspend(self, *args, **kwargs):
+ self._args[0].do_wait_suspend(*args, **kwargs)
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ def trace_exception(self, frame, str event, arg):
+ cdef bint flag;
+ # ELSE
+# def trace_exception(self, frame, event, arg):
+ # ENDIF
+ if event == 'exception':
+ flag, frame = self.should_stop_on_exception(frame, event, arg)
+
+ if flag:
+ self.handle_exception(frame, event, arg)
+ return self.trace_dispatch
+
+ return self.trace_exception
+
+ def trace_return(self, frame, event, arg):
+ if event == 'return':
+ main_debugger, filename = self._args[0], self._args[1]
+ send_signature_return_trace(main_debugger, frame, filename, arg)
+ return self.trace_return
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ def should_stop_on_exception(self, frame, str event, arg):
+ cdef PyDBAdditionalThreadInfo info;
+ cdef bint flag;
+ # ELSE
+# def should_stop_on_exception(self, frame, event, arg):
+ # ENDIF
+
+ # main_debugger, _filename, info, _thread = self._args
+ main_debugger = self._args[0]
+ info = self._args[2]
+ flag = False
+
+ # STATE_SUSPEND = 2
+ if info.pydev_state != 2: #and breakpoint is not None:
+ exception, value, trace = arg
+
+ if trace is not None: #on jython trace is None on the first event
+ exception_breakpoint = get_exception_breakpoint(
+ exception, main_debugger.break_on_caught_exceptions)
+
+ if exception_breakpoint is not None:
+ if exception_breakpoint.ignore_libraries:
+ if exception_breakpoint.notify_on_first_raise_only:
+ if main_debugger.first_appearance_in_scope(trace):
+ add_exception_to_frame(frame, (exception, value, trace))
+ try:
+ info.pydev_message = exception_breakpoint.qname
+ except:
+ info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ flag = True
+ else:
+ pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
+ flag = False
+ else:
+ if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ add_exception_to_frame(frame, (exception, value, trace))
+ try:
+ info.pydev_message = exception_breakpoint.qname
+ except:
+ info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ flag = True
+ else:
+ flag = False
+ else:
+ try:
+ if main_debugger.plugin is not None:
+ result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ if result:
+ flag, frame = result
+ except:
+ flag = False
+
+ return flag, frame
+
+ def handle_exception(self, frame, event, arg):
+ try:
+ # print 'handle_exception', frame.f_lineno, frame.f_code.co_name
+
+ # We have 3 things in arg: exception type, description, traceback object
+ trace_obj = arg[2]
+ main_debugger = self._args[0]
+
+ if not hasattr(trace_obj, 'tb_next'):
+ return #Not always there on Jython...
+
+ initial_trace_obj = trace_obj
+ if trace_obj.tb_next is None and trace_obj.tb_frame is frame:
+ #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+
+ if main_debugger.break_on_exceptions_thrown_in_same_context:
+ #Option: Don't break if an exception is caught in the same function from which it is thrown
+ return
+ else:
+ #Get the trace_obj from where the exception was raised...
+ while trace_obj.tb_next is not None:
+ trace_obj = trace_obj.tb_next
+
+
+ if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception:
+ for check_trace_obj in (initial_trace_obj, trace_obj):
+ filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+
+
+ filename_to_lines_where_exceptions_are_ignored = self.filename_to_lines_where_exceptions_are_ignored
+
+
+ lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename)
+ if lines_ignored is None:
+ lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+
+ try:
+ curr_stat = os.stat(filename)
+ curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ except:
+ curr_stat = None
+
+ last_stat = self.filename_to_stat_info.get(filename)
+ if last_stat != curr_stat:
+ self.filename_to_stat_info[filename] = curr_stat
+ lines_ignored.clear()
+ try:
+ linecache.checkcache(filename)
+ except:
+ #Jython 2.1
+ linecache.checkcache()
+
+ from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ if from_user_input:
+ merged = {}
+ merged.update(lines_ignored)
+ #Override what we have with the related entries that the user entered
+ merged.update(from_user_input)
+ else:
+ merged = lines_ignored
+
+ exc_lineno = check_trace_obj.tb_lineno
+
+ # print ('lines ignored', lines_ignored)
+ # print ('user input', from_user_input)
+ # print ('merged', merged, 'curr', exc_lineno)
+
+ if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ try:
+ line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ except:
+ #Jython 2.1
+ line = linecache.getline(filename, exc_lineno)
+
+ if IGNORE_EXCEPTION_TAG.match(line) is not None:
+ lines_ignored[exc_lineno] = 1
+ return
+ else:
+ #Put in the cache saying not to ignore
+ lines_ignored[exc_lineno] = 0
+ else:
+ #Ok, dict has it already cached, so, let's check it...
+ if merged.get(exc_lineno, 0):
+ return
+
+
+ thread = self._args[3]
+
+ try:
+ frame_id_to_frame = {}
+ frame_id_to_frame[id(frame)] = frame
+ f = trace_obj.tb_frame
+ while f is not None:
+ frame_id_to_frame[id(f)] = f
+ f = f.f_back
+ f = None
+
+ thread_id = get_thread_id(thread)
+ pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame)
+ try:
+ main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ self.do_wait_suspend(thread, frame, event, arg)
+ main_debugger.send_caught_exception_stack_proceeded(thread)
+
+ finally:
+ pydevd_vars.remove_additional_frame_by_id(thread_id)
+ except:
+ traceback.print_exc()
+
+ main_debugger.set_trace_for_frame_and_parents(frame)
+ finally:
+ #Clear some local variables...
+ trace_obj = None
+ initial_trace_obj = None
+ check_trace_obj = None
+ f = None
+ frame_id_to_frame = None
+ main_debugger = None
+ thread = None
+
+ def get_func_name(self, frame):
+ code_obj = frame.f_code
+ func_name = code_obj.co_name
+ try:
+ cls_name = get_clsname_for_code(code_obj, frame)
+ if cls_name is not None:
+ return "%s.%s" % (cls_name, func_name)
+ else:
+ return func_name
+ except:
+ traceback.print_exc()
+ return func_name
+
+ def show_return_values(self, frame, arg):
+ try:
+ try:
+ f_locals_back = getattr(frame.f_back, "f_locals", None)
+ if f_locals_back is not None:
+ return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ if return_values_dict is None:
+ return_values_dict = {}
+ f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ name = self.get_func_name(frame)
+ return_values_dict[name] = arg
+ except:
+ traceback.print_exc()
+ finally:
+ f_locals_back = None
+
+ def remove_return_values(self, main_debugger, frame):
+ try:
+ try:
+ # Showing return values was turned off, we should remove them from locals dict.
+ # The values can be in the current frame or in the back one
+ frame.f_locals.pop(RETURN_VALUES_DICT, None)
+
+ f_locals_back = getattr(frame.f_back, "f_locals", None)
+ if f_locals_back is not None:
+ f_locals_back.pop(RETURN_VALUES_DICT, None)
+ except:
+ traceback.print_exc()
+ finally:
+ f_locals_back = None
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ cpdef trace_dispatch(self, frame, str event, arg):
+ cdef str filename;
+ cdef bint is_exception_event;
+ cdef bint has_exception_breakpoints;
+ cdef bint can_skip;
+ cdef PyDBAdditionalThreadInfo info;
+ cdef int step_cmd;
+ cdef int line;
+ cdef bint is_line;
+ cdef bint is_call;
+ cdef bint is_return;
+ cdef str curr_func_name;
+ cdef bint exist_result;
+ cdef dict frame_skips_cache;
+ cdef tuple frame_cache_key;
+ cdef tuple line_cache_key;
+ cdef int breakpoints_in_line_cache;
+ cdef int breakpoints_in_frame_cache;
+ cdef bint has_breakpoint_in_frame;
+ # ELSE
+# def trace_dispatch(self, frame, event, arg):
+ # ENDIF
+
+ main_debugger, filename, info, thread, frame_skips_cache, frame_cache_key = self._args
+ # print('frame trace_dispatch', frame.f_lineno, frame.f_code.co_name, event, info.pydev_step_cmd)
+ try:
+ info.is_tracing = True
+ line = frame.f_lineno
+ line_cache_key = (frame_cache_key, line)
+
+ if main_debugger._finish_debugging_session:
+ return None
+
+ plugin_manager = main_debugger.plugin
+
+ is_exception_event = event == 'exception'
+ has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks
+
+ if is_exception_event:
+ if has_exception_breakpoints:
+ flag, frame = self.should_stop_on_exception(frame, event, arg)
+ if flag:
+ self.handle_exception(frame, event, arg)
+ return self.trace_dispatch
+ is_line = False
+ is_return = False
+ is_call = False
+ else:
+ is_line = event == 'line'
+ is_return = event == 'return'
+ is_call = event == 'call'
+ if not is_line and not is_return and not is_call:
+ # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ return None
+
+ need_trace_return = False
+ if is_call and main_debugger.signature_factory:
+ need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ if is_return and main_debugger.signature_factory:
+ send_signature_return_trace(main_debugger, frame, filename, arg)
+
+ stop_frame = info.pydev_step_stop
+ step_cmd = info.pydev_step_cmd
+
+ if is_exception_event:
+ breakpoints_for_file = None
+ # CMD_STEP_OVER = 108
+ if stop_frame and stop_frame is not frame and step_cmd == 108 and \
+ arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ info.pydev_step_stop = None
+ else:
+ # If we are in single step mode and something causes us to exit the current frame, we need to make sure we break
+ # eventually. Force the step mode to step into and the step stop frame to None.
+ # I.e.: F6 in the end of a function should stop in the next possible position (instead of forcing the user
+ # to make a step in or step over at that location).
+ # Note: this is especially troublesome when we're skipping code with the
+ # @DontTrace comment.
+ if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ info.pydev_step_stop = None
+
+ breakpoints_for_file = main_debugger.breakpoints.get(filename)
+
+ can_skip = False
+
+ if info.pydev_state == 1: # STATE_RUN = 1
+ #we can skip if:
+ #- we have no stop marked
+ #- we should make a step return/step over and we're not in the current frame
+ # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ can_skip = (step_cmd == -1 and stop_frame is None)\
+ or (step_cmd in (109, 108) and stop_frame is not frame)
+
+ if can_skip:
+ if plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+
+ # CMD_STEP_OVER = 108
+ if can_skip and is_return and main_debugger.show_return_values and info.pydev_step_cmd == 108 and frame.f_back is info.pydev_step_stop:
+ # trace function for showing return values after step over
+ can_skip = False
+
+ # Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint,
+ # we will return nothing for the next trace
+ # also, after we hit a breakpoint and go to some other debugging state, we have to force the set trace anyway,
+ # so, that's why the additional checks are there.
+ if not breakpoints_for_file:
+ if can_skip:
+ if has_exception_breakpoints:
+ return self.trace_exception
+ else:
+ if need_trace_return:
+ return self.trace_return
+ else:
+ return None
+
+ else:
+ # When cached, 0 means we don't have a breakpoint and 1 means we have.
+ if can_skip:
+ breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ if breakpoints_in_line_cache == 0:
+ return self.trace_dispatch
+
+ breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1)
+ if breakpoints_in_frame_cache != -1:
+ # Gotten from cache.
+ has_breakpoint_in_frame = breakpoints_in_frame_cache == 1
+
+ else:
+ has_breakpoint_in_frame = False
+ # Checks the breakpoint to see if there is a context match in some function
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', ''):
+ curr_func_name = ''
+
+ for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues()
+ #will match either global or some function
+ if breakpoint.func_name in ('None', curr_func_name):
+ has_breakpoint_in_frame = True
+ break
+
+ # Cache the value (1 or 0 or -1 for default because of cython).
+ if has_breakpoint_in_frame:
+ frame_skips_cache[frame_cache_key] = 1
+ else:
+ frame_skips_cache[frame_cache_key] = 0
+
+
+ if can_skip and not has_breakpoint_in_frame:
+ if has_exception_breakpoints:
+ return self.trace_exception
+ else:
+ if need_trace_return:
+ return self.trace_return
+ else:
+ return None
+
+ #We may have hit a breakpoint or we are already in step mode. Either way, let's check what we should do in this frame
+ # print('NOT skipped', frame.f_lineno, frame.f_code.co_name, event)
+
+ try:
+ flag = False
+ #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ #(one for the line and the other for the return).
+
+ stop_info = {}
+ breakpoint = None
+ exist_result = False
+ stop = False
+ bp_type = None
+ if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ breakpoint = breakpoints_for_file[line]
+ new_frame = frame
+ stop = True
+ if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ if result:
+ exist_result = True
+ flag, breakpoint, new_frame, bp_type = result
+
+ if breakpoint:
+ #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ # lets do the conditional stuff here
+ if stop or exist_result:
+ condition = breakpoint.condition
+ if condition is not None:
+ result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ self.trace_dispatch)
+ if result is not None:
+ return result
+
+ if breakpoint.expression is not None:
+ handle_breakpoint_expression(breakpoint, info, new_frame)
+
+ if not main_debugger.first_breakpoint_reached:
+ if is_call:
+ back = frame.f_back
+ if back is not None:
+ # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ # 'call' event for tracing and we stop on the first line of code twice.
+ _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \
+ (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ stop = False
+ main_debugger.first_breakpoint_reached = True
+ else:
+ # if the frame is traced after breakpoint stop,
+ # but the file should be ignored while stepping because of filters
+ if step_cmd != -1:
+ if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
+ # ignore files matching stepping filters
+ return self.trace_dispatch
+ if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename):
+ # ignore library files while stepping
+ return self.trace_dispatch
+
+ if main_debugger.show_return_values:
+ if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
+ self.show_return_values(frame, arg)
+
+ elif main_debugger.remove_return_values_flag:
+ try:
+ self.remove_return_values(main_debugger, frame)
+ finally:
+ main_debugger.remove_return_values_flag = False
+
+ if stop:
+ self.set_suspend(thread, CMD_SET_BREAK)
+ if breakpoint and breakpoint.suspend_policy == "ALL":
+ main_debugger.suspend_all_other_threads(thread)
+ elif flag and plugin_manager is not None:
+ result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ if result:
+ frame = result
+
+ # if thread has a suspend flag, we suspend with a busy wait
+ if info.pydev_state == STATE_SUSPEND:
+ self.do_wait_suspend(thread, frame, event, arg)
+ return self.trace_dispatch
+ else:
+ if not breakpoint and not is_return:
+ # No stop from anyone and no breakpoint found in line (cache that).
+ frame_skips_cache[line_cache_key] = 0
+
+ except:
+ traceback.print_exc()
+ raise
+
+ #step handling. We stop when we hit the right frame
+ try:
+ should_skip = 0
+ if pydevd_dont_trace.should_trace_hook is not None:
+ if self.should_skip == -1:
+ # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ # Which will be handled by this frame is read-only, so, we can cache it safely.
+ if not pydevd_dont_trace.should_trace_hook(frame, filename):
+ # -1, 0, 1 to be Cython-friendly
+ should_skip = self.should_skip = 1
+ else:
+ should_skip = self.should_skip = 0
+ else:
+ should_skip = self.should_skip
+
+ plugin_stop = False
+ if should_skip:
+ stop = False
+
+ elif step_cmd == CMD_STEP_INTO:
+ stop = is_line or is_return
+ if plugin_manager is not None:
+ result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ if result:
+ stop, plugin_stop = result
+
+ elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ if not main_debugger.not_in_scope(frame.f_code.co_filename):
+ stop = is_line
+
+ elif step_cmd == CMD_STEP_OVER:
+ stop = stop_frame is frame and (is_line or is_return)
+
+ if frame.f_code.co_flags & CO_GENERATOR:
+ if is_return:
+ stop = False
+
+ if plugin_manager is not None:
+ result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ if result:
+ stop, plugin_stop = result
+
+ elif step_cmd == CMD_SMART_STEP_INTO:
+ stop = False
+ if info.pydev_smart_step_stop is frame:
+ info.pydev_func_name = '.invalid.' # Must match the type in cython
+ info.pydev_smart_step_stop = None
+
+ if is_line or is_exception_event:
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', '') or curr_func_name is None:
+ curr_func_name = ''
+
+ if curr_func_name == info.pydev_func_name:
+ stop = True
+
+ elif step_cmd == CMD_STEP_RETURN:
+ stop = is_return and stop_frame is frame
+
+ elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT:
+ stop = False
+
+ if is_line or is_exception_event:
+ #Yes, we can only act on line events (weird hum?)
+ #Note: This code is duplicated at pydevd.py
+ #Acting on exception events after debugger breaks with exception
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', ''):
+ curr_func_name = ''
+
+ if curr_func_name == info.pydev_func_name:
+ line = info.pydev_next_line
+ if frame.f_lineno == line:
+ stop = True
+ else:
+ if frame.f_trace is None:
+ frame.f_trace = self.trace_dispatch
+ frame.f_lineno = line
+ frame.f_trace = None
+ stop = True
+
+ else:
+ stop = False
+
+ if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ f_code = getattr(frame.f_back, 'f_code', None)
+ if f_code is not None:
+ back_filename = os.path.basename(f_code.co_filename)
+ file_type = get_file_type(back_filename)
+ if file_type == PYDEV_FILE:
+ stop = False
+
+ if plugin_stop:
+ stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ elif stop:
+ if is_line:
+ self.set_suspend(thread, step_cmd)
+ self.do_wait_suspend(thread, frame, event, arg)
+ else: #return event
+ back = frame.f_back
+ if back is not None:
+ #When we get to the pydevd run function, the debugging has actually finished for the main thread
+ #(note that it can still go on for other threads, but for this one, we just make it finish)
+ #So, just setting it to None should be OK
+ _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]:
+ back = None
+
+ elif base == TRACE_PROPERTY:
+ # We dont want to trace the return event of pydevd_traceproperty (custom property for debugging)
+ #if we're in a return, we want it to appear to the user in the previous frame!
+ return None
+
+ elif pydevd_dont_trace.should_trace_hook is not None:
+ if not pydevd_dont_trace.should_trace_hook(back, back_filename):
+ # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ # Also, we have to reset the tracing, because if the parent's parent (or some
+ # other parent) has to be traced and it's not currently, we wouldn't stop where
+ # we should anymore (so, a step in/over/return may not stop anywhere if no parent is traced).
+ # Related test: _debugger_case17a.py
+ main_debugger.set_trace_for_frame_and_parents(back, overwrite_prev_trace=True)
+ return None
+
+ if back is not None:
+ #if we're in a return, we want it to appear to the user in the previous frame!
+ self.set_suspend(thread, step_cmd)
+ self.do_wait_suspend(thread, back, event, arg)
+ else:
+ #in jython we may not have a back frame
+ info.pydev_step_stop = None
+ info.pydev_step_cmd = -1
+ info.pydev_state = STATE_RUN
+
+ except KeyboardInterrupt:
+ raise
+ except:
+ try:
+ traceback.print_exc()
+ info.pydev_step_cmd = -1
+ except:
+ return None
+
+ #if we are quitting, let's stop the tracing
+ retVal = None
+ if not main_debugger.quitting:
+ retVal = self.trace_dispatch
+
+ return retVal
+ finally:
+ info.is_tracing = False
+
+ #end trace_dispatch
+
+import traceback
+
+from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+from _pydev_imps._pydev_saved_modules import threading
+from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+from pydevd_tracing import SetTrace
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+# In Cython, PyDBAdditionalThreadInfo is bundled in the file.
+from cpython.object cimport PyObject
+from cpython.ref cimport Py_INCREF, Py_XDECREF
+# ELSE
+# from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+# from _pydevd_bundle.pydevd_frame import PyDBFrame
+# ENDIF
+
+try:
+ from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+except ImportError:
+ def send_signature_call_trace(*args, **kwargs):
+ pass
+
+threadingCurrentThread = threading.currentThread
+get_file_type = DONT_TRACE.get
+
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+# cdef dict global_cache_skips
+# cdef dict global_cache_frame_skips
+# ELSE
+# ENDIF
+
+
+# Cache where we should keep that we completely skipped entering some context.
+# It needs to be invalidated when:
+# - Breakpoints are changed
+# It can be used when running regularly (without step over/step in/step return)
+global_cache_skips = {}
+global_cache_frame_skips = {}
+
+def trace_dispatch(py_db, frame, event, arg):
+ t = threadingCurrentThread()
+
+ if getattr(t, 'pydev_do_not_trace', None):
+ return None
+
+ try:
+ additional_info = t.additional_info
+ if additional_info is None:
+ raise AttributeError()
+ except:
+ additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+
+ thread_tracer = ThreadTracer((py_db, t, additional_info, global_cache_skips, global_cache_frame_skips))
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
+# ELSE
+# ENDIF
+ SetTrace(thread_tracer.__call__)
+ return thread_tracer.__call__(frame, event, arg)
+
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+cdef class SafeCallWrapper:
+ cdef method_object
+ def __init__(self, method_object):
+ self.method_object = method_object
+ def __call__(self, *args):
+ #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+ #in the frame, and that reference might get destroyed by set trace on frame and parents
+ cdef PyObject* method_obj = self.method_object
+ Py_INCREF(method_obj)
+ ret = (method_obj)(*args)
+ Py_XDECREF (method_obj)
+ return SafeCallWrapper(ret) if ret is not None else None
+cdef class ThreadTracer:
+ cdef public tuple _args;
+ def __init__(self, tuple args):
+ self._args = args
+# ELSE
+# class ThreadTracer:
+# def __init__(self, args):
+# self._args = args
+# ENDIF
+
+
+ def __call__(self, frame, event, arg):
+ ''' This is the callback used when we enter some context in the debugger.
+
+ We also decorate the thread we are in with info about the debugging.
+ The attributes added are:
+ pydev_state
+ pydev_step_stop
+ pydev_step_cmd
+ pydev_notify_kill
+
+ :param PyDB py_db:
+ This is the global debugger (this method should actually be added as a method to it).
+ '''
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ cdef str filename;
+ cdef str base;
+ cdef int pydev_step_cmd;
+ cdef tuple cache_key;
+ cdef dict cache_skips;
+ cdef bint is_stepping;
+ cdef tuple abs_path_real_path_and_base;
+ cdef PyDBAdditionalThreadInfo additional_info;
+ # ENDIF
+ # print('ENTER: trace_dispatch', frame.f_code.co_filename, frame.f_lineno, event, frame.f_code.co_name)
+ py_db, t, additional_info, cache_skips, frame_skips_cache = self._args
+ pydev_step_cmd = additional_info.pydev_step_cmd
+ is_stepping = pydev_step_cmd != -1
+
+ try:
+ if py_db._finish_debugging_session:
+ if not py_db._termination_event_set:
+ #that was not working very well because jython gave some socket errors
+ try:
+ if py_db.output_checker is None:
+ kill_all_pydev_threads()
+ except:
+ traceback.print_exc()
+ py_db._termination_event_set = True
+ return None
+
+ # if thread is not alive, cancel trace_dispatch processing
+ if not is_thread_alive(t):
+ py_db._process_thread_not_alive(get_thread_id(t))
+ return None # suspend tracing
+
+ try:
+ # Make fast path faster!
+ abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ except:
+ abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+
+ if py_db.thread_analyser is not None:
+ py_db.thread_analyser.log_event(frame)
+
+ if py_db.asyncio_analyser is not None:
+ py_db.asyncio_analyser.log_event(frame)
+
+ filename = abs_path_real_path_and_base[1]
+ # Note: it's important that the context name is also given because we may hit something once
+ # in the global context and another in the local context.
+ cache_key = (frame.f_lineno, frame.f_code.co_name, filename)
+ if not is_stepping and cache_key in cache_skips:
+ # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ return None
+
+ file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd
+
+ if file_type is not None:
+ if file_type == 1: # inlining LIB_FILE = 1
+ if py_db.not_in_scope(filename):
+ # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ cache_skips[cache_key] = 1
+ return None
+ else:
+ # print('skipped: trace_dispatch', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ cache_skips[cache_key] = 1
+ return None
+
+ if is_stepping:
+ if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename):
+ # ignore files matching stepping filters
+ return None
+ if py_db.is_filter_libraries and py_db.not_in_scope(filename):
+ # ignore library files while stepping
+ return None
+
+ # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ if additional_info.is_tracing:
+ return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+
+ if event == 'call' and py_db.signature_factory:
+ # We can only have a call when entering a context, so, check at this level, not at the PyDBFrame.
+ send_signature_call_trace(py_db, frame, filename)
+
+ # Just create PyDBFrame directly (removed support for Python versions < 2.5, which required keeping a weak
+ # reference to the frame).
+ ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg)
+ if ret is None:
+ cache_skips[cache_key] = 1
+ return None
+
+ # IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+ return SafeCallWrapper(ret)
+ # ELSE
+# return ret
+ # ENDIF
+
+ except SystemExit:
+ return None
+
+ except Exception:
+ if py_db._finish_debugging_session:
+ return None # Don't log errors when we're shutting down.
+ # Log it
+ try:
+ if traceback is not None:
+ # This can actually happen during the interpreter shutdown in Python 2.7
+ traceback.print_exc()
+ except:
+ # Error logging? We're really in the interpreter shutdown...
+ # (https://github.com/fabioz/PyDev.Debugger/issues/8)
+ pass
+ return None
+
+
+if IS_IRONPYTHON:
+ # This is far from ideal, as we'll leak frames (we'll always have the last created frame, not really
+ # the last topmost frame saved -- this should be Ok for our usage, but it may leak frames and things
+ # may live longer... as IronPython is garbage-collected, things should live longer anyways, so, it
+ # shouldn't be an issue as big as it's in CPython -- it may still be annoying, but this should
+ # be a reasonable workaround until IronPython itself is able to provide that functionality).
+ #
+ # See: https://github.com/IronLanguages/main/issues/1630
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import _tid_to_last_frame
+
+ _original_call = ThreadTracer.__call__
+
+ def __call__(self, frame, event, arg):
+ _tid_to_last_frame[self._args[1].ident] = frame
+ return _original_call(self, frame, event, arg)
+
+ ThreadTracer.__call__ = __call__
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py
new file mode 100644
index 00000000..17373b65
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py
@@ -0,0 +1,35 @@
+try:
+ from _pydevd_bundle.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips
+ import _pydevd_bundle.pydevd_cython
+ # this version number can be unavailable in old versions of compiled extensions
+ version = getattr(_pydevd_bundle.pydevd_cython, 'version', 0)
+except ImportError:
+ try:
+ import struct
+ import sys
+ try:
+ is_python_64bit = (struct.calcsize('P') == 8)
+ except:
+ # In Jython this call fails, but this is Ok, we don't support Jython for speedups anyways.
+ raise ImportError
+ plat = '32'
+ if is_python_64bit:
+ plat = '64'
+
+ # We also accept things as:
+ #
+ # _pydevd_bundle.pydevd_cython_win32_27_32
+ # _pydevd_bundle.pydevd_cython_win32_34_64
+ #
+ # to have multiple pre-compiled pyds distributed along the IDE
+ # (generated by build_tools/build_binaries_windows.py).
+
+ mod_name = 'pydevd_cython_%s_%s%s_%s' % (sys.platform, sys.version_info[0], sys.version_info[1], plat)
+ check_name = '_pydevd_bundle.%s' % (mod_name,)
+ mod = __import__(check_name)
+ mod = getattr(mod, mod_name)
+ trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips = \
+ mod.trace_dispatch, mod.PyDBAdditionalThreadInfo, mod.global_cache_skips, mod.global_cache_frame_skips
+ version = getattr(mod, 'version', 0)
+ except ImportError:
+ raise
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace.py
new file mode 100644
index 00000000..be73810f
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace.py
@@ -0,0 +1,123 @@
+'''
+Support for a tag that allows skipping over functions while debugging.
+'''
+import linecache
+import re
+
+# To suppress tracing a method, add the tag @DontTrace
+# to a comment either preceding or on the same line as
+# the method definition
+#
+# E.g.:
+# #@DontTrace
+# def test1():
+# pass
+#
+# ... or ...
+#
+# def test2(): #@DontTrace
+# pass
+DONT_TRACE_TAG = '@DontTrace'
+
+# Regular expression to match a decorator (at the beginning
+# of a line).
+RE_DECORATOR = re.compile(r'^\s*@')
+
+# Mapping from code object to bool.
+# If the key exists, the value is the cached result of should_trace_hook
+_filename_to_ignored_lines = {}
+
+def default_should_trace_hook(frame, filename):
+ '''
+ Return True if this frame should be traced, False if tracing should be blocked.
+ '''
+ # First, check whether this code object has a cached value
+ ignored_lines = _filename_to_ignored_lines.get(filename)
+ if ignored_lines is None:
+ # Now, look up that line of code and check for a @DontTrace
+ # preceding or on the same line as the method.
+ # E.g.:
+ # #@DontTrace
+ # def test():
+ # pass
+ # ... or ...
+ # def test(): #@DontTrace
+ # pass
+ ignored_lines = {}
+ lines = linecache.getlines(filename)
+ for i_line, line in enumerate(lines):
+ j = line.find('#')
+ if j >= 0:
+ comment = line[j:]
+ if DONT_TRACE_TAG in comment:
+ ignored_lines[i_line] = 1
+
+ #Note: when it's found in the comment, mark it up and down for the decorator lines found.
+ k = i_line - 1
+ while k >= 0:
+ if RE_DECORATOR.match(lines[k]):
+ ignored_lines[k] = 1
+ k -= 1
+ else:
+ break
+
+ k = i_line + 1
+ while k <= len(lines):
+ if RE_DECORATOR.match(lines[k]):
+ ignored_lines[k] = 1
+ k += 1
+ else:
+ break
+
+
+ _filename_to_ignored_lines[filename] = ignored_lines
+
+ func_line = frame.f_code.co_firstlineno - 1 # co_firstlineno is 1-based, so -1 is needed
+ return not (
+ func_line - 1 in ignored_lines or #-1 to get line before method
+ func_line in ignored_lines) #method line
+
+
+should_trace_hook = None
+
+
+def clear_trace_filter_cache():
+ '''
+ Clear the trace filter cache.
+ Call this after reloading.
+ '''
+ global should_trace_hook
+ try:
+ # Need to temporarily disable a hook because otherwise
+ # _filename_to_ignored_lines.clear() will never complete.
+ old_hook = should_trace_hook
+ should_trace_hook = None
+
+ # Clear the linecache
+ linecache.clearcache()
+ _filename_to_ignored_lines.clear()
+
+ finally:
+ should_trace_hook = old_hook
+
+
+def trace_filter(mode):
+ '''
+ Set the trace filter mode.
+
+ mode: Whether to enable the trace hook.
+ True: Trace filtering on (skipping methods tagged @DontTrace)
+ False: Trace filtering off (trace methods tagged @DontTrace)
+ None/default: Toggle trace filtering.
+ '''
+ global should_trace_hook
+ if mode is None:
+ mode = should_trace_hook is None
+
+ if mode:
+ should_trace_hook = default_should_trace_hook
+ else:
+ should_trace_hook = None
+
+ return mode
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace_files.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace_files.py
new file mode 100644
index 00000000..37039045
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_dont_trace_files.py
@@ -0,0 +1,119 @@
+# Important: Autogenerated file.
+
+# DO NOT edit manually!
+# DO NOT edit manually!
+
+from _pydevd_bundle.pydevd_constants import IS_PY3K
+
+LIB_FILE = 1
+PYDEV_FILE = 2
+
+DONT_TRACE = {
+ # commonly used things from the stdlib that we don't want to trace
+ 'Queue.py':LIB_FILE,
+ 'queue.py':LIB_FILE,
+ 'socket.py':LIB_FILE,
+ 'weakref.py':LIB_FILE,
+ '_weakrefset.py':LIB_FILE,
+ 'linecache.py':LIB_FILE,
+ 'threading.py':LIB_FILE,
+ 'dis.py':LIB_FILE,
+
+ #things from pydev that we don't want to trace
+ '_pydev_execfile.py':PYDEV_FILE,
+ '_pydev_BaseHTTPServer.py': PYDEV_FILE,
+ '_pydev_SimpleXMLRPCServer.py': PYDEV_FILE,
+ '_pydev_SocketServer.py': PYDEV_FILE,
+ '_pydev_calltip_util.py': PYDEV_FILE,
+ '_pydev_completer.py': PYDEV_FILE,
+ '_pydev_execfile.py': PYDEV_FILE,
+ '_pydev_filesystem_encoding.py': PYDEV_FILE,
+ '_pydev_getopt.py': PYDEV_FILE,
+ '_pydev_imports_tipper.py': PYDEV_FILE,
+ '_pydev_inspect.py': PYDEV_FILE,
+ '_pydev_jy_imports_tipper.py': PYDEV_FILE,
+ '_pydev_log.py': PYDEV_FILE,
+ '_pydev_pkgutil_old.py': PYDEV_FILE,
+ '_pydev_saved_modules.py': PYDEV_FILE,
+ '_pydev_sys_patch.py': PYDEV_FILE,
+ '_pydev_tipper_common.py': PYDEV_FILE,
+ '_pydev_uuid_old.py': PYDEV_FILE,
+ '_pydev_xmlrpclib.py': PYDEV_FILE,
+ 'django_debug.py': PYDEV_FILE,
+ 'fix_getpass.py': PYDEV_FILE,
+ 'jinja2_debug.py': PYDEV_FILE,
+ 'pycompletionserver.py': PYDEV_FILE,
+ 'pydev_app_engine_debug_startup.py': PYDEV_FILE,
+ 'pydev_console_utils.py': PYDEV_FILE,
+ 'pydev_import_hook.py': PYDEV_FILE,
+ 'pydev_imports.py': PYDEV_FILE,
+ 'pydev_ipython_console.py': PYDEV_FILE,
+ 'pydev_ipython_console_011.py': PYDEV_FILE,
+ 'pydev_is_thread_alive.py': PYDEV_FILE,
+ 'pydev_localhost.py': PYDEV_FILE,
+ 'pydev_log.py': PYDEV_FILE,
+ 'pydev_monkey.py': PYDEV_FILE,
+ 'pydev_monkey_qt.py': PYDEV_FILE,
+ 'pydev_override.py': PYDEV_FILE,
+ 'pydev_run_in_console.py': PYDEV_FILE,
+ 'pydev_umd.py': PYDEV_FILE,
+ 'pydev_versioncheck.py': PYDEV_FILE,
+ 'pydevconsole.py': PYDEV_FILE,
+ 'pydevconsole_code_for_ironpython.py': PYDEV_FILE,
+ 'pydevd.py': PYDEV_FILE,
+ 'pydevd_additional_thread_info.py': PYDEV_FILE,
+ 'pydevd_additional_thread_info_regular.py': PYDEV_FILE,
+ 'pydevd_breakpoints.py': PYDEV_FILE,
+ 'pydevd_comm.py': PYDEV_FILE,
+ 'pydevd_command_line_handling.py': PYDEV_FILE,
+ 'pydevd_concurrency_logger.py': PYDEV_FILE,
+ 'pydevd_console.py': PYDEV_FILE,
+ 'pydevd_constants.py': PYDEV_FILE,
+ 'pydevd_custom_frames.py': PYDEV_FILE,
+ 'pydevd_cython_wrapper.py': PYDEV_FILE,
+ 'pydevd_dont_trace.py': PYDEV_FILE,
+ 'pydevd_dont_trace_files.py': PYDEV_FILE,
+ 'pydevd_exec.py': PYDEV_FILE,
+ 'pydevd_exec2.py': PYDEV_FILE,
+ 'pydevd_extension_api.py': PYDEV_FILE,
+ 'pydevd_extension_utils.py': PYDEV_FILE,
+ 'pydevd_file_utils.py': PYDEV_FILE,
+ 'pydevd_frame.py': PYDEV_FILE,
+ 'pydevd_frame_eval_cython_wrapper.py': PYDEV_FILE,
+ 'pydevd_frame_eval_main.py': PYDEV_FILE,
+ 'pydevd_frame_tracing.py': PYDEV_FILE,
+ 'pydevd_frame_utils.py': PYDEV_FILE,
+ 'pydevd_helpers.py': PYDEV_FILE,
+ 'pydevd_import_class.py': PYDEV_FILE,
+ 'pydevd_io.py': PYDEV_FILE,
+ 'pydevd_kill_all_pydevd_threads.py': PYDEV_FILE,
+ 'pydevd_modify_bytecode.py': PYDEV_FILE,
+ 'pydevd_plugin_numpy_types.py': PYDEV_FILE,
+ 'pydevd_plugin_utils.py': PYDEV_FILE,
+ 'pydevd_plugins_django_form_str.py': PYDEV_FILE,
+ 'pydevd_process_net_command.py': PYDEV_FILE,
+ 'pydevd_referrers.py': PYDEV_FILE,
+ 'pydevd_reload.py': PYDEV_FILE,
+ 'pydevd_resolver.py': PYDEV_FILE,
+ 'pydevd_save_locals.py': PYDEV_FILE,
+ 'pydevd_signature.py': PYDEV_FILE,
+ 'pydevd_stackless.py': PYDEV_FILE,
+ 'pydevd_thread_wrappers.py': PYDEV_FILE,
+ 'pydevd_trace_api.py': PYDEV_FILE,
+ 'pydevd_trace_dispatch.py': PYDEV_FILE,
+ 'pydevd_trace_dispatch_regular.py': PYDEV_FILE,
+ 'pydevd_traceproperty.py': PYDEV_FILE,
+ 'pydevd_tracing.py': PYDEV_FILE,
+ 'pydevd_utils.py': PYDEV_FILE,
+ 'pydevd_vars.py': PYDEV_FILE,
+ 'pydevd_vm_type.py': PYDEV_FILE,
+ 'pydevd_xml.py': PYDEV_FILE,
+}
+
+if IS_PY3K:
+ # if we try to trace io.py it seems it can get halted (see http://bugs.python.org/issue4716)
+ DONT_TRACE['io.py'] = LIB_FILE
+
+ # Don't trace common encodings too
+ DONT_TRACE['cp1252.py'] = LIB_FILE
+ DONT_TRACE['utf_8.py'] = LIB_FILE
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_exec.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_exec.py
new file mode 100644
index 00000000..9a342ee1
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_exec.py
@@ -0,0 +1,5 @@
+def Exec(exp, global_vars, local_vars=None):
+ if local_vars is not None:
+ exec exp in global_vars, local_vars
+ else:
+ exec exp in global_vars
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_exec2.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_exec2.py
new file mode 100644
index 00000000..ee4f37a6
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_exec2.py
@@ -0,0 +1,5 @@
+def Exec(exp, global_vars, local_vars=None):
+ if local_vars is not None:
+ exec(exp, global_vars, local_vars)
+ else:
+ exec(exp, global_vars)
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_api.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_api.py
new file mode 100644
index 00000000..aac7c799
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_api.py
@@ -0,0 +1,87 @@
+import abc
+
+
+# borrowed from from six
+def _with_metaclass(meta, *bases):
+ """Create a base class with a metaclass."""
+
+ class metaclass(meta):
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+
+ return type.__new__(metaclass, 'temporary_class', (), {})
+
+
+# =======================================================================================================================
+# AbstractResolver
+# =======================================================================================================================
+class _AbstractResolver(_with_metaclass(abc.ABCMeta)):
+ """
+ This class exists only for documentation purposes to explain how to create a resolver.
+
+ Some examples on how to resolve things:
+ - list: get_dictionary could return a dict with index->item and use the index to resolve it later
+ - set: get_dictionary could return a dict with id(object)->object and reiterate in that array to resolve it later
+ - arbitrary instance: get_dictionary could return dict with attr_name->attr and use getattr to resolve it later
+ """
+
+ @abc.abstractmethod
+ def resolve(self, var, attribute):
+ """
+ In this method, we'll resolve some child item given the string representation of the item in the key
+ representing the previously asked dictionary.
+
+ @param var: this is the actual variable to be resolved.
+ @param attribute: this is the string representation of a key previously returned in get_dictionary.
+ """
+ raise NotImplementedError
+
+ @abc.abstractmethod
+ def get_dictionary(self, var):
+ """
+ @param var: this is the variable that should have its children gotten.
+
+ @return: a dictionary where each pair key, value should be shown to the user as children items
+ in the variables view for the given var.
+ """
+ raise NotImplementedError
+
+
+class _AbstractProvider(_with_metaclass(abc.ABCMeta)):
+ @abc.abstractmethod
+ def can_provide(self, type_object, type_name):
+ raise NotImplementedError
+
+
+# =======================================================================================================================
+# API CLASSES:
+# =======================================================================================================================
+
+class TypeResolveProvider(_AbstractResolver, _AbstractProvider):
+ """
+ Implement this in an extension to provide a custom resolver, see _AbstractResolver
+ """
+
+
+class StrPresentationProvider(_AbstractProvider):
+ """
+ Implement this in an extension to provide a str presentation for a type
+ """
+
+ @abc.abstractmethod
+ def get_str(self, val):
+ raise NotImplementedError
+
+
+class DebuggerEventHandler(_with_metaclass(abc.ABCMeta)):
+ """
+ Implement this to receive lifecycle events from the debugger
+ """
+
+ def on_debugger_modules_loaded(self, **kwargs):
+ """
+ This method invoked after all debugger modules are loaded. Useful for importing and/or patching debugger
+ modules at a safe time
+ :param kwargs: This is intended to be flexible dict passed from the debugger.
+ Currently passes the debugger version
+ """
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_utils.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_utils.py
new file mode 100644
index 00000000..cc0de9d7
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_extension_utils.py
@@ -0,0 +1,61 @@
+import pkgutil
+import sys
+from _pydev_bundle import pydev_log
+import pydevd_plugins.extensions
+
+class ExtensionManager(object):
+
+ def __init__(self):
+ self.loaded_extensions = None
+ self.type_to_instance = {}
+
+ def _load_modules(self):
+ self.loaded_extensions = []
+ for module_loader, name, ispkg in pkgutil.walk_packages(pydevd_plugins.extensions.__path__,
+ pydevd_plugins.extensions.__name__ + '.'):
+ mod_name = name.split('.')[-1]
+ if not ispkg and mod_name.startswith('pydevd_plugin'):
+ try:
+ __import__(name)
+ module = sys.modules[name]
+ self.loaded_extensions.append(module)
+ except ImportError:
+ pydev_log.error('Unable to load extension ' + name)
+
+ def _ensure_loaded(self):
+ if self.loaded_extensions is None:
+ self._load_modules()
+
+ def _iter_attr(self):
+ for extension in self.loaded_extensions:
+ dunder_all = getattr(extension, '__all__', None)
+ for attr_name in dir(extension):
+ if not attr_name.startswith('_'):
+ if dunder_all is None or attr_name in dunder_all:
+ yield attr_name, getattr(extension, attr_name)
+
+ def get_extension_classes(self, extension_type):
+ self._ensure_loaded()
+ if extension_type in self.type_to_instance:
+ return self.type_to_instance[extension_type]
+ handlers = self.type_to_instance.setdefault(extension_type, [])
+ for attr_name, attr in self._iter_attr():
+ if isinstance(attr, type) and issubclass(attr, extension_type) and attr is not extension_type:
+ try:
+ handlers.append(attr())
+ except:
+ pydev_log.error('Unable to load extension class' + attr_name, tb=True)
+ return handlers
+
+
+EXTENSION_MANAGER_INSTANCE = ExtensionManager()
+
+def extensions_of_type(extension_type):
+ """
+
+ :param T extension_type: The type of the extension hook
+ :rtype: list[T]
+ """
+ return EXTENSION_MANAGER_INSTANCE.get_extension_classes(extension_type)
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_frame.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_frame.py
new file mode 100644
index 00000000..5458c330
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_frame.py
@@ -0,0 +1,781 @@
+import linecache
+import os.path
+import re
+import sys
+import traceback # @Reimport
+
+from _pydev_bundle import pydev_log
+from _pydevd_bundle import pydevd_dont_trace
+from _pydevd_bundle import pydevd_vars
+from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
+from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, \
+ CMD_STEP_INTO, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO_MY_CODE
+from _pydevd_bundle.pydevd_constants import STATE_SUSPEND, get_thread_id, STATE_RUN, dict_iter_values, IS_PY3K, \
+ RETURN_VALUES_DICT
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE
+from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, just_raised
+from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+try:
+ from inspect import CO_GENERATOR
+except:
+ CO_GENERATOR = 0
+
+try:
+ from _pydevd_bundle.pydevd_signature import send_signature_call_trace, send_signature_return_trace
+except ImportError:
+ def send_signature_call_trace(*args, **kwargs):
+ pass
+
+basename = os.path.basename
+
+IGNORE_EXCEPTION_TAG = re.compile('[^#]*#.*@IgnoreException')
+DEBUG_START = ('pydevd.py', 'run')
+DEBUG_START_PY3K = ('_pydev_execfile.py', 'execfile')
+TRACE_PROPERTY = 'pydevd_traceproperty.py'
+get_file_type = DONT_TRACE.get
+
+
+def handle_breakpoint_condition(py_db, info, breakpoint, new_frame, default_return_value):
+ condition = breakpoint.condition
+ try:
+ val = eval(condition, new_frame.f_globals, new_frame.f_locals)
+ if not val:
+ return default_return_value
+
+ except:
+ if type(condition) != type(''):
+ if hasattr(condition, 'encode'):
+ condition = condition.encode('utf-8')
+
+ msg = 'Error while evaluating expression: %s\n' % (condition,)
+ sys.stderr.write(msg)
+ traceback.print_exc()
+ if not py_db.suspend_on_breakpoint_exception:
+ return default_return_value
+ else:
+ stop = True
+ try:
+ # add exception_type and stacktrace into thread additional info
+ etype, value, tb = sys.exc_info()
+ try:
+ error = ''.join(traceback.format_exception_only(etype, value))
+ stack = traceback.extract_stack(f=tb.tb_frame.f_back)
+
+ # On self.set_suspend(thread, CMD_SET_BREAK) this info will be
+ # sent to the client.
+ info.conditional_breakpoint_exception = \
+ ('Condition:\n' + condition + '\n\nError:\n' + error, stack)
+ finally:
+ etype, value, tb = None, None, None
+ except:
+ traceback.print_exc()
+
+
+def handle_breakpoint_expression(breakpoint, info, new_frame):
+ try:
+ try:
+ val = eval(breakpoint.expression, new_frame.f_globals, new_frame.f_locals)
+ except:
+ val = sys.exc_info()[1]
+ finally:
+ if val is not None:
+ info.pydev_message = str(val)
+
+
+#=======================================================================================================================
+# PyDBFrame
+#=======================================================================================================================
+# IFDEF CYTHON
+# cdef class PyDBFrame:
+# ELSE
+class PyDBFrame:
+ '''This makes the tracing for a given frame, so, the trace_dispatch
+ is used initially when we enter into a new context ('call') and then
+ is reused for the entire context.
+ '''
+# ENDIF
+
+
+ #Note: class (and not instance) attributes.
+
+ #Same thing in the main debugger but only considering the file contents, while the one in the main debugger
+ #considers the user input (so, the actual result must be a join of both).
+ filename_to_lines_where_exceptions_are_ignored = {}
+ filename_to_stat_info = {}
+
+ # IFDEF CYTHON
+ # cdef tuple _args
+ # cdef int should_skip
+ # def __init__(self, tuple args):
+ # self._args = args # In the cython version we don't need to pass the frame
+ # self.should_skip = -1 # On cythonized version, put in instance.
+ # ELSE
+ should_skip = -1 # Default value in class (put in instance on set).
+
+ def __init__(self, args):
+ #args = main_debugger, filename, base, info, t, frame
+ #yeap, much faster than putting in self and then getting it from self later on
+ self._args = args
+ # ENDIF
+
+ def set_suspend(self, *args, **kwargs):
+ self._args[0].set_suspend(*args, **kwargs)
+
+ def do_wait_suspend(self, *args, **kwargs):
+ self._args[0].do_wait_suspend(*args, **kwargs)
+
+ # IFDEF CYTHON
+ # def trace_exception(self, frame, str event, arg):
+ # cdef bint flag;
+ # ELSE
+ def trace_exception(self, frame, event, arg):
+ # ENDIF
+ if event == 'exception':
+ flag, frame = self.should_stop_on_exception(frame, event, arg)
+
+ if flag:
+ self.handle_exception(frame, event, arg)
+ return self.trace_dispatch
+
+ return self.trace_exception
+
+ def trace_return(self, frame, event, arg):
+ if event == 'return':
+ main_debugger, filename = self._args[0], self._args[1]
+ send_signature_return_trace(main_debugger, frame, filename, arg)
+ return self.trace_return
+
+ # IFDEF CYTHON
+ # def should_stop_on_exception(self, frame, str event, arg):
+ # cdef PyDBAdditionalThreadInfo info;
+ # cdef bint flag;
+ # ELSE
+ def should_stop_on_exception(self, frame, event, arg):
+ # ENDIF
+
+ # main_debugger, _filename, info, _thread = self._args
+ main_debugger = self._args[0]
+ info = self._args[2]
+ flag = False
+
+ # STATE_SUSPEND = 2
+ if info.pydev_state != 2: #and breakpoint is not None:
+ exception, value, trace = arg
+
+ if trace is not None: #on jython trace is None on the first event
+ exception_breakpoint = get_exception_breakpoint(
+ exception, main_debugger.break_on_caught_exceptions)
+
+ if exception_breakpoint is not None:
+ if exception_breakpoint.ignore_libraries:
+ if exception_breakpoint.notify_on_first_raise_only:
+ if main_debugger.first_appearance_in_scope(trace):
+ add_exception_to_frame(frame, (exception, value, trace))
+ try:
+ info.pydev_message = exception_breakpoint.qname
+ except:
+ info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ flag = True
+ else:
+ pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
+ flag = False
+ else:
+ if not exception_breakpoint.notify_on_first_raise_only or just_raised(trace):
+ add_exception_to_frame(frame, (exception, value, trace))
+ try:
+ info.pydev_message = exception_breakpoint.qname
+ except:
+ info.pydev_message = exception_breakpoint.qname.encode('utf-8')
+ flag = True
+ else:
+ flag = False
+ else:
+ try:
+ if main_debugger.plugin is not None:
+ result = main_debugger.plugin.exception_break(main_debugger, self, frame, self._args, arg)
+ if result:
+ flag, frame = result
+ except:
+ flag = False
+
+ return flag, frame
+
+ def handle_exception(self, frame, event, arg):
+ try:
+ # print 'handle_exception', frame.f_lineno, frame.f_code.co_name
+
+ # We have 3 things in arg: exception type, description, traceback object
+ trace_obj = arg[2]
+ main_debugger = self._args[0]
+
+ if not hasattr(trace_obj, 'tb_next'):
+ return #Not always there on Jython...
+
+ initial_trace_obj = trace_obj
+ if trace_obj.tb_next is None and trace_obj.tb_frame is frame:
+ #I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check).
+
+ if main_debugger.break_on_exceptions_thrown_in_same_context:
+ #Option: Don't break if an exception is caught in the same function from which it is thrown
+ return
+ else:
+ #Get the trace_obj from where the exception was raised...
+ while trace_obj.tb_next is not None:
+ trace_obj = trace_obj.tb_next
+
+
+ if main_debugger.ignore_exceptions_thrown_in_lines_with_ignore_exception:
+ for check_trace_obj in (initial_trace_obj, trace_obj):
+ filename = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame)[1]
+
+
+ filename_to_lines_where_exceptions_are_ignored = self.filename_to_lines_where_exceptions_are_ignored
+
+
+ lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(filename)
+ if lines_ignored is None:
+ lines_ignored = filename_to_lines_where_exceptions_are_ignored[filename] = {}
+
+ try:
+ curr_stat = os.stat(filename)
+ curr_stat = (curr_stat.st_size, curr_stat.st_mtime)
+ except:
+ curr_stat = None
+
+ last_stat = self.filename_to_stat_info.get(filename)
+ if last_stat != curr_stat:
+ self.filename_to_stat_info[filename] = curr_stat
+ lines_ignored.clear()
+ try:
+ linecache.checkcache(filename)
+ except:
+ #Jython 2.1
+ linecache.checkcache()
+
+ from_user_input = main_debugger.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ if from_user_input:
+ merged = {}
+ merged.update(lines_ignored)
+ #Override what we have with the related entries that the user entered
+ merged.update(from_user_input)
+ else:
+ merged = lines_ignored
+
+ exc_lineno = check_trace_obj.tb_lineno
+
+ # print ('lines ignored', lines_ignored)
+ # print ('user input', from_user_input)
+ # print ('merged', merged, 'curr', exc_lineno)
+
+ if exc_lineno not in merged: #Note: check on merged but update lines_ignored.
+ try:
+ line = linecache.getline(filename, exc_lineno, check_trace_obj.tb_frame.f_globals)
+ except:
+ #Jython 2.1
+ line = linecache.getline(filename, exc_lineno)
+
+ if IGNORE_EXCEPTION_TAG.match(line) is not None:
+ lines_ignored[exc_lineno] = 1
+ return
+ else:
+ #Put in the cache saying not to ignore
+ lines_ignored[exc_lineno] = 0
+ else:
+ #Ok, dict has it already cached, so, let's check it...
+ if merged.get(exc_lineno, 0):
+ return
+
+
+ thread = self._args[3]
+
+ try:
+ frame_id_to_frame = {}
+ frame_id_to_frame[id(frame)] = frame
+ f = trace_obj.tb_frame
+ while f is not None:
+ frame_id_to_frame[id(f)] = f
+ f = f.f_back
+ f = None
+
+ thread_id = get_thread_id(thread)
+ pydevd_vars.add_additional_frame_by_id(thread_id, frame_id_to_frame)
+ try:
+ main_debugger.send_caught_exception_stack(thread, arg, id(frame))
+ self.set_suspend(thread, CMD_STEP_CAUGHT_EXCEPTION)
+ self.do_wait_suspend(thread, frame, event, arg)
+ main_debugger.send_caught_exception_stack_proceeded(thread)
+
+ finally:
+ pydevd_vars.remove_additional_frame_by_id(thread_id)
+ except:
+ traceback.print_exc()
+
+ main_debugger.set_trace_for_frame_and_parents(frame)
+ finally:
+ #Clear some local variables...
+ trace_obj = None
+ initial_trace_obj = None
+ check_trace_obj = None
+ f = None
+ frame_id_to_frame = None
+ main_debugger = None
+ thread = None
+
+ def get_func_name(self, frame):
+ code_obj = frame.f_code
+ func_name = code_obj.co_name
+ try:
+ cls_name = get_clsname_for_code(code_obj, frame)
+ if cls_name is not None:
+ return "%s.%s" % (cls_name, func_name)
+ else:
+ return func_name
+ except:
+ traceback.print_exc()
+ return func_name
+
+ def show_return_values(self, frame, arg):
+ try:
+ try:
+ f_locals_back = getattr(frame.f_back, "f_locals", None)
+ if f_locals_back is not None:
+ return_values_dict = f_locals_back.get(RETURN_VALUES_DICT, None)
+ if return_values_dict is None:
+ return_values_dict = {}
+ f_locals_back[RETURN_VALUES_DICT] = return_values_dict
+ name = self.get_func_name(frame)
+ return_values_dict[name] = arg
+ except:
+ traceback.print_exc()
+ finally:
+ f_locals_back = None
+
+ def remove_return_values(self, main_debugger, frame):
+ try:
+ try:
+ # Showing return values was turned off, we should remove them from locals dict.
+ # The values can be in the current frame or in the back one
+ frame.f_locals.pop(RETURN_VALUES_DICT, None)
+
+ f_locals_back = getattr(frame.f_back, "f_locals", None)
+ if f_locals_back is not None:
+ f_locals_back.pop(RETURN_VALUES_DICT, None)
+ except:
+ traceback.print_exc()
+ finally:
+ f_locals_back = None
+
+ # IFDEF CYTHON
+ # cpdef trace_dispatch(self, frame, str event, arg):
+ # cdef str filename;
+ # cdef bint is_exception_event;
+ # cdef bint has_exception_breakpoints;
+ # cdef bint can_skip;
+ # cdef PyDBAdditionalThreadInfo info;
+ # cdef int step_cmd;
+ # cdef int line;
+ # cdef bint is_line;
+ # cdef bint is_call;
+ # cdef bint is_return;
+ # cdef str curr_func_name;
+ # cdef bint exist_result;
+ # cdef dict frame_skips_cache;
+ # cdef tuple frame_cache_key;
+ # cdef tuple line_cache_key;
+ # cdef int breakpoints_in_line_cache;
+ # cdef int breakpoints_in_frame_cache;
+ # cdef bint has_breakpoint_in_frame;
+ # ELSE
+ def trace_dispatch(self, frame, event, arg):
+ # ENDIF
+
+ main_debugger, filename, info, thread, frame_skips_cache, frame_cache_key = self._args
+ # print('frame trace_dispatch', frame.f_lineno, frame.f_code.co_name, event, info.pydev_step_cmd)
+ try:
+ info.is_tracing = True
+ line = frame.f_lineno
+ line_cache_key = (frame_cache_key, line)
+
+ if main_debugger._finish_debugging_session:
+ return None
+
+ plugin_manager = main_debugger.plugin
+
+ is_exception_event = event == 'exception'
+ has_exception_breakpoints = main_debugger.break_on_caught_exceptions or main_debugger.has_plugin_exception_breaks
+
+ if is_exception_event:
+ if has_exception_breakpoints:
+ flag, frame = self.should_stop_on_exception(frame, event, arg)
+ if flag:
+ self.handle_exception(frame, event, arg)
+ return self.trace_dispatch
+ is_line = False
+ is_return = False
+ is_call = False
+ else:
+ is_line = event == 'line'
+ is_return = event == 'return'
+ is_call = event == 'call'
+ if not is_line and not is_return and not is_call:
+ # I believe this can only happen in jython on some frontiers on jython and java code, which we don't want to trace.
+ return None
+
+ need_trace_return = False
+ if is_call and main_debugger.signature_factory:
+ need_trace_return = send_signature_call_trace(main_debugger, frame, filename)
+ if is_return and main_debugger.signature_factory:
+ send_signature_return_trace(main_debugger, frame, filename, arg)
+
+ stop_frame = info.pydev_step_stop
+ step_cmd = info.pydev_step_cmd
+
+ if is_exception_event:
+ breakpoints_for_file = None
+ # CMD_STEP_OVER = 108
+ if stop_frame and stop_frame is not frame and step_cmd == 108 and \
+ arg[0] in (StopIteration, GeneratorExit) and arg[2] is None:
+ info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ info.pydev_step_stop = None
+ else:
+ # If we are in single step mode and something causes us to exit the current frame, we need to make sure we break
+ # eventually. Force the step mode to step into and the step stop frame to None.
+ # I.e.: F6 in the end of a function should stop in the next possible position (instead of forcing the user
+ # to make a step in or step over at that location).
+ # Note: this is especially troublesome when we're skipping code with the
+ # @DontTrace comment.
+ if stop_frame is frame and is_return and step_cmd in (109, 108): # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ if not frame.f_code.co_flags & 0x20: # CO_GENERATOR = 0x20 (inspect.CO_GENERATOR)
+ info.pydev_step_cmd = 107 # CMD_STEP_INTO = 107
+ info.pydev_step_stop = None
+
+ breakpoints_for_file = main_debugger.breakpoints.get(filename)
+
+ can_skip = False
+
+ if info.pydev_state == 1: # STATE_RUN = 1
+ #we can skip if:
+ #- we have no stop marked
+ #- we should make a step return/step over and we're not in the current frame
+ # CMD_STEP_RETURN = 109, CMD_STEP_OVER = 108
+ can_skip = (step_cmd == -1 and stop_frame is None)\
+ or (step_cmd in (109, 108) and stop_frame is not frame)
+
+ if can_skip:
+ if plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ can_skip = not plugin_manager.can_not_skip(main_debugger, self, frame)
+
+ # CMD_STEP_OVER = 108
+ if can_skip and is_return and main_debugger.show_return_values and info.pydev_step_cmd == 108 and frame.f_back is info.pydev_step_stop:
+ # trace function for showing return values after step over
+ can_skip = False
+
+ # Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint,
+ # we will return nothing for the next trace
+ # also, after we hit a breakpoint and go to some other debugging state, we have to force the set trace anyway,
+ # so, that's why the additional checks are there.
+ if not breakpoints_for_file:
+ if can_skip:
+ if has_exception_breakpoints:
+ return self.trace_exception
+ else:
+ if need_trace_return:
+ return self.trace_return
+ else:
+ return None
+
+ else:
+ # When cached, 0 means we don't have a breakpoint and 1 means we have.
+ if can_skip:
+ breakpoints_in_line_cache = frame_skips_cache.get(line_cache_key, -1)
+ if breakpoints_in_line_cache == 0:
+ return self.trace_dispatch
+
+ breakpoints_in_frame_cache = frame_skips_cache.get(frame_cache_key, -1)
+ if breakpoints_in_frame_cache != -1:
+ # Gotten from cache.
+ has_breakpoint_in_frame = breakpoints_in_frame_cache == 1
+
+ else:
+ has_breakpoint_in_frame = False
+ # Checks the breakpoint to see if there is a context match in some function
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', ''):
+ curr_func_name = ''
+
+ for breakpoint in dict_iter_values(breakpoints_for_file): #jython does not support itervalues()
+ #will match either global or some function
+ if breakpoint.func_name in ('None', curr_func_name):
+ has_breakpoint_in_frame = True
+ break
+
+ # Cache the value (1 or 0 or -1 for default because of cython).
+ if has_breakpoint_in_frame:
+ frame_skips_cache[frame_cache_key] = 1
+ else:
+ frame_skips_cache[frame_cache_key] = 0
+
+
+ if can_skip and not has_breakpoint_in_frame:
+ if has_exception_breakpoints:
+ return self.trace_exception
+ else:
+ if need_trace_return:
+ return self.trace_return
+ else:
+ return None
+
+ #We may have hit a breakpoint or we are already in step mode. Either way, let's check what we should do in this frame
+ # print('NOT skipped', frame.f_lineno, frame.f_code.co_name, event)
+
+ try:
+ flag = False
+ #return is not taken into account for breakpoint hit because we'd have a double-hit in this case
+ #(one for the line and the other for the return).
+
+ stop_info = {}
+ breakpoint = None
+ exist_result = False
+ stop = False
+ bp_type = None
+ if not is_return and info.pydev_state != STATE_SUSPEND and breakpoints_for_file is not None and line in breakpoints_for_file:
+ breakpoint = breakpoints_for_file[line]
+ new_frame = frame
+ stop = True
+ if step_cmd == CMD_STEP_OVER and stop_frame is frame and (is_line or is_return):
+ stop = False #we don't stop on breakpoint if we have to stop by step-over (it will be processed later)
+ elif plugin_manager is not None and main_debugger.has_plugin_line_breaks:
+ result = plugin_manager.get_breakpoint(main_debugger, self, frame, event, self._args)
+ if result:
+ exist_result = True
+ flag, breakpoint, new_frame, bp_type = result
+
+ if breakpoint:
+ #ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ # lets do the conditional stuff here
+ if stop or exist_result:
+ condition = breakpoint.condition
+ if condition is not None:
+ result = handle_breakpoint_condition(main_debugger, info, breakpoint, new_frame,
+ self.trace_dispatch)
+ if result is not None:
+ return result
+
+ if breakpoint.expression is not None:
+ handle_breakpoint_expression(breakpoint, info, new_frame)
+
+ if not main_debugger.first_breakpoint_reached:
+ if is_call:
+ back = frame.f_back
+ if back is not None:
+ # When we start debug session, we call execfile in pydevd run function. It produces an additional
+ # 'call' event for tracing and we stop on the first line of code twice.
+ _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ if (base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]) or \
+ (base == DEBUG_START_PY3K[0] and back.f_code.co_name == DEBUG_START_PY3K[1]):
+ stop = False
+ main_debugger.first_breakpoint_reached = True
+ else:
+ # if the frame is traced after breakpoint stop,
+ # but the file should be ignored while stepping because of filters
+ if step_cmd != -1:
+ if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
+ # ignore files matching stepping filters
+ return self.trace_dispatch
+ if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename):
+ # ignore library files while stepping
+ return self.trace_dispatch
+
+ if main_debugger.show_return_values:
+ if is_return and info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
+ self.show_return_values(frame, arg)
+
+ elif main_debugger.remove_return_values_flag:
+ try:
+ self.remove_return_values(main_debugger, frame)
+ finally:
+ main_debugger.remove_return_values_flag = False
+
+ if stop:
+ self.set_suspend(thread, CMD_SET_BREAK)
+ if breakpoint and breakpoint.suspend_policy == "ALL":
+ main_debugger.suspend_all_other_threads(thread)
+ elif flag and plugin_manager is not None:
+ result = plugin_manager.suspend(main_debugger, thread, frame, bp_type)
+ if result:
+ frame = result
+
+ # if thread has a suspend flag, we suspend with a busy wait
+ if info.pydev_state == STATE_SUSPEND:
+ self.do_wait_suspend(thread, frame, event, arg)
+ return self.trace_dispatch
+ else:
+ if not breakpoint and not is_return:
+ # No stop from anyone and no breakpoint found in line (cache that).
+ frame_skips_cache[line_cache_key] = 0
+
+ except:
+ traceback.print_exc()
+ raise
+
+ #step handling. We stop when we hit the right frame
+ try:
+ should_skip = 0
+ if pydevd_dont_trace.should_trace_hook is not None:
+ if self.should_skip == -1:
+ # I.e.: cache the result on self.should_skip (no need to evaluate the same frame multiple times).
+ # Note that on a code reload, we won't re-evaluate this because in practice, the frame.f_code
+ # Which will be handled by this frame is read-only, so, we can cache it safely.
+ if not pydevd_dont_trace.should_trace_hook(frame, filename):
+ # -1, 0, 1 to be Cython-friendly
+ should_skip = self.should_skip = 1
+ else:
+ should_skip = self.should_skip = 0
+ else:
+ should_skip = self.should_skip
+
+ plugin_stop = False
+ if should_skip:
+ stop = False
+
+ elif step_cmd == CMD_STEP_INTO:
+ stop = is_line or is_return
+ if plugin_manager is not None:
+ result = plugin_manager.cmd_step_into(main_debugger, frame, event, self._args, stop_info, stop)
+ if result:
+ stop, plugin_stop = result
+
+ elif step_cmd == CMD_STEP_INTO_MY_CODE:
+ if not main_debugger.not_in_scope(frame.f_code.co_filename):
+ stop = is_line
+
+ elif step_cmd == CMD_STEP_OVER:
+ stop = stop_frame is frame and (is_line or is_return)
+
+ if frame.f_code.co_flags & CO_GENERATOR:
+ if is_return:
+ stop = False
+
+ if plugin_manager is not None:
+ result = plugin_manager.cmd_step_over(main_debugger, frame, event, self._args, stop_info, stop)
+ if result:
+ stop, plugin_stop = result
+
+ elif step_cmd == CMD_SMART_STEP_INTO:
+ stop = False
+ if info.pydev_smart_step_stop is frame:
+ info.pydev_func_name = '.invalid.' # Must match the type in cython
+ info.pydev_smart_step_stop = None
+
+ if is_line or is_exception_event:
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', '') or curr_func_name is None:
+ curr_func_name = ''
+
+ if curr_func_name == info.pydev_func_name:
+ stop = True
+
+ elif step_cmd == CMD_STEP_RETURN:
+ stop = is_return and stop_frame is frame
+
+ elif step_cmd == CMD_RUN_TO_LINE or step_cmd == CMD_SET_NEXT_STATEMENT:
+ stop = False
+
+ if is_line or is_exception_event:
+ #Yes, we can only act on line events (weird hum?)
+ #Note: This code is duplicated at pydevd.py
+ #Acting on exception events after debugger breaks with exception
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', ''):
+ curr_func_name = ''
+
+ if curr_func_name == info.pydev_func_name:
+ line = info.pydev_next_line
+ if frame.f_lineno == line:
+ stop = True
+ else:
+ if frame.f_trace is None:
+ frame.f_trace = self.trace_dispatch
+ frame.f_lineno = line
+ frame.f_trace = None
+ stop = True
+
+ else:
+ stop = False
+
+ if stop and step_cmd != -1 and is_return and IS_PY3K and hasattr(frame, "f_back"):
+ f_code = getattr(frame.f_back, 'f_code', None)
+ if f_code is not None:
+ back_filename = os.path.basename(f_code.co_filename)
+ file_type = get_file_type(back_filename)
+ if file_type == PYDEV_FILE:
+ stop = False
+
+ if plugin_stop:
+ stopped_on_plugin = plugin_manager.stop(main_debugger, frame, event, self._args, stop_info, arg, step_cmd)
+ elif stop:
+ if is_line:
+ self.set_suspend(thread, step_cmd)
+ self.do_wait_suspend(thread, frame, event, arg)
+ else: #return event
+ back = frame.f_back
+ if back is not None:
+ #When we get to the pydevd run function, the debugging has actually finished for the main thread
+ #(note that it can still go on for other threads, but for this one, we just make it finish)
+ #So, just setting it to None should be OK
+ _, back_filename, base = get_abs_path_real_path_and_base_from_frame(back)
+ if base == DEBUG_START[0] and back.f_code.co_name == DEBUG_START[1]:
+ back = None
+
+ elif base == TRACE_PROPERTY:
+ # We dont want to trace the return event of pydevd_traceproperty (custom property for debugging)
+ #if we're in a return, we want it to appear to the user in the previous frame!
+ return None
+
+ elif pydevd_dont_trace.should_trace_hook is not None:
+ if not pydevd_dont_trace.should_trace_hook(back, back_filename):
+ # In this case, we'll have to skip the previous one because it shouldn't be traced.
+ # Also, we have to reset the tracing, because if the parent's parent (or some
+ # other parent) has to be traced and it's not currently, we wouldn't stop where
+ # we should anymore (so, a step in/over/return may not stop anywhere if no parent is traced).
+ # Related test: _debugger_case17a.py
+ main_debugger.set_trace_for_frame_and_parents(back, overwrite_prev_trace=True)
+ return None
+
+ if back is not None:
+ #if we're in a return, we want it to appear to the user in the previous frame!
+ self.set_suspend(thread, step_cmd)
+ self.do_wait_suspend(thread, back, event, arg)
+ else:
+ #in jython we may not have a back frame
+ info.pydev_step_stop = None
+ info.pydev_step_cmd = -1
+ info.pydev_state = STATE_RUN
+
+ except KeyboardInterrupt:
+ raise
+ except:
+ try:
+ traceback.print_exc()
+ info.pydev_step_cmd = -1
+ except:
+ return None
+
+ #if we are quitting, let's stop the tracing
+ retVal = None
+ if not main_debugger.quitting:
+ retVal = self.trace_dispatch
+
+ return retVal
+ finally:
+ info.is_tracing = False
+
+ #end trace_dispatch
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_frame_utils.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_frame_utils.py
new file mode 100644
index 00000000..fbefd843
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_frame_utils.py
@@ -0,0 +1,59 @@
+from _pydevd_bundle.pydevd_constants import IS_PY3K
+
+class Frame(object):
+ def __init__(
+ self,
+ f_back,
+ f_fileno,
+ f_code,
+ f_locals,
+ f_globals=None,
+ f_trace=None):
+ self.f_back = f_back
+ self.f_lineno = f_fileno
+ self.f_code = f_code
+ self.f_locals = f_locals
+ self.f_globals = f_globals
+ self.f_trace = f_trace
+
+ if self.f_globals is None:
+ self.f_globals = {}
+
+
+class FCode(object):
+ def __init__(self, name, filename):
+ self.co_name = name
+ self.co_filename = filename
+
+
+def add_exception_to_frame(frame, exception_info):
+ frame.f_locals['__exception__'] = exception_info
+
+FILES_WITH_IMPORT_HOOKS = ['pydev_monkey_qt.py', 'pydev_import_hook.py']
+
+def just_raised(trace):
+ if trace is None:
+ return False
+ if trace.tb_next is None:
+ if IS_PY3K:
+ if trace.tb_frame.f_code.co_filename != '':
+ # Do not stop on inner exceptions in py3 while importing
+ return True
+ else:
+ return True
+ if trace.tb_next is not None:
+ filename = trace.tb_next.tb_frame.f_code.co_filename
+ # ImportError should appear in a user's code, not inside debugger
+ for file in FILES_WITH_IMPORT_HOOKS:
+ if filename.endswith(file):
+ return True
+ return False
+
+def cached_call(obj, func, *args):
+ cached_name = '_cached_' + func.__name__
+ if not hasattr(obj, cached_name):
+ setattr(obj, cached_name, func(*args))
+
+ return getattr(obj, cached_name)
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_import_class.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_import_class.py
new file mode 100644
index 00000000..ee3527c5
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_import_class.py
@@ -0,0 +1,68 @@
+#Note: code gotten from _pydev_imports_tipper.
+
+import sys
+
+def _imp(name, log=None):
+ try:
+ return __import__(name)
+ except:
+ if '.' in name:
+ sub = name[0:name.rfind('.')]
+
+ if log is not None:
+ log.add_content('Unable to import', name, 'trying with', sub)
+ log.add_exception()
+
+ return _imp(sub, log)
+ else:
+ s = 'Unable to import module: %s - sys.path: %s' % (str(name), sys.path)
+ if log is not None:
+ log.add_content(s)
+ log.add_exception()
+
+ raise ImportError(s)
+
+
+IS_IPY = False
+if sys.platform == 'cli':
+ IS_IPY = True
+ _old_imp = _imp
+ def _imp(name, log=None):
+ #We must add a reference in clr for .Net
+ import clr #@UnresolvedImport
+ initial_name = name
+ while '.' in name:
+ try:
+ clr.AddReference(name)
+ break #If it worked, that's OK.
+ except:
+ name = name[0:name.rfind('.')]
+ else:
+ try:
+ clr.AddReference(name)
+ except:
+ pass #That's OK (not dot net module).
+
+ return _old_imp(initial_name, log)
+
+
+def import_name(name, log=None):
+ mod = _imp(name, log)
+
+ components = name.split('.')
+
+ old_comp = None
+ for comp in components[1:]:
+ try:
+ #this happens in the following case:
+ #we have mx.DateTime.mxDateTime.mxDateTime.pyd
+ #but after importing it, mx.DateTime.mxDateTime shadows access to mxDateTime.pyd
+ mod = getattr(mod, comp)
+ except AttributeError:
+ if old_comp != comp:
+ raise
+
+ old_comp = comp
+
+ return mod
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_io.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_io.py
new file mode 100644
index 00000000..197f72c2
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_io.py
@@ -0,0 +1,101 @@
+from _pydevd_bundle import pydevd_constants
+
+IS_PY3K = pydevd_constants.IS_PY3K
+
+class IORedirector:
+ '''This class works to redirect the write function to many streams
+ '''
+
+ def __init__(self, *args):
+ self._redirectTo = args
+
+ def write(self, s):
+ for r in self._redirectTo:
+ try:
+ r.write(s)
+ except:
+ pass
+
+ def isatty(self):
+ return False
+
+ def flush(self):
+ for r in self._redirectTo:
+ r.flush()
+
+ def __getattr__(self, name):
+ for r in self._redirectTo:
+ if hasattr(r, name):
+ return getattr(r, name)
+ raise AttributeError(name)
+
+class IOBuf:
+ '''This class works as a replacement for stdio and stderr.
+ It is a buffer and when its contents are requested, it will erase what
+
+ it has so far so that the next return will not return the same contents again.
+ '''
+ def __init__(self):
+ self.buflist = []
+ import os
+ self.encoding = os.environ.get('PYTHONIOENCODING', 'utf-8')
+
+ def getvalue(self):
+ b = self.buflist
+ self.buflist = [] #clear it
+ return ''.join(b)
+
+ def write(self, s):
+ if not IS_PY3K:
+ if isinstance(s, unicode):
+ s = s.encode(self.encoding)
+ self.buflist.append(s)
+
+ def isatty(self):
+ return False
+
+ def flush(self):
+ pass
+
+ def empty(self):
+ return len(self.buflist) == 0
+
+class _RedirectionsHolder:
+ _stack_stdout = []
+ _stack_stderr = []
+
+
+def start_redirect(keep_original_redirection=False, std='stdout'):
+ '''
+ @param std: 'stdout', 'stderr', or 'both'
+ '''
+ import sys
+ buf = IOBuf()
+
+ if std == 'both':
+ config_stds = ['stdout', 'stderr']
+ else:
+ config_stds = [std]
+
+ for std in config_stds:
+ original = getattr(sys, std)
+ stack = getattr(_RedirectionsHolder, '_stack_%s' % std)
+ stack.append(original)
+
+ if keep_original_redirection:
+ setattr(sys, std, IORedirector(buf, getattr(sys, std)))
+ else:
+ setattr(sys, std, buf)
+ return buf
+
+
+def end_redirect(std='stdout'):
+ import sys
+ if std == 'both':
+ config_stds = ['stdout', 'stderr']
+ else:
+ config_stds = [std]
+ for std in config_stds:
+ stack = getattr(_RedirectionsHolder, '_stack_%s' % std)
+ setattr(sys, std, stack.pop())
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_kill_all_pydevd_threads.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_kill_all_pydevd_threads.py
new file mode 100644
index 00000000..1ae81e91
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_kill_all_pydevd_threads.py
@@ -0,0 +1,8 @@
+from _pydevd_bundle.pydevd_comm import PyDBDaemonThread
+from _pydevd_bundle.pydevd_constants import dict_keys
+
+def kill_all_pydev_threads():
+ threads = dict_keys(PyDBDaemonThread.created_pydb_daemon_threads)
+ for t in threads:
+ if hasattr(t, 'do_kill_pydev_thread'):
+ t.do_kill_pydev_thread()
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_plugin_utils.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_plugin_utils.py
new file mode 100644
index 00000000..0cd0d761
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_plugin_utils.py
@@ -0,0 +1,91 @@
+import types
+
+from _pydev_bundle import pydev_log
+from _pydevd_bundle import pydevd_trace_api
+
+try:
+ from pydevd_plugins import django_debug
+except:
+ django_debug = None
+ pydev_log.debug('Unable to load django_debug plugin')
+
+try:
+ from pydevd_plugins import jinja2_debug
+except:
+ jinja2_debug = None
+ pydev_log.debug('Unable to load jinja2_debug plugin')
+
+def load_plugins():
+ plugins = []
+ if django_debug is not None:
+ plugins.append(django_debug)
+
+ if jinja2_debug is not None:
+ plugins.append(jinja2_debug)
+ return plugins
+
+
+def bind_func_to_method(func, obj, method_name):
+ bound_method = types.MethodType(func, obj)
+
+ setattr(obj, method_name, bound_method)
+ return bound_method
+
+
+class PluginManager(object):
+
+ def __init__(self, main_debugger):
+ self.plugins = load_plugins()
+ self.active_plugins = []
+ self.main_debugger = main_debugger
+ self.rebind_methods()
+
+ def add_breakpoint(self, func_name, *args, **kwargs):
+ # add breakpoint for plugin and remember which plugin to use in tracing
+ for plugin in self.plugins:
+ if hasattr(plugin, func_name):
+ func = getattr(plugin, func_name)
+ result = func(self, *args, **kwargs)
+ if result:
+ self.activate(plugin)
+
+ return result
+ return None
+
+ def activate(self, plugin):
+ if plugin not in self.active_plugins:
+ self.active_plugins.append(plugin)
+ self.rebind_methods()
+
+ def rebind_methods(self):
+ if len(self.active_plugins) == 0:
+ self.bind_functions(pydevd_trace_api, getattr, pydevd_trace_api)
+ elif len(self.active_plugins) == 1:
+ self.bind_functions(pydevd_trace_api, getattr, self.active_plugins[0])
+ else:
+ self.bind_functions(pydevd_trace_api, create_dispatch, self.active_plugins)
+
+ def bind_functions(self, interface, function_factory, arg):
+ for name in dir(interface):
+ func = function_factory(arg, name)
+ if type(func) == types.FunctionType:
+ bind_func_to_method(func, self, name)
+
+
+def create_dispatch(obj, name):
+ def dispatch(self, *args, **kwargs):
+ result = None
+ for p in self.active_plugins:
+ r = getattr(p, name)(self, *args, **kwargs)
+ if not result:
+ result = r
+ return result
+ return dispatch
+
+
+
+
+
+
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_process_net_command.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_process_net_command.py
new file mode 100644
index 00000000..5931e3e5
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_process_net_command.py
@@ -0,0 +1,709 @@
+import os
+import sys
+import traceback
+
+from _pydev_bundle import pydev_log
+from _pydevd_bundle import pydevd_traceproperty, pydevd_dont_trace
+import pydevd_tracing
+import pydevd_file_utils
+from _pydevd_bundle.pydevd_breakpoints import LineBreakpoint, update_exception_hook
+from _pydevd_bundle.pydevd_comm import CMD_RUN, CMD_VERSION, CMD_LIST_THREADS, CMD_THREAD_KILL, InternalTerminateThread, \
+ CMD_THREAD_SUSPEND, pydevd_find_thread_by_id, CMD_THREAD_RUN, InternalRunThread, CMD_STEP_INTO, CMD_STEP_OVER, \
+ CMD_STEP_RETURN, CMD_STEP_INTO_MY_CODE, InternalStepThread, CMD_RUN_TO_LINE, CMD_SET_NEXT_STATEMENT, \
+ CMD_SMART_STEP_INTO, InternalSetNextStatementThread, CMD_RELOAD_CODE, ReloadCodeCommand, CMD_CHANGE_VARIABLE, \
+ InternalChangeVariable, CMD_GET_VARIABLE, InternalGetVariable, CMD_GET_ARRAY, InternalGetArray, CMD_GET_COMPLETIONS, \
+ InternalGetCompletions, CMD_GET_FRAME, InternalGetFrame, CMD_SET_BREAK, file_system_encoding, CMD_REMOVE_BREAK, \
+ CMD_EVALUATE_EXPRESSION, CMD_EXEC_EXPRESSION, InternalEvaluateExpression, CMD_CONSOLE_EXEC, InternalConsoleExec, \
+ CMD_SET_PY_EXCEPTION, CMD_GET_FILE_CONTENTS, CMD_SET_PROPERTY_TRACE, CMD_ADD_EXCEPTION_BREAK, \
+ CMD_REMOVE_EXCEPTION_BREAK, CMD_LOAD_SOURCE, CMD_ADD_DJANGO_EXCEPTION_BREAK, CMD_REMOVE_DJANGO_EXCEPTION_BREAK, \
+ CMD_EVALUATE_CONSOLE_EXPRESSION, InternalEvaluateConsoleExpression, InternalConsoleGetCompletions, \
+ CMD_RUN_CUSTOM_OPERATION, InternalRunCustomOperation, CMD_IGNORE_THROWN_EXCEPTION_AT, CMD_ENABLE_DONT_TRACE, \
+ CMD_SHOW_RETURN_VALUES, ID_TO_MEANING, CMD_GET_DESCRIPTION, InternalGetDescription
+from _pydevd_bundle.pydevd_constants import get_thread_id, IS_PY3K, DebugInfoHolder, dict_keys, \
+ STATE_RUN
+
+
+def process_net_command(py_db, cmd_id, seq, text):
+ '''Processes a command received from the Java side
+
+ @param cmd_id: the id of the command
+ @param seq: the sequence of the command
+ @param text: the text received in the command
+
+ @note: this method is run as a big switch... after doing some tests, it's not clear whether changing it for
+ a dict id --> function call will have better performance result. A simple test with xrange(10000000) showed
+ that the gains from having a fast access to what should be executed are lost because of the function call in
+ a way that if we had 10 elements in the switch the if..elif are better -- but growing the number of choices
+ makes the solution with the dispatch look better -- so, if this gets more than 20-25 choices at some time,
+ it may be worth refactoring it (actually, reordering the ifs so that the ones used mostly come before
+ probably will give better performance).
+ '''
+ # print(ID_TO_MEANING[str(cmd_id)], repr(text))
+
+ py_db._main_lock.acquire()
+ try:
+ try:
+ cmd = None
+ if cmd_id == CMD_RUN:
+ py_db.ready_to_run = True
+
+ elif cmd_id == CMD_VERSION:
+ # response is version number
+ # ide_os should be 'WINDOWS' or 'UNIX'.
+ ide_os = 'WINDOWS'
+
+ # Breakpoints can be grouped by 'LINE' or by 'ID'.
+ breakpoints_by = 'LINE'
+
+ splitted = text.split('\t')
+ if len(splitted) == 1:
+ _local_version = splitted
+
+ elif len(splitted) == 2:
+ _local_version, ide_os = splitted
+
+ elif len(splitted) == 3:
+ _local_version, ide_os, breakpoints_by = splitted
+
+ if breakpoints_by == 'ID':
+ py_db._set_breakpoints_with_id = True
+ else:
+ py_db._set_breakpoints_with_id = False
+
+ pydevd_file_utils.set_ide_os(ide_os)
+
+ cmd = py_db.cmd_factory.make_version_message(seq)
+
+ elif cmd_id == CMD_LIST_THREADS:
+ # response is a list of threads
+ cmd = py_db.cmd_factory.make_list_threads_message(seq)
+
+ elif cmd_id == CMD_THREAD_KILL:
+ int_cmd = InternalTerminateThread(text)
+ py_db.post_internal_command(int_cmd, text)
+
+ elif cmd_id == CMD_THREAD_SUSPEND:
+ # Yes, thread suspend is still done at this point, not through an internal command!
+ t = pydevd_find_thread_by_id(text)
+ if t and not hasattr(t, 'pydev_do_not_trace'):
+ additional_info = None
+ try:
+ additional_info = t.additional_info
+ except AttributeError:
+ pass # that's ok, no info currently set
+
+ if additional_info is not None:
+ for frame in additional_info.iter_frames(t):
+ py_db.set_trace_for_frame_and_parents(frame, overwrite_prev_trace=True)
+ del frame
+
+ py_db.set_suspend(t, CMD_THREAD_SUSPEND)
+ elif text.startswith('__frame__:'):
+ sys.stderr.write("Can't suspend tasklet: %s\n" % (text,))
+
+ elif cmd_id == CMD_THREAD_RUN:
+ t = pydevd_find_thread_by_id(text)
+ if t:
+ t.additional_info.pydev_step_cmd = -1
+ t.additional_info.pydev_step_stop = None
+ t.additional_info.pydev_state = STATE_RUN
+
+ elif text.startswith('__frame__:'):
+ sys.stderr.write("Can't make tasklet run: %s\n" % (text,))
+
+
+ elif cmd_id == CMD_STEP_INTO or cmd_id == CMD_STEP_OVER or cmd_id == CMD_STEP_RETURN or \
+ cmd_id == CMD_STEP_INTO_MY_CODE:
+ # we received some command to make a single step
+ t = pydevd_find_thread_by_id(text)
+ if t:
+ thread_id = get_thread_id(t)
+ int_cmd = InternalStepThread(thread_id, cmd_id)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif text.startswith('__frame__:'):
+ sys.stderr.write("Can't make tasklet step command: %s\n" % (text,))
+
+
+ elif cmd_id == CMD_RUN_TO_LINE or cmd_id == CMD_SET_NEXT_STATEMENT or cmd_id == CMD_SMART_STEP_INTO:
+ # we received some command to make a single step
+ thread_id, line, func_name = text.split('\t', 2)
+ t = pydevd_find_thread_by_id(thread_id)
+ if t:
+ int_cmd = InternalSetNextStatementThread(thread_id, cmd_id, line, func_name)
+ py_db.post_internal_command(int_cmd, thread_id)
+ elif thread_id.startswith('__frame__:'):
+ sys.stderr.write("Can't set next statement in tasklet: %s\n" % (thread_id,))
+
+
+ elif cmd_id == CMD_RELOAD_CODE:
+ # we received some command to make a reload of a module
+ module_name = text.strip()
+
+ thread_id = '*' # Any thread
+
+ # Note: not going for the main thread because in this case it'd only do the load
+ # when we stopped on a breakpoint.
+ # for tid, t in py_db._running_thread_ids.items(): #Iterate in copy
+ # thread_name = t.getName()
+ #
+ # print thread_name, get_thread_id(t)
+ # #Note: if possible, try to reload on the main thread
+ # if thread_name == 'MainThread':
+ # thread_id = tid
+
+ int_cmd = ReloadCodeCommand(module_name, thread_id)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+
+ elif cmd_id == CMD_CHANGE_VARIABLE:
+ # the text is: thread\tstackframe\tFRAME|GLOBAL\tattribute_to_change\tvalue_to_change
+ try:
+ thread_id, frame_id, scope, attr_and_value = text.split('\t', 3)
+
+ tab_index = attr_and_value.rindex('\t')
+ attr = attr_and_value[0:tab_index].replace('\t', '.')
+ value = attr_and_value[tab_index + 1:]
+ int_cmd = InternalChangeVariable(seq, thread_id, frame_id, scope, attr, value)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ except:
+ traceback.print_exc()
+
+ elif cmd_id == CMD_GET_VARIABLE:
+ # we received some command to get a variable
+ # the text is: thread_id\tframe_id\tFRAME|GLOBAL\tattributes*
+ try:
+ thread_id, frame_id, scopeattrs = text.split('\t', 2)
+
+ if scopeattrs.find('\t') != -1: # there are attributes beyond scope
+ scope, attrs = scopeattrs.split('\t', 1)
+ else:
+ scope, attrs = (scopeattrs, None)
+
+ int_cmd = InternalGetVariable(seq, thread_id, frame_id, scope, attrs)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ except:
+ traceback.print_exc()
+
+ elif cmd_id == CMD_GET_ARRAY:
+ # we received some command to get an array variable
+ # the text is: thread_id\tframe_id\tFRAME|GLOBAL\tname\ttemp\troffs\tcoffs\trows\tcols\tformat
+ try:
+ roffset, coffset, rows, cols, format, thread_id, frame_id, scopeattrs = text.split('\t', 7)
+
+ if scopeattrs.find('\t') != -1: # there are attributes beyond scope
+ scope, attrs = scopeattrs.split('\t', 1)
+ else:
+ scope, attrs = (scopeattrs, None)
+
+ int_cmd = InternalGetArray(seq, roffset, coffset, rows, cols, format, thread_id, frame_id, scope, attrs)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ except:
+ traceback.print_exc()
+
+ elif cmd_id == CMD_SHOW_RETURN_VALUES:
+ try:
+ show_return_values = text.split('\t')[1]
+ if int(show_return_values) == 1:
+ py_db.show_return_values = True
+ else:
+ if py_db.show_return_values:
+ # We should remove saved return values
+ py_db.remove_return_values_flag = True
+ py_db.show_return_values = False
+ pydev_log.debug("Show return values: %s\n" % py_db.show_return_values)
+ except:
+ traceback.print_exc()
+
+ elif cmd_id == CMD_GET_COMPLETIONS:
+ # we received some command to get a variable
+ # the text is: thread_id\tframe_id\tactivation token
+ try:
+ thread_id, frame_id, scope, act_tok = text.split('\t', 3)
+
+ int_cmd = InternalGetCompletions(seq, thread_id, frame_id, act_tok)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ except:
+ traceback.print_exc()
+ elif cmd_id == CMD_GET_DESCRIPTION:
+ try:
+
+ thread_id, frame_id, expression = text.split('\t', 2)
+ int_cmd = InternalGetDescription(seq, thread_id, frame_id, expression)
+ py_db.post_internal_command(int_cmd, thread_id)
+ except:
+ traceback.print_exc()
+
+ elif cmd_id == CMD_GET_FRAME:
+ thread_id, frame_id, scope = text.split('\t', 2)
+
+ int_cmd = InternalGetFrame(seq, thread_id, frame_id)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif cmd_id == CMD_SET_BREAK:
+ # func name: 'None': match anything. Empty: match global, specified: only method context.
+ # command to add some breakpoint.
+ # text is file\tline. Add to breakpoints dictionary
+ suspend_policy = "NONE"
+ if py_db._set_breakpoints_with_id:
+ breakpoint_id, type, file, line, func_name, condition, expression = text.split('\t', 6)
+
+ breakpoint_id = int(breakpoint_id)
+ line = int(line)
+
+ # We must restore new lines and tabs as done in
+ # AbstractDebugTarget.breakpointAdded
+ condition = condition.replace("@_@NEW_LINE_CHAR@_@", '\n').\
+ replace("@_@TAB_CHAR@_@", '\t').strip()
+
+ expression = expression.replace("@_@NEW_LINE_CHAR@_@", '\n').\
+ replace("@_@TAB_CHAR@_@", '\t').strip()
+ else:
+ #Note: this else should be removed after PyCharm migrates to setting
+ #breakpoints by id (and ideally also provides func_name).
+ type, file, line, func_name, suspend_policy, condition, expression = text.split('\t', 6)
+ # If we don't have an id given for each breakpoint, consider
+ # the id to be the line.
+ breakpoint_id = line = int(line)
+
+ condition = condition.replace("@_@NEW_LINE_CHAR@_@", '\n'). \
+ replace("@_@TAB_CHAR@_@", '\t').strip()
+
+ expression = expression.replace("@_@NEW_LINE_CHAR@_@", '\n'). \
+ replace("@_@TAB_CHAR@_@", '\t').strip()
+
+ if not IS_PY3K: # In Python 3, the frame object will have unicode for the file, whereas on python 2 it has a byte-array encoded with the filesystem encoding.
+ file = file.encode(file_system_encoding)
+
+ file = pydevd_file_utils.norm_file_to_server(file)
+
+ if not pydevd_file_utils.exists(file):
+ sys.stderr.write('pydev debugger: warning: trying to add breakpoint'\
+ ' to file that does not exist: %s (will have no effect)\n' % (file,))
+ sys.stderr.flush()
+
+
+ if len(condition) <= 0 or condition is None or condition == "None":
+ condition = None
+
+ if len(expression) <= 0 or expression is None or expression == "None":
+ expression = None
+
+ if type == 'python-line':
+ breakpoint = LineBreakpoint(line, condition, func_name, expression, suspend_policy)
+ breakpoints = py_db.breakpoints
+ file_to_id_to_breakpoint = py_db.file_to_id_to_line_breakpoint
+ supported_type = True
+ else:
+ result = None
+ plugin = py_db.get_plugin_lazy_init()
+ if plugin is not None:
+ result = plugin.add_breakpoint('add_line_breakpoint', py_db, type, file, line, condition, expression, func_name)
+ if result is not None:
+ supported_type = True
+ breakpoint, breakpoints = result
+ file_to_id_to_breakpoint = py_db.file_to_id_to_plugin_breakpoint
+ else:
+ supported_type = False
+
+ if not supported_type:
+ raise NameError(type)
+
+ if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
+ pydev_log.debug('Added breakpoint:%s - line:%s - func_name:%s\n' % (file, line, func_name.encode('utf-8')))
+ sys.stderr.flush()
+
+ if file in file_to_id_to_breakpoint:
+ id_to_pybreakpoint = file_to_id_to_breakpoint[file]
+ else:
+ id_to_pybreakpoint = file_to_id_to_breakpoint[file] = {}
+
+ id_to_pybreakpoint[breakpoint_id] = breakpoint
+ py_db.consolidate_breakpoints(file, id_to_pybreakpoint, breakpoints)
+ if py_db.plugin is not None:
+ py_db.has_plugin_line_breaks = py_db.plugin.has_line_breaks()
+
+ py_db.set_tracing_for_untraced_contexts_if_not_frame_eval(overwrite_prev_trace=True)
+ py_db.enable_tracing_in_frames_while_running_if_frame_eval()
+
+ elif cmd_id == CMD_REMOVE_BREAK:
+ #command to remove some breakpoint
+ #text is type\file\tid. Remove from breakpoints dictionary
+ breakpoint_type, file, breakpoint_id = text.split('\t', 2)
+
+ if not IS_PY3K: # In Python 3, the frame object will have unicode for the file, whereas on python 2 it has a byte-array encoded with the filesystem encoding.
+ file = file.encode(file_system_encoding)
+
+ file = pydevd_file_utils.norm_file_to_server(file)
+
+ try:
+ breakpoint_id = int(breakpoint_id)
+ except ValueError:
+ pydev_log.error('Error removing breakpoint. Expected breakpoint_id to be an int. Found: %s' % (breakpoint_id,))
+
+ else:
+ file_to_id_to_breakpoint = None
+ if breakpoint_type == 'python-line':
+ breakpoints = py_db.breakpoints
+ file_to_id_to_breakpoint = py_db.file_to_id_to_line_breakpoint
+ elif py_db.get_plugin_lazy_init() is not None:
+ result = py_db.plugin.get_breakpoints(py_db, breakpoint_type)
+ if result is not None:
+ file_to_id_to_breakpoint = py_db.file_to_id_to_plugin_breakpoint
+ breakpoints = result
+
+ if file_to_id_to_breakpoint is None:
+ pydev_log.error('Error removing breakpoint. Cant handle breakpoint of type %s' % breakpoint_type)
+ else:
+ try:
+ id_to_pybreakpoint = file_to_id_to_breakpoint.get(file, {})
+ if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
+ existing = id_to_pybreakpoint[breakpoint_id]
+ sys.stderr.write('Removed breakpoint:%s - line:%s - func_name:%s (id: %s)\n' % (
+ file, existing.line, existing.func_name.encode('utf-8'), breakpoint_id))
+
+ del id_to_pybreakpoint[breakpoint_id]
+ py_db.consolidate_breakpoints(file, id_to_pybreakpoint, breakpoints)
+ if py_db.plugin is not None:
+ py_db.has_plugin_line_breaks = py_db.plugin.has_line_breaks()
+
+ except KeyError:
+ pydev_log.error("Error removing breakpoint: Breakpoint id not found: %s id: %s. Available ids: %s\n" % (
+ file, breakpoint_id, dict_keys(id_to_pybreakpoint)))
+
+
+ elif cmd_id == CMD_EVALUATE_EXPRESSION or cmd_id == CMD_EXEC_EXPRESSION:
+ #command to evaluate the given expression
+ #text is: thread\tstackframe\tLOCAL\texpression
+ temp_name = ""
+ try:
+ thread_id, frame_id, scope, expression, trim, temp_name = text.split('\t', 5)
+ except ValueError:
+ thread_id, frame_id, scope, expression, trim = text.split('\t', 4)
+ int_cmd = InternalEvaluateExpression(seq, thread_id, frame_id, expression,
+ cmd_id == CMD_EXEC_EXPRESSION, int(trim) == 1, temp_name)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif cmd_id == CMD_CONSOLE_EXEC:
+ #command to exec expression in console, in case expression is only partially valid 'False' is returned
+ #text is: thread\tstackframe\tLOCAL\texpression
+
+ thread_id, frame_id, scope, expression = text.split('\t', 3)
+
+ int_cmd = InternalConsoleExec(seq, thread_id, frame_id, expression)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif cmd_id == CMD_SET_PY_EXCEPTION:
+ # Command which receives set of exceptions on which user wants to break the debugger
+ # text is: break_on_uncaught;break_on_caught;TypeError;ImportError;zipimport.ZipImportError;
+ # This API is optional and works 'in bulk' -- it's possible
+ # to get finer-grained control with CMD_ADD_EXCEPTION_BREAK/CMD_REMOVE_EXCEPTION_BREAK
+ # which allows setting caught/uncaught per exception.
+ #
+ splitted = text.split(';')
+ py_db.break_on_uncaught_exceptions = {}
+ py_db.break_on_caught_exceptions = {}
+ added = []
+ if len(splitted) >= 4:
+ if splitted[0] == 'true':
+ break_on_uncaught = True
+ else:
+ break_on_uncaught = False
+
+ if splitted[1] == 'true':
+ break_on_caught = True
+ else:
+ break_on_caught = False
+
+ if splitted[2] == 'true':
+ py_db.break_on_exceptions_thrown_in_same_context = True
+ else:
+ py_db.break_on_exceptions_thrown_in_same_context = False
+
+ if splitted[3] == 'true':
+ py_db.ignore_exceptions_thrown_in_lines_with_ignore_exception = True
+ else:
+ py_db.ignore_exceptions_thrown_in_lines_with_ignore_exception = False
+
+ for exception_type in splitted[4:]:
+ exception_type = exception_type.strip()
+ if not exception_type:
+ continue
+
+ exception_breakpoint = py_db.add_break_on_exception(
+ exception_type,
+ notify_always=break_on_caught,
+ notify_on_terminate=break_on_uncaught,
+ notify_on_first_raise_only=False,
+ )
+ if exception_breakpoint is None:
+ continue
+ added.append(exception_breakpoint)
+
+ py_db.update_after_exceptions_added(added)
+ if break_on_caught:
+ py_db.enable_tracing_in_frames_while_running_if_frame_eval()
+
+ else:
+ sys.stderr.write("Error when setting exception list. Received: %s\n" % (text,))
+
+ elif cmd_id == CMD_GET_FILE_CONTENTS:
+
+ if not IS_PY3K: # In Python 3, the frame object will have unicode for the file, whereas on python 2 it has a byte-array encoded with the filesystem encoding.
+ text = text.encode(file_system_encoding)
+
+ if os.path.exists(text):
+ f = open(text, 'r')
+ try:
+ source = f.read()
+ finally:
+ f.close()
+ cmd = py_db.cmd_factory.make_get_file_contents(seq, source)
+
+ elif cmd_id == CMD_SET_PROPERTY_TRACE:
+ # Command which receives whether to trace property getter/setter/deleter
+ # text is feature_state(true/false);disable_getter/disable_setter/disable_deleter
+ if text != "":
+ splitted = text.split(';')
+ if len(splitted) >= 3:
+ if py_db.disable_property_trace is False and splitted[0] == 'true':
+ # Replacing property by custom property only when the debugger starts
+ pydevd_traceproperty.replace_builtin_property()
+ py_db.disable_property_trace = True
+ # Enable/Disable tracing of the property getter
+ if splitted[1] == 'true':
+ py_db.disable_property_getter_trace = True
+ else:
+ py_db.disable_property_getter_trace = False
+ # Enable/Disable tracing of the property setter
+ if splitted[2] == 'true':
+ py_db.disable_property_setter_trace = True
+ else:
+ py_db.disable_property_setter_trace = False
+ # Enable/Disable tracing of the property deleter
+ if splitted[3] == 'true':
+ py_db.disable_property_deleter_trace = True
+ else:
+ py_db.disable_property_deleter_trace = False
+ else:
+ # User hasn't configured any settings for property tracing
+ pass
+
+ elif cmd_id == CMD_ADD_EXCEPTION_BREAK:
+ if text.find('\t') != -1:
+ exception, notify_always, notify_on_terminate, ignore_libraries = text.split('\t', 3)
+ else:
+ exception, notify_always, notify_on_terminate, ignore_libraries = text, 0, 0, 0
+
+ if exception.find('-') != -1:
+ breakpoint_type, exception = exception.split('-')
+ else:
+ breakpoint_type = 'python'
+
+ if breakpoint_type == 'python':
+ if int(notify_always) == 1:
+ pydev_log.warn("Deprecated parameter: 'notify always' policy removed in PyCharm\n")
+ exception_breakpoint = py_db.add_break_on_exception(
+ exception,
+ notify_always=int(notify_always) > 0,
+ notify_on_terminate = int(notify_on_terminate) == 1,
+ notify_on_first_raise_only=int(notify_always) == 2,
+ ignore_libraries=int(ignore_libraries) > 0
+ )
+
+ if exception_breakpoint is not None:
+ py_db.update_after_exceptions_added([exception_breakpoint])
+ if notify_always:
+ py_db.enable_tracing_in_frames_while_running_if_frame_eval()
+ else:
+ supported_type = False
+ plugin = py_db.get_plugin_lazy_init()
+ if plugin is not None:
+ supported_type = plugin.add_breakpoint('add_exception_breakpoint', py_db, breakpoint_type, exception)
+
+ if supported_type:
+ py_db.has_plugin_exception_breaks = py_db.plugin.has_exception_breaks()
+ py_db.enable_tracing_in_frames_while_running_if_frame_eval()
+ else:
+ raise NameError(breakpoint_type)
+
+
+
+ elif cmd_id == CMD_REMOVE_EXCEPTION_BREAK:
+ exception = text
+ if exception.find('-') != -1:
+ exception_type, exception = exception.split('-')
+ else:
+ exception_type = 'python'
+
+ if exception_type == 'python':
+ try:
+ cp = py_db.break_on_uncaught_exceptions.copy()
+ cp.pop(exception, None)
+ py_db.break_on_uncaught_exceptions = cp
+
+ cp = py_db.break_on_caught_exceptions.copy()
+ cp.pop(exception, None)
+ py_db.break_on_caught_exceptions = cp
+ except:
+ pydev_log.debug("Error while removing exception %s"%sys.exc_info()[0])
+ update_exception_hook(py_db)
+ else:
+ supported_type = False
+
+ # I.e.: no need to initialize lazy (if we didn't have it in the first place, we can't remove
+ # anything from it anyways).
+ plugin = py_db.plugin
+ if plugin is not None:
+ supported_type = plugin.remove_exception_breakpoint(py_db, exception_type, exception)
+
+ if supported_type:
+ py_db.has_plugin_exception_breaks = py_db.plugin.has_exception_breaks()
+ else:
+ raise NameError(exception_type)
+ if len(py_db.break_on_caught_exceptions) == 0 and not py_db.has_plugin_exception_breaks:
+ py_db.disable_tracing_while_running_if_frame_eval()
+
+ elif cmd_id == CMD_LOAD_SOURCE:
+ path = text
+ try:
+ f = open(path, 'r')
+ source = f.read()
+ py_db.cmd_factory.make_load_source_message(seq, source, py_db)
+ except:
+ return py_db.cmd_factory.make_error_message(seq, pydevd_tracing.get_exception_traceback_str())
+
+ elif cmd_id == CMD_ADD_DJANGO_EXCEPTION_BREAK:
+ exception = text
+ plugin = py_db.get_plugin_lazy_init()
+ if plugin is not None:
+ plugin.add_breakpoint('add_exception_breakpoint', py_db, 'django', exception)
+ py_db.has_plugin_exception_breaks = py_db.plugin.has_exception_breaks()
+ py_db.enable_tracing_in_frames_while_running_if_frame_eval()
+
+ elif cmd_id == CMD_REMOVE_DJANGO_EXCEPTION_BREAK:
+ exception = text
+
+ # I.e.: no need to initialize lazy (if we didn't have it in the first place, we can't remove
+ # anything from it anyways).
+ plugin = py_db.plugin
+ if plugin is not None:
+ plugin.remove_exception_breakpoint(py_db, 'django', exception)
+ py_db.has_plugin_exception_breaks = py_db.plugin.has_exception_breaks()
+ if len(py_db.break_on_caught_exceptions) == 0 and not py_db.has_plugin_exception_breaks:
+ py_db.disable_tracing_while_running_if_frame_eval()
+
+ elif cmd_id == CMD_EVALUATE_CONSOLE_EXPRESSION:
+ # Command which takes care for the debug console communication
+ if text != "":
+ thread_id, frame_id, console_command = text.split('\t', 2)
+ console_command, line = console_command.split('\t')
+
+ if console_command == 'EVALUATE':
+ int_cmd = InternalEvaluateConsoleExpression(
+ seq, thread_id, frame_id, line, buffer_output=True)
+
+ elif console_command == 'EVALUATE_UNBUFFERED':
+ int_cmd = InternalEvaluateConsoleExpression(
+ seq, thread_id, frame_id, line, buffer_output=False)
+
+ elif console_command == 'GET_COMPLETIONS':
+ int_cmd = InternalConsoleGetCompletions(seq, thread_id, frame_id, line)
+
+ else:
+ raise ValueError('Unrecognized command: %s' % (console_command,))
+
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif cmd_id == CMD_RUN_CUSTOM_OPERATION:
+ # Command which runs a custom operation
+ if text != "":
+ try:
+ location, custom = text.split('||', 1)
+ except:
+ sys.stderr.write('Custom operation now needs a || separator. Found: %s\n' % (text,))
+ raise
+
+ thread_id, frame_id, scopeattrs = location.split('\t', 2)
+
+ if scopeattrs.find('\t') != -1: # there are attributes beyond scope
+ scope, attrs = scopeattrs.split('\t', 1)
+ else:
+ scope, attrs = (scopeattrs, None)
+
+ # : style: EXECFILE or EXEC
+ # : encoded_code_or_file: file to execute or code
+ # : fname: name of function to be executed in the resulting namespace
+ style, encoded_code_or_file, fnname = custom.split('\t', 3)
+ int_cmd = InternalRunCustomOperation(seq, thread_id, frame_id, scope, attrs,
+ style, encoded_code_or_file, fnname)
+ py_db.post_internal_command(int_cmd, thread_id)
+
+ elif cmd_id == CMD_IGNORE_THROWN_EXCEPTION_AT:
+ if text:
+ replace = 'REPLACE:' # Not all 3.x versions support u'REPLACE:', so, doing workaround.
+ if not IS_PY3K:
+ replace = unicode(replace)
+
+ if text.startswith(replace):
+ text = text[8:]
+ py_db.filename_to_lines_where_exceptions_are_ignored.clear()
+
+ if text:
+ for line in text.split('||'): # Can be bulk-created (one in each line)
+ filename, line_number = line.split('|')
+ if not IS_PY3K:
+ filename = filename.encode(file_system_encoding)
+
+ filename = pydevd_file_utils.norm_file_to_server(filename)
+
+ if os.path.exists(filename):
+ lines_ignored = py_db.filename_to_lines_where_exceptions_are_ignored.get(filename)
+ if lines_ignored is None:
+ lines_ignored = py_db.filename_to_lines_where_exceptions_are_ignored[filename] = {}
+ lines_ignored[int(line_number)] = 1
+ else:
+ sys.stderr.write('pydev debugger: warning: trying to ignore exception thrown'\
+ ' on file that does not exist: %s (will have no effect)\n' % (filename,))
+
+ elif cmd_id == CMD_ENABLE_DONT_TRACE:
+ if text:
+ true_str = 'true' # Not all 3.x versions support u'str', so, doing workaround.
+ if not IS_PY3K:
+ true_str = unicode(true_str)
+
+ mode = text.strip() == true_str
+ pydevd_dont_trace.trace_filter(mode)
+
+ else:
+ #I have no idea what this is all about
+ cmd = py_db.cmd_factory.make_error_message(seq, "unexpected command " + str(cmd_id))
+
+ if cmd is not None:
+ py_db.writer.add_command(cmd)
+ del cmd
+
+ except Exception:
+ traceback.print_exc()
+ try:
+ from StringIO import StringIO
+ except ImportError:
+ from io import StringIO
+ stream = StringIO()
+ traceback.print_exc(file=stream)
+ cmd = py_db.cmd_factory.make_error_message(
+ seq,
+ "Unexpected exception in process_net_command.\nInitial params: %s. Exception: %s" % (
+ ((cmd_id, seq, text), stream.getvalue())
+ )
+ )
+
+ py_db.writer.add_command(cmd)
+ finally:
+ py_db._main_lock.release()
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_referrers.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_referrers.py
new file mode 100644
index 00000000..a4d502c9
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_referrers.py
@@ -0,0 +1,236 @@
+import sys
+from _pydevd_bundle import pydevd_xml
+from os.path import basename
+import traceback
+try:
+ from urllib import quote, quote_plus, unquote, unquote_plus
+except:
+ from urllib.parse import quote, quote_plus, unquote, unquote_plus #@Reimport @UnresolvedImport
+
+#===================================================================================================
+# print_var_node
+#===================================================================================================
+def print_var_node(xml_node, stream):
+ name = xml_node.getAttribute('name')
+ value = xml_node.getAttribute('value')
+ val_type = xml_node.getAttribute('type')
+
+ found_as = xml_node.getAttribute('found_as')
+ stream.write('Name: ')
+ stream.write(unquote_plus(name))
+ stream.write(', Value: ')
+ stream.write(unquote_plus(value))
+ stream.write(', Type: ')
+ stream.write(unquote_plus(val_type))
+ if found_as:
+ stream.write(', Found as: %s' % (unquote_plus(found_as),))
+ stream.write('\n')
+
+#===================================================================================================
+# print_referrers
+#===================================================================================================
+def print_referrers(obj, stream=None):
+ if stream is None:
+ stream = sys.stdout
+ result = get_referrer_info(obj)
+ from xml.dom.minidom import parseString
+ dom = parseString(result)
+
+ xml = dom.getElementsByTagName('xml')[0]
+ for node in xml.childNodes:
+ if node.nodeType == node.TEXT_NODE:
+ continue
+
+ if node.localName == 'for':
+ stream.write('Searching references for: ')
+ for child in node.childNodes:
+ if child.nodeType == node.TEXT_NODE:
+ continue
+ print_var_node(child, stream)
+
+ elif node.localName == 'var':
+ stream.write('Referrer found: ')
+ print_var_node(node, stream)
+
+ else:
+ sys.stderr.write('Unhandled node: %s\n' % (node,))
+
+ return result
+
+
+#===================================================================================================
+# get_referrer_info
+#===================================================================================================
+def get_referrer_info(searched_obj):
+ DEBUG = 0
+ if DEBUG:
+ sys.stderr.write('Getting referrers info.\n')
+ try:
+ try:
+ if searched_obj is None:
+ ret = ['\n']
+
+ ret.append('\n')
+ ret.append(pydevd_xml.var_to_xml(
+ searched_obj,
+ 'Skipping getting referrers for None',
+ additional_in_xml=' id="%s"' % (id(searched_obj),)))
+ ret.append(' \n')
+ ret.append(' ')
+ ret = ''.join(ret)
+ return ret
+
+ obj_id = id(searched_obj)
+
+ try:
+ if DEBUG:
+ sys.stderr.write('Getting referrers...\n')
+ import gc
+ referrers = gc.get_referrers(searched_obj)
+ except:
+ traceback.print_exc()
+ ret = ['\n']
+
+ ret.append('\n')
+ ret.append(pydevd_xml.var_to_xml(
+ searched_obj,
+ 'Exception raised while trying to get_referrers.',
+ additional_in_xml=' id="%s"' % (id(searched_obj),)))
+ ret.append(' \n')
+ ret.append(' ')
+ ret = ''.join(ret)
+ return ret
+
+ if DEBUG:
+ sys.stderr.write('Found %s referrers.\n' % (len(referrers),))
+
+ curr_frame = sys._getframe()
+ frame_type = type(curr_frame)
+
+ #Ignore this frame and any caller frame of this frame
+
+ ignore_frames = {} #Should be a set, but it's not available on all python versions.
+ while curr_frame is not None:
+ if basename(curr_frame.f_code.co_filename).startswith('pydev'):
+ ignore_frames[curr_frame] = 1
+ curr_frame = curr_frame.f_back
+
+
+ ret = ['\n']
+
+ ret.append('\n')
+ if DEBUG:
+ sys.stderr.write('Searching Referrers of obj with id="%s"\n' % (obj_id,))
+
+ ret.append(pydevd_xml.var_to_xml(
+ searched_obj,
+ 'Referrers of obj with id="%s"' % (obj_id,)))
+ ret.append(' \n')
+
+ all_objects = None
+
+ for r in referrers:
+ try:
+ if r in ignore_frames:
+ continue #Skip the references we may add ourselves
+ except:
+ pass #Ok: unhashable type checked...
+
+ if r is referrers:
+ continue
+
+ r_type = type(r)
+ r_id = str(id(r))
+
+ representation = str(r_type)
+
+ found_as = ''
+ if r_type == frame_type:
+ if DEBUG:
+ sys.stderr.write('Found frame referrer: %r\n' % (r,))
+ for key, val in r.f_locals.items():
+ if val is searched_obj:
+ found_as = key
+ break
+
+ elif r_type == dict:
+ if DEBUG:
+ sys.stderr.write('Found dict referrer: %r\n' % (r,))
+
+ # Try to check if it's a value in the dict (and under which key it was found)
+ for key, val in r.items():
+ if val is searched_obj:
+ found_as = key
+ if DEBUG:
+ sys.stderr.write(' Found as %r in dict\n' % (found_as,))
+ break
+
+ #Ok, there's one annoying thing: many times we find it in a dict from an instance,
+ #but with this we don't directly have the class, only the dict, so, to workaround that
+ #we iterate over all reachable objects ad check if one of those has the given dict.
+ if all_objects is None:
+ all_objects = gc.get_objects()
+
+ for x in all_objects:
+ try:
+ if getattr(x, '__dict__', None) is r:
+ r = x
+ r_type = type(x)
+ r_id = str(id(r))
+ representation = str(r_type)
+ break
+ except:
+ pass #Just ignore any error here (i.e.: ReferenceError, etc.)
+
+ elif r_type in (tuple, list):
+ if DEBUG:
+ sys.stderr.write('Found tuple referrer: %r\n' % (r,))
+
+ for i, x in enumerate(r):
+ if x is searched_obj:
+ found_as = '%s[%s]' % (r_type.__name__, i)
+ if DEBUG:
+ sys.stderr.write(' Found as %s in tuple: \n' % (found_as,))
+ break
+
+ if found_as:
+ if not isinstance(found_as, str):
+ found_as = str(found_as)
+ found_as = ' found_as="%s"' % (pydevd_xml.make_valid_xml_value(found_as),)
+
+ ret.append(pydevd_xml.var_to_xml(
+ r,
+ representation,
+ additional_in_xml=' id="%s"%s' % (r_id, found_as)))
+ finally:
+ if DEBUG:
+ sys.stderr.write('Done searching for references.\n')
+
+ #If we have any exceptions, don't keep dangling references from this frame to any of our objects.
+ all_objects = None
+ referrers = None
+ searched_obj = None
+ r = None
+ x = None
+ key = None
+ val = None
+ curr_frame = None
+ ignore_frames = None
+ except:
+ traceback.print_exc()
+ ret = ['\n']
+
+ ret.append('\n')
+ ret.append(pydevd_xml.var_to_xml(
+ searched_obj,
+ 'Error getting referrers for:',
+ additional_in_xml=' id="%s"' % (id(searched_obj),)))
+ ret.append(' \n')
+ ret.append(' ')
+ ret = ''.join(ret)
+ return ret
+
+ ret.append(' ')
+ ret = ''.join(ret)
+ return ret
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_reload.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_reload.py
new file mode 100644
index 00000000..be89da0b
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_reload.py
@@ -0,0 +1,453 @@
+"""
+Based on the python xreload.
+
+Changes
+======================
+
+1. we don't recreate the old namespace from new classes. Rather, we keep the existing namespace,
+load a new version of it and update only some of the things we can inplace. That way, we don't break
+things such as singletons or end up with a second representation of the same class in memory.
+
+2. If we find it to be a __metaclass__, we try to update it as a regular class.
+
+3. We don't remove old attributes (and leave them lying around even if they're no longer used).
+
+4. Reload hooks were changed
+
+These changes make it more stable, especially in the common case (where in a debug session only the
+contents of a function are changed), besides providing flexibility for users that want to extend
+on it.
+
+
+
+Hooks
+======================
+
+Classes/modules can be specially crafted to work with the reload (so that it can, for instance,
+update some constant which was changed).
+
+1. To participate in the change of some attribute:
+
+ In a module:
+
+ __xreload_old_new__(namespace, name, old, new)
+
+ in a class:
+
+ @classmethod
+ __xreload_old_new__(cls, name, old, new)
+
+ A class or module may include a method called '__xreload_old_new__' which is called when we're
+ unable to reload a given attribute.
+
+
+
+2. To do something after the whole reload is finished:
+
+ In a module:
+
+ __xreload_after_reload_update__(namespace):
+
+ In a class:
+
+ @classmethod
+ __xreload_after_reload_update__(cls):
+
+
+ A class or module may include a method called '__xreload_after_reload_update__' which is called
+ after the reload finishes.
+
+
+Important: when providing a hook, always use the namespace or cls provided and not anything in the global
+namespace, as the global namespace are only temporarily created during the reload and may not reflect the
+actual application state (while the cls and namespace passed are).
+
+
+Current limitations
+======================
+
+
+- Attributes/constants are added, but not changed (so singletons and the application state is not
+ broken -- use provided hooks to workaround it).
+
+- Code using metaclasses may not always work.
+
+- Functions and methods using decorators (other than classmethod and staticmethod) are not handled
+ correctly.
+
+- Renamings are not handled correctly.
+
+- Dependent modules are not reloaded.
+
+- New __slots__ can't be added to existing classes.
+
+
+Info
+======================
+
+Original: http://svn.python.org/projects/sandbox/trunk/xreload/xreload.py
+Note: it seems https://github.com/plone/plone.reload/blob/master/plone/reload/xreload.py enhances it (to check later)
+
+Interesting alternative: https://code.google.com/p/reimport/
+
+Alternative to reload().
+
+This works by executing the module in a scratch namespace, and then patching classes, methods and
+functions in place. This avoids the need to patch instances. New objects are copied into the
+target namespace.
+
+"""
+
+import imp
+from _pydev_bundle.pydev_imports import Exec
+from _pydevd_bundle import pydevd_dont_trace
+import sys
+import traceback
+import types
+
+NO_DEBUG = 0
+LEVEL1 = 1
+LEVEL2 = 2
+
+DEBUG = NO_DEBUG
+
+def write(*args):
+ new_lst = []
+ for a in args:
+ new_lst.append(str(a))
+
+ msg = ' '.join(new_lst)
+ sys.stdout.write('%s\n' % (msg,))
+
+def write_err(*args):
+ new_lst = []
+ for a in args:
+ new_lst.append(str(a))
+
+ msg = ' '.join(new_lst)
+ sys.stderr.write('pydev debugger: %s\n' % (msg,))
+
+def notify_info0(*args):
+ write_err(*args)
+
+def notify_info(*args):
+ if DEBUG >= LEVEL1:
+ write(*args)
+
+def notify_info2(*args):
+ if DEBUG >= LEVEL2:
+ write(*args)
+
+def notify_error(*args):
+ write_err(*args)
+
+
+
+#=======================================================================================================================
+# code_objects_equal
+#=======================================================================================================================
+def code_objects_equal(code0, code1):
+ for d in dir(code0):
+ if d.startswith('_') or 'lineno' in d:
+ continue
+ if getattr(code0, d) != getattr(code1, d):
+ return False
+ return True
+
+
+#=======================================================================================================================
+# xreload
+#=======================================================================================================================
+def xreload(mod):
+ """Reload a module in place, updating classes, methods and functions.
+
+ mod: a module object
+
+ Returns a boolean indicating whether a change was done.
+ """
+ r = Reload(mod)
+ r.apply()
+ found_change = r.found_change
+ r = None
+ pydevd_dont_trace.clear_trace_filter_cache()
+ return found_change
+
+
+# This isn't actually used... Initially I planned to reload variables which are immutable on the
+# namespace, but this can destroy places where we're saving state, which may not be what we want,
+# so, we're being conservative and giving the user hooks if he wants to do a reload.
+#
+# immutable_types = [int, str, float, tuple] #That should be common to all Python versions
+#
+# for name in 'long basestr unicode frozenset'.split():
+# try:
+# immutable_types.append(__builtins__[name])
+# except:
+# pass #Just ignore: not all python versions are created equal.
+# immutable_types = tuple(immutable_types)
+
+
+#=======================================================================================================================
+# Reload
+#=======================================================================================================================
+class Reload:
+
+ def __init__(self, mod):
+ self.mod = mod
+ self.found_change = False
+
+ def apply(self):
+ mod = self.mod
+ self._on_finish_callbacks = []
+ try:
+ # Get the module name, e.g. 'foo.bar.whatever'
+ modname = mod.__name__
+ # Get the module namespace (dict) early; this is part of the type check
+ modns = mod.__dict__
+ # Parse it into package name and module name, e.g. 'foo.bar' and 'whatever'
+ i = modname.rfind(".")
+ if i >= 0:
+ pkgname, modname = modname[:i], modname[i + 1:]
+ else:
+ pkgname = None
+ # Compute the search path
+ if pkgname:
+ # We're not reloading the package, only the module in it
+ pkg = sys.modules[pkgname]
+ path = pkg.__path__ # Search inside the package
+ else:
+ # Search the top-level module path
+ pkg = None
+ path = None # Make find_module() uses the default search path
+ # Find the module; may raise ImportError
+ (stream, filename, (suffix, mode, kind)) = imp.find_module(modname, path)
+ # Turn it into a code object
+ try:
+ # Is it Python source code or byte code read from a file?
+ if kind not in (imp.PY_COMPILED, imp.PY_SOURCE):
+ # Fall back to built-in reload()
+ notify_error('Could not find source to reload (mod: %s)' % (modname,))
+ return
+ if kind == imp.PY_SOURCE:
+ source = stream.read()
+ code = compile(source, filename, "exec")
+ else:
+ import marshal
+ code = marshal.load(stream)
+ finally:
+ if stream:
+ stream.close()
+ # Execute the code. We copy the module dict to a temporary; then
+ # clear the module dict; then execute the new code in the module
+ # dict; then swap things back and around. This trick (due to
+ # Glyph Lefkowitz) ensures that the (readonly) __globals__
+ # attribute of methods and functions is set to the correct dict
+ # object.
+ new_namespace = modns.copy()
+ new_namespace.clear()
+ new_namespace["__name__"] = modns["__name__"]
+ Exec(code, new_namespace)
+ # Now we get to the hard part
+ oldnames = set(modns)
+ newnames = set(new_namespace)
+
+ # Create new tokens (note: not deleting existing)
+ for name in newnames - oldnames:
+ notify_info0('Added:', name, 'to namespace')
+ self.found_change = True
+ modns[name] = new_namespace[name]
+
+ # Update in-place what we can
+ for name in oldnames & newnames:
+ self._update(modns, name, modns[name], new_namespace[name])
+
+ self._handle_namespace(modns)
+
+ for c in self._on_finish_callbacks:
+ c()
+ del self._on_finish_callbacks[:]
+ except:
+ traceback.print_exc()
+
+
+ def _handle_namespace(self, namespace, is_class_namespace=False):
+ on_finish = None
+ if is_class_namespace:
+ xreload_after_update = getattr(namespace, '__xreload_after_reload_update__', None)
+ if xreload_after_update is not None:
+ self.found_change = True
+ on_finish = lambda: xreload_after_update()
+
+ elif '__xreload_after_reload_update__' in namespace:
+ xreload_after_update = namespace['__xreload_after_reload_update__']
+ self.found_change = True
+ on_finish = lambda: xreload_after_update(namespace)
+
+
+ if on_finish is not None:
+ # If a client wants to know about it, give him a chance.
+ self._on_finish_callbacks.append(on_finish)
+
+
+
+ def _update(self, namespace, name, oldobj, newobj, is_class_namespace=False):
+ """Update oldobj, if possible in place, with newobj.
+
+ If oldobj is immutable, this simply returns newobj.
+
+ Args:
+ oldobj: the object to be updated
+ newobj: the object used as the source for the update
+ """
+ try:
+ notify_info2('Updating: ', oldobj)
+ if oldobj is newobj:
+ # Probably something imported
+ return
+
+ if type(oldobj) is not type(newobj):
+ # Cop-out: if the type changed, give up
+ notify_error('Type of: %s changed... Skipping.' % (oldobj,))
+ return
+
+ if isinstance(newobj, types.FunctionType):
+ self._update_function(oldobj, newobj)
+ return
+
+ if isinstance(newobj, types.MethodType):
+ self._update_method(oldobj, newobj)
+ return
+
+ if isinstance(newobj, classmethod):
+ self._update_classmethod(oldobj, newobj)
+ return
+
+ if isinstance(newobj, staticmethod):
+ self._update_staticmethod(oldobj, newobj)
+ return
+
+ if hasattr(types, 'ClassType'):
+ classtype = (types.ClassType, type) #object is not instance of types.ClassType.
+ else:
+ classtype = type
+
+ if isinstance(newobj, classtype):
+ self._update_class(oldobj, newobj)
+ return
+
+ # New: dealing with metaclasses.
+ if hasattr(newobj, '__metaclass__') and hasattr(newobj, '__class__') and newobj.__metaclass__ == newobj.__class__:
+ self._update_class(oldobj, newobj)
+ return
+
+ if namespace is not None:
+
+ if oldobj != newobj and str(oldobj) != str(newobj) and repr(oldobj) != repr(newobj):
+ xreload_old_new = None
+ if is_class_namespace:
+ xreload_old_new = getattr(namespace, '__xreload_old_new__', None)
+ if xreload_old_new is not None:
+ self.found_change = True
+ xreload_old_new(name, oldobj, newobj)
+
+ elif '__xreload_old_new__' in namespace:
+ xreload_old_new = namespace['__xreload_old_new__']
+ xreload_old_new(namespace, name, oldobj, newobj)
+ self.found_change = True
+
+ # Too much information to the user...
+ # else:
+ # notify_info0('%s NOT updated. Create __xreload_old_new__(name, old, new) for custom reload' % (name,))
+
+ except:
+ notify_error('Exception found when updating %s. Proceeding for other items.' % (name,))
+ traceback.print_exc()
+
+
+ # All of the following functions have the same signature as _update()
+
+
+ def _update_function(self, oldfunc, newfunc):
+ """Update a function object."""
+ oldfunc.__doc__ = newfunc.__doc__
+ oldfunc.__dict__.update(newfunc.__dict__)
+
+ try:
+ newfunc.__code__
+ attr_name = '__code__'
+ except AttributeError:
+ newfunc.func_code
+ attr_name = 'func_code'
+
+ old_code = getattr(oldfunc, attr_name)
+ new_code = getattr(newfunc, attr_name)
+ if not code_objects_equal(old_code, new_code):
+ notify_info0('Updated function code:', oldfunc)
+ setattr(oldfunc, attr_name, new_code)
+ self.found_change = True
+
+ try:
+ oldfunc.__defaults__ = newfunc.__defaults__
+ except AttributeError:
+ oldfunc.func_defaults = newfunc.func_defaults
+
+ return oldfunc
+
+
+ def _update_method(self, oldmeth, newmeth):
+ """Update a method object."""
+ # XXX What if im_func is not a function?
+ if hasattr(oldmeth, 'im_func') and hasattr(newmeth, 'im_func'):
+ self._update(None, None, oldmeth.im_func, newmeth.im_func)
+ elif hasattr(oldmeth, '__func__') and hasattr(newmeth, '__func__'):
+ self._update(None, None, oldmeth.__func__, newmeth.__func__)
+ return oldmeth
+
+
+ def _update_class(self, oldclass, newclass):
+ """Update a class object."""
+ olddict = oldclass.__dict__
+ newdict = newclass.__dict__
+
+ oldnames = set(olddict)
+ newnames = set(newdict)
+
+ for name in newnames - oldnames:
+ setattr(oldclass, name, newdict[name])
+ notify_info0('Added:', name, 'to', oldclass)
+ self.found_change = True
+
+ # Note: not removing old things...
+ # for name in oldnames - newnames:
+ # notify_info('Removed:', name, 'from', oldclass)
+ # delattr(oldclass, name)
+
+ for name in (oldnames & newnames) - set(['__dict__', '__doc__']):
+ self._update(oldclass, name, olddict[name], newdict[name], is_class_namespace=True)
+
+ old_bases = getattr(oldclass, '__bases__', None)
+ new_bases = getattr(newclass, '__bases__', None)
+ if str(old_bases) != str(new_bases):
+ notify_error('Changing the hierarchy of a class is not supported. %s may be inconsistent.' % (oldclass,))
+
+ self._handle_namespace(oldclass, is_class_namespace=True)
+
+
+ def _update_classmethod(self, oldcm, newcm):
+ """Update a classmethod update."""
+ # While we can't modify the classmethod object itself (it has no
+ # mutable attributes), we *can* extract the underlying function
+ # (by calling __get__(), which returns a method object) and update
+ # it in-place. We don't have the class available to pass to
+ # __get__() but any object except None will do.
+ self._update(None, None, oldcm.__get__(0), newcm.__get__(0))
+
+
+ def _update_staticmethod(self, oldsm, newsm):
+ """Update a staticmethod update."""
+ # While we can't modify the staticmethod object itself (it has no
+ # mutable attributes), we *can* extract the underlying function
+ # (by calling __get__(), which returns it) and update it in-place.
+ # We don't have the class available to pass to __get__() but any
+ # object except None will do.
+ self._update(None, None, oldsm.__get__(0), newsm.__get__(0))
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_resolver.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_resolver.py
new file mode 100644
index 00000000..ae80d158
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_resolver.py
@@ -0,0 +1,488 @@
+try:
+ import StringIO
+except:
+ import io as StringIO
+import traceback
+from os.path import basename
+
+from _pydevd_bundle import pydevd_constants
+from _pydevd_bundle.pydevd_constants import dict_iter_items, dict_keys, xrange
+
+
+# Note: 300 is already a lot to see in the outline (after that the user should really use the shell to get things)
+# and this also means we'll pass less information to the client side (which makes debugging faster).
+MAX_ITEMS_TO_HANDLE = 300
+
+TOO_LARGE_MSG = 'Too large to show contents. Max items to show: ' + str(MAX_ITEMS_TO_HANDLE)
+TOO_LARGE_ATTR = 'Unable to handle:'
+
+#=======================================================================================================================
+# UnableToResolveVariableException
+#=======================================================================================================================
+class UnableToResolveVariableException(Exception):
+ pass
+
+
+#=======================================================================================================================
+# InspectStub
+#=======================================================================================================================
+class InspectStub:
+ def isbuiltin(self, _args):
+ return False
+ def isroutine(self, object):
+ return False
+
+try:
+ import inspect
+except:
+ inspect = InspectStub()
+
+try:
+ import java.lang #@UnresolvedImport
+except:
+ pass
+
+#types does not include a MethodWrapperType
+try:
+ MethodWrapperType = type([].__str__)
+except:
+ MethodWrapperType = None
+
+
+#=======================================================================================================================
+# See: pydevd_extension_api module for resolver interface
+#=======================================================================================================================
+
+
+#=======================================================================================================================
+# DefaultResolver
+#=======================================================================================================================
+class DefaultResolver:
+ '''
+ DefaultResolver is the class that'll actually resolve how to show some variable.
+ '''
+
+ def resolve(self, var, attribute):
+ return getattr(var, attribute)
+
+ def get_dictionary(self, var, names=None):
+ if MethodWrapperType:
+ return self._getPyDictionary(var, names)
+ else:
+ return self._getJyDictionary(var)
+
+ def _getJyDictionary(self, obj):
+ ret = {}
+ found = java.util.HashMap()
+
+ original = obj
+ if hasattr(obj, '__class__') and obj.__class__ == java.lang.Class:
+
+ #get info about superclasses
+ classes = []
+ classes.append(obj)
+ c = obj.getSuperclass()
+ while c != None:
+ classes.append(c)
+ c = c.getSuperclass()
+
+ #get info about interfaces
+ interfs = []
+ for obj in classes:
+ interfs.extend(obj.getInterfaces())
+ classes.extend(interfs)
+
+ #now is the time when we actually get info on the declared methods and fields
+ for obj in classes:
+
+ declaredMethods = obj.getDeclaredMethods()
+ declaredFields = obj.getDeclaredFields()
+ for i in xrange(len(declaredMethods)):
+ name = declaredMethods[i].getName()
+ ret[name] = declaredMethods[i].toString()
+ found.put(name, 1)
+
+ for i in xrange(len(declaredFields)):
+ name = declaredFields[i].getName()
+ found.put(name, 1)
+ #if declaredFields[i].isAccessible():
+ declaredFields[i].setAccessible(True)
+ #ret[name] = declaredFields[i].get( declaredFields[i] )
+ try:
+ ret[name] = declaredFields[i].get(original)
+ except:
+ ret[name] = declaredFields[i].toString()
+
+ #this simple dir does not always get all the info, that's why we have the part before
+ #(e.g.: if we do a dir on String, some methods that are from other interfaces such as
+ #charAt don't appear)
+ try:
+ d = dir(original)
+ for name in d:
+ if found.get(name) is not 1:
+ ret[name] = getattr(original, name)
+ except:
+ #sometimes we're unable to do a dir
+ pass
+
+ return ret
+
+ def get_names(self, var):
+ names = dir(var)
+ if not names and hasattr(var, '__members__'):
+ names = var.__members__
+ return names
+
+ def _getPyDictionary(self, var, names=None):
+ filterPrivate = False
+ filterSpecial = True
+ filterFunction = True
+ filterBuiltIn = True
+
+ if not names:
+ names = self.get_names(var)
+ d = {}
+
+ #Be aware that the order in which the filters are applied attempts to
+ #optimize the operation by removing as many items as possible in the
+ #first filters, leaving fewer items for later filters
+
+ if filterBuiltIn or filterFunction:
+ for n in names:
+ if filterSpecial:
+ if n.startswith('__') and n.endswith('__'):
+ continue
+
+ if filterPrivate:
+ if n.startswith('_') or n.endswith('__'):
+ continue
+
+ try:
+ attr = getattr(var, n)
+
+ #filter builtins?
+ if filterBuiltIn:
+ if inspect.isbuiltin(attr):
+ continue
+
+ #filter functions?
+ if filterFunction:
+ if inspect.isroutine(attr) or isinstance(attr, MethodWrapperType):
+ continue
+ except:
+ #if some error occurs getting it, let's put it to the user.
+ strIO = StringIO.StringIO()
+ traceback.print_exc(file=strIO)
+ attr = strIO.getvalue()
+
+ d[ n ] = attr
+
+ return d
+
+
+#=======================================================================================================================
+# DictResolver
+#=======================================================================================================================
+class DictResolver:
+
+ def resolve(self, dict, key):
+ if key in ('__len__', TOO_LARGE_ATTR):
+ return None
+
+ if '(' not in key:
+ #we have to treat that because the dict resolver is also used to directly resolve the global and local
+ #scopes (which already have the items directly)
+ try:
+ return dict[key]
+ except:
+ return getattr(dict, key)
+
+ #ok, we have to iterate over the items to find the one that matches the id, because that's the only way
+ #to actually find the reference from the string we have before.
+ expected_id = int(key.split('(')[-1][:-1])
+ for key, val in dict_iter_items(dict):
+ if id(key) == expected_id:
+ return val
+
+ raise UnableToResolveVariableException()
+
+ def key_to_str(self, key):
+ if isinstance(key, str):
+ return '%r' % key
+ else:
+ if not pydevd_constants.IS_PY3K:
+ if isinstance(key, unicode):
+ return "u'%s'" % key
+ return key
+
+ def get_dictionary(self, dict):
+ ret = {}
+
+ i = 0
+ for key, val in dict_iter_items(dict):
+ i += 1
+ #we need to add the id because otherwise we cannot find the real object to get its contents later on.
+ key = '%s (%s)' % (self.key_to_str(key), id(key))
+ ret[key] = val
+ if i > MAX_ITEMS_TO_HANDLE:
+ ret[TOO_LARGE_ATTR] = TOO_LARGE_MSG
+ break
+
+ ret['__len__'] = len(dict)
+ # in case if the class extends built-in type and has some additional fields
+ additional_fields = defaultResolver.get_dictionary(dict)
+ ret.update(additional_fields)
+ return ret
+
+
+#=======================================================================================================================
+# TupleResolver
+#=======================================================================================================================
+class TupleResolver: #to enumerate tuples and lists
+
+ def resolve(self, var, attribute):
+ '''
+ @param var: that's the original attribute
+ @param attribute: that's the key passed in the dict (as a string)
+ '''
+ if attribute in ('__len__', TOO_LARGE_ATTR):
+ return None
+ try:
+ return var[int(attribute)]
+ except:
+ return getattr(var, attribute)
+
+ def get_dictionary(self, var):
+ l = len(var)
+ d = {}
+
+ format_str = '%0' + str(int(len(str(l)))) + 'd'
+
+ i = 0
+ for item in var:
+ d[format_str % i] = item
+ i += 1
+
+ if i > MAX_ITEMS_TO_HANDLE:
+ d[TOO_LARGE_ATTR] = TOO_LARGE_MSG
+ break
+
+ d['__len__'] = len(var)
+ # in case if the class extends built-in type and has some additional fields
+ additional_fields = defaultResolver.get_dictionary(var)
+ d.update(additional_fields)
+ return d
+
+
+
+#=======================================================================================================================
+# SetResolver
+#=======================================================================================================================
+class SetResolver:
+ '''
+ Resolves a set as dict id(object)->object
+ '''
+
+ def resolve(self, var, attribute):
+ if attribute in ('__len__', TOO_LARGE_ATTR):
+ return None
+
+ try:
+ attribute = int(attribute)
+ except:
+ return getattr(var, attribute)
+
+ for v in var:
+ if id(v) == attribute:
+ return v
+
+ raise UnableToResolveVariableException('Unable to resolve %s in %s' % (attribute, var))
+
+ def get_dictionary(self, var):
+ d = {}
+ i = 0
+ for item in var:
+ i+= 1
+ d[id(item)] = item
+
+ if i > MAX_ITEMS_TO_HANDLE:
+ d[TOO_LARGE_ATTR] = TOO_LARGE_MSG
+ break
+
+
+ d['__len__'] = len(var)
+ # in case if the class extends built-in type and has some additional fields
+ additional_fields = defaultResolver.get_dictionary(var)
+ d.update(additional_fields)
+ return d
+
+
+#=======================================================================================================================
+# InstanceResolver
+#=======================================================================================================================
+class InstanceResolver:
+
+ def resolve(self, var, attribute):
+ field = var.__class__.getDeclaredField(attribute)
+ field.setAccessible(True)
+ return field.get(var)
+
+ def get_dictionary(self, obj):
+ ret = {}
+
+ declaredFields = obj.__class__.getDeclaredFields()
+ for i in xrange(len(declaredFields)):
+ name = declaredFields[i].getName()
+ try:
+ declaredFields[i].setAccessible(True)
+ ret[name] = declaredFields[i].get(obj)
+ except:
+ traceback.print_exc()
+
+ return ret
+
+
+#=======================================================================================================================
+# JyArrayResolver
+#=======================================================================================================================
+class JyArrayResolver:
+ '''
+ This resolves a regular Object[] array from java
+ '''
+
+ def resolve(self, var, attribute):
+ if attribute == '__len__':
+ return None
+ return var[int(attribute)]
+
+ def get_dictionary(self, obj):
+ ret = {}
+
+ for i in xrange(len(obj)):
+ ret[ i ] = obj[i]
+
+ ret['__len__'] = len(obj)
+ return ret
+
+
+
+
+#=======================================================================================================================
+# MultiValueDictResolver
+#=======================================================================================================================
+class MultiValueDictResolver(DictResolver):
+
+ def resolve(self, dict, key):
+ if key in ('__len__', TOO_LARGE_ATTR):
+ return None
+
+ #ok, we have to iterate over the items to find the one that matches the id, because that's the only way
+ #to actually find the reference from the string we have before.
+ expected_id = int(key.split('(')[-1][:-1])
+ for key in dict_keys(dict):
+ val = dict.getlist(key)
+ if id(key) == expected_id:
+ return val
+
+ raise UnableToResolveVariableException()
+
+
+
+#=======================================================================================================================
+# DjangoFormResolver
+#=======================================================================================================================
+class DjangoFormResolver(DefaultResolver):
+ has_errors_attr = False
+
+ def get_names(self, var):
+ names = dir(var)
+ if not names and hasattr(var, '__members__'):
+ names = var.__members__
+
+ if "errors" in names:
+ self.has_errors_attr = True
+ names.remove("errors")
+ return names
+
+ def get_dictionary(self, var, names=None):
+ # Do not call self.errors because it is property and has side effects
+ d = defaultResolver.get_dictionary(var, self.get_names(var))
+ if self.has_errors_attr:
+ try:
+ errors_attr = getattr(var, "_errors")
+ except:
+ errors_attr = None
+ d["errors"] = errors_attr
+ return d
+
+
+#=======================================================================================================================
+# DequeResolver
+#=======================================================================================================================
+class DequeResolver(TupleResolver):
+ def get_dictionary(self, var):
+ d = TupleResolver.get_dictionary(self, var)
+ d['maxlen'] = getattr(var, 'maxlen', None)
+ return d
+
+
+#=======================================================================================================================
+# FrameResolver
+#=======================================================================================================================
+class FrameResolver:
+ '''
+ This resolves a frame.
+ '''
+
+ def resolve(self, obj, attribute):
+ if attribute == '__internals__':
+ return defaultResolver.get_dictionary(obj)
+
+ if attribute == 'stack':
+ return self.get_frame_stack(obj)
+
+ if attribute == 'f_locals':
+ return obj.f_locals
+
+ return None
+
+
+ def get_dictionary(self, obj):
+ ret = {}
+ ret['__internals__'] = defaultResolver.get_dictionary(obj)
+ ret['stack'] = self.get_frame_stack(obj)
+ ret['f_locals'] = obj.f_locals
+ return ret
+
+
+ def get_frame_stack(self, frame):
+ ret = []
+ if frame is not None:
+ ret.append(self.get_frame_name(frame))
+
+ while frame.f_back:
+ frame = frame.f_back
+ ret.append(self.get_frame_name(frame))
+
+ return ret
+
+ def get_frame_name(self, frame):
+ if frame is None:
+ return 'None'
+ try:
+ name = basename(frame.f_code.co_filename)
+ return 'frame: %s [%s:%s] id:%s' % (frame.f_code.co_name, name, frame.f_lineno, id(frame))
+ except:
+ return 'frame object'
+
+
+defaultResolver = DefaultResolver()
+dictResolver = DictResolver()
+tupleResolver = TupleResolver()
+instanceResolver = InstanceResolver()
+jyArrayResolver = JyArrayResolver()
+setResolver = SetResolver()
+multiValueDictResolver = MultiValueDictResolver()
+djangoFormResolver = DjangoFormResolver()
+dequeResolver = DequeResolver()
+frameResolver = FrameResolver()
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_save_locals.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_save_locals.py
new file mode 100644
index 00000000..3c6b0d60
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_save_locals.py
@@ -0,0 +1,69 @@
+"""
+Utility for saving locals.
+"""
+import sys
+
+try:
+ import types
+
+ frame_type = types.FrameType
+except:
+ frame_type = type(sys._getframe())
+
+
+def is_save_locals_available():
+ return save_locals_impl is not None
+
+
+def save_locals(frame):
+ """
+ Copy values from locals_dict into the fast stack slots in the given frame.
+
+ Note: the 'save_locals' branch had a different approach wrapping the frame (much more code, but it gives ideas
+ on how to save things partially, not the 'whole' locals).
+ """
+ if not isinstance(frame, frame_type):
+ # Fix exception when changing Django variable (receiving DjangoTemplateFrame)
+ return
+
+ if save_locals_impl is not None:
+ try:
+ save_locals_impl(frame)
+ except:
+ pass
+
+
+def make_save_locals_impl():
+ """
+ Factory for the 'save_locals_impl' method. This may seem like a complicated pattern but it is essential that the method is created at
+ module load time. Inner imports after module load time would cause an occasional debugger deadlock due to the importer lock and debugger
+ lock being taken in different order in different threads.
+ """
+ try:
+ if '__pypy__' in sys.builtin_module_names:
+ import __pypy__ # @UnresolvedImport
+ save_locals = __pypy__.locals_to_fast
+ except:
+ pass
+ else:
+ if '__pypy__' in sys.builtin_module_names:
+ def save_locals_pypy_impl(frame):
+ save_locals(frame)
+
+ return save_locals_pypy_impl
+
+ try:
+ import ctypes
+ locals_to_fast = ctypes.pythonapi.PyFrame_LocalsToFast
+ except:
+ pass
+ else:
+ def save_locals_ctypes_impl(frame):
+ locals_to_fast(ctypes.py_object(frame), ctypes.c_int(0))
+
+ return save_locals_ctypes_impl
+
+ return None
+
+
+save_locals_impl = make_save_locals_impl()
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_signature.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_signature.py
new file mode 100644
index 00000000..6cc1e6f1
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_signature.py
@@ -0,0 +1,206 @@
+
+try:
+ import trace
+except ImportError:
+ pass
+else:
+ trace._warn = lambda *args: None # workaround for http://bugs.python.org/issue17143 (PY-8706)
+
+import os
+from _pydevd_bundle.pydevd_comm import CMD_SIGNATURE_CALL_TRACE, NetCommand
+from _pydevd_bundle import pydevd_xml
+from _pydevd_bundle.pydevd_constants import xrange, dict_iter_items
+from _pydevd_bundle import pydevd_utils
+from _pydevd_bundle.pydevd_utils import get_clsname_for_code
+
+
+class Signature(object):
+ def __init__(self, file, name):
+ self.file = file
+ self.name = name
+ self.args = []
+ self.args_str = []
+ self.return_type = None
+
+ def add_arg(self, name, type):
+ self.args.append((name, type))
+ self.args_str.append("%s:%s"%(name, type))
+
+ def set_args(self, frame, recursive=False):
+ self.args = []
+
+ code = frame.f_code
+ locals = frame.f_locals
+
+ for i in xrange(0, code.co_argcount):
+ name = code.co_varnames[i]
+ class_name = get_type_of_value(locals[name], recursive=recursive)
+
+ self.add_arg(name, class_name)
+
+ def __str__(self):
+ return "%s %s(%s)"%(self.file, self.name, ", ".join(self.args_str))
+
+
+def get_type_of_value(value, ignore_module_name=('__main__', '__builtin__', 'builtins'), recursive=False):
+ tp = type(value)
+ class_name = tp.__name__
+ if class_name == 'instance': # old-style classes
+ tp = value.__class__
+ class_name = tp.__name__
+
+ if hasattr(tp, '__module__') and tp.__module__ and tp.__module__ not in ignore_module_name:
+ class_name = "%s.%s"%(tp.__module__, class_name)
+
+ if class_name == 'list':
+ class_name = 'List'
+ if len(value) > 0 and recursive:
+ class_name += '[%s]' % get_type_of_value(value[0], recursive=recursive)
+ return class_name
+
+ if class_name == 'dict':
+ class_name = 'Dict'
+ if len(value) > 0 and recursive:
+ for (k, v) in dict_iter_items(value):
+ class_name += '[%s, %s]' % (get_type_of_value(k, recursive=recursive),
+ get_type_of_value(v, recursive=recursive))
+ break
+ return class_name
+
+ if class_name == 'tuple':
+ class_name = 'Tuple'
+ if len(value) > 0 and recursive:
+ class_name += '['
+ class_name += ', '.join(get_type_of_value(v, recursive=recursive) for v in value)
+ class_name += ']'
+
+ return class_name
+
+
+def _modname(path):
+ """Return a plausible module name for the path"""
+ base = os.path.basename(path)
+ filename, ext = os.path.splitext(base)
+ return filename
+
+
+class SignatureFactory(object):
+ def __init__(self):
+ self._caller_cache = {}
+ self.cache = CallSignatureCache()
+
+ def is_in_scope(self, filename):
+ return not pydevd_utils.not_in_project_roots(filename)
+
+ def create_signature(self, frame, filename, with_args=True):
+ try:
+ _, modulename, funcname = self.file_module_function_of(frame)
+ signature = Signature(filename, funcname)
+ if with_args:
+ signature.set_args(frame, recursive=True)
+ return signature
+ except:
+ import traceback
+ traceback.print_exc()
+
+
+ def file_module_function_of(self, frame): #this code is take from trace module and fixed to work with new-style classes
+ code = frame.f_code
+ filename = code.co_filename
+ if filename:
+ modulename = _modname(filename)
+ else:
+ modulename = None
+
+ funcname = code.co_name
+ clsname = None
+ if code in self._caller_cache:
+ if self._caller_cache[code] is not None:
+ clsname = self._caller_cache[code]
+ else:
+ self._caller_cache[code] = None
+ clsname = get_clsname_for_code(code, frame)
+ if clsname is not None:
+ # cache the result - assumption is that new.* is
+ # not called later to disturb this relationship
+ # _caller_cache could be flushed if functions in
+ # the new module get called.
+ self._caller_cache[code] = clsname
+
+ if clsname is not None:
+ funcname = "%s.%s" % (clsname, funcname)
+
+ return filename, modulename, funcname
+
+
+def get_signature_info(signature):
+ return signature.file, signature.name, ' '.join([arg[1] for arg in signature.args])
+
+
+def get_frame_info(frame):
+ co = frame.f_code
+ return co.co_name, frame.f_lineno, co.co_filename
+
+
+class CallSignatureCache(object):
+ def __init__(self):
+ self.cache = {}
+
+ def add(self, signature):
+ filename, name, args_type = get_signature_info(signature)
+ calls_from_file = self.cache.setdefault(filename, {})
+ name_calls = calls_from_file.setdefault(name, {})
+ name_calls[args_type] = None
+
+ def is_in_cache(self, signature):
+ filename, name, args_type = get_signature_info(signature)
+ if args_type in self.cache.get(filename, {}).get(name, {}):
+ return True
+ return False
+
+
+def create_signature_message(signature):
+ cmdTextList = [""]
+
+ cmdTextList.append('' % (pydevd_xml.make_valid_xml_value(signature.file), pydevd_xml.make_valid_xml_value(signature.name)))
+
+ for arg in signature.args:
+ cmdTextList.append(' ' % (pydevd_xml.make_valid_xml_value(arg[0]), pydevd_xml.make_valid_xml_value(arg[1])))
+
+ if signature.return_type is not None:
+ cmdTextList.append(' ' % (pydevd_xml.make_valid_xml_value(signature.return_type)))
+
+ cmdTextList.append(" ")
+ cmdText = ''.join(cmdTextList)
+ return NetCommand(CMD_SIGNATURE_CALL_TRACE, 0, cmdText)
+
+
+def send_signature_call_trace(dbg, frame, filename):
+ if dbg.signature_factory and dbg.signature_factory.is_in_scope(filename):
+ signature = dbg.signature_factory.create_signature(frame, filename)
+ if signature is not None:
+ if dbg.signature_factory.cache is not None:
+ if not dbg.signature_factory.cache.is_in_cache(signature):
+ dbg.signature_factory.cache.add(signature)
+ dbg.writer.add_command(create_signature_message(signature))
+ return True
+ else:
+ # we don't send signature if it is cached
+ return False
+ else:
+ dbg.writer.add_command(create_signature_message(signature))
+ return True
+ return False
+
+
+def send_signature_return_trace(dbg, frame, filename, return_value):
+ if dbg.signature_factory and dbg.signature_factory.is_in_scope(filename):
+ signature = dbg.signature_factory.create_signature(frame, filename, with_args=False)
+ signature.return_type = get_type_of_value(return_value, recursive=True)
+ dbg.writer.add_command(create_signature_message(signature))
+ return True
+
+ return False
+
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_stackless.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_stackless.py
new file mode 100644
index 00000000..04fc09b2
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_stackless.py
@@ -0,0 +1,416 @@
+from __future__ import nested_scopes
+
+import weakref
+import sys
+
+from _pydevd_bundle.pydevd_comm import get_global_debugger
+from _pydevd_bundle.pydevd_constants import threading, call_only_once
+from _pydevd_bundle.pydevd_constants import dict_items
+from _pydevd_bundle.pydevd_custom_frames import update_custom_frame, remove_custom_frame, add_custom_frame
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
+from pydevd_tracing import SetTrace
+import stackless # @UnresolvedImport
+
+
+# Used so that we don't loose the id (because we'll remove when it's not alive and would generate a new id for the
+# same tasklet).
+class TaskletToLastId:
+ '''
+ So, why not a WeakKeyDictionary?
+ The problem is that removals from the WeakKeyDictionary will create a new tasklet (as it adds a callback to
+ remove the key when it's garbage-collected), so, we can get into a recursion.
+ '''
+
+ def __init__(self):
+ self.tasklet_ref_to_last_id = {}
+ self._i = 0
+
+
+ def get(self, tasklet):
+ return self.tasklet_ref_to_last_id.get(weakref.ref(tasklet))
+
+
+ def __setitem__(self, tasklet, last_id):
+ self.tasklet_ref_to_last_id[weakref.ref(tasklet)] = last_id
+ self._i += 1
+ if self._i % 100 == 0: #Collect at each 100 additions to the dict (no need to rush).
+ for tasklet_ref in list(self.tasklet_ref_to_last_id.keys()):
+ if tasklet_ref() is None:
+ del self.tasklet_ref_to_last_id[tasklet_ref]
+
+
+_tasklet_to_last_id = TaskletToLastId()
+
+#=======================================================================================================================
+# _TaskletInfo
+#=======================================================================================================================
+class _TaskletInfo:
+
+ _last_id = 0
+
+ def __init__(self, tasklet_weakref, tasklet):
+ self.frame_id = None
+ self.tasklet_weakref = tasklet_weakref
+
+ last_id = _tasklet_to_last_id.get(tasklet)
+ if last_id is None:
+ _TaskletInfo._last_id += 1
+ last_id = _TaskletInfo._last_id
+ _tasklet_to_last_id[tasklet] = last_id
+
+ self._tasklet_id = last_id
+
+ self.update_name()
+
+ def update_name(self):
+ tasklet = self.tasklet_weakref()
+ if tasklet:
+ if tasklet.blocked:
+ state = 'blocked'
+ elif tasklet.paused:
+ state = 'paused'
+ elif tasklet.scheduled:
+ state = 'scheduled'
+ else:
+ state = ''
+
+ try:
+ name = tasklet.name
+ except AttributeError:
+ if tasklet.is_main:
+ name = 'MainTasklet'
+ else:
+ name = 'Tasklet-%s' % (self._tasklet_id,)
+
+ thread_id = tasklet.thread_id
+ if thread_id != -1:
+ for thread in threading.enumerate():
+ if thread.ident == thread_id:
+ if thread.name:
+ thread_name = "of %s" % (thread.name,)
+ else:
+ thread_name = "of Thread-%s" % (thread.name or str(thread_id),)
+ break
+ else:
+ # should not happen.
+ thread_name = "of Thread-%s" % (str(thread_id),)
+ thread = None
+ else:
+ # tasklet is no longer bound to a thread, because its thread ended
+ thread_name = "without thread"
+
+ tid = id(tasklet)
+ tasklet = None
+ else:
+ state = 'dead'
+ name = 'Tasklet-%s' % (self._tasklet_id,)
+ thread_name = ""
+ tid = '-'
+ self.tasklet_name = '%s %s %s (%s)' % (state, name, thread_name, tid)
+
+ if not hasattr(stackless.tasklet, "trace_function"):
+ # bug https://bitbucket.org/stackless-dev/stackless/issue/42
+ # is not fixed. Stackless releases before 2014
+ def update_name(self):
+ tasklet = self.tasklet_weakref()
+ if tasklet:
+ try:
+ name = tasklet.name
+ except AttributeError:
+ if tasklet.is_main:
+ name = 'MainTasklet'
+ else:
+ name = 'Tasklet-%s' % (self._tasklet_id,)
+
+ thread_id = tasklet.thread_id
+ for thread in threading.enumerate():
+ if thread.ident == thread_id:
+ if thread.name:
+ thread_name = "of %s" % (thread.name,)
+ else:
+ thread_name = "of Thread-%s" % (thread.name or str(thread_id),)
+ break
+ else:
+ # should not happen.
+ thread_name = "of Thread-%s" % (str(thread_id),)
+ thread = None
+
+ tid = id(tasklet)
+ tasklet = None
+ else:
+ name = 'Tasklet-%s' % (self._tasklet_id,)
+ thread_name = ""
+ tid = '-'
+ self.tasklet_name = '%s %s (%s)' % (name, thread_name, tid)
+
+_weak_tasklet_registered_to_info = {}
+
+#=======================================================================================================================
+# get_tasklet_info
+#=======================================================================================================================
+def get_tasklet_info(tasklet):
+ return register_tasklet_info(tasklet)
+
+
+#=======================================================================================================================
+# register_tasklet_info
+#=======================================================================================================================
+def register_tasklet_info(tasklet):
+ r = weakref.ref(tasklet)
+ info = _weak_tasklet_registered_to_info.get(r)
+ if info is None:
+ info = _weak_tasklet_registered_to_info[r] = _TaskletInfo(r, tasklet)
+
+ return info
+
+
+_application_set_schedule_callback = None
+
+#=======================================================================================================================
+# _schedule_callback
+#=======================================================================================================================
+def _schedule_callback(prev, next):
+ '''
+ Called when a context is stopped or a new context is made runnable.
+ '''
+ try:
+ if not prev and not next:
+ return
+
+ current_frame = sys._getframe()
+
+ if next:
+ register_tasklet_info(next)
+
+ # Ok, making next runnable: set the tracing facility in it.
+ debugger = get_global_debugger()
+ if debugger is not None:
+ next.trace_function = debugger.trace_dispatch
+ frame = next.frame
+ if frame is current_frame:
+ frame = frame.f_back
+ if hasattr(frame, 'f_trace'): # Note: can be None (but hasattr should cover for that too).
+ frame.f_trace = debugger.trace_dispatch
+
+ debugger = None
+
+ if prev:
+ register_tasklet_info(prev)
+
+ try:
+ for tasklet_ref, tasklet_info in dict_items(_weak_tasklet_registered_to_info): # Make sure it's a copy!
+ tasklet = tasklet_ref()
+ if tasklet is None or not tasklet.alive:
+ # Garbage-collected already!
+ try:
+ del _weak_tasklet_registered_to_info[tasklet_ref]
+ except KeyError:
+ pass
+ if tasklet_info.frame_id is not None:
+ remove_custom_frame(tasklet_info.frame_id)
+ else:
+ is_running = stackless.get_thread_info(tasklet.thread_id)[1] is tasklet
+ if tasklet is prev or (tasklet is not next and not is_running):
+ # the tasklet won't run after this scheduler action:
+ # - the tasklet is the previous tasklet
+ # - it is not the next tasklet and it is not an already running tasklet
+ frame = tasklet.frame
+ if frame is current_frame:
+ frame = frame.f_back
+ if frame is not None:
+ base = get_abs_path_real_path_and_base_from_frame(frame)[-1]
+ # print >>sys.stderr, "SchedCB: %r, %d, '%s', '%s'" % (tasklet, frame.f_lineno, _filename, base)
+ is_file_to_ignore = base in DONT_TRACE
+ if not is_file_to_ignore:
+ tasklet_info.update_name()
+ if tasklet_info.frame_id is None:
+ tasklet_info.frame_id = add_custom_frame(frame, tasklet_info.tasklet_name, tasklet.thread_id)
+ else:
+ update_custom_frame(tasklet_info.frame_id, frame, tasklet.thread_id, name=tasklet_info.tasklet_name)
+
+ elif tasklet is next or is_running:
+ if tasklet_info.frame_id is not None:
+ # Remove info about stackless suspended when it starts to run.
+ remove_custom_frame(tasklet_info.frame_id)
+ tasklet_info.frame_id = None
+
+
+ finally:
+ tasklet = None
+ tasklet_info = None
+ frame = None
+
+ except:
+ import traceback;traceback.print_exc()
+
+ if _application_set_schedule_callback is not None:
+ return _application_set_schedule_callback(prev, next)
+
+if not hasattr(stackless.tasklet, "trace_function"):
+ # Older versions of Stackless, released before 2014
+ # This code does not work reliable! It is affected by several
+ # stackless bugs: Stackless issues #44, #42, #40
+ def _schedule_callback(prev, next):
+ '''
+ Called when a context is stopped or a new context is made runnable.
+ '''
+ try:
+ if not prev and not next:
+ return
+
+ if next:
+ register_tasklet_info(next)
+
+ # Ok, making next runnable: set the tracing facility in it.
+ debugger = get_global_debugger()
+ if debugger is not None and next.frame:
+ if hasattr(next.frame, 'f_trace'):
+ next.frame.f_trace = debugger.trace_dispatch
+ debugger = None
+
+ if prev:
+ register_tasklet_info(prev)
+
+ try:
+ for tasklet_ref, tasklet_info in dict_items(_weak_tasklet_registered_to_info): # Make sure it's a copy!
+ tasklet = tasklet_ref()
+ if tasklet is None or not tasklet.alive:
+ # Garbage-collected already!
+ try:
+ del _weak_tasklet_registered_to_info[tasklet_ref]
+ except KeyError:
+ pass
+ if tasklet_info.frame_id is not None:
+ remove_custom_frame(tasklet_info.frame_id)
+ else:
+ if tasklet.paused or tasklet.blocked or tasklet.scheduled:
+ if tasklet.frame and tasklet.frame.f_back:
+ f_back = tasklet.frame.f_back
+ base = get_abs_path_real_path_and_base_from_frame(f_back)[-1]
+ is_file_to_ignore = base in DONT_TRACE
+ if not is_file_to_ignore:
+ if tasklet_info.frame_id is None:
+ tasklet_info.frame_id = add_custom_frame(f_back, tasklet_info.tasklet_name, tasklet.thread_id)
+ else:
+ update_custom_frame(tasklet_info.frame_id, f_back, tasklet.thread_id)
+
+ elif tasklet.is_current:
+ if tasklet_info.frame_id is not None:
+ # Remove info about stackless suspended when it starts to run.
+ remove_custom_frame(tasklet_info.frame_id)
+ tasklet_info.frame_id = None
+
+ finally:
+ tasklet = None
+ tasklet_info = None
+ f_back = None
+
+ except:
+ import traceback;traceback.print_exc()
+
+ if _application_set_schedule_callback is not None:
+ return _application_set_schedule_callback(prev, next)
+
+
+ _original_setup = stackless.tasklet.setup
+
+ #=======================================================================================================================
+ # setup
+ #=======================================================================================================================
+ def setup(self, *args, **kwargs):
+ '''
+ Called to run a new tasklet: rebind the creation so that we can trace it.
+ '''
+
+ f = self.tempval
+ def new_f(old_f, args, kwargs):
+
+ debugger = get_global_debugger()
+ if debugger is not None:
+ SetTrace(debugger.trace_dispatch)
+
+ debugger = None
+
+ # Remove our own traces :)
+ self.tempval = old_f
+ register_tasklet_info(self)
+
+ # Hover old_f to see the stackless being created and *args and **kwargs to see its parameters.
+ return old_f(*args, **kwargs)
+
+ # This is the way to tell stackless that the function it should execute is our function, not the original one. Note:
+ # setting tempval is the same as calling bind(new_f), but it seems that there's no other way to get the currently
+ # bound function, so, keeping on using tempval instead of calling bind (which is actually the same thing in a better
+ # API).
+
+ self.tempval = new_f
+
+ return _original_setup(self, f, args, kwargs)
+
+ #=======================================================================================================================
+ # __call__
+ #=======================================================================================================================
+ def __call__(self, *args, **kwargs):
+ '''
+ Called to run a new tasklet: rebind the creation so that we can trace it.
+ '''
+
+ return setup(self, *args, **kwargs)
+
+
+ _original_run = stackless.run
+
+
+ #=======================================================================================================================
+ # run
+ #=======================================================================================================================
+ def run(*args, **kwargs):
+ debugger = get_global_debugger()
+ if debugger is not None:
+ SetTrace(debugger.trace_dispatch)
+ debugger = None
+
+ return _original_run(*args, **kwargs)
+
+
+
+#=======================================================================================================================
+# patch_stackless
+#=======================================================================================================================
+def patch_stackless():
+ '''
+ This function should be called to patch the stackless module so that new tasklets are properly tracked in the
+ debugger.
+ '''
+ global _application_set_schedule_callback
+ _application_set_schedule_callback = stackless.set_schedule_callback(_schedule_callback)
+
+ def set_schedule_callback(callable):
+ global _application_set_schedule_callback
+ old = _application_set_schedule_callback
+ _application_set_schedule_callback = callable
+ return old
+
+ def get_schedule_callback():
+ global _application_set_schedule_callback
+ return _application_set_schedule_callback
+
+ set_schedule_callback.__doc__ = stackless.set_schedule_callback.__doc__
+ if hasattr(stackless, "get_schedule_callback"):
+ get_schedule_callback.__doc__ = stackless.get_schedule_callback.__doc__
+ stackless.set_schedule_callback = set_schedule_callback
+ stackless.get_schedule_callback = get_schedule_callback
+
+ if not hasattr(stackless.tasklet, "trace_function"):
+ # Older versions of Stackless, released before 2014
+ __call__.__doc__ = stackless.tasklet.__call__.__doc__
+ stackless.tasklet.__call__ = __call__
+
+ setup.__doc__ = stackless.tasklet.setup.__doc__
+ stackless.tasklet.setup = setup
+
+ run.__doc__ = stackless.run.__doc__
+ stackless.run = run
+
+patch_stackless = call_only_once(patch_stackless)
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_api.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_api.py
new file mode 100644
index 00000000..b2bdaff4
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_api.py
@@ -0,0 +1,41 @@
+def add_line_breakpoint(plugin, pydb, type, file, line, condition, expression, func_name):
+ return None
+
+def add_exception_breakpoint(plugin, pydb, type, exception):
+ return False
+
+def remove_exception_breakpoint(plugin, pydb, type, exception):
+ return False
+
+def get_breakpoints(plugin, pydb):
+ return None
+
+def can_not_skip(plugin, pydb, pydb_frame, frame):
+ return False
+
+def has_exception_breaks(plugin):
+ return False
+
+def has_line_breaks(plugin):
+ return False
+
+def cmd_step_into(plugin, pydb, frame, event, args, stop_info, stop):
+ return False
+
+def cmd_step_over(plugin, pydb, frame, event, args, stop_info, stop):
+ return False
+
+def stop(plugin, pydb, frame, event, args, stop_info, arg, step_cmd):
+ return False
+
+def get_breakpoint(plugin, pydb, pydb_frame, frame, event, args):
+ return None
+
+def suspend(plugin, pydb, thread, frame):
+ return None
+
+def exception_break(plugin, pydb, pydb_frame, frame, args, arg):
+ return None
+
+def change_variable(plugin, frame, attr, expression):
+ return False
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch.py
new file mode 100644
index 00000000..a9047bda
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch.py
@@ -0,0 +1,74 @@
+# Defines which version of the trace_dispatch we'll use.
+# Should give warning only here if cython is not available but supported.
+
+import os
+import sys
+from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED
+
+
+use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
+dirname = os.path.dirname(os.path.dirname(__file__))
+# Do not show incorrect warning for .egg files for Remote debugger
+if not CYTHON_SUPPORTED or dirname.endswith('.egg'):
+ # Do not try to import cython extensions if cython isn't supported
+ use_cython = 'NO'
+
+
+def delete_old_compiled_extensions():
+ pydev_dir = os.path.dirname(os.path.dirname(__file__))
+ _pydevd_bundle_dir = os.path.dirname(__file__)
+ _pydevd_frame_eval_dir = os.path.join(pydev_dir, '_pydevd_frame_eval')
+ try:
+ import shutil
+ for file in os.listdir(_pydevd_bundle_dir):
+ if file.startswith("pydevd") and file.endswith(".so"):
+ os.remove(os.path.join(_pydevd_bundle_dir, file))
+ for file in os.listdir(_pydevd_frame_eval_dir):
+ if file.startswith("pydevd") and file.endswith(".so"):
+ os.remove(os.path.join(_pydevd_frame_eval_dir, file))
+ build_dir = os.path.join(pydev_dir, "build")
+ if os.path.exists(build_dir):
+ shutil.rmtree(os.path.join(pydev_dir, "build"))
+ except OSError:
+ from _pydev_bundle.pydev_monkey import log_error_once
+ log_error_once("warning: failed to delete old cython speedups. Please delete all *.so files from the directories "
+ "\"%s\" and \"%s\"" % (_pydevd_bundle_dir, _pydevd_frame_eval_dir))
+
+
+if use_cython == 'YES':
+ # We must import the cython version if forcing cython
+ from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips
+ def trace_dispatch(py_db, frame, event, arg):
+ return _trace_dispatch(py_db, frame, event, arg)
+
+elif use_cython == 'NO':
+ # Use the regular version if not forcing cython
+ from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips # @UnusedImport
+
+elif use_cython is None:
+ # Regular: use fallback if not found and give message to user
+ try:
+ from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips
+ def trace_dispatch(py_db, frame, event, arg):
+ return _trace_dispatch(py_db, frame, event, arg)
+
+ # This version number is always available
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import version as regular_version
+ # This version number from the already compiled cython extension
+ from _pydevd_bundle.pydevd_cython_wrapper import version as cython_version
+ if cython_version != regular_version:
+ delete_old_compiled_extensions()
+ raise ImportError()
+
+ except ImportError:
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport
+ from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips # @UnusedImport
+ from _pydev_bundle.pydev_monkey import log_error_once
+
+ log_error_once("warning: Debugger speedups using cython not found. Run '\"%s\" \"%s\" build_ext --inplace' to build." % (
+ sys.executable, os.path.join(dirname, 'setup_cython.py')))
+
+else:
+ raise RuntimeError('Unexpected value for PYDEVD_USE_CYTHON: %s (accepted: YES, NO)' % (use_cython,))
+
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py
new file mode 100644
index 00000000..06388ccf
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py
@@ -0,0 +1,229 @@
+import traceback
+
+from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+from _pydev_imps._pydev_saved_modules import threading
+from _pydevd_bundle.pydevd_constants import get_thread_id, IS_IRONPYTHON
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+from pydevd_tracing import SetTrace
+# IFDEF CYTHON
+# # In Cython, PyDBAdditionalThreadInfo is bundled in the file.
+# from cpython.object cimport PyObject
+# from cpython.ref cimport Py_INCREF, Py_XDECREF
+# ELSE
+from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+from _pydevd_bundle.pydevd_frame import PyDBFrame
+# ENDIF
+
+try:
+ from _pydevd_bundle.pydevd_signature import send_signature_call_trace
+except ImportError:
+ def send_signature_call_trace(*args, **kwargs):
+ pass
+
+threadingCurrentThread = threading.currentThread
+get_file_type = DONT_TRACE.get
+
+# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
+# cdef dict global_cache_skips
+# cdef dict global_cache_frame_skips
+# ELSE
+# ENDIF
+
+
+# Cache where we should keep that we completely skipped entering some context.
+# It needs to be invalidated when:
+# - Breakpoints are changed
+# It can be used when running regularly (without step over/step in/step return)
+global_cache_skips = {}
+global_cache_frame_skips = {}
+
+def trace_dispatch(py_db, frame, event, arg):
+ t = threadingCurrentThread()
+
+ if getattr(t, 'pydev_do_not_trace', None):
+ return None
+
+ try:
+ additional_info = t.additional_info
+ if additional_info is None:
+ raise AttributeError()
+ except:
+ additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+
+ thread_tracer = ThreadTracer((py_db, t, additional_info, global_cache_skips, global_cache_frame_skips))
+# IFDEF CYTHON
+# t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
+# ELSE
+# ENDIF
+ SetTrace(thread_tracer.__call__)
+ return thread_tracer.__call__(frame, event, arg)
+
+# IFDEF CYTHON
+# cdef class SafeCallWrapper:
+# cdef method_object
+# def __init__(self, method_object):
+# self.method_object = method_object
+# def __call__(self, *args):
+# #Cannot use 'self' once inside the delegate call since we are borrowing the self reference f_trace field
+# #in the frame, and that reference might get destroyed by set trace on frame and parents
+# cdef PyObject* method_obj = self.method_object
+# Py_INCREF(method_obj)
+# ret = (method_obj)(*args)
+# Py_XDECREF (method_obj)
+# return SafeCallWrapper(ret) if ret is not None else None
+# cdef class ThreadTracer:
+# cdef public tuple _args;
+# def __init__(self, tuple args):
+# self._args = args
+# ELSE
+class ThreadTracer:
+ def __init__(self, args):
+ self._args = args
+# ENDIF
+
+
+ def __call__(self, frame, event, arg):
+ ''' This is the callback used when we enter some context in the debugger.
+
+ We also decorate the thread we are in with info about the debugging.
+ The attributes added are:
+ pydev_state
+ pydev_step_stop
+ pydev_step_cmd
+ pydev_notify_kill
+
+ :param PyDB py_db:
+ This is the global debugger (this method should actually be added as a method to it).
+ '''
+ # IFDEF CYTHON
+ # cdef str filename;
+ # cdef str base;
+ # cdef int pydev_step_cmd;
+ # cdef tuple cache_key;
+ # cdef dict cache_skips;
+ # cdef bint is_stepping;
+ # cdef tuple abs_path_real_path_and_base;
+ # cdef PyDBAdditionalThreadInfo additional_info;
+ # ENDIF
+ # print('ENTER: trace_dispatch', frame.f_code.co_filename, frame.f_lineno, event, frame.f_code.co_name)
+ py_db, t, additional_info, cache_skips, frame_skips_cache = self._args
+ pydev_step_cmd = additional_info.pydev_step_cmd
+ is_stepping = pydev_step_cmd != -1
+
+ try:
+ if py_db._finish_debugging_session:
+ if not py_db._termination_event_set:
+ #that was not working very well because jython gave some socket errors
+ try:
+ if py_db.output_checker is None:
+ kill_all_pydev_threads()
+ except:
+ traceback.print_exc()
+ py_db._termination_event_set = True
+ return None
+
+ # if thread is not alive, cancel trace_dispatch processing
+ if not is_thread_alive(t):
+ py_db._process_thread_not_alive(get_thread_id(t))
+ return None # suspend tracing
+
+ try:
+ # Make fast path faster!
+ abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ except:
+ abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+
+ if py_db.thread_analyser is not None:
+ py_db.thread_analyser.log_event(frame)
+
+ if py_db.asyncio_analyser is not None:
+ py_db.asyncio_analyser.log_event(frame)
+
+ filename = abs_path_real_path_and_base[1]
+ # Note: it's important that the context name is also given because we may hit something once
+ # in the global context and another in the local context.
+ cache_key = (frame.f_lineno, frame.f_code.co_name, filename)
+ if not is_stepping and cache_key in cache_skips:
+ # print('skipped: trace_dispatch (cache hit)', cache_key, frame.f_lineno, event, frame.f_code.co_name)
+ return None
+
+ file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug threading or anything related to pydevd
+
+ if file_type is not None:
+ if file_type == 1: # inlining LIB_FILE = 1
+ if py_db.not_in_scope(filename):
+ # print('skipped: trace_dispatch (not in scope)', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ cache_skips[cache_key] = 1
+ return None
+ else:
+ # print('skipped: trace_dispatch', abs_path_real_path_and_base[-1], frame.f_lineno, event, frame.f_code.co_name, file_type)
+ cache_skips[cache_key] = 1
+ return None
+
+ if is_stepping:
+ if py_db.is_filter_enabled and py_db.is_ignored_by_filters(filename):
+ # ignore files matching stepping filters
+ return None
+ if py_db.is_filter_libraries and py_db.not_in_scope(filename):
+ # ignore library files while stepping
+ return None
+
+ # print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
+ if additional_info.is_tracing:
+ return None #we don't wan't to trace code invoked from pydevd_frame.trace_dispatch
+
+ if event == 'call' and py_db.signature_factory:
+ # We can only have a call when entering a context, so, check at this level, not at the PyDBFrame.
+ send_signature_call_trace(py_db, frame, filename)
+
+ # Just create PyDBFrame directly (removed support for Python versions < 2.5, which required keeping a weak
+ # reference to the frame).
+ ret = PyDBFrame((py_db, filename, additional_info, t, frame_skips_cache, (frame.f_code.co_name, frame.f_code.co_firstlineno, filename))).trace_dispatch(frame, event, arg)
+ if ret is None:
+ cache_skips[cache_key] = 1
+ return None
+
+ # IFDEF CYTHON
+ # return SafeCallWrapper(ret)
+ # ELSE
+ return ret
+ # ENDIF
+
+ except SystemExit:
+ return None
+
+ except Exception:
+ if py_db._finish_debugging_session:
+ return None # Don't log errors when we're shutting down.
+ # Log it
+ try:
+ if traceback is not None:
+ # This can actually happen during the interpreter shutdown in Python 2.7
+ traceback.print_exc()
+ except:
+ # Error logging? We're really in the interpreter shutdown...
+ # (https://github.com/fabioz/PyDev.Debugger/issues/8)
+ pass
+ return None
+
+
+if IS_IRONPYTHON:
+ # This is far from ideal, as we'll leak frames (we'll always have the last created frame, not really
+ # the last topmost frame saved -- this should be Ok for our usage, but it may leak frames and things
+ # may live longer... as IronPython is garbage-collected, things should live longer anyways, so, it
+ # shouldn't be an issue as big as it's in CPython -- it may still be annoying, but this should
+ # be a reasonable workaround until IronPython itself is able to provide that functionality).
+ #
+ # See: https://github.com/IronLanguages/main/issues/1630
+ from _pydevd_bundle.pydevd_additional_thread_info_regular import _tid_to_last_frame
+
+ _original_call = ThreadTracer.__call__
+
+ def __call__(self, frame, event, arg):
+ _tid_to_last_frame[self._args[1].ident] = frame
+ return _original_call(self, frame, event, arg)
+
+ ThreadTracer.__call__ = __call__
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_traceproperty.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_traceproperty.py
new file mode 100644
index 00000000..d5d1fb91
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_traceproperty.py
@@ -0,0 +1,108 @@
+'''For debug purpose we are replacing actual builtin property by the debug property
+'''
+from _pydevd_bundle.pydevd_comm import get_global_debugger
+from _pydevd_bundle.pydevd_constants import DebugInfoHolder, IS_PY2
+import pydevd_tracing
+
+#=======================================================================================================================
+# replace_builtin_property
+#=======================================================================================================================
+def replace_builtin_property(new_property=None):
+ if new_property is None:
+ new_property = DebugProperty
+ original = property
+ if IS_PY2:
+ try:
+ import __builtin__
+ __builtin__.__dict__['property'] = new_property
+ except:
+ if DebugInfoHolder.DEBUG_TRACE_LEVEL:
+ import traceback;traceback.print_exc() #@Reimport
+ else:
+ try:
+ import builtins #Python 3.0 does not have the __builtin__ module @UnresolvedImport
+ builtins.__dict__['property'] = new_property
+ except:
+ if DebugInfoHolder.DEBUG_TRACE_LEVEL:
+ import traceback;traceback.print_exc() #@Reimport
+ return original
+
+
+#=======================================================================================================================
+# DebugProperty
+#=======================================================================================================================
+class DebugProperty(object):
+ """A custom property which allows python property to get
+ controlled by the debugger and selectively disable/re-enable
+ the tracing.
+ """
+
+
+ def __init__(self, fget=None, fset=None, fdel=None, doc=None):
+ self.fget = fget
+ self.fset = fset
+ self.fdel = fdel
+ self.__doc__ = doc
+
+
+ def __get__(self, obj, objtype=None):
+ if obj is None:
+ return self
+ global_debugger = get_global_debugger()
+ try:
+ if global_debugger is not None and global_debugger.disable_property_getter_trace:
+ pydevd_tracing.SetTrace(None)
+ if self.fget is None:
+ raise AttributeError("unreadable attribute")
+ return self.fget(obj)
+ finally:
+ if global_debugger is not None:
+ pydevd_tracing.SetTrace(global_debugger.trace_dispatch)
+
+
+ def __set__(self, obj, value):
+ global_debugger = get_global_debugger()
+ try:
+ if global_debugger is not None and global_debugger.disable_property_setter_trace:
+ pydevd_tracing.SetTrace(None)
+ if self.fset is None:
+ raise AttributeError("can't set attribute")
+ self.fset(obj, value)
+ finally:
+ if global_debugger is not None:
+ pydevd_tracing.SetTrace(global_debugger.trace_dispatch)
+
+
+ def __delete__(self, obj):
+ global_debugger = get_global_debugger()
+ try:
+ if global_debugger is not None and global_debugger.disable_property_deleter_trace:
+ pydevd_tracing.SetTrace(None)
+ if self.fdel is None:
+ raise AttributeError("can't delete attribute")
+ self.fdel(obj)
+ finally:
+ if global_debugger is not None:
+ pydevd_tracing.SetTrace(global_debugger.trace_dispatch)
+
+
+ def getter(self, fget):
+ """Overriding getter decorator for the property
+ """
+ self.fget = fget
+ return self
+
+
+ def setter(self, fset):
+ """Overriding setter decorator for the property
+ """
+ self.fset = fset
+ return self
+
+
+ def deleter(self, fdel):
+ """Overriding deleter decorator for the property
+ """
+ self.fdel = fdel
+ return self
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_utils.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_utils.py
new file mode 100644
index 00000000..27df7b3c
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_utils.py
@@ -0,0 +1,205 @@
+from __future__ import nested_scopes
+import traceback
+import os
+
+try:
+ from urllib import quote
+except:
+ from urllib.parse import quote # @UnresolvedImport
+
+import inspect
+from _pydevd_bundle.pydevd_constants import IS_PY3K
+import sys
+from _pydev_bundle import pydev_log
+
+def save_main_module(file, module_name):
+ # patch provided by: Scott Schlesier - when script is run, it does not
+ # use globals from pydevd:
+ # This will prevent the pydevd script from contaminating the namespace for the script to be debugged
+ # pretend pydevd is not the main module, and
+ # convince the file to be debugged that it was loaded as main
+ sys.modules[module_name] = sys.modules['__main__']
+ sys.modules[module_name].__name__ = module_name
+ from imp import new_module
+
+ m = new_module('__main__')
+ sys.modules['__main__'] = m
+ if hasattr(sys.modules[module_name], '__loader__'):
+ m.__loader__ = getattr(sys.modules[module_name], '__loader__')
+ m.__file__ = file
+
+ return m
+
+
+def to_number(x):
+ if is_string(x):
+ try:
+ n = float(x)
+ return n
+ except ValueError:
+ pass
+
+ l = x.find('(')
+ if l != -1:
+ y = x[0:l-1]
+ #print y
+ try:
+ n = float(y)
+ return n
+ except ValueError:
+ pass
+ return None
+
+def compare_object_attrs_key(x):
+ if '__len__' == x:
+ as_number = to_number(x)
+ if as_number is None:
+ as_number = 99999999
+ # __len__ should appear after other attributes in a list.
+ return (1, as_number)
+ else:
+ return (-1, to_string(x))
+
+if IS_PY3K:
+ def is_string(x):
+ return isinstance(x, str)
+
+else:
+ def is_string(x):
+ return isinstance(x, basestring)
+
+def to_string(x):
+ if is_string(x):
+ return x
+ else:
+ return str(x)
+
+def print_exc():
+ if traceback:
+ traceback.print_exc()
+
+if IS_PY3K:
+ def quote_smart(s, safe='/'):
+ return quote(s, safe)
+else:
+ def quote_smart(s, safe='/'):
+ if isinstance(s, unicode):
+ s = s.encode('utf-8')
+
+ return quote(s, safe)
+
+
+def get_clsname_for_code(code, frame):
+ clsname = None
+ if len(code.co_varnames) > 0:
+ # We are checking the first argument of the function
+ # (`self` or `cls` for methods).
+ first_arg_name = code.co_varnames[0]
+ if first_arg_name in frame.f_locals:
+ first_arg_obj = frame.f_locals[first_arg_name]
+ if inspect.isclass(first_arg_obj): # class method
+ first_arg_class = first_arg_obj
+ else: # instance method
+ first_arg_class = first_arg_obj.__class__
+ func_name = code.co_name
+ if hasattr(first_arg_class, func_name):
+ method = getattr(first_arg_class, func_name)
+ func_code = None
+ if hasattr(method, 'func_code'): # Python2
+ func_code = method.func_code
+ elif hasattr(method, '__code__'): # Python3
+ func_code = method.__code__
+ if func_code and func_code == code:
+ clsname = first_arg_class.__name__
+
+ return clsname
+
+
+def _get_project_roots(project_roots_cache=[]):
+ # Note: the project_roots_cache is the same instance among the many calls to the method
+ if not project_roots_cache:
+ roots = os.getenv('IDE_PROJECT_ROOTS', '').split(os.pathsep)
+ pydev_log.debug("IDE_PROJECT_ROOTS %s\n" % roots)
+ new_roots = []
+ for root in roots:
+ new_roots.append(os.path.normcase(root))
+ project_roots_cache.append(new_roots)
+ return project_roots_cache[-1] # returns the project roots with case normalized
+
+
+def _get_library_roots(library_roots_cache=[]):
+ # Note: the project_roots_cache is the same instance among the many calls to the method
+ if not library_roots_cache:
+ roots = os.getenv('LIBRARY_ROOTS', '').split(os.pathsep)
+ pydev_log.debug("LIBRARY_ROOTS %s\n" % roots)
+ new_roots = []
+ for root in roots:
+ new_roots.append(os.path.normcase(root))
+ library_roots_cache.append(new_roots)
+ return library_roots_cache[-1] # returns the project roots with case normalized
+
+
+def not_in_project_roots(filename, filename_to_not_in_scope_cache={}):
+ # Note: the filename_to_not_in_scope_cache is the same instance among the many calls to the method
+ try:
+ return filename_to_not_in_scope_cache[filename]
+ except:
+ project_roots = _get_project_roots()
+ original_filename = filename
+ if not os.path.isabs(filename) and not filename.startswith('<'):
+ filename = os.path.abspath(filename)
+ filename = os.path.normcase(filename)
+ for root in project_roots:
+ if len(root) > 0 and filename.startswith(root):
+ filename_to_not_in_scope_cache[original_filename] = False
+ break
+ else: # for else (only called if the break wasn't reached).
+ filename_to_not_in_scope_cache[original_filename] = True
+
+ if not filename_to_not_in_scope_cache[original_filename]:
+ # additional check if interpreter is situated in a project directory
+ library_roots = _get_library_roots()
+ for root in library_roots:
+ if root != '' and filename.startswith(root):
+ filename_to_not_in_scope_cache[original_filename] = True
+
+ # at this point it must be loaded.
+ return filename_to_not_in_scope_cache[original_filename]
+
+
+def is_filter_enabled():
+ return os.getenv('PYDEVD_FILTERS') is not None
+
+
+def is_filter_libraries():
+ is_filter = os.getenv('PYDEVD_FILTER_LIBRARIES') is not None
+ pydev_log.debug("PYDEVD_FILTER_LIBRARIES %s\n" % is_filter)
+ return is_filter
+
+
+def _get_stepping_filters(filters_cache=[]):
+ if not filters_cache:
+ filters = os.getenv('PYDEVD_FILTERS', '').split(';')
+ pydev_log.debug("PYDEVD_FILTERS %s\n" % filters)
+ new_filters = []
+ for new_filter in filters:
+ new_filters.append(new_filter)
+ filters_cache.append(new_filters)
+ return filters_cache[-1]
+
+
+def is_ignored_by_filter(filename, filename_to_ignored_by_filters_cache={}):
+ try:
+ return filename_to_ignored_by_filters_cache[filename]
+ except:
+ import fnmatch
+ for stepping_filter in _get_stepping_filters():
+ if fnmatch.fnmatch(filename, stepping_filter):
+ pydev_log.debug("File %s ignored by filter %s" % (filename, stepping_filter))
+ filename_to_ignored_by_filters_cache[filename] = True
+ break
+ else:
+ filename_to_ignored_by_filters_cache[filename] = False
+
+ return filename_to_ignored_by_filters_cache[filename]
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_vars.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_vars.py
new file mode 100644
index 00000000..206ece0d
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_vars.py
@@ -0,0 +1,608 @@
+""" pydevd_vars deals with variables:
+ resolution/conversion to XML.
+"""
+import pickle
+from _pydevd_bundle.pydevd_constants import get_frame, get_thread_id, xrange
+
+from _pydevd_bundle.pydevd_custom_frames import get_custom_frame
+from _pydevd_bundle.pydevd_xml import ExceptionOnEvaluate, get_type, var_to_xml
+from _pydev_imps._pydev_saved_modules import thread
+
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+import sys # @Reimport
+
+from _pydev_imps._pydev_saved_modules import threading
+import traceback
+from _pydevd_bundle import pydevd_save_locals
+from _pydev_bundle.pydev_imports import Exec, quote, execfile
+from _pydevd_bundle.pydevd_utils import to_string
+
+SENTINEL_VALUE = []
+
+# ------------------------------------------------------------------------------------------------------ class for errors
+
+class VariableError(RuntimeError): pass
+
+
+class FrameNotFoundError(RuntimeError): pass
+
+
+def _iter_frames(initialFrame):
+ '''NO-YIELD VERSION: Iterates through all the frames starting at the specified frame (which will be the first returned item)'''
+ # cannot use yield
+ frames = []
+
+ while initialFrame is not None:
+ frames.append(initialFrame)
+ initialFrame = initialFrame.f_back
+
+ return frames
+
+
+def dump_frames(thread_id):
+ sys.stdout.write('dumping frames\n')
+ if thread_id != get_thread_id(threading.currentThread()):
+ raise VariableError("find_frame: must execute on same thread")
+
+ curFrame = get_frame()
+ for frame in _iter_frames(curFrame):
+ sys.stdout.write('%s\n' % pickle.dumps(frame))
+
+
+# ===============================================================================
+# AdditionalFramesContainer
+# ===============================================================================
+class AdditionalFramesContainer:
+ lock = thread.allocate_lock()
+ additional_frames = {} # dict of dicts
+
+
+def add_additional_frame_by_id(thread_id, frames_by_id):
+ AdditionalFramesContainer.additional_frames[thread_id] = frames_by_id
+
+
+addAdditionalFrameById = add_additional_frame_by_id # Backward compatibility
+
+
+def remove_additional_frame_by_id(thread_id):
+ del AdditionalFramesContainer.additional_frames[thread_id]
+
+
+removeAdditionalFrameById = remove_additional_frame_by_id # Backward compatibility
+
+
+def has_additional_frames_by_id(thread_id):
+ return thread_id in AdditionalFramesContainer.additional_frames
+
+
+def get_additional_frames_by_id(thread_id):
+ return AdditionalFramesContainer.additional_frames.get(thread_id)
+
+
+def find_frame(thread_id, frame_id):
+ """ returns a frame on the thread that has a given frame_id """
+ try:
+ curr_thread_id = get_thread_id(threading.currentThread())
+ if thread_id != curr_thread_id:
+ try:
+ return get_custom_frame(thread_id, frame_id) # I.e.: thread_id could be a stackless frame id + thread_id.
+ except:
+ pass
+
+ raise VariableError("find_frame: must execute on same thread (%s != %s)" % (thread_id, curr_thread_id))
+
+ lookingFor = int(frame_id)
+
+ if AdditionalFramesContainer.additional_frames:
+ if thread_id in AdditionalFramesContainer.additional_frames:
+ frame = AdditionalFramesContainer.additional_frames[thread_id].get(lookingFor)
+
+ if frame is not None:
+ return frame
+
+ curFrame = get_frame()
+ if frame_id == "*":
+ return curFrame # any frame is specified with "*"
+
+ frameFound = None
+
+ for frame in _iter_frames(curFrame):
+ if lookingFor == id(frame):
+ frameFound = frame
+ del frame
+ break
+
+ del frame
+
+ # Important: python can hold a reference to the frame from the current context
+ # if an exception is raised, so, if we don't explicitly add those deletes
+ # we might have those variables living much more than we'd want to.
+
+ # I.e.: sys.exc_info holding reference to frame that raises exception (so, other places
+ # need to call sys.exc_clear())
+ del curFrame
+
+ if frameFound is None:
+ msgFrames = ''
+ i = 0
+
+ for frame in _iter_frames(get_frame()):
+ i += 1
+ msgFrames += str(id(frame))
+ if i % 5 == 0:
+ msgFrames += '\n'
+ else:
+ msgFrames += ' - '
+
+ errMsg = '''find_frame: frame not found.
+ Looking for thread_id:%s, frame_id:%s
+ Current thread_id:%s, available frames:
+ %s\n
+ ''' % (thread_id, lookingFor, curr_thread_id, msgFrames)
+
+ sys.stderr.write(errMsg)
+ return None
+
+ return frameFound
+ except:
+ import traceback
+ traceback.print_exc()
+ return None
+
+
+def getVariable(thread_id, frame_id, scope, attrs):
+ """
+ returns the value of a variable
+
+ :scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME
+
+ BY_ID means we'll traverse the list of all objects alive to get the object.
+
+ :attrs: after reaching the proper scope, we have to get the attributes until we find
+ the proper location (i.e.: obj\tattr1\tattr2)
+
+ :note: when BY_ID is used, the frame_id is considered the id of the object to find and
+ not the frame (as we don't care about the frame in this case).
+ """
+ if scope == 'BY_ID':
+ if thread_id != get_thread_id(threading.currentThread()):
+ raise VariableError("getVariable: must execute on same thread")
+
+ try:
+ import gc
+ objects = gc.get_objects()
+ except:
+ pass # Not all python variants have it.
+ else:
+ frame_id = int(frame_id)
+ for var in objects:
+ if id(var) == frame_id:
+ if attrs is not None:
+ attrList = attrs.split('\t')
+ for k in attrList:
+ _type, _typeName, resolver = get_type(var)
+ var = resolver.resolve(var, k)
+
+ return var
+
+ # If it didn't return previously, we coudn't find it by id (i.e.: alrceady garbage collected).
+ sys.stderr.write('Unable to find object with id: %s\n' % (frame_id,))
+ return None
+
+ frame = find_frame(thread_id, frame_id)
+ if frame is None:
+ return {}
+
+ if attrs is not None:
+ attrList = attrs.split('\t')
+ else:
+ attrList = []
+
+ for attr in attrList:
+ attr.replace("@_@TAB_CHAR@_@", '\t')
+
+ if scope == 'EXPRESSION':
+ for count in xrange(len(attrList)):
+ if count == 0:
+ # An Expression can be in any scope (globals/locals), therefore it needs to evaluated as an expression
+ var = evaluate_expression(thread_id, frame_id, attrList[count], False)
+ else:
+ _type, _typeName, resolver = get_type(var)
+ var = resolver.resolve(var, attrList[count])
+ else:
+ if scope == "GLOBAL":
+ var = frame.f_globals
+ del attrList[0] # globals are special, and they get a single dummy unused attribute
+ else:
+ # in a frame access both locals and globals as Python does
+ var = {}
+ var.update(frame.f_globals)
+ var.update(frame.f_locals)
+
+ for k in attrList:
+ _type, _typeName, resolver = get_type(var)
+ var = resolver.resolve(var, k)
+
+ return var
+
+
+def resolve_compound_variable(thread_id, frame_id, scope, attrs):
+ """ returns the value of the compound variable as a dictionary"""
+
+ var = getVariable(thread_id, frame_id, scope, attrs)
+
+ try:
+ _type, _typeName, resolver = get_type(var)
+ return resolver.get_dictionary(var)
+ except:
+ sys.stderr.write('Error evaluating: thread_id: %s\nframe_id: %s\nscope: %s\nattrs: %s\n' % (
+ thread_id, frame_id, scope, attrs,))
+ traceback.print_exc()
+
+
+def resolve_var(var, attrs):
+ attrList = attrs.split('\t')
+
+ for k in attrList:
+ type, _typeName, resolver = get_type(var)
+
+ var = resolver.resolve(var, k)
+
+ try:
+ type, _typeName, resolver = get_type(var)
+ return resolver.get_dictionary(var)
+ except:
+ traceback.print_exc()
+
+
+def custom_operation(thread_id, frame_id, scope, attrs, style, code_or_file, operation_fn_name):
+ """
+ We'll execute the code_or_file and then search in the namespace the operation_fn_name to execute with the given var.
+
+ code_or_file: either some code (i.e.: from pprint import pprint) or a file to be executed.
+ operation_fn_name: the name of the operation to execute after the exec (i.e.: pprint)
+ """
+ expressionValue = getVariable(thread_id, frame_id, scope, attrs)
+
+ try:
+ namespace = {'__name__': ''}
+ if style == "EXECFILE":
+ namespace['__file__'] = code_or_file
+ execfile(code_or_file, namespace, namespace)
+ else: # style == EXEC
+ namespace['__file__'] = ''
+ Exec(code_or_file, namespace, namespace)
+
+ return str(namespace[operation_fn_name](expressionValue))
+ except:
+ traceback.print_exc()
+
+
+def eval_in_context(expression, globals, locals):
+ result = None
+ try:
+ result = eval(expression, globals, locals)
+ except Exception:
+ s = StringIO()
+ traceback.print_exc(file=s)
+ result = s.getvalue()
+
+ try:
+ try:
+ etype, value, tb = sys.exc_info()
+ result = value
+ finally:
+ etype = value = tb = None
+ except:
+ pass
+
+ result = ExceptionOnEvaluate(result)
+
+ # Ok, we have the initial error message, but let's see if we're dealing with a name mangling error...
+ try:
+ if '__' in expression:
+ # Try to handle '__' name mangling...
+ split = expression.split('.')
+ curr = locals.get(split[0])
+ for entry in split[1:]:
+ if entry.startswith('__') and not hasattr(curr, entry):
+ entry = '_%s%s' % (curr.__class__.__name__, entry)
+ curr = getattr(curr, entry)
+
+ result = curr
+ except:
+ pass
+ return result
+
+
+def evaluate_expression(thread_id, frame_id, expression, doExec):
+ '''returns the result of the evaluated expression
+ @param doExec: determines if we should do an exec or an eval
+ '''
+ frame = find_frame(thread_id, frame_id)
+ if frame is None:
+ return
+
+ # Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
+ # (Names not resolved in generator expression in method)
+ # See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
+ updated_globals = {}
+ updated_globals.update(frame.f_globals)
+ updated_globals.update(frame.f_locals) # locals later because it has precedence over the actual globals
+
+ try:
+ expression = str(expression.replace('@LINE@', '\n'))
+
+ if doExec:
+ try:
+ # try to make it an eval (if it is an eval we can print it, otherwise we'll exec it and
+ # it will have whatever the user actually did)
+ compiled = compile(expression, '', 'eval')
+ except:
+ Exec(expression, updated_globals, frame.f_locals)
+ pydevd_save_locals.save_locals(frame)
+ else:
+ result = eval(compiled, updated_globals, frame.f_locals)
+ if result is not None: # Only print if it's not None (as python does)
+ sys.stdout.write('%s\n' % (result,))
+ return
+
+ else:
+ return eval_in_context(expression, updated_globals, frame.f_locals)
+ finally:
+ # Should not be kept alive if an exception happens and this frame is kept in the stack.
+ del updated_globals
+ del frame
+
+
+def change_attr_expression(thread_id, frame_id, attr, expression, dbg, value=SENTINEL_VALUE):
+ '''Changes some attribute in a given frame.
+ '''
+ frame = find_frame(thread_id, frame_id)
+ if frame is None:
+ return
+
+ try:
+ expression = expression.replace('@LINE@', '\n')
+
+ if dbg.plugin and value is SENTINEL_VALUE:
+ result = dbg.plugin.change_variable(frame, attr, expression)
+ if result:
+ return result
+
+ if attr[:7] == "Globals":
+ attr = attr[8:]
+ if attr in frame.f_globals:
+ if value is SENTINEL_VALUE:
+ value = eval(expression, frame.f_globals, frame.f_locals)
+ frame.f_globals[attr] = value
+ return frame.f_globals[attr]
+ else:
+ if '.' not in attr: # i.e.: if we have a '.', we're changing some attribute of a local var.
+ if pydevd_save_locals.is_save_locals_available():
+ if value is SENTINEL_VALUE:
+ value = eval(expression, frame.f_globals, frame.f_locals)
+ frame.f_locals[attr] = value
+ pydevd_save_locals.save_locals(frame)
+ return frame.f_locals[attr]
+
+ # default way (only works for changing it in the topmost frame)
+ if value is SENTINEL_VALUE:
+ value = eval(expression, frame.f_globals, frame.f_locals)
+ result = value
+ Exec('%s=%s' % (attr, expression), frame.f_globals, frame.f_locals)
+ return result
+
+
+ except Exception:
+ traceback.print_exc()
+
+
+MAXIMUM_ARRAY_SIZE = 100
+MAX_SLICE_SIZE = 1000
+
+
+def table_like_struct_to_xml(array, name, roffset, coffset, rows, cols, format):
+ _, type_name, _ = get_type(array)
+ if type_name == 'ndarray':
+ array, metaxml, r, c, f = array_to_meta_xml(array, name, format)
+ xml = metaxml
+ format = '%' + f
+ if rows == -1 and cols == -1:
+ rows = r
+ cols = c
+ xml += array_to_xml(array, roffset, coffset, rows, cols, format)
+ elif type_name == 'DataFrame':
+ xml = dataframe_to_xml(array, name, roffset, coffset, rows, cols, format)
+ else:
+ raise VariableError("Do not know how to convert type %s to table" % (type_name))
+
+ return "%s " % xml
+
+
+def array_to_xml(array, roffset, coffset, rows, cols, format):
+ xml = ""
+ rows = min(rows, MAXIMUM_ARRAY_SIZE)
+ cols = min(cols, MAXIMUM_ARRAY_SIZE)
+
+ # there is no obvious rule for slicing (at least 5 choices)
+ if len(array) == 1 and (rows > 1 or cols > 1):
+ array = array[0]
+ if array.size > len(array):
+ array = array[roffset:, coffset:]
+ rows = min(rows, len(array))
+ cols = min(cols, len(array[0]))
+ if len(array) == 1:
+ array = array[0]
+ elif array.size == len(array):
+ if roffset == 0 and rows == 1:
+ array = array[coffset:]
+ cols = min(cols, len(array))
+ elif coffset == 0 and cols == 1:
+ array = array[roffset:]
+ rows = min(rows, len(array))
+
+ xml += "" % (rows, cols)
+ for row in xrange(rows):
+ xml += "" % to_string(row)
+ for col in xrange(cols):
+ value = array
+ if rows == 1 or cols == 1:
+ if rows == 1 and cols == 1:
+ value = array[0]
+ else:
+ if rows == 1:
+ dim = col
+ else:
+ dim = row
+ value = array[dim]
+ if "ndarray" in str(type(value)):
+ value = value[0]
+ else:
+ value = array[row][col]
+ value = format % value
+ xml += var_to_xml(value, '')
+ return xml
+
+
+def array_to_meta_xml(array, name, format):
+ type = array.dtype.kind
+ slice = name
+ l = len(array.shape)
+
+ # initial load, compute slice
+ if format == '%':
+ if l > 2:
+ slice += '[0]' * (l - 2)
+ for r in xrange(l - 2):
+ array = array[0]
+ if type == 'f':
+ format = '.5f'
+ elif type == 'i' or type == 'u':
+ format = 'd'
+ else:
+ format = 's'
+ else:
+ format = format.replace('%', '')
+
+ l = len(array.shape)
+ reslice = ""
+ if l > 2:
+ raise Exception("%s has more than 2 dimensions." % slice)
+ elif l == 1:
+ # special case with 1D arrays arr[i, :] - row, but arr[:, i] - column with equal shape and ndim
+ # http://stackoverflow.com/questions/16837946/numpy-a-2-rows-1-column-file-loadtxt-returns-1row-2-columns
+ # explanation: http://stackoverflow.com/questions/15165170/how-do-i-maintain-row-column-orientation-of-vectors-in-numpy?rq=1
+ # we use kind of a hack - get information about memory from C_CONTIGUOUS
+ is_row = array.flags['C_CONTIGUOUS']
+
+ if is_row:
+ rows = 1
+ cols = min(len(array), MAX_SLICE_SIZE)
+ if cols < len(array):
+ reslice = '[0:%s]' % (cols)
+ array = array[0:cols]
+ else:
+ cols = 1
+ rows = min(len(array), MAX_SLICE_SIZE)
+ if rows < len(array):
+ reslice = '[0:%s]' % (rows)
+ array = array[0:rows]
+ elif l == 2:
+ rows = min(array.shape[-2], MAX_SLICE_SIZE)
+ cols = min(array.shape[-1], MAX_SLICE_SIZE)
+ if cols < array.shape[-1] or rows < array.shape[-2]:
+ reslice = '[0:%s, 0:%s]' % (rows, cols)
+ array = array[0:rows, 0:cols]
+
+ # avoid slice duplication
+ if not slice.endswith(reslice):
+ slice += reslice
+
+ bounds = (0, 0)
+ if type in "biufc":
+ bounds = (array.min(), array.max())
+ xml = '' % \
+ (slice, rows, cols, format, type, bounds[1], bounds[0])
+ return array, xml, rows, cols, format
+
+
+
+def dataframe_to_xml(df, name, roffset, coffset, rows, cols, format):
+ """
+ :type df: pandas.core.frame.DataFrame
+ :type name: str
+ :type coffset: int
+ :type roffset: int
+ :type rows: int
+ :type cols: int
+ :type format: str
+
+
+ """
+ num_rows = min(df.shape[0], MAX_SLICE_SIZE)
+ num_cols = min(df.shape[1], MAX_SLICE_SIZE)
+ if (num_rows, num_cols) != df.shape:
+ df = df.iloc[0:num_rows, 0: num_cols]
+ slice = '.iloc[0:%s, 0:%s]' % (num_rows, num_cols)
+ else:
+ slice = ''
+ slice = name + slice
+ xml = '\n' % \
+ (slice, num_rows, num_cols)
+
+ if (rows, cols) == (-1, -1):
+ rows, cols = num_rows, num_cols
+
+ rows = min(rows, MAXIMUM_ARRAY_SIZE)
+ cols = min(min(cols, MAXIMUM_ARRAY_SIZE), num_cols)
+ # need to precompute column bounds here before slicing!
+ col_bounds = [None] * cols
+ for col in xrange(cols):
+ dtype = df.dtypes.iloc[coffset + col].kind
+ if dtype in "biufc":
+ cvalues = df.iloc[:, coffset + col]
+ bounds = (cvalues.min(), cvalues.max())
+ else:
+ bounds = (0, 0)
+ col_bounds[col] = bounds
+
+ df = df.iloc[roffset: roffset + rows, coffset: coffset + cols]
+ rows, cols = df.shape
+
+ xml += "\n" % (rows, cols)
+ format = format.replace('%', '')
+ col_formats = []
+
+ get_label = lambda label: str(label) if not isinstance(label, tuple) else '/'.join(map(str, label))
+
+ for col in xrange(cols):
+ dtype = df.dtypes.iloc[col].kind
+ if dtype == 'f' and format:
+ fmt = format
+ elif dtype == 'f':
+ fmt = '.5f'
+ elif dtype == 'i' or dtype == 'u':
+ fmt= 'd'
+ else:
+ fmt= 's'
+ col_formats.append('%' + fmt)
+ bounds = col_bounds[col]
+
+ xml += ' \n' % \
+ (str(col), get_label(df.axes[1].values[col]), dtype, fmt, bounds[1], bounds[0])
+ for row, label in enumerate(iter(df.axes[0])):
+ xml += "\n" % \
+ (str(row), get_label(label))
+ xml += " \n"
+ xml += "\n" % (rows, cols)
+ for row in xrange(rows):
+ xml += "\n" % str(row)
+ for col in xrange(cols):
+ value = df.iat[row, col]
+ value = col_formats[col] % value
+ xml += var_to_xml(value, '')
+ return xml
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_vm_type.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_vm_type.py
new file mode 100644
index 00000000..d2cf5b67
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_vm_type.py
@@ -0,0 +1,41 @@
+import sys
+
+#=======================================================================================================================
+# PydevdVmType
+#=======================================================================================================================
+class PydevdVmType:
+
+ PYTHON = 'python'
+ JYTHON = 'jython'
+ vm_type = None
+
+
+#=======================================================================================================================
+# set_vm_type
+#=======================================================================================================================
+def set_vm_type(vm_type):
+ PydevdVmType.vm_type = vm_type
+
+
+#=======================================================================================================================
+# get_vm_type
+#=======================================================================================================================
+def get_vm_type():
+ if PydevdVmType.vm_type is None:
+ setup_type()
+ return PydevdVmType.vm_type
+
+
+#=======================================================================================================================
+# setup_type
+#=======================================================================================================================
+def setup_type(str=None):
+ if str is not None:
+ PydevdVmType.vm_type = str
+ return
+
+ if sys.platform.startswith("java"):
+ PydevdVmType.vm_type = PydevdVmType.JYTHON
+ else:
+ PydevdVmType.vm_type = PydevdVmType.PYTHON
+
diff --git a/ptvsd/pydevd/_pydevd_bundle/pydevd_xml.py b/ptvsd/pydevd/_pydevd_bundle/pydevd_xml.py
new file mode 100644
index 00000000..2c7fdac8
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_bundle/pydevd_xml.py
@@ -0,0 +1,362 @@
+from _pydev_bundle import pydev_log
+import traceback
+from _pydevd_bundle import pydevd_extension_utils
+from _pydevd_bundle import pydevd_resolver
+import sys
+from _pydevd_bundle.pydevd_constants import dict_iter_items, dict_keys, IS_PY3K, \
+ MAXIMUM_VARIABLE_REPRESENTATION_SIZE, RETURN_VALUES_DICT
+from _pydev_bundle.pydev_imports import quote
+from _pydevd_bundle.pydevd_extension_api import TypeResolveProvider, StrPresentationProvider
+
+try:
+ import types
+
+ frame_type = types.FrameType
+except:
+ frame_type = None
+
+try:
+ from xml.sax.saxutils import escape
+
+
+ def make_valid_xml_value(s):
+ return escape(s, {'"': '"'})
+except:
+ # Simple replacement if it's not there.
+ def make_valid_xml_value(s):
+ return s.replace('<', '<').replace('>', '>').replace('"', '"')
+
+
+class ExceptionOnEvaluate:
+ def __init__(self, result):
+ self.result = result
+
+
+_IS_JYTHON = sys.platform.startswith("java")
+
+
+def _create_default_type_map():
+ if not _IS_JYTHON:
+ default_type_map = [
+ # None means that it should not be treated as a compound variable
+
+ # isintance does not accept a tuple on some versions of python, so, we must declare it expanded
+ (type(None), None,),
+ (int, None),
+ (float, None),
+ (complex, None),
+ (str, None),
+ (tuple, pydevd_resolver.tupleResolver),
+ (list, pydevd_resolver.tupleResolver),
+ (dict, pydevd_resolver.dictResolver),
+ ]
+ try:
+ default_type_map.append((long, None)) # @UndefinedVariable
+ except:
+ pass # not available on all python versions
+
+ try:
+ default_type_map.append((unicode, None)) # @UndefinedVariable
+ except:
+ pass # not available on all python versions
+
+ try:
+ default_type_map.append((set, pydevd_resolver.setResolver))
+ except:
+ pass # not available on all python versions
+
+ try:
+ default_type_map.append((frozenset, pydevd_resolver.setResolver))
+ except:
+ pass # not available on all python versions
+
+ try:
+ from django.utils.datastructures import MultiValueDict
+ default_type_map.insert(0, (MultiValueDict, pydevd_resolver.multiValueDictResolver))
+ # we should put it before dict
+ except:
+ pass # django may not be installed
+
+ try:
+ from django.forms import BaseForm
+ default_type_map.insert(0, (BaseForm, pydevd_resolver.djangoFormResolver))
+ # we should put it before instance resolver
+ except:
+ pass # django may not be installed
+
+ try:
+ from collections import deque
+ default_type_map.append((deque, pydevd_resolver.dequeResolver))
+ except:
+ pass
+
+ if frame_type is not None:
+ default_type_map.append((frame_type, pydevd_resolver.frameResolver))
+
+ else:
+ from org.python import core # @UnresolvedImport
+ default_type_map = [
+ (core.PyNone, None),
+ (core.PyInteger, None),
+ (core.PyLong, None),
+ (core.PyFloat, None),
+ (core.PyComplex, None),
+ (core.PyString, None),
+ (core.PyTuple, pydevd_resolver.tupleResolver),
+ (core.PyList, pydevd_resolver.tupleResolver),
+ (core.PyDictionary, pydevd_resolver.dictResolver),
+ (core.PyStringMap, pydevd_resolver.dictResolver),
+ ]
+ if hasattr(core, 'PyJavaInstance'):
+ # Jython 2.5b3 removed it.
+ default_type_map.append((core.PyJavaInstance, pydevd_resolver.instanceResolver))
+
+ return default_type_map
+
+
+class TypeResolveHandler(object):
+ NO_PROVIDER = [] # Sentinel value (any mutable object to be used as a constant would be valid).
+
+ def __init__(self):
+ # Note: don't initialize with the types we already know about so that the extensions can override
+ # the default resolvers that are already available if they want.
+ self._type_to_resolver_cache = {}
+ self._type_to_str_provider_cache = {}
+ self._initialized = False
+
+ def _initialize(self):
+ self._default_type_map = _create_default_type_map()
+ self._resolve_providers = pydevd_extension_utils.extensions_of_type(TypeResolveProvider)
+ self._str_providers = pydevd_extension_utils.extensions_of_type(StrPresentationProvider)
+ self._initialized = True
+
+ def get_type(self, o):
+ try:
+ try:
+ # Faster than type(o) as we don't need the function call.
+ type_object = o.__class__
+ except:
+ # Not all objects have __class__ (i.e.: there are bad bindings around).
+ type_object = type(o)
+
+ type_name = type_object.__name__
+ except:
+ # This happens for org.python.core.InitModule
+ return 'Unable to get Type', 'Unable to get Type', None
+
+ return self._get_type(o, type_object, type_name)
+
+ def _get_type(self, o, type_object, type_name):
+ resolver = self._type_to_resolver_cache.get(type_object)
+ if resolver is not None:
+ return type_object, type_name, resolver
+
+ if not self._initialized:
+ self._initialize()
+
+ try:
+ for resolver in self._resolve_providers:
+ if resolver.can_provide(type_object, type_name):
+ # Cache it
+ self._type_to_resolver_cache[type_object] = resolver
+ return type_object, type_name, resolver
+
+ for t in self._default_type_map:
+ if isinstance(o, t[0]):
+ # Cache it
+ resolver = t[1]
+ self._type_to_resolver_cache[type_object] = resolver
+ return (type_object, type_name, resolver)
+ except:
+ traceback.print_exc()
+
+ # No match return default (and cache it).
+ resolver = pydevd_resolver.defaultResolver
+ self._type_to_resolver_cache[type_object] = resolver
+ return type_object, type_name, resolver
+
+ if _IS_JYTHON:
+ _base_get_type = _get_type
+
+ def _get_type(self, o, type_object, type_name):
+ if type_name == 'org.python.core.PyJavaInstance':
+ return type_object, type_name, pydevd_resolver.instanceResolver
+
+ if type_name == 'org.python.core.PyArray':
+ return type_object, type_name, pydevd_resolver.jyArrayResolver
+
+ return self._base_get_type(o, type_name, type_name)
+
+ def str_from_providers(self, o, type_object, type_name):
+ provider = self._type_to_str_provider_cache.get(type_object)
+
+ if provider is self.NO_PROVIDER:
+ return None
+
+ if provider is not None:
+ return provider.get_str(o)
+
+ if not self._initialized:
+ self._initialize()
+
+ for provider in self._str_providers:
+ if provider.can_provide(type_object, type_name):
+ self._type_to_str_provider_cache[type_object] = provider
+ return provider.get_str(o)
+
+ self._type_to_str_provider_cache[type_object] = self.NO_PROVIDER
+ return None
+
+
+_TYPE_RESOLVE_HANDLER = TypeResolveHandler()
+
+"""
+def get_type(o):
+ Receives object and returns a triple (typeObject, typeString, resolver).
+
+ resolver != None means that variable is a container, and should be displayed as a hierarchy.
+
+ Use the resolver to get its attributes.
+
+ All container objects should have a resolver.
+"""
+get_type = _TYPE_RESOLVE_HANDLER.get_type
+
+_str_from_providers = _TYPE_RESOLVE_HANDLER.str_from_providers
+
+
+def return_values_from_dict_to_xml(return_dict):
+ res = ""
+ for name, val in dict_iter_items(return_dict):
+ res += var_to_xml(val, name, additional_in_xml=' isRetVal="True"')
+ return res
+
+
+def frame_vars_to_xml(frame_f_locals, hidden_ns=None):
+ """ dumps frame variables to XML
+
+ """
+ xml = ""
+
+ keys = dict_keys(frame_f_locals)
+ if hasattr(keys, 'sort'):
+ keys.sort() # Python 3.0 does not have it
+ else:
+ keys = sorted(keys) # Jython 2.1 does not have it
+
+ return_values_xml = ''
+
+ for k in keys:
+ try:
+ v = frame_f_locals[k]
+ if k == RETURN_VALUES_DICT:
+ for name, val in dict_iter_items(v):
+ return_values_xml += var_to_xml(val, name, additional_in_xml=' isRetVal="True"')
+
+ else:
+ if hidden_ns is not None and k in hidden_ns:
+ xml += var_to_xml(v, str(k), additional_in_xml=' isIPythonHidden="True"')
+ else:
+ xml += var_to_xml(v, str(k))
+ except Exception:
+ traceback.print_exc()
+ pydev_log.error("Unexpected error, recovered safely.\n")
+
+ # Show return values as the first entry.
+ return return_values_xml + xml
+
+
+def var_to_xml(val, name, doTrim=True, additional_in_xml=''):
+ """ single variable or dictionary to xml representation """
+
+ try:
+ # This should be faster than isinstance (but we have to protect against not having a '__class__' attribute).
+ is_exception_on_eval = val.__class__ == ExceptionOnEvaluate
+ except:
+ is_exception_on_eval = False
+
+ if is_exception_on_eval:
+ v = val.result
+ else:
+ v = val
+
+ _type, typeName, resolver = get_type(v)
+ type_qualifier = getattr(_type, "__module__", "")
+ try:
+ str_from_provider = _str_from_providers(v, _type, typeName)
+ if str_from_provider is not None:
+ value = str_from_provider
+ elif hasattr(v, '__class__'):
+ if v.__class__ == frame_type:
+ value = pydevd_resolver.frameResolver.get_frame_name(v)
+
+ elif v.__class__ in (list, tuple):
+ if len(v) > 300:
+ value = '%s: %s' % (str(v.__class__), '' % (len(v),))
+ else:
+ value = '%s: %s' % (str(v.__class__), v)
+ else:
+ try:
+ cName = str(v.__class__)
+ if cName.find('.') != -1:
+ cName = cName.split('.')[-1]
+
+ elif cName.find("'") != -1: # does not have '.' (could be something like )
+ cName = cName[cName.index("'") + 1:]
+
+ if cName.endswith("'>"):
+ cName = cName[:-2]
+ except:
+ cName = str(v.__class__)
+
+ value = '%s: %s' % (cName, v)
+ else:
+ value = str(v)
+ except:
+ try:
+ value = repr(v)
+ except:
+ value = 'Unable to get repr for %s' % v.__class__
+
+ try:
+ name = quote(name, '/>_= ') # TODO: Fix PY-5834 without using quote
+ except:
+ pass
+
+ xml = ' MAXIMUM_VARIABLE_REPRESENTATION_SIZE and doTrim:
+ value = value[0:MAXIMUM_VARIABLE_REPRESENTATION_SIZE]
+ value += '...'
+
+ # fix to work with unicode values
+ try:
+ if not IS_PY3K:
+ if value.__class__ == unicode: # @UndefinedVariable
+ value = value.encode('utf-8')
+ else:
+ if value.__class__ == bytes:
+ value = value.encode('utf-8')
+ except TypeError: # in java, unicode is a function
+ pass
+
+ xml_value = ' value="%s"' % (make_valid_xml_value(quote(value, '/>_= ')))
+ else:
+ xml_value = ''
+
+ if is_exception_on_eval:
+ xml_container = ' isErrorOnEval="True"'
+ else:
+ if resolver is not None:
+ xml_container = ' isContainer="True"'
+ else:
+ xml_container = ''
+
+ return ''.join((xml, xml_qualifier, xml_value, xml_container, additional_in_xml, ' />\n'))
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/__init__.py b/ptvsd/pydevd/_pydevd_frame_eval/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py
new file mode 100644
index 00000000..3b8f1fc6
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py
@@ -0,0 +1,31 @@
+try:
+ from _pydevd_frame_eval.pydevd_frame_evaluator import frame_eval_func, stop_frame_eval, enable_cache_frames_without_breaks, dummy_trace_dispatch
+except ImportError:
+ try:
+ import struct
+ import sys
+ try:
+ is_64bits = sys.maxsize > 2**32
+ except:
+ # In Jython this call fails, but this is Ok, we don't support Jython for speedups anyways.
+ raise ImportError
+ plat = '32'
+ if is_64bits:
+ plat = '64'
+
+ # We also accept things as:
+ #
+ # _pydevd_frame_eval.pydevd_frame_evaluator_win32_27_32
+ # _pydevd_frame_eval.pydevd_frame_evaluator_win32_34_64
+ #
+ # to have multiple pre-compiled pyds distributed along the IDE
+ # (generated by build_tools/build_binaries_windows.py).
+
+ mod_name = 'pydevd_frame_evaluator_%s_%s%s_%s' % (sys.platform, sys.version_info[0], sys.version_info[1], plat)
+ check_name = '_pydevd_frame_eval.%s' % (mod_name,)
+ mod = __import__(check_name)
+ mod = getattr(mod, mod_name)
+ frame_eval_func, stop_frame_eval, enable_cache_frames_without_breaks, dummy_trace_dispatch = \
+ mod.frame_eval_func, mod.stop_frame_eval, mod.enable_cache_frames_without_breaks, mod.dummy_trace_dispatch
+ except ImportError:
+ raise
\ No newline at end of file
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py
new file mode 100644
index 00000000..47a7188d
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py
@@ -0,0 +1,28 @@
+import os
+import sys
+
+IS_PY36 = False
+if sys.version_info[0] == 3 and sys.version_info[1] == 6:
+ IS_PY36 = True
+
+frame_eval_func = None
+stop_frame_eval = None
+enable_cache_frames_without_breaks = None
+dummy_trace_dispatch = None
+
+USE_FRAME_EVAL = os.environ.get('PYDEVD_USE_FRAME_EVAL', None)
+
+if USE_FRAME_EVAL == 'NO':
+ frame_eval_func, stop_frame_eval = None, None
+
+else:
+ if IS_PY36:
+ try:
+ from _pydevd_frame_eval.pydevd_frame_eval_cython_wrapper import frame_eval_func, stop_frame_eval, enable_cache_frames_without_breaks, \
+ dummy_trace_dispatch
+ except ImportError:
+ from _pydev_bundle.pydev_monkey import log_error_once
+
+ dirname = os.path.dirname(os.path.dirname(__file__))
+ log_error_once("warning: Debugger speedups using cython not found. Run '\"%s\" \"%s\" build_ext --inplace' to build." % (
+ sys.executable, os.path.join(dirname, 'setup_cython.py')))
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c
new file mode 100644
index 00000000..43992607
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c
@@ -0,0 +1,6771 @@
+/* Generated by Cython 0.25.2 */
+
+/* BEGIN: Cython Metadata
+{
+ "distutils": {
+ "depends": []
+ },
+ "module_name": "_pydevd_frame_eval.pydevd_frame_evaluator"
+}
+END: Cython Metadata */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_25_2"
+#include
+#ifndef offsetof
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef HAVE_LONG_LONG
+ #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
+ #define HAVE_LONG_LONG
+ #endif
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+ #define CYTHON_COMPILING_IN_PYPY 1
+ #define CYTHON_COMPILING_IN_PYSTON 0
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #undef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 0
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #undef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 1
+ #undef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 0
+ #undef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 0
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+#elif defined(PYSTON_VERSION)
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_PYSTON 1
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+#else
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_PYSTON 0
+ #define CYTHON_COMPILING_IN_CPYTHON 1
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #if PY_VERSION_HEX < 0x02070000
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
+ #define CYTHON_USE_PYLONG_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #if PY_VERSION_HEX < 0x030300F0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
+ #define CYTHON_USE_UNICODE_WRITER 1
+ #endif
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #ifndef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 1
+ #endif
+ #ifndef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 1
+ #endif
+#endif
+#if !defined(CYTHON_FAST_PYCCALL)
+#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
+#endif
+#if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #undef SHIFT
+ #undef BASE
+ #undef MASK
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+ #define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#ifndef Py_TPFLAGS_CHECKTYPES
+ #define Py_TPFLAGS_CHECKTYPES 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_INDEX
+ #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_FINALIZE
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#ifndef METH_FASTCALL
+ #define METH_FASTCALL 0x80
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
+ Py_ssize_t nargs, PyObject *kwnames);
+#else
+ #define __Pyx_PyCFunctionFast _PyCFunctionFast
+#endif
+#if CYTHON_FAST_PYCCALL
+#define __Pyx_PyFastCFunction_Check(func)\
+ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
+#else
+#define __Pyx_PyFastCFunction_Check(func) 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define PyUnicode_1BYTE_KIND 1
+ #define PyUnicode_2BYTE_KIND 2
+ #define PyUnicode_4BYTE_KIND 4
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
+ #define PyObject_Free(p) PyMem_Free(p)
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
+#endif
+#if CYTHON_COMPILING_IN_PYSTON
+ #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
+#else
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
+ #define PyObject_ASCII(o) PyObject_Repr(o)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#if CYTHON_USE_ASYNC_SLOTS
+ #if PY_VERSION_HEX >= 0x030500B1
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
+ #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
+ #else
+ typedef struct {
+ unaryfunc am_await;
+ unaryfunc am_aiter;
+ unaryfunc am_anext;
+ } __Pyx_PyAsyncMethodsStruct;
+ #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
+ #endif
+#else
+ #define __Pyx_PyType_AsAsync(obj) NULL
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+#ifndef CYTHON_MAYBE_UNUSED_VAR
+# if defined(__cplusplus)
+ template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
+# else
+# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
+# endif
+#endif
+#ifndef CYTHON_NCP_UNUSED
+# if CYTHON_COMPILING_IN_CPYTHON
+# define CYTHON_NCP_UNUSED
+# else
+# define CYTHON_NCP_UNUSED CYTHON_UNUSED
+# endif
+#endif
+#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
+
+#ifndef CYTHON_INLINE
+ #if defined(__clang__)
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
+ #elif defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+ #define _USE_MATH_DEFINES
+#endif
+#include
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
+#define __Pyx_truncl trunc
+#else
+#define __Pyx_truncl truncl
+#endif
+
+
+#define __PYX_ERR(f_index, lineno, Ln_error) \
+{ \
+ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
+}
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#define __PYX_HAVE___pydevd_frame_eval__pydevd_frame_evaluator
+#define __PYX_HAVE_API___pydevd_frame_eval__pydevd_frame_evaluator
+#include "frameobject.h"
+#include "code.h"
+#include "pystate.h"
+#include "ceval.h"
+#ifdef _OPENMP
+#include
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_uchar_cast(c) ((unsigned char)c)
+#define __Pyx_long_cast(x) ((long)x)
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
+ (sizeof(type) < sizeof(Py_ssize_t)) ||\
+ (sizeof(type) > sizeof(Py_ssize_t) &&\
+ likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX) &&\
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
+ v == (type)PY_SSIZE_T_MIN))) ||\
+ (sizeof(type) == sizeof(Py_ssize_t) &&\
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX))) )
+#if defined (__cplusplus) && __cplusplus >= 201103L
+ #include
+ #define __Pyx_sst_abs(value) std::abs(value)
+#elif SIZEOF_INT >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) abs(value)
+#elif SIZEOF_LONG >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) labs(value)
+#elif defined (_MSC_VER) && defined (_M_X64)
+ #define __Pyx_sst_abs(value) _abs64(value)
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define __Pyx_sst_abs(value) llabs(value)
+#elif defined (__GNUC__)
+ #define __Pyx_sst_abs(value) __builtin_llabs(value)
+#else
+ #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
+#endif
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
+#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_ASSUME_SAFE_MACROS
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
+#else
+#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
+#endif
+#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static PyObject *__pyx_empty_unicode;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "_pydevd_frame_eval/pydevd_frame_evaluator.pyx",
+};
+
+/*--- Type declarations ---*/
+
+/* --- Runtime support code (head) --- */
+/* Refnanny.proto */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ if (acquire_gil) {\
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
+ PyGILState_Release(__pyx_gilstate_save);\
+ } else {\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext()\
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_XDECREF(tmp);\
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_DECREF(tmp);\
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+/* PyObjectGetAttrStr.proto */
+#if CYTHON_USE_TYPE_SLOTS
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+/* GetBuiltinName.proto */
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+/* GetModuleGlobalName.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+/* PyObjectSetAttrStr.proto */
+#if CYTHON_USE_TYPE_SLOTS
+#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
+static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_setattro))
+ return tp->tp_setattro(obj, attr_name, value);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_setattr))
+ return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
+#endif
+ return PyObject_SetAttr(obj, attr_name, value);
+}
+#else
+#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
+#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
+#endif
+
+/* RaiseArgTupleInvalid.proto */
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+/* RaiseDoubleKeywords.proto */
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+/* ParseKeywords.proto */
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
+ const char* function_name);
+
+/* ArgTypeTest.proto */
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
+
+/* PyCFunctionFastCall.proto */
+#if CYTHON_FAST_PYCCALL
+static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
+#else
+#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
+#endif
+
+/* PyFunctionFastCall.proto */
+#if CYTHON_FAST_PYCALL
+#define __Pyx_PyFunction_FastCall(func, args, nargs)\
+ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
+#if 1 || PY_VERSION_HEX < 0x030600B1
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
+#else
+#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
+#endif
+#endif
+
+/* PyObjectCall.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+/* PyObjectCallMethO.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+/* PyObjectCallOneArg.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+/* PyObjectCallNoArg.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+/* PyThreadStateGet.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
+#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
+#else
+#define __Pyx_PyThreadState_declare
+#define __Pyx_PyThreadState_assign
+#endif
+
+/* SaveResetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+#else
+#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
+#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
+#endif
+
+/* PyErrFetchRestore.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
+#endif
+
+/* bytes_tailmatch.proto */
+static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
+ Py_ssize_t start, Py_ssize_t end, int direction);
+static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
+ Py_ssize_t start, Py_ssize_t end, int direction);
+
+/* unicode_tailmatch.proto */
+static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
+ Py_ssize_t start, Py_ssize_t end, int direction);
+
+/* str_tailmatch.proto */
+static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
+ Py_ssize_t end, int direction);
+
+/* GetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
+static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+#endif
+
+/* None.proto */
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
+/* RaiseException.proto */
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+/* GetAttr.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
+
+/* GetAttr3.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
+
+/* GetItemInt.proto */
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
+
+/* RaiseTooManyValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+/* RaiseNeedMoreValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+/* IterFinish.proto */
+static CYTHON_INLINE int __Pyx_IterFinish(void);
+
+/* UnpackItemEndCheck.proto */
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
+
+/* PySequenceContains.proto */
+static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
+ int result = PySequence_Contains(seq, item);
+ return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+/* ListAppend.proto */
+#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+ PyListObject* L = (PyListObject*) list;
+ Py_ssize_t len = Py_SIZE(list);
+ if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+ Py_INCREF(x);
+ PyList_SET_ITEM(list, len, x);
+ Py_SIZE(list) = len+1;
+ return 0;
+ }
+ return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#endif
+
+/* WriteUnraisableException.proto */
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename,
+ int full_traceback, int nogil);
+
+/* Import.proto */
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+/* ImportFrom.proto */
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+/* CalculateMetaclass.proto */
+static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
+
+/* Py3ClassCreate.proto */
+static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
+ PyObject *mkw, PyObject *modname, PyObject *doc);
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
+ PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
+
+/* CodeObjectCache.proto */
+typedef struct {
+ PyCodeObject* code_object;
+ int code_line;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+/* AddTraceback.proto */
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+/* CheckBinaryVersion.proto */
+static int __Pyx_check_binary_version(void);
+
+/* InitStrings.proto */
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from '_pydevd_frame_eval.pydevd_frame_evaluator' */
+static PyObject *__pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_dummy_trace_dispatch(PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
+static PyObject *__pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_get_bytecode_while_frame_eval(PyFrameObject *, int); /*proto*/
+#define __Pyx_MODULE_NAME "_pydevd_frame_eval.pydevd_frame_evaluator"
+int __pyx_module_is_main__pydevd_frame_eval__pydevd_frame_evaluator = 0;
+
+/* Implementation of '_pydevd_frame_eval.pydevd_frame_evaluator' */
+static PyObject *__pyx_builtin_AttributeError;
+static const char __pyx_k_[] = "/";
+static const char __pyx_k__2[] = "\\";
+static const char __pyx_k_add[] = "add";
+static const char __pyx_k_arg[] = "arg";
+static const char __pyx_k_dis[] = "dis";
+static const char __pyx_k_doc[] = "__doc__";
+static const char __pyx_k_get[] = "get";
+static const char __pyx_k_code[] = "__code__";
+static const char __pyx_k_main[] = "__main__";
+static const char __pyx_k_test[] = "__test__";
+static const char __pyx_k_event[] = "event";
+static const char __pyx_k_frame[] = "frame";
+static const char __pyx_k_index[] = "index";
+static const char __pyx_k_local[] = "local";
+static const char __pyx_k_state[] = "state";
+static const char __pyx_k_f_code[] = "f_code";
+static const char __pyx_k_import[] = "__import__";
+static const char __pyx_k_module[] = "__module__";
+static const char __pyx_k_plugin[] = "plugin";
+static const char __pyx_k_prepare[] = "__prepare__";
+static const char __pyx_k_SetTrace[] = "SetTrace";
+static const char __pyx_k_qualname[] = "__qualname__";
+static const char __pyx_k_f_globals[] = "f_globals";
+static const char __pyx_k_metaclass[] = "__metaclass__";
+static const char __pyx_k_new_value[] = "new_value";
+static const char __pyx_k_threading[] = "threading";
+static const char __pyx_k_DONT_TRACE[] = "DONT_TRACE";
+static const char __pyx_k_is_tracing[] = "is_tracing";
+static const char __pyx_k_breakpoints[] = "breakpoints";
+static const char __pyx_k_co_filename[] = "co_filename";
+static const char __pyx_k_insert_code[] = "insert_code";
+static const char __pyx_k_can_not_skip[] = "can_not_skip";
+static const char __pyx_k_code_objects[] = "code_objects";
+static const char __pyx_k_threading_py[] = "threading.py";
+static const char __pyx_k_currentThread[] = "currentThread";
+static const char __pyx_k_get_file_type[] = "get_file_type";
+static const char __pyx_k_weakrefset_py[] = "_weakrefset.py";
+static const char __pyx_k_AttributeError[] = "AttributeError";
+static const char __pyx_k_findlinestarts[] = "findlinestarts";
+static const char __pyx_k_set_trace_func[] = "set_trace_func";
+static const char __pyx_k_trace_dispatch[] = "trace_dispatch";
+static const char __pyx_k_use_code_extra[] = "use_code_extra";
+static const char __pyx_k_AVOID_RECURSION[] = "AVOID_RECURSION";
+static const char __pyx_k_additional_info[] = "additional_info";
+static const char __pyx_k_frame_eval_func[] = "frame_eval_func";
+static const char __pyx_k_stop_frame_eval[] = "stop_frame_eval";
+static const char __pyx_k_is_use_code_extra[] = "is_use_code_extra";
+static const char __pyx_k_pydevd_file_utils[] = "pydevd_file_utils";
+static const char __pyx_k_NO_BREAKS_IN_FRAME[] = "NO_BREAKS_IN_FRAME";
+static const char __pyx_k_UseCodeExtraHolder[] = "UseCodeExtraHolder";
+static const char __pyx_k_pydev_do_not_trace[] = "pydev_do_not_trace";
+static const char __pyx_k_get_global_debugger[] = "get_global_debugger";
+static const char __pyx_k_update_globals_dict[] = "update_globals_dict";
+static const char __pyx_k_dummy_trace_dispatch[] = "dummy_trace_dispatch";
+static const char __pyx_k_dummy_tracing_holder[] = "dummy_tracing_holder";
+static const char __pyx_k_has_plugin_line_breaks[] = "has_plugin_line_breaks";
+static const char __pyx_k_PyDBAdditionalThreadInfo[] = "PyDBAdditionalThreadInfo";
+static const char __pyx_k_pydev_trace_code_wrapper[] = "pydev_trace_code_wrapper";
+static const char __pyx_k_pydevd_bundle_pydevd_comm[] = "_pydevd_bundle.pydevd_comm";
+static const char __pyx_k_NORM_PATHS_AND_BASE_CONTAINER[] = "NORM_PATHS_AND_BASE_CONTAINER";
+static const char __pyx_k_home_user_work_PyDev_Debugger[] = "/home/user/work/PyDev.Debugger/_pydevd_frame_eval/pydevd_frame_evaluator.pyx";
+static const char __pyx_k_pydevd_frame_eval_pydevd_frame[] = "_pydevd_frame_eval.pydevd_frame_tracing";
+static const char __pyx_k_get_abs_path_real_path_and_base[] = "get_abs_path_real_path_and_base_from_frame";
+static const char __pyx_k_pydev_imps__pydev_saved_modules[] = "_pydev_imps._pydev_saved_modules";
+static const char __pyx_k_pydevd_bundle_pydevd_additional[] = "_pydevd_bundle.pydevd_additional_thread_info";
+static const char __pyx_k_pydevd_bundle_pydevd_dont_trace[] = "_pydevd_bundle.pydevd_dont_trace_files";
+static const char __pyx_k_pydevd_frame_eval_pydevd_modify[] = "_pydevd_frame_eval.pydevd_modify_bytecode";
+static const char __pyx_k_set_trace_for_frame_and_parents[] = "set_trace_for_frame_and_parents";
+static const char __pyx_k_enable_cache_frames_without_brea[] = "enable_cache_frames_without_breaks";
+static const char __pyx_k_pydevd_additional_thread_info_re[] = "pydevd_additional_thread_info_regular.py";
+static const char __pyx_k_pydevd_frame_eval_pydevd_frame_2[] = "_pydevd_frame_eval.pydevd_frame_evaluator";
+static PyObject *__pyx_kp_s_;
+static PyObject *__pyx_n_s_AVOID_RECURSION;
+static PyObject *__pyx_n_s_AttributeError;
+static PyObject *__pyx_n_s_DONT_TRACE;
+static PyObject *__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER;
+static PyObject *__pyx_n_s_NO_BREAKS_IN_FRAME;
+static PyObject *__pyx_n_s_PyDBAdditionalThreadInfo;
+static PyObject *__pyx_n_s_SetTrace;
+static PyObject *__pyx_n_s_UseCodeExtraHolder;
+static PyObject *__pyx_kp_s__2;
+static PyObject *__pyx_n_s_add;
+static PyObject *__pyx_n_s_additional_info;
+static PyObject *__pyx_n_s_arg;
+static PyObject *__pyx_n_s_breakpoints;
+static PyObject *__pyx_n_s_can_not_skip;
+static PyObject *__pyx_n_s_co_filename;
+static PyObject *__pyx_n_s_code;
+static PyObject *__pyx_n_s_code_objects;
+static PyObject *__pyx_n_s_currentThread;
+static PyObject *__pyx_n_s_dis;
+static PyObject *__pyx_n_s_doc;
+static PyObject *__pyx_n_s_dummy_trace_dispatch;
+static PyObject *__pyx_n_s_dummy_tracing_holder;
+static PyObject *__pyx_n_s_enable_cache_frames_without_brea;
+static PyObject *__pyx_n_s_event;
+static PyObject *__pyx_n_s_f_code;
+static PyObject *__pyx_n_s_f_globals;
+static PyObject *__pyx_n_s_findlinestarts;
+static PyObject *__pyx_n_s_frame;
+static PyObject *__pyx_n_s_frame_eval_func;
+static PyObject *__pyx_n_s_get;
+static PyObject *__pyx_n_s_get_abs_path_real_path_and_base;
+static PyObject *__pyx_n_s_get_file_type;
+static PyObject *__pyx_n_s_get_global_debugger;
+static PyObject *__pyx_n_s_has_plugin_line_breaks;
+static PyObject *__pyx_kp_s_home_user_work_PyDev_Debugger;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_index;
+static PyObject *__pyx_n_s_insert_code;
+static PyObject *__pyx_n_s_is_tracing;
+static PyObject *__pyx_n_s_is_use_code_extra;
+static PyObject *__pyx_n_s_local;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_metaclass;
+static PyObject *__pyx_n_s_module;
+static PyObject *__pyx_n_s_new_value;
+static PyObject *__pyx_n_s_plugin;
+static PyObject *__pyx_n_s_prepare;
+static PyObject *__pyx_n_s_pydev_do_not_trace;
+static PyObject *__pyx_n_s_pydev_imps__pydev_saved_modules;
+static PyObject *__pyx_n_s_pydev_trace_code_wrapper;
+static PyObject *__pyx_kp_s_pydevd_additional_thread_info_re;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_additional;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_comm;
+static PyObject *__pyx_n_s_pydevd_bundle_pydevd_dont_trace;
+static PyObject *__pyx_n_s_pydevd_file_utils;
+static PyObject *__pyx_n_s_pydevd_frame_eval_pydevd_frame;
+static PyObject *__pyx_n_s_pydevd_frame_eval_pydevd_frame_2;
+static PyObject *__pyx_n_s_pydevd_frame_eval_pydevd_modify;
+static PyObject *__pyx_n_s_qualname;
+static PyObject *__pyx_n_s_set_trace_for_frame_and_parents;
+static PyObject *__pyx_n_s_set_trace_func;
+static PyObject *__pyx_n_s_state;
+static PyObject *__pyx_n_s_stop_frame_eval;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_threading;
+static PyObject *__pyx_kp_s_threading_py;
+static PyObject *__pyx_n_s_trace_dispatch;
+static PyObject *__pyx_n_s_update_globals_dict;
+static PyObject *__pyx_n_s_use_code_extra;
+static PyObject *__pyx_kp_s_weakrefset_py;
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_is_use_code_extra(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_2enable_cache_frames_without_breaks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_new_value); /* proto */
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_4dummy_trace_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg); /* proto */
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_6frame_eval_func(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_8stop_frame_eval(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_neg_1;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__9;
+static PyObject *__pyx_codeobj__4;
+static PyObject *__pyx_codeobj__6;
+static PyObject *__pyx_codeobj__8;
+static PyObject *__pyx_codeobj__10;
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":28
+ *
+ *
+ * def is_use_code_extra(): # <<<<<<<<<<<<<<
+ * return UseCodeExtraHolder.use_code_extra
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_1is_use_code_extra(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_1is_use_code_extra = {"is_use_code_extra", (PyCFunction)__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_1is_use_code_extra, METH_NOARGS, 0};
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_1is_use_code_extra(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("is_use_code_extra (wrapper)", 0);
+ __pyx_r = __pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_is_use_code_extra(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_is_use_code_extra(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ __Pyx_RefNannySetupContext("is_use_code_extra", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":29
+ *
+ * def is_use_code_extra():
+ * return UseCodeExtraHolder.use_code_extra # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_UseCodeExtraHolder); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_use_code_extra); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":28
+ *
+ *
+ * def is_use_code_extra(): # <<<<<<<<<<<<<<
+ * return UseCodeExtraHolder.use_code_extra
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.is_use_code_extra", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":33
+ *
+ * # enable using `co_extra` field in order to cache frames without breakpoints
+ * def enable_cache_frames_without_breaks(new_value): # <<<<<<<<<<<<<<
+ * UseCodeExtraHolder.use_code_extra = new_value
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_3enable_cache_frames_without_breaks(PyObject *__pyx_self, PyObject *__pyx_v_new_value); /*proto*/
+static PyMethodDef __pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_3enable_cache_frames_without_breaks = {"enable_cache_frames_without_breaks", (PyCFunction)__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_3enable_cache_frames_without_breaks, METH_O, 0};
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_3enable_cache_frames_without_breaks(PyObject *__pyx_self, PyObject *__pyx_v_new_value) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("enable_cache_frames_without_breaks (wrapper)", 0);
+ __pyx_r = __pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_2enable_cache_frames_without_breaks(__pyx_self, ((PyObject *)__pyx_v_new_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_2enable_cache_frames_without_breaks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_new_value) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("enable_cache_frames_without_breaks", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":34
+ * # enable using `co_extra` field in order to cache frames without breakpoints
+ * def enable_cache_frames_without_breaks(new_value):
+ * UseCodeExtraHolder.use_code_extra = new_value # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_UseCodeExtraHolder); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_use_code_extra, __pyx_v_new_value) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":33
+ *
+ * # enable using `co_extra` field in order to cache frames without breakpoints
+ * def enable_cache_frames_without_breaks(new_value): # <<<<<<<<<<<<<<
+ * UseCodeExtraHolder.use_code_extra = new_value
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.enable_cache_frames_without_breaks", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":37
+ *
+ *
+ * cpdef dummy_trace_dispatch(frame, str event, arg): # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_5dummy_trace_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_dummy_trace_dispatch(CYTHON_UNUSED PyObject *__pyx_v_frame, CYTHON_UNUSED PyObject *__pyx_v_event, CYTHON_UNUSED PyObject *__pyx_v_arg, CYTHON_UNUSED int __pyx_skip_dispatch) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("dummy_trace_dispatch", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":38
+ *
+ * cpdef dummy_trace_dispatch(frame, str event, arg):
+ * return None # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_None);
+ __pyx_r = Py_None;
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":37
+ *
+ *
+ * cpdef dummy_trace_dispatch(frame, str event, arg): # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_5dummy_trace_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_5dummy_trace_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_frame = 0;
+ PyObject *__pyx_v_event = 0;
+ PyObject *__pyx_v_arg = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("dummy_trace_dispatch (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,&__pyx_n_s_event,&__pyx_n_s_arg,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("dummy_trace_dispatch", 1, 3, 3, 1); __PYX_ERR(0, 37, __pyx_L3_error)
+ }
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("dummy_trace_dispatch", 1, 3, 3, 2); __PYX_ERR(0, 37, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dummy_trace_dispatch") < 0)) __PYX_ERR(0, 37, __pyx_L3_error)
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_frame = values[0];
+ __pyx_v_event = ((PyObject*)values[1]);
+ __pyx_v_arg = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("dummy_trace_dispatch", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error)
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.dummy_trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event), (&PyString_Type), 1, "event", 1))) __PYX_ERR(0, 37, __pyx_L1_error)
+ __pyx_r = __pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_4dummy_trace_dispatch(__pyx_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_4dummy_trace_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frame, PyObject *__pyx_v_event, PyObject *__pyx_v_arg) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ __Pyx_RefNannySetupContext("dummy_trace_dispatch", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_dummy_trace_dispatch(__pyx_v_frame, __pyx_v_event, __pyx_v_arg, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.dummy_trace_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":41
+ *
+ *
+ * cdef PyObject* get_bytecode_while_frame_eval(PyFrameObject *frame_obj, int exc): # <<<<<<<<<<<<<<
+ * frame = frame_obj
+ * cdef str filepath = frame.f_code.co_filename
+ */
+
+static PyObject *__pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_get_bytecode_while_frame_eval(PyFrameObject *__pyx_v_frame_obj, int __pyx_v_exc) {
+ PyObject *__pyx_v_frame = NULL;
+ PyObject *__pyx_v_filepath = 0;
+ int __pyx_v_skip_file;
+ void *__pyx_v_extra;
+ int *__pyx_v_extra_value;
+ int __pyx_v_thread_index;
+ PyObject *__pyx_v_file = NULL;
+ PyObject *__pyx_v_path_separator = NULL;
+ PyObject *__pyx_v_t = NULL;
+ PyObject *__pyx_v_additional_info = NULL;
+ PyObject *__pyx_v_abs_path_real_path_and_base = NULL;
+ PyObject *__pyx_v_file_type = NULL;
+ int __pyx_v_was_break;
+ PyObject *__pyx_v_main_debugger = NULL;
+ PyObject *__pyx_v_breakpoints = NULL;
+ PyObject *__pyx_v_code_object = NULL;
+ PyObject *__pyx_v_breakpoints_to_update = NULL;
+ CYTHON_UNUSED PyObject *__pyx_v_offset = NULL;
+ PyObject *__pyx_v_line = NULL;
+ PyObject *__pyx_v_breakpoint = NULL;
+ PyObject *__pyx_v_success = NULL;
+ PyObject *__pyx_v_new_code = NULL;
+ PyObject *__pyx_v_bp = NULL;
+ PyObject *__pyx_v_can_not_skip = NULL;
+ PyObject *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ Py_ssize_t __pyx_t_11;
+ PyObject *(*__pyx_t_12)(PyObject *);
+ Py_ssize_t __pyx_t_13;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ PyObject *(*__pyx_t_18)(PyObject *);
+ int __pyx_t_19;
+ __Pyx_RefNannySetupContext("get_bytecode_while_frame_eval", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":42
+ *
+ * cdef PyObject* get_bytecode_while_frame_eval(PyFrameObject *frame_obj, int exc):
+ * frame = frame_obj # <<<<<<<<<<<<<<
+ * cdef str filepath = frame.f_code.co_filename
+ * cdef bint skip_file = exc
+ */
+ __pyx_t_1 = ((PyObject *)__pyx_v_frame_obj);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_frame = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":43
+ * cdef PyObject* get_bytecode_while_frame_eval(PyFrameObject *frame_obj, int exc):
+ * frame = frame_obj
+ * cdef str filepath = frame.f_code.co_filename # <<<<<<<<<<<<<<
+ * cdef bint skip_file = exc
+ * cdef void* extra = NULL
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 43, __pyx_L1_error)
+ __pyx_v_filepath = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":44
+ * frame = frame_obj
+ * cdef str filepath = frame.f_code.co_filename
+ * cdef bint skip_file = exc # <<<<<<<<<<<<<<
+ * cdef void* extra = NULL
+ * cdef int* extra_value = NULL
+ */
+ __pyx_v_skip_file = __pyx_v_exc;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":45
+ * cdef str filepath = frame.f_code.co_filename
+ * cdef bint skip_file = exc
+ * cdef void* extra = NULL # <<<<<<<<<<<<<<
+ * cdef int* extra_value = NULL
+ * cdef int thread_index = -1
+ */
+ __pyx_v_extra = NULL;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":46
+ * cdef bint skip_file = exc
+ * cdef void* extra = NULL
+ * cdef int* extra_value = NULL # <<<<<<<<<<<<<<
+ * cdef int thread_index = -1
+ *
+ */
+ __pyx_v_extra_value = NULL;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":47
+ * cdef void* extra = NULL
+ * cdef int* extra_value = NULL
+ * cdef int thread_index = -1 # <<<<<<<<<<<<<<
+ *
+ * if is_use_code_extra is None or AVOID_RECURSION is None:
+ */
+ __pyx_v_thread_index = -1;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":49
+ * cdef int thread_index = -1
+ *
+ * if is_use_code_extra is None or AVOID_RECURSION is None: # <<<<<<<<<<<<<<
+ * # Sometimes during process shutdown these global variables become None
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_use_code_extra); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = (__pyx_t_2 == Py_None);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = (__pyx_t_4 != 0);
+ if (!__pyx_t_5) {
+ } else {
+ __pyx_t_3 = __pyx_t_5;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_AVOID_RECURSION); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = (__pyx_t_2 == Py_None);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = (__pyx_t_5 != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":51
+ * if is_use_code_extra is None or AVOID_RECURSION is None:
+ * # Sometimes during process shutdown these global variables become None
+ * return _PyEval_EvalFrameDefault(frame_obj, exc) # <<<<<<<<<<<<<<
+ *
+ * if is_use_code_extra():
+ */
+ __pyx_r = _PyEval_EvalFrameDefault(__pyx_v_frame_obj, __pyx_v_exc);
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":49
+ * cdef int thread_index = -1
+ *
+ * if is_use_code_extra is None or AVOID_RECURSION is None: # <<<<<<<<<<<<<<
+ * # Sometimes during process shutdown these global variables become None
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":53
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * if is_use_code_extra(): # <<<<<<<<<<<<<<
+ * extra = PyMem_Malloc(sizeof(int))
+ * try:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_use_code_extra); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 53, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":54
+ *
+ * if is_use_code_extra():
+ * extra = PyMem_Malloc(sizeof(int)) # <<<<<<<<<<<<<<
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index
+ */
+ __pyx_v_extra = PyMem_Malloc((sizeof(int)));
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":55
+ * if is_use_code_extra():
+ * extra = PyMem_Malloc(sizeof(int))
+ * try: # <<<<<<<<<<<<<<
+ * thread_index = UseCodeExtraHolder.local.index
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":56
+ * extra = PyMem_Malloc(sizeof(int))
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index # <<<<<<<<<<<<<<
+ * except:
+ * pass
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UseCodeExtraHolder); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L7_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_local); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L7_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L7_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 56, __pyx_L7_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_thread_index = __pyx_t_10;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":55
+ * if is_use_code_extra():
+ * extra = PyMem_Malloc(sizeof(int))
+ * try: # <<<<<<<<<<<<<<
+ * thread_index = UseCodeExtraHolder.local.index
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L14_try_end;
+ __pyx_L7_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":57
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index
+ * except: # <<<<<<<<<<<<<<
+ * pass
+ * if thread_index != -1:
+ */
+ /*except:*/ {
+ __Pyx_ErrRestore(0,0,0);
+ goto __pyx_L8_exception_handled;
+ }
+ __pyx_L8_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L14_try_end:;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":59
+ * except:
+ * pass
+ * if thread_index != -1: # <<<<<<<<<<<<<<
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ * if extra is not NULL:
+ */
+ __pyx_t_3 = ((__pyx_v_thread_index != -1L) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":60
+ * pass
+ * if thread_index != -1:
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra) # <<<<<<<<<<<<<<
+ * if extra is not NULL:
+ * extra_value = extra
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ _PyCode_GetExtra(((PyObject *)__pyx_t_2), __pyx_v_thread_index, (&__pyx_v_extra));
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":61
+ * if thread_index != -1:
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ * if extra is not NULL: # <<<<<<<<<<<<<<
+ * extra_value = extra
+ * if extra_value[0] == NO_BREAKS_IN_FRAME:
+ */
+ __pyx_t_3 = ((__pyx_v_extra != NULL) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":62
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ * if extra is not NULL:
+ * extra_value = extra # <<<<<<<<<<<<<<
+ * if extra_value[0] == NO_BREAKS_IN_FRAME:
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ */
+ __pyx_v_extra_value = ((int *)__pyx_v_extra);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":63
+ * if extra is not NULL:
+ * extra_value = extra
+ * if extra_value[0] == NO_BREAKS_IN_FRAME: # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_extra_value[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NO_BREAKS_IN_FRAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":64
+ * extra_value = extra
+ * if extra_value[0] == NO_BREAKS_IN_FRAME:
+ * return _PyEval_EvalFrameDefault(frame_obj, exc) # <<<<<<<<<<<<<<
+ *
+ * for file in AVOID_RECURSION:
+ */
+ __pyx_r = _PyEval_EvalFrameDefault(__pyx_v_frame_obj, __pyx_v_exc);
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":63
+ * if extra is not NULL:
+ * extra_value = extra
+ * if extra_value[0] == NO_BREAKS_IN_FRAME: # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":61
+ * if thread_index != -1:
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ * if extra is not NULL: # <<<<<<<<<<<<<<
+ * extra_value = extra
+ * if extra_value[0] == NO_BREAKS_IN_FRAME:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":59
+ * except:
+ * pass
+ * if thread_index != -1: # <<<<<<<<<<<<<<
+ * _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ * if extra is not NULL:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":53
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * if is_use_code_extra(): # <<<<<<<<<<<<<<
+ * extra = PyMem_Malloc(sizeof(int))
+ * try:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":66
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * for file in AVOID_RECURSION: # <<<<<<<<<<<<<<
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'):
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_AVOID_RECURSION); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
+ __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
+ } else {
+ __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 66, __pyx_L1_error)
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ for (;;) {
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ #endif
+ }
+ } else {
+ __pyx_t_6 = __pyx_t_12(__pyx_t_1);
+ if (unlikely(!__pyx_t_6)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 66, __pyx_L1_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ }
+ __Pyx_XDECREF_SET(__pyx_v_file, __pyx_t_6);
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":68
+ * for file in AVOID_RECURSION:
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'): # <<<<<<<<<<<<<<
+ * if filepath.endswith(path_separator + file):
+ * skip_file = True
+ */
+ __pyx_t_6 = __pyx_tuple__3; __Pyx_INCREF(__pyx_t_6); __pyx_t_13 = 0;
+ for (;;) {
+ if (__pyx_t_13 >= 2) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 68, __pyx_L1_error)
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ #endif
+ __Pyx_XDECREF_SET(__pyx_v_path_separator, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":69
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'):
+ * if filepath.endswith(path_separator + file): # <<<<<<<<<<<<<<
+ * skip_file = True
+ * break
+ */
+ if (unlikely(__pyx_v_filepath == Py_None)) {
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith");
+ __PYX_ERR(0, 69, __pyx_L1_error)
+ }
+ __pyx_t_2 = PyNumber_Add(__pyx_v_path_separator, __pyx_v_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyStr_Tailmatch(__pyx_v_filepath, __pyx_t_2, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if ((__pyx_t_3 != 0)) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":70
+ * for path_separator in ('/', '\\'):
+ * if filepath.endswith(path_separator + file):
+ * skip_file = True # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_skip_file = 1;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":71
+ * if filepath.endswith(path_separator + file):
+ * skip_file = True
+ * break # <<<<<<<<<<<<<<
+ *
+ * if not skip_file:
+ */
+ goto __pyx_L21_break;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":69
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'):
+ * if filepath.endswith(path_separator + file): # <<<<<<<<<<<<<<
+ * skip_file = True
+ * break
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":68
+ * for file in AVOID_RECURSION:
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'): # <<<<<<<<<<<<<<
+ * if filepath.endswith(path_separator + file):
+ * skip_file = True
+ */
+ }
+ __pyx_L21_break:;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":66
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * for file in AVOID_RECURSION: # <<<<<<<<<<<<<<
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'):
+ */
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":73
+ * break
+ *
+ * if not skip_file: # <<<<<<<<<<<<<<
+ * try:
+ * t = threading.currentThread()
+ */
+ __pyx_t_3 = ((!(__pyx_v_skip_file != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":74
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * t = threading.currentThread()
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_7);
+ /*try:*/ {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":75
+ * if not skip_file:
+ * try:
+ * t = threading.currentThread() # <<<<<<<<<<<<<<
+ * except:
+ * skip_file = True
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L24_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_currentThread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L24_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L24_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L24_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_t = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":74
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * t = threading.currentThread()
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L31_try_end;
+ __pyx_L24_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":76
+ * try:
+ * t = threading.currentThread()
+ * except: # <<<<<<<<<<<<<<
+ * skip_file = True
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.get_bytecode_while_frame_eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_6) < 0) __PYX_ERR(0, 76, __pyx_L26_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":77
+ * t = threading.currentThread()
+ * except:
+ * skip_file = True # <<<<<<<<<<<<<<
+ *
+ * if not skip_file:
+ */
+ __pyx_v_skip_file = 1;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L25_exception_handled;
+ }
+ __pyx_L26_except_error:;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":74
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * t = threading.currentThread()
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
+ goto __pyx_L1_error;
+ __pyx_L25_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
+ __pyx_L31_try_end:;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":73
+ * break
+ *
+ * if not skip_file: # <<<<<<<<<<<<<<
+ * try:
+ * t = threading.currentThread()
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":79
+ * skip_file = True
+ *
+ * if not skip_file: # <<<<<<<<<<<<<<
+ * try:
+ * additional_info = t.additional_info
+ */
+ __pyx_t_3 = ((!(__pyx_v_skip_file != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":80
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":81
+ * if not skip_file:
+ * try:
+ * additional_info = t.additional_info # <<<<<<<<<<<<<<
+ * if additional_info is None:
+ * raise AttributeError()
+ */
+ if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); __PYX_ERR(0, 81, __pyx_L35_error) }
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_additional_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L35_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_v_additional_info = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":82
+ * try:
+ * additional_info = t.additional_info
+ * if additional_info is None: # <<<<<<<<<<<<<<
+ * raise AttributeError()
+ * except:
+ */
+ __pyx_t_3 = (__pyx_v_additional_info == Py_None);
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":83
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ * raise AttributeError() # <<<<<<<<<<<<<<
+ * except:
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ */
+ __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_builtin_AttributeError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L35_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __PYX_ERR(0, 83, __pyx_L35_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":82
+ * try:
+ * additional_info = t.additional_info
+ * if additional_info is None: # <<<<<<<<<<<<<<
+ * raise AttributeError()
+ * except:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":80
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L42_try_end;
+ __pyx_L35_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":84
+ * if additional_info is None:
+ * raise AttributeError()
+ * except: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ * # request `co_extra` inside every new thread
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.get_bytecode_while_frame_eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 84, __pyx_L37_except_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":85
+ * raise AttributeError()
+ * except:
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo() # <<<<<<<<<<<<<<
+ * # request `co_extra` inside every new thread
+ * thread_index = _PyEval_RequestCodeExtraIndex(PyMem_Free)
+ */
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_PyDBAdditionalThreadInfo); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 85, __pyx_L37_except_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_16) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 85, __pyx_L37_except_error)
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ } else {
+ __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 85, __pyx_L37_except_error)
+ }
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_XDECREF_SET(__pyx_v_additional_info, __pyx_t_14);
+ if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); __PYX_ERR(0, 85, __pyx_L37_except_error) }
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_t, __pyx_n_s_additional_info, __pyx_t_14) < 0) __PYX_ERR(0, 85, __pyx_L37_except_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":87
+ * additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ * # request `co_extra` inside every new thread
+ * thread_index = _PyEval_RequestCodeExtraIndex(PyMem_Free) # <<<<<<<<<<<<<<
+ * UseCodeExtraHolder.local.index = thread_index
+ *
+ */
+ __pyx_v_thread_index = _PyEval_RequestCodeExtraIndex(PyMem_Free);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":88
+ * # request `co_extra` inside every new thread
+ * thread_index = _PyEval_RequestCodeExtraIndex(PyMem_Free)
+ * UseCodeExtraHolder.local.index = thread_index # <<<<<<<<<<<<<<
+ *
+ * if additional_info.is_tracing or getattr(t, 'pydev_do_not_trace', None):
+ */
+ __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_thread_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L37_except_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_UseCodeExtraHolder); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 88, __pyx_L37_except_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_local); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L37_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__Pyx_PyObject_SetAttrStr(__pyx_t_16, __pyx_n_s_index, __pyx_t_14) < 0) __PYX_ERR(0, 88, __pyx_L37_except_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L36_exception_handled;
+ }
+ __pyx_L37_except_error:;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":80
+ *
+ * if not skip_file:
+ * try: # <<<<<<<<<<<<<<
+ * additional_info = t.additional_info
+ * if additional_info is None:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L1_error;
+ __pyx_L36_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L42_try_end:;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":90
+ * UseCodeExtraHolder.local.index = thread_index
+ *
+ * if additional_info.is_tracing or getattr(t, 'pydev_do_not_trace', None): # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_additional_info, __pyx_n_s_is_tracing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!__pyx_t_3) {
+ } else {
+ __pyx_t_4 = __pyx_t_3;
+ goto __pyx_L47_bool_binop_done;
+ }
+ if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); __PYX_ERR(0, 90, __pyx_L1_error) }
+ __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_t, __pyx_n_s_pydev_do_not_trace, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = __pyx_t_3;
+ __pyx_L47_bool_binop_done:;
+ if (__pyx_t_4) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":91
+ *
+ * if additional_info.is_tracing or getattr(t, 'pydev_do_not_trace', None):
+ * return _PyEval_EvalFrameDefault(frame_obj, exc) # <<<<<<<<<<<<<<
+ *
+ * additional_info.is_tracing = True
+ */
+ __pyx_r = _PyEval_EvalFrameDefault(__pyx_v_frame_obj, __pyx_v_exc);
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":90
+ * UseCodeExtraHolder.local.index = thread_index
+ *
+ * if additional_info.is_tracing or getattr(t, 'pydev_do_not_trace', None): # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":93
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * additional_info.is_tracing = True # <<<<<<<<<<<<<<
+ * try:
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_additional_info, __pyx_n_s_is_tracing, Py_True) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":94
+ *
+ * additional_info.is_tracing = True
+ * try: # <<<<<<<<<<<<<<
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_7);
+ /*try:*/ {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":95
+ * additional_info.is_tracing = True
+ * try:
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename] # <<<<<<<<<<<<<<
+ * except:
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L49_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L49_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_co_filename); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 95, __pyx_L49_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L49_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_abs_path_real_path_and_base = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":94
+ *
+ * additional_info.is_tracing = True
+ * try: # <<<<<<<<<<<<<<
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L56_try_end;
+ __pyx_L49_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":96
+ * try:
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except: # <<<<<<<<<<<<<<
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ *
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.get_bytecode_while_frame_eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 96, __pyx_L51_except_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":97
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except:
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame) # <<<<<<<<<<<<<<
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_15 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_15)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_15);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (!__pyx_t_15) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_frame); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ {
+ __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_GOTREF(__pyx_t_17);
+ __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15); __pyx_t_15 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_frame);
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L51_except_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_abs_path_real_path_and_base, __pyx_t_16);
+ __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L50_exception_handled;
+ }
+ __pyx_L51_except_error:;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":94
+ *
+ * additional_info.is_tracing = True
+ * try: # <<<<<<<<<<<<<<
+ * abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ * except:
+ */
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
+ goto __pyx_L1_error;
+ __pyx_L50_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
+ __pyx_L56_try_end:;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":99
+ * abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd # <<<<<<<<<<<<<<
+ * if file_type is not None:
+ * additional_info.is_tracing = False
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_file_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_abs_path_real_path_and_base, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_16 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_16) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_2};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_2};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_16); __pyx_t_16 = NULL;
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_file_type = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":100
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd
+ * if file_type is not None: # <<<<<<<<<<<<<<
+ * additional_info.is_tracing = False
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ */
+ __pyx_t_4 = (__pyx_v_file_type != Py_None);
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":101
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd
+ * if file_type is not None:
+ * additional_info.is_tracing = False # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_additional_info, __pyx_n_s_is_tracing, Py_False) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":102
+ * if file_type is not None:
+ * additional_info.is_tracing = False
+ * return _PyEval_EvalFrameDefault(frame_obj, exc) # <<<<<<<<<<<<<<
+ *
+ * was_break = False
+ */
+ __pyx_r = _PyEval_EvalFrameDefault(__pyx_v_frame_obj, __pyx_v_exc);
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":100
+ *
+ * file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd
+ * if file_type is not None: # <<<<<<<<<<<<<<
+ * additional_info.is_tracing = False
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":104
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * was_break = False # <<<<<<<<<<<<<<
+ * main_debugger = get_global_debugger()
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ */
+ __pyx_v_was_break = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":105
+ *
+ * was_break = False
+ * main_debugger = get_global_debugger() # <<<<<<<<<<<<<<
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ * code_object = frame.f_code
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_global_debugger); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 105, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_14 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_14) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_main_debugger = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":106
+ * was_break = False
+ * main_debugger = get_global_debugger()
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1]) # <<<<<<<<<<<<<<
+ * code_object = frame.f_code
+ * if breakpoints:
+ */
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_breakpoints); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_abs_path_real_path_and_base, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_v_breakpoints = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":107
+ * main_debugger = get_global_debugger()
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ * code_object = frame.f_code # <<<<<<<<<<<<<<
+ * if breakpoints:
+ * breakpoints_to_update = []
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_code_object = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":108
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ * code_object = frame.f_code
+ * if breakpoints: # <<<<<<<<<<<<<<
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object):
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_breakpoints); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 108, __pyx_L1_error)
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":109
+ * code_object = frame.f_code
+ * if breakpoints:
+ * breakpoints_to_update = [] # <<<<<<<<<<<<<<
+ * for offset, line in dis.findlinestarts(code_object):
+ * if line in breakpoints:
+ */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_breakpoints_to_update = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":110
+ * if breakpoints:
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object): # <<<<<<<<<<<<<<
+ * if line in breakpoints:
+ * breakpoint = breakpoints[line]
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_dis); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_findlinestarts); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
+ }
+ }
+ if (!__pyx_t_14) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_v_code_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_16)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_code_object};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_code_object};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_14); __pyx_t_14 = NULL;
+ __Pyx_INCREF(__pyx_v_code_object);
+ __Pyx_GIVEREF(__pyx_v_code_object);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_code_object);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_16 = __pyx_t_1; __Pyx_INCREF(__pyx_t_16); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
+ } else {
+ __pyx_t_11 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_12 = Py_TYPE(__pyx_t_16)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 110, __pyx_L1_error)
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ for (;;) {
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_16))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_16)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_16, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_16)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_16, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ #endif
+ }
+ } else {
+ __pyx_t_1 = __pyx_t_12(__pyx_t_16);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 110, __pyx_L1_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ }
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 110, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_14);
+ #else
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_18 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ index = 0; __pyx_t_6 = __pyx_t_18(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L63_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ index = 1; __pyx_t_14 = __pyx_t_18(__pyx_t_2); if (unlikely(!__pyx_t_14)) goto __pyx_L63_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_14);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_2), 2) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
+ __pyx_t_18 = NULL;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L64_unpacking_done;
+ __pyx_L63_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_18 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 110, __pyx_L1_error)
+ __pyx_L64_unpacking_done:;
+ }
+ __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_14);
+ __pyx_t_14 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":111
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object):
+ * if line in breakpoints: # <<<<<<<<<<<<<<
+ * breakpoint = breakpoints[line]
+ * if code_object not in breakpoint.code_objects:
+ */
+ __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_line, __pyx_v_breakpoints, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":112
+ * for offset, line in dis.findlinestarts(code_object):
+ * if line in breakpoints:
+ * breakpoint = breakpoints[line] # <<<<<<<<<<<<<<
+ * if code_object not in breakpoint.code_objects:
+ * # This check is needed for generator functions, because after each yield the new frame is created
+ */
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_breakpoints, __pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_breakpoint, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":113
+ * if line in breakpoints:
+ * breakpoint = breakpoints[line]
+ * if code_object not in breakpoint.code_objects: # <<<<<<<<<<<<<<
+ * # This check is needed for generator functions, because after each yield the new frame is created
+ * # but the former code object is used
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_breakpoint, __pyx_n_s_code_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_code_object, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":116
+ * # This check is needed for generator functions, because after each yield the new frame is created
+ * # but the former code object is used
+ * success, new_code = insert_code(frame.f_code, pydev_trace_code_wrapper.__code__, line) # <<<<<<<<<<<<<<
+ * if success:
+ * breakpoints_to_update.append(breakpoint)
+ */
+ __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_insert_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydev_trace_code_wrapper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_code); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_17);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_6, __pyx_t_17, __pyx_v_line};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_6, __pyx_t_17, __pyx_v_line};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_15 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ if (__pyx_t_2) {
+ __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL;
+ }
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_10, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_17);
+ PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_10, __pyx_t_17);
+ __Pyx_INCREF(__pyx_v_line);
+ __Pyx_GIVEREF(__pyx_v_line);
+ PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_10, __pyx_v_line);
+ __pyx_t_6 = 0;
+ __pyx_t_17 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
+ #if !CYTHON_COMPILING_IN_PYPY
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 116, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_14 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_15 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_15);
+ #else
+ __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_17 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 116, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_17);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_18 = Py_TYPE(__pyx_t_17)->tp_iternext;
+ index = 0; __pyx_t_14 = __pyx_t_18(__pyx_t_17); if (unlikely(!__pyx_t_14)) goto __pyx_L67_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_14);
+ index = 1; __pyx_t_15 = __pyx_t_18(__pyx_t_17); if (unlikely(!__pyx_t_15)) goto __pyx_L67_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_15);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_17), 2) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
+ __pyx_t_18 = NULL;
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ goto __pyx_L68_unpacking_done;
+ __pyx_L67_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __pyx_t_18 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ __PYX_ERR(0, 116, __pyx_L1_error)
+ __pyx_L68_unpacking_done:;
+ }
+ __Pyx_XDECREF_SET(__pyx_v_success, __pyx_t_14);
+ __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_new_code, __pyx_t_15);
+ __pyx_t_15 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":117
+ * # but the former code object is used
+ * success, new_code = insert_code(frame.f_code, pydev_trace_code_wrapper.__code__, line)
+ * if success: # <<<<<<<<<<<<<<
+ * breakpoints_to_update.append(breakpoint)
+ * Py_INCREF(new_code)
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_success); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 117, __pyx_L1_error)
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":118
+ * success, new_code = insert_code(frame.f_code, pydev_trace_code_wrapper.__code__, line)
+ * if success:
+ * breakpoints_to_update.append(breakpoint) # <<<<<<<<<<<<<<
+ * Py_INCREF(new_code)
+ * frame_obj.f_code = new_code
+ */
+ __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_breakpoints_to_update, __pyx_v_breakpoint); if (unlikely(__pyx_t_19 == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":119
+ * if success:
+ * breakpoints_to_update.append(breakpoint)
+ * Py_INCREF(new_code) # <<<<<<<<<<<<<<
+ * frame_obj.f_code = new_code
+ * was_break = True
+ */
+ Py_INCREF(__pyx_v_new_code);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":120
+ * breakpoints_to_update.append(breakpoint)
+ * Py_INCREF(new_code)
+ * frame_obj.f_code = new_code # <<<<<<<<<<<<<<
+ * was_break = True
+ * else:
+ */
+ __pyx_v_frame_obj->f_code = ((PyCodeObject *)__pyx_v_new_code);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":121
+ * Py_INCREF(new_code)
+ * frame_obj.f_code = new_code
+ * was_break = True # <<<<<<<<<<<<<<
+ * else:
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ */
+ __pyx_v_was_break = 1;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":117
+ * # but the former code object is used
+ * success, new_code = insert_code(frame.f_code, pydev_trace_code_wrapper.__code__, line)
+ * if success: # <<<<<<<<<<<<<<
+ * breakpoints_to_update.append(breakpoint)
+ * Py_INCREF(new_code)
+ */
+ goto __pyx_L69;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":123
+ * was_break = True
+ * else:
+ * main_debugger.set_trace_for_frame_and_parents(frame) # <<<<<<<<<<<<<<
+ * was_break = False
+ * break
+ */
+ /*else*/ {
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_set_trace_for_frame_and_parents); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_14 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_14) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_frame};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_frame};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else
+ #endif
+ {
+ __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_17);
+ __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14); __pyx_t_14 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_frame);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":124
+ * else:
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ * was_break = False # <<<<<<<<<<<<<<
+ * break
+ * if was_break:
+ */
+ __pyx_v_was_break = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":125
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ * was_break = False
+ * break # <<<<<<<<<<<<<<
+ * if was_break:
+ * update_globals_dict(frame.f_globals)
+ */
+ goto __pyx_L62_break;
+ }
+ __pyx_L69:;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":113
+ * if line in breakpoints:
+ * breakpoint = breakpoints[line]
+ * if code_object not in breakpoint.code_objects: # <<<<<<<<<<<<<<
+ * # This check is needed for generator functions, because after each yield the new frame is created
+ * # but the former code object is used
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":111
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object):
+ * if line in breakpoints: # <<<<<<<<<<<<<<
+ * breakpoint = breakpoints[line]
+ * if code_object not in breakpoint.code_objects:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":110
+ * if breakpoints:
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object): # <<<<<<<<<<<<<<
+ * if line in breakpoints:
+ * breakpoint = breakpoints[line]
+ */
+ }
+ __pyx_L62_break:;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":126
+ * was_break = False
+ * break
+ * if was_break: # <<<<<<<<<<<<<<
+ * update_globals_dict(frame.f_globals)
+ * for bp in breakpoints_to_update:
+ */
+ __pyx_t_3 = (__pyx_v_was_break != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":127
+ * break
+ * if was_break:
+ * update_globals_dict(frame.f_globals) # <<<<<<<<<<<<<<
+ * for bp in breakpoints_to_update:
+ * bp.code_objects.add(frame.f_code)
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_update_globals_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_globals); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_17 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_17)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_17);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_17) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_15};
+ __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_15};
+ __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_17); __pyx_t_17 = NULL;
+ __Pyx_GIVEREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":128
+ * if was_break:
+ * update_globals_dict(frame.f_globals)
+ * for bp in breakpoints_to_update: # <<<<<<<<<<<<<<
+ * bp.code_objects.add(frame.f_code)
+ * else:
+ */
+ __pyx_t_16 = __pyx_v_breakpoints_to_update; __Pyx_INCREF(__pyx_t_16); __pyx_t_11 = 0;
+ for (;;) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_16)) break;
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_16, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ #endif
+ __Pyx_XDECREF_SET(__pyx_v_bp, __pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":129
+ * update_globals_dict(frame.f_globals)
+ * for bp in breakpoints_to_update:
+ * bp.code_objects.add(frame.f_code) # <<<<<<<<<<<<<<
+ * else:
+ * if main_debugger.has_plugin_line_breaks:
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_bp, __pyx_n_s_code_objects); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_add); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_17 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_17)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_17);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_17) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_14};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_14};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_17); __pyx_t_17 = NULL;
+ __Pyx_GIVEREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_14);
+ __pyx_t_14 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":128
+ * if was_break:
+ * update_globals_dict(frame.f_globals)
+ * for bp in breakpoints_to_update: # <<<<<<<<<<<<<<
+ * bp.code_objects.add(frame.f_code)
+ * else:
+ */
+ }
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":126
+ * was_break = False
+ * break
+ * if was_break: # <<<<<<<<<<<<<<
+ * update_globals_dict(frame.f_globals)
+ * for bp in breakpoints_to_update:
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":108
+ * breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ * code_object = frame.f_code
+ * if breakpoints: # <<<<<<<<<<<<<<
+ * breakpoints_to_update = []
+ * for offset, line in dis.findlinestarts(code_object):
+ */
+ goto __pyx_L60;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":131
+ * bp.code_objects.add(frame.f_code)
+ * else:
+ * if main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ * if can_not_skip:
+ */
+ /*else*/ {
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_has_plugin_line_breaks); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 131, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 131, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":132
+ * else:
+ * if main_debugger.has_plugin_line_breaks:
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame) # <<<<<<<<<<<<<<
+ * if can_not_skip:
+ * was_break = True
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_plugin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_can_not_skip); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_main_debugger, Py_None, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_main_debugger, Py_None, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_1) {
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_main_debugger);
+ __Pyx_GIVEREF(__pyx_v_main_debugger);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_v_main_debugger);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, Py_None);
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_10, __pyx_v_frame);
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_6, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_v_can_not_skip = __pyx_t_16;
+ __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":133
+ * if main_debugger.has_plugin_line_breaks:
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ * if can_not_skip: # <<<<<<<<<<<<<<
+ * was_break = True
+ * main_debugger.SetTrace(main_debugger.trace_dispatch)
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_can_not_skip); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 133, __pyx_L1_error)
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":134
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ * if can_not_skip:
+ * was_break = True # <<<<<<<<<<<<<<
+ * main_debugger.SetTrace(main_debugger.trace_dispatch)
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ */
+ __pyx_v_was_break = 1;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":135
+ * if can_not_skip:
+ * was_break = True
+ * main_debugger.SetTrace(main_debugger.trace_dispatch) # <<<<<<<<<<<<<<
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ *
+ */
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_SetTrace); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_trace_dispatch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
+ __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
+ __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1); __pyx_t_1 = NULL;
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":136
+ * was_break = True
+ * main_debugger.SetTrace(main_debugger.trace_dispatch)
+ * main_debugger.set_trace_for_frame_and_parents(frame) # <<<<<<<<<<<<<<
+ *
+ * if not was_break:
+ */
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_debugger, __pyx_n_s_set_trace_for_frame_and_parents); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_14 = NULL;
+ if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_14) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_frame); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_frame};
+ __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else
+ #endif
+ {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_14); __pyx_t_14 = NULL;
+ __Pyx_INCREF(__pyx_v_frame);
+ __Pyx_GIVEREF(__pyx_v_frame);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_frame);
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_6, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 136, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":133
+ * if main_debugger.has_plugin_line_breaks:
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ * if can_not_skip: # <<<<<<<<<<<<<<
+ * was_break = True
+ * main_debugger.SetTrace(main_debugger.trace_dispatch)
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":131
+ * bp.code_objects.add(frame.f_code)
+ * else:
+ * if main_debugger.has_plugin_line_breaks: # <<<<<<<<<<<<<<
+ * can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ * if can_not_skip:
+ */
+ }
+ }
+ __pyx_L60:;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":138
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ *
+ * if not was_break: # <<<<<<<<<<<<<<
+ * extra_value = PyMem_Malloc(sizeof(int))
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ */
+ __pyx_t_3 = ((!(__pyx_v_was_break != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":139
+ *
+ * if not was_break:
+ * extra_value = PyMem_Malloc(sizeof(int)) # <<<<<<<<<<<<<<
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ * try:
+ */
+ __pyx_v_extra_value = ((int *)PyMem_Malloc((sizeof(int))));
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":140
+ * if not was_break:
+ * extra_value = PyMem_Malloc(sizeof(int))
+ * extra_value[0] = NO_BREAKS_IN_FRAME # <<<<<<<<<<<<<<
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index
+ */
+ __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_NO_BREAKS_IN_FRAME); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ (__pyx_v_extra_value[0]) = __pyx_t_10;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":141
+ * extra_value = PyMem_Malloc(sizeof(int))
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ * try: # <<<<<<<<<<<<<<
+ * thread_index = UseCodeExtraHolder.local.index
+ * except:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":142
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index # <<<<<<<<<<<<<<
+ * except:
+ * pass
+ */
+ __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_UseCodeExtraHolder); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 142, __pyx_L76_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_local); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 142, __pyx_L76_error)
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_index); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 142, __pyx_L76_error)
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L76_error)
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_v_thread_index = __pyx_t_10;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":141
+ * extra_value = PyMem_Malloc(sizeof(int))
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ * try: # <<<<<<<<<<<<<<
+ * thread_index = UseCodeExtraHolder.local.index
+ * except:
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L83_try_end;
+ __pyx_L76_error:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":143
+ * try:
+ * thread_index = UseCodeExtraHolder.local.index
+ * except: # <<<<<<<<<<<<<<
+ * pass
+ * if thread_index != -1:
+ */
+ /*except:*/ {
+ __Pyx_ErrRestore(0,0,0);
+ goto __pyx_L77_exception_handled;
+ }
+ __pyx_L77_exception_handled:;
+ __Pyx_PyThreadState_assign
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L83_try_end:;
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":145
+ * except:
+ * pass
+ * if thread_index != -1: # <<<<<<<<<<<<<<
+ * _PyCode_SetExtra( code_object, thread_index, extra_value)
+ *
+ */
+ __pyx_t_3 = ((__pyx_v_thread_index != -1L) != 0);
+ if (__pyx_t_3) {
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":146
+ * pass
+ * if thread_index != -1:
+ * _PyCode_SetExtra( code_object, thread_index, extra_value) # <<<<<<<<<<<<<<
+ *
+ * additional_info.is_tracing = False
+ */
+ _PyCode_SetExtra(((PyObject *)__pyx_v_code_object), __pyx_v_thread_index, __pyx_v_extra_value);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":145
+ * except:
+ * pass
+ * if thread_index != -1: # <<<<<<<<<<<<<<
+ * _PyCode_SetExtra( code_object, thread_index, extra_value)
+ *
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":138
+ * main_debugger.set_trace_for_frame_and_parents(frame)
+ *
+ * if not was_break: # <<<<<<<<<<<<<<
+ * extra_value = PyMem_Malloc(sizeof(int))
+ * extra_value[0] = NO_BREAKS_IN_FRAME
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":148
+ * _PyCode_SetExtra( code_object, thread_index, extra_value)
+ *
+ * additional_info.is_tracing = False # <<<<<<<<<<<<<<
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ */
+ if (__Pyx_PyObject_SetAttrStr(__pyx_v_additional_info, __pyx_n_s_is_tracing, Py_False) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":79
+ * skip_file = True
+ *
+ * if not skip_file: # <<<<<<<<<<<<<<
+ * try:
+ * additional_info = t.additional_info
+ */
+ }
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":149
+ *
+ * additional_info.is_tracing = False
+ * return _PyEval_EvalFrameDefault(frame_obj, exc) # <<<<<<<<<<<<<<
+ *
+ * def frame_eval_func():
+ */
+ __pyx_r = _PyEval_EvalFrameDefault(__pyx_v_frame_obj, __pyx_v_exc);
+ goto __pyx_L0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":41
+ *
+ *
+ * cdef PyObject* get_bytecode_while_frame_eval(PyFrameObject *frame_obj, int exc): # <<<<<<<<<<<<<<
+ * frame = frame_obj
+ * cdef str filepath = frame.f_code.co_filename
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_XDECREF(__pyx_t_17);
+ __Pyx_WriteUnraisable("_pydevd_frame_eval.pydevd_frame_evaluator.get_bytecode_while_frame_eval", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_frame);
+ __Pyx_XDECREF(__pyx_v_filepath);
+ __Pyx_XDECREF(__pyx_v_file);
+ __Pyx_XDECREF(__pyx_v_path_separator);
+ __Pyx_XDECREF(__pyx_v_t);
+ __Pyx_XDECREF(__pyx_v_additional_info);
+ __Pyx_XDECREF(__pyx_v_abs_path_real_path_and_base);
+ __Pyx_XDECREF(__pyx_v_file_type);
+ __Pyx_XDECREF(__pyx_v_main_debugger);
+ __Pyx_XDECREF(__pyx_v_breakpoints);
+ __Pyx_XDECREF(__pyx_v_code_object);
+ __Pyx_XDECREF(__pyx_v_breakpoints_to_update);
+ __Pyx_XDECREF(__pyx_v_offset);
+ __Pyx_XDECREF(__pyx_v_line);
+ __Pyx_XDECREF(__pyx_v_breakpoint);
+ __Pyx_XDECREF(__pyx_v_success);
+ __Pyx_XDECREF(__pyx_v_new_code);
+ __Pyx_XDECREF(__pyx_v_bp);
+ __Pyx_XDECREF(__pyx_v_can_not_skip);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":151
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * def frame_eval_func(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_7frame_eval_func(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_7frame_eval_func = {"frame_eval_func", (PyCFunction)__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_7frame_eval_func, METH_NOARGS, 0};
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_7frame_eval_func(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("frame_eval_func (wrapper)", 0);
+ __pyx_r = __pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_6frame_eval_func(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_6frame_eval_func(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyThreadState *__pyx_v_state;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ __Pyx_RefNannySetupContext("frame_eval_func", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":152
+ *
+ * def frame_eval_func():
+ * cdef PyThreadState *state = PyThreadState_Get() # <<<<<<<<<<<<<<
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ * global dummy_tracing_holder
+ */
+ __pyx_v_state = PyThreadState_Get();
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":153
+ * def frame_eval_func():
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = get_bytecode_while_frame_eval # <<<<<<<<<<<<<<
+ * global dummy_tracing_holder
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+ */
+ __pyx_v_state->interp->eval_frame = __pyx_f_18_pydevd_frame_eval_22pydevd_frame_evaluator_get_bytecode_while_frame_eval;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":155
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ * global dummy_tracing_holder
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch) # <<<<<<<<<<<<<<
+ *
+ * def stop_frame_eval():
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dummy_tracing_holder); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_trace_func); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dummy_trace_dispatch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ #if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else
+ #endif
+ #if CYTHON_FAST_PYCCALL
+ if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
+ PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else
+ #endif
+ {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":151
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * def frame_eval_func(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_pydevd_frame_eval.pydevd_frame_evaluator.frame_eval_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":157
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+ *
+ * def stop_frame_eval(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_9stop_frame_eval(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_9stop_frame_eval = {"stop_frame_eval", (PyCFunction)__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_9stop_frame_eval, METH_NOARGS, 0};
+static PyObject *__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_9stop_frame_eval(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("stop_frame_eval (wrapper)", 0);
+ __pyx_r = __pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_8stop_frame_eval(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_18_pydevd_frame_eval_22pydevd_frame_evaluator_8stop_frame_eval(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyThreadState *__pyx_v_state;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("stop_frame_eval", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":158
+ *
+ * def stop_frame_eval():
+ * cdef PyThreadState *state = PyThreadState_Get() # <<<<<<<<<<<<<<
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault
+ */
+ __pyx_v_state = PyThreadState_Get();
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":159
+ * def stop_frame_eval():
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault # <<<<<<<<<<<<<<
+ */
+ __pyx_v_state->interp->eval_frame = _PyEval_EvalFrameDefault;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":157
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+ *
+ * def stop_frame_eval(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {"dummy_trace_dispatch", (PyCFunction)__pyx_pw_18_pydevd_frame_eval_22pydevd_frame_evaluator_5dummy_trace_dispatch, METH_VARARGS|METH_KEYWORDS, 0},
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "pydevd_frame_evaluator",
+ 0, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
+ {&__pyx_n_s_AVOID_RECURSION, __pyx_k_AVOID_RECURSION, sizeof(__pyx_k_AVOID_RECURSION), 0, 0, 1, 1},
+ {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
+ {&__pyx_n_s_DONT_TRACE, __pyx_k_DONT_TRACE, sizeof(__pyx_k_DONT_TRACE), 0, 0, 1, 1},
+ {&__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER, __pyx_k_NORM_PATHS_AND_BASE_CONTAINER, sizeof(__pyx_k_NORM_PATHS_AND_BASE_CONTAINER), 0, 0, 1, 1},
+ {&__pyx_n_s_NO_BREAKS_IN_FRAME, __pyx_k_NO_BREAKS_IN_FRAME, sizeof(__pyx_k_NO_BREAKS_IN_FRAME), 0, 0, 1, 1},
+ {&__pyx_n_s_PyDBAdditionalThreadInfo, __pyx_k_PyDBAdditionalThreadInfo, sizeof(__pyx_k_PyDBAdditionalThreadInfo), 0, 0, 1, 1},
+ {&__pyx_n_s_SetTrace, __pyx_k_SetTrace, sizeof(__pyx_k_SetTrace), 0, 0, 1, 1},
+ {&__pyx_n_s_UseCodeExtraHolder, __pyx_k_UseCodeExtraHolder, sizeof(__pyx_k_UseCodeExtraHolder), 0, 0, 1, 1},
+ {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
+ {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
+ {&__pyx_n_s_additional_info, __pyx_k_additional_info, sizeof(__pyx_k_additional_info), 0, 0, 1, 1},
+ {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
+ {&__pyx_n_s_breakpoints, __pyx_k_breakpoints, sizeof(__pyx_k_breakpoints), 0, 0, 1, 1},
+ {&__pyx_n_s_can_not_skip, __pyx_k_can_not_skip, sizeof(__pyx_k_can_not_skip), 0, 0, 1, 1},
+ {&__pyx_n_s_co_filename, __pyx_k_co_filename, sizeof(__pyx_k_co_filename), 0, 0, 1, 1},
+ {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
+ {&__pyx_n_s_code_objects, __pyx_k_code_objects, sizeof(__pyx_k_code_objects), 0, 0, 1, 1},
+ {&__pyx_n_s_currentThread, __pyx_k_currentThread, sizeof(__pyx_k_currentThread), 0, 0, 1, 1},
+ {&__pyx_n_s_dis, __pyx_k_dis, sizeof(__pyx_k_dis), 0, 0, 1, 1},
+ {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
+ {&__pyx_n_s_dummy_trace_dispatch, __pyx_k_dummy_trace_dispatch, sizeof(__pyx_k_dummy_trace_dispatch), 0, 0, 1, 1},
+ {&__pyx_n_s_dummy_tracing_holder, __pyx_k_dummy_tracing_holder, sizeof(__pyx_k_dummy_tracing_holder), 0, 0, 1, 1},
+ {&__pyx_n_s_enable_cache_frames_without_brea, __pyx_k_enable_cache_frames_without_brea, sizeof(__pyx_k_enable_cache_frames_without_brea), 0, 0, 1, 1},
+ {&__pyx_n_s_event, __pyx_k_event, sizeof(__pyx_k_event), 0, 0, 1, 1},
+ {&__pyx_n_s_f_code, __pyx_k_f_code, sizeof(__pyx_k_f_code), 0, 0, 1, 1},
+ {&__pyx_n_s_f_globals, __pyx_k_f_globals, sizeof(__pyx_k_f_globals), 0, 0, 1, 1},
+ {&__pyx_n_s_findlinestarts, __pyx_k_findlinestarts, sizeof(__pyx_k_findlinestarts), 0, 0, 1, 1},
+ {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_frame_eval_func, __pyx_k_frame_eval_func, sizeof(__pyx_k_frame_eval_func), 0, 0, 1, 1},
+ {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
+ {&__pyx_n_s_get_abs_path_real_path_and_base, __pyx_k_get_abs_path_real_path_and_base, sizeof(__pyx_k_get_abs_path_real_path_and_base), 0, 0, 1, 1},
+ {&__pyx_n_s_get_file_type, __pyx_k_get_file_type, sizeof(__pyx_k_get_file_type), 0, 0, 1, 1},
+ {&__pyx_n_s_get_global_debugger, __pyx_k_get_global_debugger, sizeof(__pyx_k_get_global_debugger), 0, 0, 1, 1},
+ {&__pyx_n_s_has_plugin_line_breaks, __pyx_k_has_plugin_line_breaks, sizeof(__pyx_k_has_plugin_line_breaks), 0, 0, 1, 1},
+ {&__pyx_kp_s_home_user_work_PyDev_Debugger, __pyx_k_home_user_work_PyDev_Debugger, sizeof(__pyx_k_home_user_work_PyDev_Debugger), 0, 0, 1, 0},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
+ {&__pyx_n_s_insert_code, __pyx_k_insert_code, sizeof(__pyx_k_insert_code), 0, 0, 1, 1},
+ {&__pyx_n_s_is_tracing, __pyx_k_is_tracing, sizeof(__pyx_k_is_tracing), 0, 0, 1, 1},
+ {&__pyx_n_s_is_use_code_extra, __pyx_k_is_use_code_extra, sizeof(__pyx_k_is_use_code_extra), 0, 0, 1, 1},
+ {&__pyx_n_s_local, __pyx_k_local, sizeof(__pyx_k_local), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
+ {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
+ {&__pyx_n_s_new_value, __pyx_k_new_value, sizeof(__pyx_k_new_value), 0, 0, 1, 1},
+ {&__pyx_n_s_plugin, __pyx_k_plugin, sizeof(__pyx_k_plugin), 0, 0, 1, 1},
+ {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_do_not_trace, __pyx_k_pydev_do_not_trace, sizeof(__pyx_k_pydev_do_not_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_imps__pydev_saved_modules, __pyx_k_pydev_imps__pydev_saved_modules, sizeof(__pyx_k_pydev_imps__pydev_saved_modules), 0, 0, 1, 1},
+ {&__pyx_n_s_pydev_trace_code_wrapper, __pyx_k_pydev_trace_code_wrapper, sizeof(__pyx_k_pydev_trace_code_wrapper), 0, 0, 1, 1},
+ {&__pyx_kp_s_pydevd_additional_thread_info_re, __pyx_k_pydevd_additional_thread_info_re, sizeof(__pyx_k_pydevd_additional_thread_info_re), 0, 0, 1, 0},
+ {&__pyx_n_s_pydevd_bundle_pydevd_additional, __pyx_k_pydevd_bundle_pydevd_additional, sizeof(__pyx_k_pydevd_bundle_pydevd_additional), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_comm, __pyx_k_pydevd_bundle_pydevd_comm, sizeof(__pyx_k_pydevd_bundle_pydevd_comm), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_bundle_pydevd_dont_trace, __pyx_k_pydevd_bundle_pydevd_dont_trace, sizeof(__pyx_k_pydevd_bundle_pydevd_dont_trace), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_file_utils, __pyx_k_pydevd_file_utils, sizeof(__pyx_k_pydevd_file_utils), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_frame_eval_pydevd_frame, __pyx_k_pydevd_frame_eval_pydevd_frame, sizeof(__pyx_k_pydevd_frame_eval_pydevd_frame), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_frame_eval_pydevd_frame_2, __pyx_k_pydevd_frame_eval_pydevd_frame_2, sizeof(__pyx_k_pydevd_frame_eval_pydevd_frame_2), 0, 0, 1, 1},
+ {&__pyx_n_s_pydevd_frame_eval_pydevd_modify, __pyx_k_pydevd_frame_eval_pydevd_modify, sizeof(__pyx_k_pydevd_frame_eval_pydevd_modify), 0, 0, 1, 1},
+ {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
+ {&__pyx_n_s_set_trace_for_frame_and_parents, __pyx_k_set_trace_for_frame_and_parents, sizeof(__pyx_k_set_trace_for_frame_and_parents), 0, 0, 1, 1},
+ {&__pyx_n_s_set_trace_func, __pyx_k_set_trace_func, sizeof(__pyx_k_set_trace_func), 0, 0, 1, 1},
+ {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
+ {&__pyx_n_s_stop_frame_eval, __pyx_k_stop_frame_eval, sizeof(__pyx_k_stop_frame_eval), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
+ {&__pyx_kp_s_threading_py, __pyx_k_threading_py, sizeof(__pyx_k_threading_py), 0, 0, 1, 0},
+ {&__pyx_n_s_trace_dispatch, __pyx_k_trace_dispatch, sizeof(__pyx_k_trace_dispatch), 0, 0, 1, 1},
+ {&__pyx_n_s_update_globals_dict, __pyx_k_update_globals_dict, sizeof(__pyx_k_update_globals_dict), 0, 0, 1, 1},
+ {&__pyx_n_s_use_code_extra, __pyx_k_use_code_extra, sizeof(__pyx_k_use_code_extra), 0, 0, 1, 1},
+ {&__pyx_kp_s_weakrefset_py, __pyx_k_weakrefset_py, sizeof(__pyx_k_weakrefset_py), 0, 0, 1, 0},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 83, __pyx_L1_error)
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":68
+ * for file in AVOID_RECURSION:
+ * # we can't call any other function without this check, because we can get stack overflow
+ * for path_separator in ('/', '\\'): # <<<<<<<<<<<<<<
+ * if filepath.endswith(path_separator + file):
+ * skip_file = True
+ */
+ __pyx_tuple__3 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 68, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":28
+ *
+ *
+ * def is_use_code_extra(): # <<<<<<<<<<<<<<
+ * return UseCodeExtraHolder.use_code_extra
+ *
+ */
+ __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_user_work_PyDev_Debugger, __pyx_n_s_is_use_code_extra, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 28, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":33
+ *
+ * # enable using `co_extra` field in order to cache frames without breakpoints
+ * def enable_cache_frames_without_breaks(new_value): # <<<<<<<<<<<<<<
+ * UseCodeExtraHolder.use_code_extra = new_value
+ *
+ */
+ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_new_value); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 33, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
+ __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_user_work_PyDev_Debugger, __pyx_n_s_enable_cache_frames_without_brea, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 33, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":151
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * def frame_eval_func(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ */
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_state); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 151, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
+ __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_user_work_PyDev_Debugger, __pyx_n_s_frame_eval_func, 151, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 151, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":157
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+ *
+ * def stop_frame_eval(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault
+ */
+ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_state); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 157, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_tuple__9);
+ __Pyx_GIVEREF(__pyx_tuple__9);
+ __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_user_work_PyDev_Debugger, __pyx_n_s_stop_frame_eval, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 157, __pyx_L1_error)
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initpydevd_frame_evaluator(void); /*proto*/
+PyMODINIT_FUNC initpydevd_frame_evaluator(void)
+#else
+PyMODINIT_FUNC PyInit_pydevd_frame_evaluator(void); /*proto*/
+PyMODINIT_FUNC PyInit_pydevd_frame_evaluator(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pydevd_frame_evaluator(void)", 0);
+ if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
+ #ifdef __Pyx_CyFunction_USED
+ if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_Coroutine_USED
+ if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ #ifdef __Pyx_StopAsyncIteration_USED
+ if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("pydevd_frame_evaluator", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
+ /*--- Initialize various global constants etc. ---*/
+ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+ if (__pyx_module_is_main__pydevd_frame_eval__pydevd_frame_evaluator) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
+ if (!PyDict_GetItemString(modules, "_pydevd_frame_eval.pydevd_frame_evaluator")) {
+ if (unlikely(PyDict_SetItemString(modules, "_pydevd_frame_eval.pydevd_frame_evaluator", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ /*--- Constants init code ---*/
+ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
+ if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ #endif
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":1
+ * import dis # <<<<<<<<<<<<<<
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_dis, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_dis, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":2
+ * import dis
+ * from _pydev_imps._pydev_saved_modules import threading # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ * from _pydevd_bundle.pydevd_comm import get_global_debugger
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_threading);
+ __Pyx_GIVEREF(__pyx_n_s_threading);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_threading);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydev_imps__pydev_saved_modules, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":3
+ * import dis
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_comm import get_global_debugger
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_PyDBAdditionalThreadInfo);
+ __Pyx_GIVEREF(__pyx_n_s_PyDBAdditionalThreadInfo);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PyDBAdditionalThreadInfo);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_additional, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PyDBAdditionalThreadInfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyDBAdditionalThreadInfo, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":4
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ * from _pydevd_bundle.pydevd_comm import get_global_debugger # <<<<<<<<<<<<<<
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_get_global_debugger);
+ __Pyx_GIVEREF(__pyx_n_s_get_global_debugger);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_global_debugger);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_comm, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_global_debugger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_global_debugger, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":5
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ * from _pydevd_bundle.pydevd_comm import get_global_debugger
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE # <<<<<<<<<<<<<<
+ * from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder
+ * from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_DONT_TRACE);
+ __Pyx_GIVEREF(__pyx_n_s_DONT_TRACE);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DONT_TRACE);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_pydevd_bundle_pydevd_dont_trace, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DONT_TRACE, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":6
+ * from _pydevd_bundle.pydevd_comm import get_global_debugger
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder # <<<<<<<<<<<<<<
+ * from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ */
+ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_pydev_trace_code_wrapper);
+ __Pyx_GIVEREF(__pyx_n_s_pydev_trace_code_wrapper);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_pydev_trace_code_wrapper);
+ __Pyx_INCREF(__pyx_n_s_update_globals_dict);
+ __Pyx_GIVEREF(__pyx_n_s_update_globals_dict);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_update_globals_dict);
+ __Pyx_INCREF(__pyx_n_s_dummy_tracing_holder);
+ __Pyx_GIVEREF(__pyx_n_s_dummy_tracing_holder);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_dummy_tracing_holder);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_frame_eval_pydevd_frame, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_pydev_trace_code_wrapper); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydev_trace_code_wrapper, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_update_globals_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_globals_dict, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dummy_tracing_holder); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_dummy_tracing_holder, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":7
+ * from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+ * from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder
+ * from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code # <<<<<<<<<<<<<<
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ *
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_insert_code);
+ __Pyx_GIVEREF(__pyx_n_s_insert_code);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_insert_code);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_pydevd_frame_eval_pydevd_modify, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_insert_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_insert_code, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":8
+ * from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder
+ * from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER # <<<<<<<<<<<<<<
+ *
+ * AVOID_RECURSION = [
+ */
+ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ __Pyx_GIVEREF(__pyx_n_s_get_abs_path_real_path_and_base);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_abs_path_real_path_and_base);
+ __Pyx_INCREF(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ __Pyx_GIVEREF(__pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pydevd_file_utils, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_abs_path_real_path_and_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_abs_path_real_path_and_base, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_NORM_PATHS_AND_BASE_CONTAINER, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":10
+ * from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+ *
+ * AVOID_RECURSION = [ # <<<<<<<<<<<<<<
+ * 'pydevd_additional_thread_info_regular.py',
+ * 'threading.py',
+ */
+ __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_kp_s_pydevd_additional_thread_info_re);
+ __Pyx_GIVEREF(__pyx_kp_s_pydevd_additional_thread_info_re);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_pydevd_additional_thread_info_re);
+ __Pyx_INCREF(__pyx_kp_s_threading_py);
+ __Pyx_GIVEREF(__pyx_kp_s_threading_py);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_threading_py);
+ __Pyx_INCREF(__pyx_kp_s_weakrefset_py);
+ __Pyx_GIVEREF(__pyx_kp_s_weakrefset_py);
+ PyList_SET_ITEM(__pyx_t_2, 2, __pyx_kp_s_weakrefset_py);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_AVOID_RECURSION, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":16
+ * ]
+ *
+ * get_file_type = DONT_TRACE.get # <<<<<<<<<<<<<<
+ * NO_BREAKS_IN_FRAME = 1
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DONT_TRACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_file_type, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":17
+ *
+ * get_file_type = DONT_TRACE.get
+ * NO_BREAKS_IN_FRAME = 1 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_BREAKS_IN_FRAME, __pyx_int_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":20
+ *
+ *
+ * class UseCodeExtraHolder: # <<<<<<<<<<<<<<
+ * # Use this flag in order to disable co_extra field
+ * use_code_extra = True
+ */
+ __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_UseCodeExtraHolder, __pyx_n_s_UseCodeExtraHolder, (PyObject *) NULL, __pyx_n_s_pydevd_frame_eval_pydevd_frame_2, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":22
+ * class UseCodeExtraHolder:
+ * # Use this flag in order to disable co_extra field
+ * use_code_extra = True # <<<<<<<<<<<<<<
+ * # Keep the index of co_extra in a thread-local storage
+ * local = threading.local()
+ */
+ if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_use_code_extra, Py_True) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":24
+ * use_code_extra = True
+ * # Keep the index of co_extra in a thread-local storage
+ * local = threading.local() # <<<<<<<<<<<<<<
+ * local.index = -1
+ *
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_local); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_local, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":25
+ * # Keep the index of co_extra in a thread-local storage
+ * local = threading.local()
+ * local.index = -1 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_local);
+ if (unlikely(!__pyx_t_2)) {
+ PyErr_Clear();
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_local);
+ }
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_n_s_index, __pyx_int_neg_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":20
+ *
+ *
+ * class UseCodeExtraHolder: # <<<<<<<<<<<<<<
+ * # Use this flag in order to disable co_extra field
+ * use_code_extra = True
+ */
+ __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_UseCodeExtraHolder, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_UseCodeExtraHolder, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":28
+ *
+ *
+ * def is_use_code_extra(): # <<<<<<<<<<<<<<
+ * return UseCodeExtraHolder.use_code_extra
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_1is_use_code_extra, NULL, __pyx_n_s_pydevd_frame_eval_pydevd_frame_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_use_code_extra, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":33
+ *
+ * # enable using `co_extra` field in order to cache frames without breakpoints
+ * def enable_cache_frames_without_breaks(new_value): # <<<<<<<<<<<<<<
+ * UseCodeExtraHolder.use_code_extra = new_value
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_3enable_cache_frames_without_breaks, NULL, __pyx_n_s_pydevd_frame_eval_pydevd_frame_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_enable_cache_frames_without_brea, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":151
+ * return _PyEval_EvalFrameDefault(frame_obj, exc)
+ *
+ * def frame_eval_func(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = get_bytecode_while_frame_eval
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_7frame_eval_func, NULL, __pyx_n_s_pydevd_frame_eval_pydevd_frame_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_frame_eval_func, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":157
+ * dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+ *
+ * def stop_frame_eval(): # <<<<<<<<<<<<<<
+ * cdef PyThreadState *state = PyThreadState_Get()
+ * state.interp.eval_frame = _PyEval_EvalFrameDefault
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_18_pydevd_frame_eval_22pydevd_frame_evaluator_9stop_frame_eval, NULL, __pyx_n_s_pydevd_frame_eval_pydevd_frame_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_stop_frame_eval, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "_pydevd_frame_eval/pydevd_frame_evaluator.pyx":1
+ * import dis # <<<<<<<<<<<<<<
+ * from _pydev_imps._pydev_saved_modules import threading
+ * from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init _pydevd_frame_eval.pydevd_frame_evaluator", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init _pydevd_frame_eval.pydevd_frame_evaluator");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+/* Refnanny */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+/* GetBuiltinName */
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+/* GetModuleGlobalName */
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if !CYTHON_AVOID_BORROWED_REFS
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+/* RaiseArgTupleInvalid */
+ static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+/* RaiseDoubleKeywords */
+ static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+/* ParseKeywords */
+ static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+/* ArgTypeTest */
+ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact)
+{
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (none_allowed && obj == Py_None) return 1;
+ else if (exact) {
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
+ }
+ else {
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
+ }
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
+ return 0;
+}
+
+/* PyCFunctionFastCall */
+ #if CYTHON_FAST_PYCCALL
+static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
+ PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
+ PyCFunction meth = PyCFunction_GET_FUNCTION(func);
+ PyObject *self = PyCFunction_GET_SELF(func);
+ assert(PyCFunction_Check(func));
+ assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
+ assert(nargs >= 0);
+ assert(nargs == 0 || args != NULL);
+ /* _PyCFunction_FastCallDict() must not be called with an exception set,
+ because it may clear it (directly or indirectly) and so the
+ caller loses its exception */
+ assert(!PyErr_Occurred());
+ return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
+}
+#endif // CYTHON_FAST_PYCCALL
+
+/* PyFunctionFastCall */
+ #if CYTHON_FAST_PYCALL
+#include "frameobject.h"
+static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
+ PyObject *globals) {
+ PyFrameObject *f;
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject **fastlocals;
+ Py_ssize_t i;
+ PyObject *result;
+ assert(globals != NULL);
+ /* XXX Perhaps we should create a specialized
+ PyFrame_New() that doesn't take locals, but does
+ take builtins without sanity checking them.
+ */
+ assert(tstate != NULL);
+ f = PyFrame_New(tstate, co, globals, NULL);
+ if (f == NULL) {
+ return NULL;
+ }
+ fastlocals = f->f_localsplus;
+ for (i = 0; i < na; i++) {
+ Py_INCREF(*args);
+ fastlocals[i] = *args++;
+ }
+ result = PyEval_EvalFrameEx(f,0);
+ ++tstate->recursion_depth;
+ Py_DECREF(f);
+ --tstate->recursion_depth;
+ return result;
+}
+#if 1 || PY_VERSION_HEX < 0x030600B1
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
+ PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
+ PyObject *globals = PyFunction_GET_GLOBALS(func);
+ PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
+ PyObject *closure;
+#if PY_MAJOR_VERSION >= 3
+ PyObject *kwdefs;
+#endif
+ PyObject *kwtuple, **k;
+ PyObject **d;
+ Py_ssize_t nd;
+ Py_ssize_t nk;
+ PyObject *result;
+ assert(kwargs == NULL || PyDict_Check(kwargs));
+ nk = kwargs ? PyDict_Size(kwargs) : 0;
+ if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
+ return NULL;
+ }
+ if (
+#if PY_MAJOR_VERSION >= 3
+ co->co_kwonlyargcount == 0 &&
+#endif
+ likely(kwargs == NULL || nk == 0) &&
+ co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
+ if (argdefs == NULL && co->co_argcount == nargs) {
+ result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
+ goto done;
+ }
+ else if (nargs == 0 && argdefs != NULL
+ && co->co_argcount == Py_SIZE(argdefs)) {
+ /* function called with no arguments, but all parameters have
+ a default value: use default values as arguments .*/
+ args = &PyTuple_GET_ITEM(argdefs, 0);
+ result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
+ goto done;
+ }
+ }
+ if (kwargs != NULL) {
+ Py_ssize_t pos, i;
+ kwtuple = PyTuple_New(2 * nk);
+ if (kwtuple == NULL) {
+ result = NULL;
+ goto done;
+ }
+ k = &PyTuple_GET_ITEM(kwtuple, 0);
+ pos = i = 0;
+ while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
+ Py_INCREF(k[i]);
+ Py_INCREF(k[i+1]);
+ i += 2;
+ }
+ nk = i / 2;
+ }
+ else {
+ kwtuple = NULL;
+ k = NULL;
+ }
+ closure = PyFunction_GET_CLOSURE(func);
+#if PY_MAJOR_VERSION >= 3
+ kwdefs = PyFunction_GET_KW_DEFAULTS(func);
+#endif
+ if (argdefs != NULL) {
+ d = &PyTuple_GET_ITEM(argdefs, 0);
+ nd = Py_SIZE(argdefs);
+ }
+ else {
+ d = NULL;
+ nd = 0;
+ }
+#if PY_MAJOR_VERSION >= 3
+ result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
+ args, nargs,
+ k, (int)nk,
+ d, (int)nd, kwdefs, closure);
+#else
+ result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
+ args, nargs,
+ k, (int)nk,
+ d, (int)nd, closure);
+#endif
+ Py_XDECREF(kwtuple);
+done:
+ Py_LeaveRecursiveCall();
+ return result;
+}
+#endif // CPython < 3.6
+#endif // CYTHON_FAST_PYCALL
+
+/* PyObjectCall */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+/* PyObjectCallMethO */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+/* PyObjectCallOneArg */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(func)) {
+ return __Pyx_PyFunction_FastCall(func, &arg, 1);
+ }
+#endif
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+#if CYTHON_FAST_PYCCALL
+ } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
+ return __Pyx_PyCFunction_FastCall(func, &arg, 1);
+#endif
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_Pack(1, arg);
+ if (unlikely(!args)) return NULL;
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+#endif
+
+/* PyObjectCallNoArg */
+ #if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#if CYTHON_FAST_PYCALL
+ if (PyFunction_Check(func)) {
+ return __Pyx_PyFunction_FastCall(func, NULL, 0);
+ }
+#endif
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+/* SaveResetException */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+}
+static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+}
+#endif
+
+/* PyErrFetchRestore */
+ #if CYTHON_FAST_THREAD_STATE
+static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+}
+static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+}
+#endif
+
+/* bytes_tailmatch */
+ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
+ Py_ssize_t start, Py_ssize_t end, int direction) {
+ const char* self_ptr = PyBytes_AS_STRING(self);
+ Py_ssize_t self_len = PyBytes_GET_SIZE(self);
+ const char* sub_ptr;
+ Py_ssize_t sub_len;
+ int retval;
+ Py_buffer view;
+ view.obj = NULL;
+ if ( PyBytes_Check(arg) ) {
+ sub_ptr = PyBytes_AS_STRING(arg);
+ sub_len = PyBytes_GET_SIZE(arg);
+ }
+#if PY_MAJOR_VERSION < 3
+ else if ( PyUnicode_Check(arg) ) {
+ return (int) PyUnicode_Tailmatch(self, arg, start, end, direction);
+ }
+#endif
+ else {
+ if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
+ return -1;
+ sub_ptr = (const char*) view.buf;
+ sub_len = view.len;
+ }
+ if (end > self_len)
+ end = self_len;
+ else if (end < 0)
+ end += self_len;
+ if (end < 0)
+ end = 0;
+ if (start < 0)
+ start += self_len;
+ if (start < 0)
+ start = 0;
+ if (direction > 0) {
+ if (end-sub_len > start)
+ start = end - sub_len;
+ }
+ if (start + sub_len <= end)
+ retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
+ else
+ retval = 0;
+ if (view.obj)
+ PyBuffer_Release(&view);
+ return retval;
+}
+static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
+ Py_ssize_t start, Py_ssize_t end, int direction) {
+ if (unlikely(PyTuple_Check(substr))) {
+ Py_ssize_t i, count = PyTuple_GET_SIZE(substr);
+ for (i = 0; i < count; i++) {
+ int result;
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i),
+ start, end, direction);
+#else
+ PyObject* sub = PySequence_ITEM(substr, i);
+ if (unlikely(!sub)) return -1;
+ result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction);
+ Py_DECREF(sub);
+#endif
+ if (result) {
+ return result;
+ }
+ }
+ return 0;
+ }
+ return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
+}
+
+/* unicode_tailmatch */
+ static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
+ Py_ssize_t start, Py_ssize_t end, int direction) {
+ if (unlikely(PyTuple_Check(substr))) {
+ Py_ssize_t i, count = PyTuple_GET_SIZE(substr);
+ for (i = 0; i < count; i++) {
+ Py_ssize_t result;
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i),
+ start, end, direction);
+#else
+ PyObject* sub = PySequence_ITEM(substr, i);
+ if (unlikely(!sub)) return -1;
+ result = PyUnicode_Tailmatch(s, sub, start, end, direction);
+ Py_DECREF(sub);
+#endif
+ if (result) {
+ return (int) result;
+ }
+ }
+ return 0;
+ }
+ return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
+}
+
+/* str_tailmatch */
+ static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
+ Py_ssize_t end, int direction)
+{
+ if (PY_MAJOR_VERSION < 3)
+ return __Pyx_PyBytes_Tailmatch(self, arg, start, end, direction);
+ else
+ return __Pyx_PyUnicode_Tailmatch(self, arg, start, end, direction);
+}
+
+/* GetException */
+ #if CYTHON_FAST_THREAD_STATE
+static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
+#else
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+#endif
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_FAST_THREAD_STATE
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_FAST_THREAD_STATE
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_FAST_THREAD_STATE
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+/* None */
+ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
+ PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
+}
+
+/* RaiseException */
+ #if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ __Pyx_PyThreadState_declare
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_PyThreadState_assign
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ int is_subclass = PyObject_IsSubclass(instance_class, type);
+ if (!is_subclass) {
+ instance_class = NULL;
+ } else if (unlikely(is_subclass == -1)) {
+ goto bad;
+ } else {
+ type = instance_class;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+/* GetAttr */
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+ if (likely(PyUnicode_Check(n)))
+#else
+ if (likely(PyString_Check(n)))
+#endif
+ return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+ return PyObject_GetAttr(o, n);
+}
+
+/* GetAttr3 */
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
+ PyObject *r = __Pyx_GetAttr(o, n);
+ if (unlikely(!r)) {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+ goto bad;
+ PyErr_Clear();
+ r = d;
+ Py_INCREF(d);
+ }
+ return r;
+bad:
+ return NULL;
+}
+
+/* GetItemInt */
+ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
+ CYTHON_NCP_UNUSED int wraparound,
+ CYTHON_NCP_UNUSED int boundscheck) {
+#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
+ if (is_list || PyList_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+ if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+ PyObject *r = PyList_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ else if (PyTuple_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ } else {
+ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+ if (likely(m && m->sq_item)) {
+ if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (likely(l >= 0)) {
+ i += l;
+ } else {
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return NULL;
+ PyErr_Clear();
+ }
+ }
+ return m->sq_item(o, i);
+ }
+ }
+#else
+ if (is_list || PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+/* RaiseTooManyValuesToUnpack */
+ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+ PyErr_Format(PyExc_ValueError,
+ "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
+}
+
+/* RaiseNeedMoreValuesToUnpack */
+ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+ PyErr_Format(PyExc_ValueError,
+ "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
+ index, (index == 1) ? "" : "s");
+}
+
+/* IterFinish */
+ static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_FAST_THREAD_STATE
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* exc_type = tstate->curexc_type;
+ if (unlikely(exc_type)) {
+ if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+ PyObject *exc_value, *exc_tb;
+ exc_value = tstate->curexc_value;
+ exc_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+ Py_DECREF(exc_type);
+ Py_XDECREF(exc_value);
+ Py_XDECREF(exc_tb);
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#else
+ if (unlikely(PyErr_Occurred())) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+ PyErr_Clear();
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#endif
+}
+
+/* UnpackItemEndCheck */
+ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
+ if (unlikely(retval)) {
+ Py_DECREF(retval);
+ __Pyx_RaiseTooManyValuesError(expected);
+ return -1;
+ } else {
+ return __Pyx_IterFinish();
+ }
+ return 0;
+}
+
+/* WriteUnraisableException */
+ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback, CYTHON_UNUSED int nogil) {
+ PyObject *old_exc, *old_val, *old_tb;
+ PyObject *ctx;
+ __Pyx_PyThreadState_declare
+#ifdef WITH_THREAD
+ PyGILState_STATE state;
+ if (nogil)
+ state = PyGILState_Ensure();
+#ifdef _MSC_VER
+ else state = (PyGILState_STATE)-1;
+#endif
+#endif
+ __Pyx_PyThreadState_assign
+ __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+#ifdef WITH_THREAD
+ if (nogil)
+ PyGILState_Release(state);
+#endif
+}
+
+/* Import */
+ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+/* ImportFrom */
+ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+/* CalculateMetaclass */
+ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
+ Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
+ for (i=0; i < nbases; i++) {
+ PyTypeObject *tmptype;
+ PyObject *tmp = PyTuple_GET_ITEM(bases, i);
+ tmptype = Py_TYPE(tmp);
+#if PY_MAJOR_VERSION < 3
+ if (tmptype == &PyClass_Type)
+ continue;
+#endif
+ if (!metaclass) {
+ metaclass = tmptype;
+ continue;
+ }
+ if (PyType_IsSubtype(metaclass, tmptype))
+ continue;
+ if (PyType_IsSubtype(tmptype, metaclass)) {
+ metaclass = tmptype;
+ continue;
+ }
+ PyErr_SetString(PyExc_TypeError,
+ "metaclass conflict: "
+ "the metaclass of a derived class "
+ "must be a (non-strict) subclass "
+ "of the metaclasses of all its bases");
+ return NULL;
+ }
+ if (!metaclass) {
+#if PY_MAJOR_VERSION < 3
+ metaclass = &PyClass_Type;
+#else
+ metaclass = &PyType_Type;
+#endif
+ }
+ Py_INCREF((PyObject*) metaclass);
+ return (PyObject*) metaclass;
+}
+
+/* Py3ClassCreate */
+ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
+ PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
+ PyObject *ns;
+ if (metaclass) {
+ PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
+ if (prep) {
+ PyObject *pargs = PyTuple_Pack(2, name, bases);
+ if (unlikely(!pargs)) {
+ Py_DECREF(prep);
+ return NULL;
+ }
+ ns = PyObject_Call(prep, pargs, mkw);
+ Py_DECREF(prep);
+ Py_DECREF(pargs);
+ } else {
+ if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
+ return NULL;
+ PyErr_Clear();
+ ns = PyDict_New();
+ }
+ } else {
+ ns = PyDict_New();
+ }
+ if (unlikely(!ns))
+ return NULL;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
+ if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
+ return ns;
+bad:
+ Py_DECREF(ns);
+ return NULL;
+}
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
+ PyObject *dict, PyObject *mkw,
+ int calculate_metaclass, int allow_py2_metaclass) {
+ PyObject *result, *margs;
+ PyObject *owned_metaclass = NULL;
+ if (allow_py2_metaclass) {
+ owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
+ if (owned_metaclass) {
+ metaclass = owned_metaclass;
+ } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
+ PyErr_Clear();
+ } else {
+ return NULL;
+ }
+ }
+ if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
+ metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
+ Py_XDECREF(owned_metaclass);
+ if (unlikely(!metaclass))
+ return NULL;
+ owned_metaclass = metaclass;
+ }
+ margs = PyTuple_Pack(3, name, bases, dict);
+ if (unlikely(!margs)) {
+ result = NULL;
+ } else {
+ result = PyObject_Call(metaclass, margs, mkw);
+ Py_DECREF(margs);
+ }
+ Py_XDECREF(owned_metaclass);
+ return result;
+}
+
+/* CodeObjectCache */
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = start + (end - start) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+/* AddTraceback */
+ #include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+/* CIntFromPyVerify */
+ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
+#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
+#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
+ {\
+ func_type value = func_value;\
+ if (sizeof(target_type) < sizeof(func_type)) {\
+ if (unlikely(value != (func_type) (target_type) value)) {\
+ func_type zero = 0;\
+ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
+ return (target_type) -1;\
+ if (is_unsigned && unlikely(value < zero))\
+ goto raise_neg_overflow;\
+ else\
+ goto raise_overflow;\
+ }\
+ }\
+ return (target_type) value;\
+ }
+
+/* CIntToPy */
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = (int) 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+/* CIntToPy */
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = (long) 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+/* CIntFromPy */
+ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = (int) 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (int) 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
+ case 2:
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
+ }
+ }
+ break;
+ }
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+#else
+ {
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
+ if (unlikely(result < 0))
+ return (int) -1;
+ if (unlikely(result == 1))
+ goto raise_neg_overflow;
+ }
+#endif
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
+#endif
+ }
+ } else {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (int) 0;
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
+ case -2:
+ if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 2:
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case -3:
+ if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case -4:
+ if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
+ }
+ }
+ break;
+ }
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
+#endif
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+/* CIntFromPy */
+ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = (long) 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (long) 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
+ case 2:
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
+ }
+ }
+ break;
+ }
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+#else
+ {
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
+ if (unlikely(result < 0))
+ return (long) -1;
+ if (unlikely(result == 1))
+ goto raise_neg_overflow;
+ }
+#endif
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
+#endif
+ }
+ } else {
+#if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
+ switch (Py_SIZE(x)) {
+ case 0: return (long) 0;
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
+ case -2:
+ if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 2:
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case -3:
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 3:
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case -4:
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ case 4:
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
+ }
+ }
+ break;
+ }
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
+#ifdef HAVE_LONG_LONG
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
+#endif
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+/* CheckBinaryVersion */
+ static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+/* InitStrings */
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
+#if CYTHON_USE_TYPE_SLOTS
+ PyNumberMethods *m;
+#endif
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return __Pyx_NewRef(x);
+#if CYTHON_USE_TYPE_SLOTS
+ m = Py_TYPE(x)->tp_as_number;
+ #if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+ #else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+ #endif
+#else
+ res = PyNumber_Int(x);
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b))) {
+ if (sizeof(Py_ssize_t) >= sizeof(long))
+ return PyInt_AS_LONG(b);
+ else
+ return PyInt_AsSsize_t(x);
+ }
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_USE_PYLONG_INTERNALS
+ const digit* digits = ((PyLongObject*)b)->ob_digit;
+ const Py_ssize_t size = Py_SIZE(b);
+ if (likely(__Pyx_sst_abs(size) <= 1)) {
+ ival = likely(size) ? digits[0] : 0;
+ if (size == -1) ival = -ival;
+ return ival;
+ } else {
+ switch (size) {
+ case 2:
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -2:
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case 3:
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -3:
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case 4:
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
+ return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ case -4:
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
+ return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
+ }
+ break;
+ }
+ }
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd
new file mode 100644
index 00000000..2bf8b2d6
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd
@@ -0,0 +1,99 @@
+from cpython.mem cimport PyMem_Malloc, PyMem_Free
+
+cdef extern from *:
+ ctypedef void PyObject
+ ctypedef struct PyCodeObject:
+ int co_argcount; # arguments, except *args */
+ int co_kwonlyargcount; # keyword only arguments */
+ int co_nlocals; # local variables */
+ int co_stacksize; # entries needed for evaluation stack */
+ int co_flags; # CO_..., see below */
+ int co_firstlineno; # first source line number */
+ PyObject *co_code; # instruction opcodes */
+ PyObject *co_consts; # list (constants used) */
+ PyObject *co_names; # list of strings (names used) */
+ PyObject *co_varnames; # tuple of strings (local variable names) */
+ PyObject *co_freevars; # tuple of strings (free variable names) */
+ PyObject *co_cellvars; # tuple of strings (cell variable names) */
+ unsigned char *co_cell2arg; # Maps cell vars which are arguments. */
+ PyObject *co_filename; # unicode (where it was loaded from) */
+ PyObject *co_name; # unicode (name, for reference) */
+ PyObject *co_lnotab; # string (encoding addr<->lineno mapping) See
+ # Objects/lnotab_notes.txt for details. */
+ void *co_zombieframe; # for optimization only (see frameobject.c) */
+ PyObject *co_weakreflist; # to support weakrefs to code objects */
+ void *co_extra;
+
+cdef extern from "frameobject.h":
+ ctypedef struct PyFrameObject:
+ PyCodeObject *f_code # code segment
+ PyObject *f_builtins # builtin symbol table (PyDictObject)
+ PyObject *f_globals # global symbol table (PyDictObject) */
+ PyObject *f_locals # local symbol table (any mapping) */
+ PyObject **f_valuestack #
+ PyObject **f_stacktop
+ PyObject *f_trace # Trace function */
+ PyObject *f_exc_type
+ PyObject *f_exc_value
+ PyObject *f_exc_traceback
+ PyObject *f_gen;
+
+ int f_lasti; #/* Last instruction if called */
+ int f_lineno; #/* Current line number */
+ int f_iblock; #/* index in f_blockstack */
+ char f_executing; #/* whether the frame is still executing */
+ PyObject *f_localsplus[1];
+
+cdef extern from "code.h":
+ ctypedef void freefunc(void *)
+ int _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
+ int _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
+
+cdef extern from "Python.h":
+ void Py_INCREF(object o)
+ void Py_DECREF(object o)
+ object PyImport_ImportModule(char *name)
+ PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
+ object PyObject_GetAttrString(object o, char *attr_name)
+
+cdef extern from "pystate.h":
+ ctypedef PyObject* _PyFrameEvalFunction(PyFrameObject *frame, int exc)
+
+ ctypedef struct PyInterpreterState:
+ PyInterpreterState *next
+ PyInterpreterState *tstate_head
+
+ PyObject *modules
+
+ PyObject *modules_by_index
+ PyObject *sysdict
+ PyObject *builtins
+ PyObject *importlib
+
+ PyObject *codec_search_path
+ PyObject *codec_search_cache
+ PyObject *codec_error_registry
+ int codecs_initialized
+ int fscodec_initialized
+
+ int dlopenflags
+
+ PyObject *builtins_copy
+ PyObject *import_func
+ # Initialized to PyEval_EvalFrameDefault().
+ _PyFrameEvalFunction eval_frame
+
+ ctypedef struct PyThreadState:
+ PyThreadState *prev
+ PyThreadState *next
+ PyInterpreterState *interp
+ # ...
+
+ PyThreadState *PyThreadState_Get()
+
+cdef extern from "ceval.h":
+ int _PyEval_RequestCodeExtraIndex(freefunc)
+ PyFrameObject *PyEval_GetFrame()
+ PyObject* PyEval_CallFunction(PyObject *callable, const char *format, ...)
+
+ PyObject* _PyEval_EvalFrameDefault(PyFrameObject *frame, int exc)
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx
new file mode 100644
index 00000000..2bc0dcf0
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx
@@ -0,0 +1,159 @@
+import dis
+from _pydev_imps._pydev_saved_modules import threading
+from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+from _pydevd_bundle.pydevd_comm import get_global_debugger
+from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
+from _pydevd_frame_eval.pydevd_frame_tracing import pydev_trace_code_wrapper, update_globals_dict, dummy_tracing_holder
+from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+
+AVOID_RECURSION = [
+ 'pydevd_additional_thread_info_regular.py',
+ 'threading.py',
+ '_weakrefset.py'
+]
+
+get_file_type = DONT_TRACE.get
+NO_BREAKS_IN_FRAME = 1
+
+
+class UseCodeExtraHolder:
+ # Use this flag in order to disable co_extra field
+ use_code_extra = True
+ # Keep the index of co_extra in a thread-local storage
+ local = threading.local()
+ local.index = -1
+
+
+def is_use_code_extra():
+ return UseCodeExtraHolder.use_code_extra
+
+
+# enable using `co_extra` field in order to cache frames without breakpoints
+def enable_cache_frames_without_breaks(new_value):
+ UseCodeExtraHolder.use_code_extra = new_value
+
+
+cpdef dummy_trace_dispatch(frame, str event, arg):
+ return None
+
+
+cdef PyObject* get_bytecode_while_frame_eval(PyFrameObject *frame_obj, int exc):
+ frame = frame_obj
+ cdef str filepath = frame.f_code.co_filename
+ cdef bint skip_file = exc
+ cdef void* extra = NULL
+ cdef int* extra_value = NULL
+ cdef int thread_index = -1
+
+ if is_use_code_extra is None or AVOID_RECURSION is None:
+ # Sometimes during process shutdown these global variables become None
+ return _PyEval_EvalFrameDefault(frame_obj, exc)
+
+ if is_use_code_extra():
+ extra = PyMem_Malloc(sizeof(int))
+ try:
+ thread_index = UseCodeExtraHolder.local.index
+ except:
+ pass
+ if thread_index != -1:
+ _PyCode_GetExtra( frame.f_code, thread_index, &extra)
+ if extra is not NULL:
+ extra_value = extra
+ if extra_value[0] == NO_BREAKS_IN_FRAME:
+ return _PyEval_EvalFrameDefault(frame_obj, exc)
+
+ for file in AVOID_RECURSION:
+ # we can't call any other function without this check, because we can get stack overflow
+ for path_separator in ('/', '\\'):
+ if filepath.endswith(path_separator + file):
+ skip_file = True
+ break
+
+ if not skip_file:
+ try:
+ t = threading.currentThread()
+ except:
+ skip_file = True
+
+ if not skip_file:
+ try:
+ additional_info = t.additional_info
+ if additional_info is None:
+ raise AttributeError()
+ except:
+ additional_info = t.additional_info = PyDBAdditionalThreadInfo()
+ # request `co_extra` inside every new thread
+ thread_index = _PyEval_RequestCodeExtraIndex(PyMem_Free)
+ UseCodeExtraHolder.local.index = thread_index
+
+ if additional_info.is_tracing or getattr(t, 'pydev_do_not_trace', None):
+ return _PyEval_EvalFrameDefault(frame_obj, exc)
+
+ additional_info.is_tracing = True
+ try:
+ abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ except:
+ abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+
+ file_type = get_file_type(abs_path_real_path_and_base[-1]) #we don't want to debug anything related to pydevd
+ if file_type is not None:
+ additional_info.is_tracing = False
+ return _PyEval_EvalFrameDefault(frame_obj, exc)
+
+ was_break = False
+ main_debugger = get_global_debugger()
+ breakpoints = main_debugger.breakpoints.get(abs_path_real_path_and_base[1])
+ code_object = frame.f_code
+ if breakpoints:
+ breakpoints_to_update = []
+ for offset, line in dis.findlinestarts(code_object):
+ if line in breakpoints:
+ breakpoint = breakpoints[line]
+ if code_object not in breakpoint.code_objects:
+ # This check is needed for generator functions, because after each yield the new frame is created
+ # but the former code object is used
+ success, new_code = insert_code(frame.f_code, pydev_trace_code_wrapper.__code__, line)
+ if success:
+ breakpoints_to_update.append(breakpoint)
+ Py_INCREF(new_code)
+ frame_obj.f_code = new_code
+ was_break = True
+ else:
+ main_debugger.set_trace_for_frame_and_parents(frame)
+ was_break = False
+ break
+ if was_break:
+ update_globals_dict(frame.f_globals)
+ for bp in breakpoints_to_update:
+ bp.code_objects.add(frame.f_code)
+ else:
+ if main_debugger.has_plugin_line_breaks:
+ can_not_skip = main_debugger.plugin.can_not_skip(main_debugger, None, frame)
+ if can_not_skip:
+ was_break = True
+ main_debugger.SetTrace(main_debugger.trace_dispatch)
+ main_debugger.set_trace_for_frame_and_parents(frame)
+
+ if not was_break:
+ extra_value = PyMem_Malloc(sizeof(int))
+ extra_value[0] = NO_BREAKS_IN_FRAME
+ try:
+ thread_index = UseCodeExtraHolder.local.index
+ except:
+ pass
+ if thread_index != -1:
+ _PyCode_SetExtra( code_object, thread_index, extra_value)
+
+ additional_info.is_tracing = False
+ return _PyEval_EvalFrameDefault(frame_obj, exc)
+
+def frame_eval_func():
+ cdef PyThreadState *state = PyThreadState_Get()
+ state.interp.eval_frame = get_bytecode_while_frame_eval
+ global dummy_tracing_holder
+ dummy_tracing_holder.set_trace_func(dummy_trace_dispatch)
+
+def stop_frame_eval():
+ cdef PyThreadState *state = PyThreadState_Get()
+ state.interp.eval_frame = _PyEval_EvalFrameDefault
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py
new file mode 100644
index 00000000..c58f71cb
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py
@@ -0,0 +1,86 @@
+import sys
+
+from _pydev_bundle import pydev_log
+from _pydev_imps._pydev_saved_modules import threading
+from _pydevd_bundle.pydevd_comm import get_global_debugger, CMD_SET_BREAK
+from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
+from _pydevd_bundle.pydevd_frame import handle_breakpoint_condition, handle_breakpoint_expression
+
+
+class DummyTracingHolder:
+ dummy_trace_func = None
+
+ def set_trace_func(self, trace_func):
+ self.dummy_trace_func = trace_func
+
+
+dummy_tracing_holder = DummyTracingHolder()
+
+
+def update_globals_dict(globals_dict):
+ new_globals = {'_pydev_stop_at_break': _pydev_stop_at_break}
+ globals_dict.update(new_globals)
+
+
+def handle_breakpoint(frame, thread, global_debugger, breakpoint):
+ # ok, hit breakpoint, now, we have to discover if it is a conditional breakpoint
+ new_frame = frame
+ condition = breakpoint.condition
+ info = thread.additional_info
+ if condition is not None:
+ handle_breakpoint_condition(global_debugger, info, breakpoint, new_frame, False)
+
+ if breakpoint.expression is not None:
+ handle_breakpoint_expression(breakpoint, info, new_frame)
+
+ if breakpoint.suspend_policy == "ALL":
+ global_debugger.suspend_all_other_threads(thread)
+
+ return True
+
+
+def _get_line_for_frame(frame):
+ # it's absolutely necessary to reset tracing function for frame in order to get the real line number
+ tracing_func = frame.f_trace
+ frame.f_trace = None
+ line = frame.f_lineno
+ frame.f_trace = tracing_func
+ return line
+
+
+def _pydev_stop_at_break():
+ frame = sys._getframe(1)
+ t = threading.currentThread()
+ if t.additional_info.is_tracing:
+ return
+
+ if t.additional_info.pydev_step_cmd == -1 and frame.f_trace in (None, dummy_tracing_holder.dummy_trace_func):
+ # do not handle breakpoints while stepping, because they're handled by old tracing function
+ t.additional_info.is_tracing = True
+ debugger = get_global_debugger()
+
+ try:
+ abs_path_real_path_and_base = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
+ except:
+ abs_path_real_path_and_base = get_abs_path_real_path_and_base_from_frame(frame)
+ filename = abs_path_real_path_and_base[1]
+
+ breakpoints_for_file = debugger.breakpoints.get(filename)
+ line = _get_line_for_frame(frame)
+ try:
+ breakpoint = breakpoints_for_file[line]
+ except KeyError:
+ pydev_log.debug("Couldn't find breakpoint in the file {} on line {}".format(frame.f_code.co_filename, line))
+ return
+ if breakpoint and handle_breakpoint(frame, t, debugger, breakpoint):
+ pydev_log.debug("Suspending at breakpoint in file: {} on line {}".format(frame.f_code.co_filename, line))
+ debugger.set_suspend(t, CMD_SET_BREAK)
+ debugger.do_wait_suspend(t, frame, 'line', None, "frame_eval")
+
+ t.additional_info.is_tracing = False
+
+
+def pydev_trace_code_wrapper():
+ # import this module again, because it's inserted inside user's code
+ global _pydev_stop_at_break
+ _pydev_stop_at_break()
diff --git a/ptvsd/pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py
new file mode 100644
index 00000000..14f3a38a
--- /dev/null
+++ b/ptvsd/pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py
@@ -0,0 +1,212 @@
+import dis
+import traceback
+from opcode import opmap, EXTENDED_ARG, HAVE_ARGUMENT
+from types import CodeType
+
+MAX_BYTE = 255
+
+
+def _add_attr_values_from_insert_to_original(original_code, insert_code, insert_code_obj, attribute_name, op_list):
+ """
+ This function appends values of the attribute `attribute_name` of the inserted code to the original values,
+ and changes indexes inside inserted code. If some bytecode instruction in the inserted code used to call argument
+ number i, after modification it calls argument n + i, where n - length of the values in the original code.
+ So it helps to avoid variables mixing between two pieces of code.
+
+ :param original_code: code to modify
+ :param insert_code: code to insert
+ :param insert_code_obj: bytes sequence of inserted code, which should be modified too
+ :param attribute_name: name of attribute to modify ('co_names', 'co_consts' or 'co_varnames')
+ :param op_list: sequence of bytecodes whose arguments should be changed
+ :return: modified bytes sequence of the code to insert and new values of the attribute `attribute_name` for
+ original code
+ """
+ orig_value = getattr(original_code, attribute_name)
+ insert_value = getattr(insert_code, attribute_name)
+ orig_names_len = len(orig_value)
+ code_with_new_values = list(insert_code_obj)
+ offset = 0
+ while offset < len(code_with_new_values):
+ op = code_with_new_values[offset]
+ if op in op_list:
+ new_val = code_with_new_values[offset + 1] + orig_names_len
+ if new_val > MAX_BYTE:
+ code_with_new_values[offset + 1] = new_val & MAX_BYTE
+ code_with_new_values = code_with_new_values[:offset] + [EXTENDED_ARG, new_val >> 8] + \
+ code_with_new_values[offset:]
+ offset += 2
+ else:
+ code_with_new_values[offset + 1] = new_val
+ offset += 2
+ new_values = orig_value + insert_value
+ return bytes(code_with_new_values), new_values
+
+
+def _modify_new_lines(code_to_modify, all_inserted_code):
+ """
+ Update new lines in order to hide inserted code inside the original code
+ :param code_to_modify: code to modify
+ :param all_inserted_code: list of tuples (offset, list of code instructions) with all inserted pieces of code
+ :return: bytes sequence of code with updated lines offsets
+ """
+ new_list = list(code_to_modify.co_lnotab)
+ abs_offset = prev_abs_offset = 0
+ i = 0
+ while i < len(new_list):
+ prev_abs_offset = abs_offset
+ abs_offset += new_list[i]
+ for (inserted_offset, inserted_code) in all_inserted_code:
+ if prev_abs_offset <= inserted_offset < abs_offset:
+ size_of_inserted = len(inserted_code)
+ new_list[i] += size_of_inserted
+ abs_offset += size_of_inserted
+ if new_list[i] > MAX_BYTE:
+ new_list[i] = new_list[i] - MAX_BYTE
+ new_list = new_list[:i] + [MAX_BYTE, 0] + new_list[i:]
+ i += 2
+ return bytes(new_list)
+
+
+def _unpack_opargs(code, inserted_code_list, current_index):
+ """
+ Modified version of `_unpack_opargs` function from module `dis`.
+ We have to use it, because sometimes code can be in an inconsistent state: if EXTENDED_ARG
+ operator was introduced into the code, but it hasn't been inserted into `code_list` yet.
+ In this case we can't use standard `_unpack_opargs` and we should check whether there are
+ some new operators in `inserted_code_list`.
+ """
+ extended_arg = 0
+ for i in range(0, len(code), 2):
+ op = code[i]
+ if op >= HAVE_ARGUMENT:
+ if not extended_arg:
+ # in case if we added EXTENDED_ARG, but haven't inserted it to the source code yet.
+ for code_index in range(current_index, len(inserted_code_list)):
+ inserted_offset, inserted_code = inserted_code_list[code_index]
+ if inserted_offset == i and inserted_code[0] == EXTENDED_ARG:
+ extended_arg = inserted_code[1] << 8
+ arg = code[i+1] | extended_arg
+ extended_arg = (arg << 8) if op == EXTENDED_ARG else 0
+ else:
+ arg = None
+ yield (i, op, arg)
+
+
+def _update_label_offsets(code_obj, breakpoint_offset, breakpoint_code_list):
+ """
+ Update labels for the relative and absolute jump targets
+ :param code_obj: code to modify
+ :param breakpoint_offset: offset for the inserted code
+ :param breakpoint_code_list: size of the inserted code
+ :return: bytes sequence with modified labels; list of tuples (resulting offset, list of code instructions) with
+ information about all inserted pieces of code
+ """
+ inserted_code = list()
+ # the list with all inserted pieces of code
+ inserted_code.append((breakpoint_offset, breakpoint_code_list))
+ code_list = list(code_obj)
+ j = 0
+
+ while j < len(inserted_code):
+ current_offset, current_code_list = inserted_code[j]
+ offsets_for_modification = []
+
+ for offset, op, arg in _unpack_opargs(code_list, inserted_code, j):
+ if arg is not None:
+ if op in dis.hasjrel:
+ # has relative jump target
+ label = offset + 2 + arg
+ if offset < current_offset < label:
+ # change labels for relative jump targets if code was inserted inside
+ offsets_for_modification.append(offset)
+ elif op in dis.hasjabs:
+ # change label for absolute jump if code was inserted before it
+ if current_offset < arg:
+ offsets_for_modification.append(offset)
+ for i in range(0, len(code_list), 2):
+ op = code_list[i]
+ if i in offsets_for_modification and op >= dis.HAVE_ARGUMENT:
+ new_arg = code_list[i + 1] + len(current_code_list)
+ if new_arg <= MAX_BYTE:
+ code_list[i + 1] = new_arg
+ else:
+ # handle bytes overflow
+ if i - 2 > 0 and code_list[i - 2] == EXTENDED_ARG and code_list[i - 1] < MAX_BYTE:
+ # if new argument > 255 and EXTENDED_ARG already exists we need to increase it's argument
+ code_list[i - 1] += 1
+ else:
+ # if there isn't EXTENDED_ARG operator yet we have to insert the new operator
+ extended_arg_code = [EXTENDED_ARG, new_arg >> 8]
+ inserted_code.append((i, extended_arg_code))
+ code_list[i + 1] = new_arg & MAX_BYTE
+
+ code_list = code_list[:current_offset] + current_code_list + code_list[current_offset:]
+
+ for k in range(len(inserted_code)):
+ offset, inserted_code_list = inserted_code[k]
+ if current_offset < offset:
+ inserted_code[k] = (offset + len(current_code_list), inserted_code_list)
+ j += 1
+
+ return bytes(code_list), inserted_code
+
+
+def _return_none_fun():
+ return None
+
+
+def insert_code(code_to_modify, code_to_insert, before_line):
+ """
+ Insert piece of code `code_to_insert` to `code_to_modify` right inside the line `before_line` before the
+ instruction on this line by modifying original bytecode
+
+ :param code_to_modify: Code to modify
+ :param code_to_insert: Code to insert
+ :param before_line: Number of line for code insertion
+ :return: boolean flag whether insertion was successful, modified code
+ """
+ linestarts = dict(dis.findlinestarts(code_to_modify))
+ if before_line not in linestarts.values():
+ return code_to_modify
+ offset = None
+ for off, line_no in linestarts.items():
+ if line_no == before_line:
+ offset = off
+
+ return_none_size = len(_return_none_fun.__code__.co_code)
+ code_to_insert_obj = code_to_insert.co_code[:-return_none_size]
+ try:
+ code_to_insert_obj, new_names = \
+ _add_attr_values_from_insert_to_original(code_to_modify, code_to_insert, code_to_insert_obj, 'co_names',
+ dis.hasname)
+ code_to_insert_obj, new_consts = \
+ _add_attr_values_from_insert_to_original(code_to_modify, code_to_insert, code_to_insert_obj, 'co_consts',
+ [opmap['LOAD_CONST']])
+ code_to_insert_obj, new_vars = \
+ _add_attr_values_from_insert_to_original(code_to_modify, code_to_insert, code_to_insert_obj, 'co_varnames',
+ dis.haslocal)
+ new_bytes, all_inserted_code = _update_label_offsets(code_to_modify.co_code, offset, list(code_to_insert_obj))
+
+ new_lnotab = _modify_new_lines(code_to_modify, all_inserted_code)
+ except ValueError:
+ traceback.print_exc()
+ return False, code_to_modify
+
+ new_code = CodeType(
+ code_to_modify.co_argcount, # integer
+ code_to_modify.co_kwonlyargcount, # integer
+ len(new_vars), # integer
+ code_to_modify.co_stacksize, # integer
+ code_to_modify.co_flags, # integer
+ new_bytes, # bytes
+ new_consts, # tuple
+ new_names, # tuple
+ new_vars, # tuple
+ code_to_modify.co_filename, # string
+ code_to_modify.co_name, # string
+ code_to_modify.co_firstlineno, # integer
+ new_lnotab, # bytes
+ code_to_modify.co_freevars, # tuple
+ code_to_modify.co_cellvars # tuple
+ )
+ return True, new_code
diff --git a/ptvsd/pydevd/appveyor.yml b/ptvsd/pydevd/appveyor.yml
new file mode 100644
index 00000000..9279e7c6
--- /dev/null
+++ b/ptvsd/pydevd/appveyor.yml
@@ -0,0 +1,76 @@
+environment:
+
+ matrix:
+
+ # For Python versions available on Appveyor, see
+ # http://www.appveyor.com/docs/installed-software#python
+ # The list here is complete (excluding Python 2.6, which
+ # isn't covered by this document) at the time of writing.
+
+ - PYTHON_FOLDER: "C:\\Python27"
+ PYDEVD_USE_CYTHON: YES
+ - PYTHON_FOLDER: "C:\\Python27"
+ PYDEVD_USE_CYTHON: NO
+
+ #- PYTHON_FOLDER: "C:\\Python33"
+ #- PYTHON_FOLDER: "C:\\Python34"
+ #- PYTHON_FOLDER: "C:\\Python35"
+ #- PYTHON_FOLDER: "C:\\Python27-x64"
+ #- PYTHON_FOLDER: "C:\\Python33-x64"
+ # DISTUTILS_USE_SDK: "1"
+ #- PYTHON_FOLDER: "C:\\Python34-x64"
+ # DISTUTILS_USE_SDK: "1"
+
+ - PYTHON_FOLDER: "C:\\Python35-x64"
+ PYDEVD_USE_CYTHON: YES
+ - PYTHON_FOLDER: "C:\\Python35-x64"
+ PYDEVD_USE_CYTHON: NO
+
+ - PYTHON_FOLDER: "C:\\Python36-x64"
+ PYDEVD_USE_CYTHON: YES
+ - PYTHON_FOLDER: "C:\\Python36-x64"
+ PYDEVD_USE_CYTHON: NO
+
+ - PYTHON_FOLDER: "C:\\Python36-x64"
+ PYDEVD_USE_CYTHON: NO
+ TEST_IRONPYTHON: YES
+
+install:
+ # Note: we can't use powershell for everything as it'll fail if anything is written to stderr (which is expected
+ # in some cases), so, using cmd on case where writing to stderr is Ok.
+ - cmd: "set PYTHON_EXE=%PYTHON_FOLDER%\\python.exe"
+ - ps: if ($env:TEST_IRONPYTHON -eq "YES"){Start-FileDownload https://github.com/IronLanguages/main/releases/download/ipy-2.7.5/IronPython-2.7.5.zip -FileName ironpython.zip}
+ - cmd: IF "%TEST_IRONPYTHON%"=="YES" (7z x ironpython.zip -oironpython)
+ - cmd: IF "%TEST_IRONPYTHON%"=="YES" (ironpython\IronPython-2.7.5\ipy.exe -X:Frames -X:ExceptionDetail -X:ShowClrExceptions -m ensurepip)
+ - cmd: IF "%TEST_IRONPYTHON%"=="YES" (ironpython\IronPython-2.7.5\ipy.exe -X:Frames -X:ExceptionDetail -X:ShowClrExceptions -m pip install pytest)
+ - ps: |
+ if ($env:TEST_IRONPYTHON -ne "YES"){
+ $PYTHON_EXE = $Env:PYTHON_EXE
+ & $PYTHON_EXE -m pip install wheel
+ & $PYTHON_EXE -m pip install cython
+ & $PYTHON_EXE -m pip install numpy
+ & $PYTHON_EXE -m pip install pytest
+ & $PYTHON_EXE -m pip install psutil
+ & $PYTHON_EXE -m pip install ipython
+ if ($env:PYTHON -eq "C:\\Python27"){
+ "%PYTHON%\\python.exe -m pip install django>=1.7,<1.8"
+ }
+ }
+ - cmd: "set PYTHONPATH=%PYTHONPATH%;%APPVEYOR_BUILD_FOLDER%"
+
+build_script:
+ - "%PYTHON_EXE% build_tools/build.py"
+
+test_script:
+ - cmd: IF "%TEST_IRONPYTHON%"=="YES" (ironpython\IronPython-2.7.5\ipy.exe -X:Frames -X:ExceptionDetail -X:ShowClrExceptions -m pytest --assert=plain -k "not samples")
+ - cmd: IF "%TEST_IRONPYTHON%"=="" (%PYTHON_EXE% -m pytest)
+
+artifacts:
+ # bdist_wheel puts your built wheel in the dist directory
+ # - path: dist\*
+ - path: build\lib.*
+
+#on_success:
+# You can use this step to upload your artifacts to a public website.
+# See Appveyor's documentation for more details. Or you can simply
+# access your wheels from the Appveyor "artifacts" tab for your build.
\ No newline at end of file
diff --git a/ptvsd/pydevd/build.gradle b/ptvsd/pydevd/build.gradle
new file mode 100644
index 00000000..d3361333
--- /dev/null
+++ b/ptvsd/pydevd/build.gradle
@@ -0,0 +1,43 @@
+import org.apache.tools.ant.taskdefs.condition.Os
+
+plugins {
+ id "com.jetbrains.python.envs" version "0.0.9"
+}
+
+envs {
+ project.buildDir = new File(System.getenv().getOrDefault("PYCHARM_BUILD_DIR", buildDir))
+ bootstrapDirectory = new File(buildDir, '.miniconda')
+ envsDirectory = new File(buildDir, 'MinicondaEnvs')
+ minicondaVersion = 'latest'
+ packages = ["cython", "pip", "setuptools"]
+
+ conda "py27_64", "2.7", ["wheel", "twine"], false
+ conda "py34_64", "3.4", ["wheel", "twine"], false
+ conda "py35_64", "3.5", ["wheel", "twine"], false
+ conda "py36_64", "3.6", ["wheel", "twine"], false
+ conda "py27_32", "2.7", ["wheel", "twine"], false
+ conda "py34_32", "3.4", ["wheel", "twine"], false
+ conda "py35_32", "3.5", ["wheel", "twine"], false
+ conda "py36_32", "3.6", ["wheel", "twine"], false
+}
+
+task buildBinariesOnWindows(dependsOn: 'build_envs') << {
+ exec {
+ workingDir projectDir
+
+ environment PYTHONPATH: projectDir,
+ MINICONDA32_ENVS: envs.envsDirectory,
+ MINICONDA64_ENVS: envs.envsDirectory
+
+ commandLine "${envs.envsDirectory}/py27_32/python.exe", "build_tools/build_binaries_windows.py"
+ }
+}
+
+task buildBinaries() {
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ dependsOn buildBinariesOnWindows
+ }
+ else if (Os.isFamily(Os.FAMILY_MAC)) {
+ dependsOn buildOnMac
+ }
+}
diff --git a/ptvsd/pydevd/build_tools/build.py b/ptvsd/pydevd/build_tools/build.py
new file mode 100644
index 00000000..017e6434
--- /dev/null
+++ b/ptvsd/pydevd/build_tools/build.py
@@ -0,0 +1,171 @@
+'''
+Helper to build pydevd.
+
+It should:
+ * recreate our generated files
+ * compile cython deps (properly setting up the environment first).
+
+Note that it's used in the CI to build the cython deps based on the PYDEVD_USE_CYTHON environment variable.
+'''
+from __future__ import print_function
+
+import os
+import subprocess
+import sys
+
+from generate_code import remove_if_exists, root_dir, is_python_64bit, generate_dont_trace_files, generate_cython_module
+
+
+def validate_pair(ob):
+ try:
+ if not (len(ob) == 2):
+ print("Unexpected result:", ob, file=sys.stderr)
+ raise ValueError
+ except:
+ return False
+ return True
+
+
+def consume(it):
+ try:
+ while True:
+ next(it)
+ except StopIteration:
+ pass
+
+def get_environment_from_batch_command(env_cmd, initial=None):
+ """
+ Take a command (either a single command or list of arguments)
+ and return the environment created after running that command.
+ Note that if the command must be a batch file or .cmd file, or the
+ changes to the environment will not be captured.
+
+ If initial is supplied, it is used as the initial environment passed
+ to the child process.
+ """
+ if not isinstance(env_cmd, (list, tuple)):
+ env_cmd = [env_cmd]
+ if not os.path.exists(env_cmd[0]):
+ raise RuntimeError('Error: %s does not exist' % (env_cmd[0],))
+
+ # construct the command that will alter the environment
+ env_cmd = subprocess.list2cmdline(env_cmd)
+ # create a tag so we can tell in the output when the proc is done
+ tag = 'Done running command'
+ # construct a cmd.exe command to do accomplish this
+ cmd = 'cmd.exe /s /c "{env_cmd} && echo "{tag}" && set"'.format(**vars())
+ # launch the process
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=initial)
+ # parse the output sent to stdout
+ lines = proc.stdout
+ # consume whatever output occurs until the tag is reached
+ for line in lines:
+ line = line.decode('utf-8')
+ if 'The specified configuration type is missing.' in line:
+ raise AssertionError('Error executing %s. View http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/ for details.' % (env_cmd))
+ if tag in line:
+ break
+ if sys.version_info[0] > 2:
+ # define a way to handle each KEY=VALUE line
+ handle_line = lambda l: l.decode('utf-8').rstrip().split('=', 1)
+ else:
+ # define a way to handle each KEY=VALUE line
+ handle_line = lambda l: l.rstrip().split('=', 1)
+ # parse key/values into pairs
+ pairs = map(handle_line, lines)
+ # make sure the pairs are valid
+ valid_pairs = filter(validate_pair, pairs)
+ # construct a dictionary of the pairs
+ result = dict(valid_pairs)
+ # let the process finish
+ proc.communicate()
+ return result
+
+def remove_binaries():
+ for f in os.listdir(os.path.join(root_dir, '_pydevd_bundle')):
+ if f.endswith('.pyd'):
+ remove_if_exists(os.path.join(root_dir, '_pydevd_bundle', f))
+
+def build():
+ if '--no-remove-binaries' not in sys.argv:
+ remove_binaries()
+
+
+ os.chdir(root_dir)
+
+ env=None
+ if sys.platform == 'win32':
+ # "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
+ # set MSSdk=1
+ # set DISTUTILS_USE_SDK=1
+ # set VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools
+
+
+ env = os.environ.copy()
+ if sys.version_info[:2] in ((2,6), (2,7), (3,5), (3,6)):
+ import setuptools # We have to import it first for the compiler to be found
+ from distutils import msvc9compiler
+
+ if sys.version_info[:2] in ((2,6), (2,7)):
+ vcvarsall = msvc9compiler.find_vcvarsall(9.0)
+ elif sys.version_info[:2] in ((3,5), (3,6)):
+ vcvarsall = msvc9compiler.find_vcvarsall(14.0)
+ if vcvarsall is None or not os.path.exists(vcvarsall):
+ raise RuntimeError('Error finding vcvarsall.')
+
+ if is_python_64bit():
+ env.update(get_environment_from_batch_command(
+ [vcvarsall, 'amd64'],
+ initial=os.environ.copy()))
+ else:
+ env.update(get_environment_from_batch_command(
+ [vcvarsall, 'x86'],
+ initial=os.environ.copy()))
+
+ elif sys.version_info[:2] in ((3,3), (3,4)):
+ if is_python_64bit():
+ env.update(get_environment_from_batch_command(
+ [r"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd", '/x64'],
+ initial=os.environ.copy()))
+ else:
+ env.update(get_environment_from_batch_command(
+ [r"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd", '/x86'],
+ initial=os.environ.copy()))
+
+ else:
+ raise AssertionError('Unable to setup environment for Python: %s' % (sys.version,))
+
+ env['MSSdk'] = '1'
+ env['DISTUTILS_USE_SDK'] = '1'
+
+ additional_args = []
+ for arg in sys.argv:
+ if arg.startswith('--target-pyd-name='):
+ additional_args.append(arg)
+ if arg.startswith('--target-pyd-frame-eval='):
+ additional_args.append(arg)
+ break
+ else:
+ additional_args.append('--force-cython') # Build always forces cython!
+
+ args = [
+ sys.executable, os.path.join(os.path.dirname(__file__), '..', 'setup_cython.py'), 'build_ext', '--inplace',
+ ]+additional_args
+ print('Calling args: %s' % (args,))
+ subprocess.check_call(args, env=env,)
+
+if __name__ == '__main__':
+ use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
+ if use_cython == 'YES':
+ build()
+ elif use_cython == 'NO':
+ remove_binaries()
+ elif use_cython is None:
+ # Regular process
+ if '--no-regenerate-files' not in sys.argv:
+ generate_dont_trace_files()
+ generate_cython_module()
+ build()
+ else:
+ raise RuntimeError('Unexpected value for PYDEVD_USE_CYTHON: %s (accepted: YES, NO)' % (use_cython,))
+
diff --git a/ptvsd/pydevd/build_tools/build_binaries_windows.py b/ptvsd/pydevd/build_tools/build_binaries_windows.py
new file mode 100644
index 00000000..f19535f4
--- /dev/null
+++ b/ptvsd/pydevd/build_tools/build_binaries_windows.py
@@ -0,0 +1,187 @@
+r'''
+Creating the needed environments for creating the pre-compiled distribution on Windods:
+
+1. Download:
+
+* conda32 at C:\tools\Miniconda32
+
+* conda64 at C:\tools\Miniconda
+
+Create the environments:
+
+C:\tools\Miniconda32\Scripts\conda create -y -f -n py27_32 python=2.7 cython numpy nose ipython pip
+C:\tools\Miniconda32\Scripts\activate py27_32
+pip install "django>=1.7,<1.8"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+C:\tools\Miniconda32\Scripts\conda create -y -f -n py34_32 python=3.4 cython numpy nose ipython pip
+C:\tools\Miniconda32\Scripts\activate py34_32
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+C:\tools\Miniconda32\Scripts\conda create -y -f -n py35_32 python=3.5 cython numpy nose ipython pip
+C:\tools\Miniconda32\Scripts\activate py35_32
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+C:\tools\Miniconda32\Scripts\conda create -y -f -n py36_32 python=3.6 cython numpy nose ipython pip
+C:\tools\Miniconda32\Scripts\activate py36_32
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+
+C:\tools\Miniconda\Scripts\conda create -y -f -n py27_64 python=2.7 cython numpy nose ipython pip
+C:\tools\Miniconda\Scripts\activate py27_64
+pip install "django>=1.7,<1.8"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+C:\tools\Miniconda\Scripts\conda create -y -f -n py34_64 python=3.4 cython numpy nose ipython pip
+C:\tools\Miniconda\Scripts\activate py34_64
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+C:\tools\Miniconda\Scripts\conda create -y -f -n py35_64 python=3.5 cython numpy nose ipython pip
+C:\tools\Miniconda\Scripts\activate py35_64
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+
+C:\tools\Miniconda\Scripts\conda create -y -f -n py36_64 python=3.6 cython numpy nose ipython pip
+C:\tools\Miniconda\Scripts\activate py36_64
+pip install "django>=1.9"
+pip install -U "setuptools>=0.9"
+pip install -U "pip>=1.4" "wheel>=0.21" twine
+deactivate
+
+
+
+
+### UPDATE CYTHON
+
+C:\tools\Miniconda32\Scripts\activate py27_32
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda32\Scripts\activate py34_32
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda32\Scripts\activate py35_32
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda32\Scripts\activate py36_32
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda\Scripts\activate py27_64
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda\Scripts\activate py34_64
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda\Scripts\activate py35_64
+conda update -y cython
+deactivate
+
+C:\tools\Miniconda\Scripts\activate py36_64
+conda update -y cython
+deactivate
+
+
+'''
+
+from __future__ import unicode_literals
+import os
+import subprocess
+import sys
+
+miniconda32_envs = os.getenv('MINICONDA32_ENVS', r'C:\tools\Miniconda32\envs')
+miniconda64_envs = os.getenv('MINICONDA64_ENVS', r'C:\tools\Miniconda\envs')
+
+python_installations = [
+ r'%s\py27_32\python.exe' % miniconda32_envs,
+ r'%s\py34_32\python.exe' % miniconda32_envs,
+ r'%s\py35_32\python.exe' % miniconda32_envs,
+ r'%s\py36_32\python.exe' % miniconda32_envs,
+
+ r'%s\py27_64\python.exe' % miniconda64_envs,
+ r'%s\py34_64\python.exe' % miniconda64_envs,
+ r'%s\py35_64\python.exe' % miniconda64_envs,
+ r'%s\py36_64\python.exe' % miniconda64_envs,
+]
+
+root_dir = os.path.dirname(os.path.dirname(__file__))
+def list_binaries():
+ for f in os.listdir(os.path.join(root_dir, '_pydevd_bundle')):
+ if f.endswith('.pyd'):
+ yield f
+
+def extract_version(python_install):
+ return python_install.split('\\')[-2][2:]
+
+
+def main():
+ from generate_code import generate_dont_trace_files
+ from generate_code import generate_cython_module
+
+ # First, make sure that our code is up to date.
+ generate_dont_trace_files()
+ generate_cython_module()
+
+ for python_install in python_installations:
+ assert os.path.exists(python_install)
+
+ from build import remove_binaries
+ remove_binaries()
+
+ for f in list_binaries():
+ raise AssertionError('Binary not removed: %s' % (f,))
+
+ for i, python_install in enumerate(python_installations):
+ print()
+ print('*'*80)
+ print('*'*80)
+ print()
+ new_name = 'pydevd_cython_%s_%s' % (sys.platform, extract_version(python_install))
+ args = [
+ python_install, os.path.join(root_dir, 'build_tools', 'build.py'), '--no-remove-binaries', '--target-pyd-name=%s' % new_name, '--force-cython']
+ if i != 0:
+ args.append('--no-regenerate-files')
+ if extract_version(python_install).startswith('36'):
+ name_frame_eval = 'pydevd_frame_evaluator_%s_%s' % (sys.platform, extract_version(python_install))
+ args.append('--target-pyd-frame-eval=%s' % name_frame_eval)
+ print('Calling: %s' % (' '.join(args)))
+ subprocess.check_call(args)
+
+
+
+if __name__ == '__main__':
+ main()
+
+# C:\tools\Miniconda32\envs\py27_32\python build_tools\build.py: generates the .pyx and .c
+# C:\tools\Miniconda32\envs\py27_32\python build_tools\build_binaries_windows.py: builds for multiple python versions
+
+r'''
+To run do:
+cd /D x:\PyDev.Debugger
+set PYTHONPATH=x:\PyDev.Debugger
+C:\tools\Miniconda32\envs\py27_32\python build_tools\build.py
+C:\tools\Miniconda32\envs\py27_32\python build_tools\build_binaries_windows.py
+'''
diff --git a/ptvsd/pydevd/build_tools/generate_code.py b/ptvsd/pydevd/build_tools/generate_code.py
new file mode 100644
index 00000000..dc7a3b81
--- /dev/null
+++ b/ptvsd/pydevd/build_tools/generate_code.py
@@ -0,0 +1,186 @@
+'''
+This module should be run to recreate the files that we generate automatically
+(i.e.: modules that shouldn't be traced and cython .pyx)
+'''
+
+from __future__ import print_function
+
+import os
+import struct
+
+
+
+def is_python_64bit():
+ return (struct.calcsize('P') == 8)
+
+root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+
+def get_cython_contents(filename):
+ if filename.endswith('.pyc'):
+ filename = filename[:-1]
+
+ state = 'regular'
+
+ new_contents = []
+ with open(filename, 'r') as stream:
+ for line in stream:
+ strip = line.strip()
+ if state == 'regular':
+ if strip == '# IFDEF CYTHON':
+ state = 'cython'
+
+ new_contents.append('%s -- DONT EDIT THIS FILE (it is automatically generated)\n' % line.replace('\n', '').replace('\r', ''))
+ continue
+
+ new_contents.append(line)
+
+ elif state == 'cython':
+ if strip == '# ELSE':
+ state = 'nocython'
+ new_contents.append(line)
+ continue
+
+ elif strip == '# ENDIF':
+ state = 'regular'
+ new_contents.append(line)
+ continue
+
+ assert strip.startswith('# '), 'Line inside # IFDEF CYTHON must start with "# ".'
+ new_contents.append(line.replace('# ', '', 1))
+
+ elif state == 'nocython':
+ if strip == '# ENDIF':
+ state = 'regular'
+ new_contents.append(line)
+ continue
+ new_contents.append('# %s' % line)
+
+ assert state == 'regular', 'Error: # IFDEF CYTHON found without # ENDIF'
+
+
+ return ''.join(new_contents)
+
+def _generate_cython_from_files(target, modules):
+ contents = ['''# Important: Autogenerated file.
+
+# DO NOT edit manually!
+# DO NOT edit manually!
+''']
+
+ for mod in modules:
+ contents.append(get_cython_contents(mod.__file__))
+
+ with open(target, 'w') as stream:
+ stream.write(''.join(contents))
+
+def generate_dont_trace_files():
+ template = '''# Important: Autogenerated file.
+
+# DO NOT edit manually!
+# DO NOT edit manually!
+
+from _pydevd_bundle.pydevd_constants import IS_PY3K
+
+LIB_FILE = 1
+PYDEV_FILE = 2
+
+DONT_TRACE = {
+ # commonly used things from the stdlib that we don't want to trace
+ 'Queue.py':LIB_FILE,
+ 'queue.py':LIB_FILE,
+ 'socket.py':LIB_FILE,
+ 'weakref.py':LIB_FILE,
+ '_weakrefset.py':LIB_FILE,
+ 'linecache.py':LIB_FILE,
+ 'threading.py':LIB_FILE,
+ 'dis.py':LIB_FILE,
+
+ #things from pydev that we don't want to trace
+ '_pydev_execfile.py':PYDEV_FILE,
+%(pydev_files)s
+}
+
+if IS_PY3K:
+ # if we try to trace io.py it seems it can get halted (see http://bugs.python.org/issue4716)
+ DONT_TRACE['io.py'] = LIB_FILE
+
+ # Don't trace common encodings too
+ DONT_TRACE['cp1252.py'] = LIB_FILE
+ DONT_TRACE['utf_8.py'] = LIB_FILE
+'''
+
+ pydev_files = []
+
+ for root, dirs, files in os.walk(root_dir):
+ for d in [
+ '.git',
+ '.settings',
+ 'build',
+ 'build_tools',
+ 'dist',
+ 'pydevd.egg-info',
+ 'pydevd_attach_to_process',
+ 'pydev_sitecustomize',
+ 'stubs',
+ 'tests',
+ 'tests_mainloop',
+ 'tests_python',
+ 'tests_runfiles',
+ 'test_pydevd_reload',
+ 'third_party',
+ '__pycache__',
+ '_pydev_runfiles',
+ 'pydev_ipython',
+ ]:
+ try:
+ dirs.remove(d)
+ except:
+ pass
+
+ for f in files:
+ if f.endswith('.py'):
+ if f not in (
+ '__init__.py',
+ 'runfiles.py',
+ 'pydev_coverage.py',
+ 'pydev_pysrc.py',
+ 'setup.py',
+ 'setup_cython.py',
+ 'interpreterInfo.py',
+ 'conftest.py',
+ ):
+ pydev_files.append(" '%s': PYDEV_FILE," % (f,))
+
+ contents = template % (dict(pydev_files='\n'.join(sorted(pydev_files))))
+ assert 'pydevd.py' in contents
+ assert 'pydevd_dont_trace.py' in contents
+ with open(os.path.join(root_dir, '_pydevd_bundle', 'pydevd_dont_trace_files.py'), 'w') as stream:
+ stream.write(contents)
+
+def remove_if_exists(f):
+ try:
+ if os.path.exists(f):
+ os.remove(f)
+ except:
+ import traceback;traceback.print_exc()
+
+def generate_cython_module():
+ remove_if_exists(os.path.join(root_dir, '_pydevd_bundle', 'pydevd_cython.pyx'))
+
+ target = os.path.join(root_dir, '_pydevd_bundle', 'pydevd_cython.pyx')
+ curr = os.environ.get('PYDEVD_USE_CYTHON')
+ try:
+ os.environ['PYDEVD_USE_CYTHON'] = 'NO'
+
+ from _pydevd_bundle import pydevd_additional_thread_info_regular
+ from _pydevd_bundle import pydevd_frame, pydevd_trace_dispatch_regular
+ _generate_cython_from_files(target, [pydevd_additional_thread_info_regular, pydevd_frame, pydevd_trace_dispatch_regular])
+ finally:
+ if curr is None:
+ del os.environ['PYDEVD_USE_CYTHON']
+ else:
+ os.environ['PYDEVD_USE_CYTHON'] = curr
+
+if __name__ == '__main__':
+ generate_dont_trace_files()
+ generate_cython_module()
diff --git a/ptvsd/pydevd/build_tools/names_to_rename.py b/ptvsd/pydevd/build_tools/names_to_rename.py
new file mode 100644
index 00000000..1525974d
--- /dev/null
+++ b/ptvsd/pydevd/build_tools/names_to_rename.py
@@ -0,0 +1,318 @@
+'''
+Helper module to hold the names to rename while doing refactoring to convert to pep8.
+'''
+NAMES = '''
+# sendCaughtExceptionStack
+# sendBreakpointConditionException
+# setSuspend
+# processThreadNotAlive
+# sendCaughtExceptionStackProceeded
+# doWaitSuspend
+# SetTraceForFrameAndParents
+# prepareToRun
+# processCommandLine
+# initStdoutRedirect
+# initStderrRedirect
+# OnRun
+# doKillPydevThread
+# stopTrace
+# handleExcept
+# processCommand
+# processNetCommand
+# addCommand
+# StartClient
+# getNextSeq
+# makeMessage
+# StartServer
+# threadToXML
+# makeErrorMessage
+# makeThreadCreatedMessage
+# makeCustomFrameCreatedMessage
+# makeListThreadsMessage
+# makeVariableChangedMessage
+# makeIoMessage
+# makeVersionMessage
+# makeThreadKilledMessage
+# makeThreadSuspendStr
+# makeValidXmlValue
+# makeThreadSuspendMessage
+# makeThreadRunMessage
+# makeGetVariableMessage
+# makeGetArrayMessage
+# makeGetFrameMessage
+# makeEvaluateExpressionMessage
+# makeGetCompletionsMessage
+# makeGetFileContents
+# makeSendBreakpointExceptionMessage
+# makeSendCurrExceptionTraceMessage
+# makeSendCurrExceptionTraceProceededMessage
+# makeSendConsoleMessage
+# makeCustomOperationMessage
+# makeLoadSourceMessage
+# makeShowConsoleMessage
+# makeExitMessage
+# canBeExecutedBy
+# doIt
+# additionalInfo
+# cmdFactory
+# GetExceptionTracebackStr
+# _GetStackStr
+# _InternalSetTrace
+# ReplaceSysSetTraceFunc
+# RestoreSysSetTraceFunc
+
+
+
+# AddContent
+# AddException
+# AddObserver
+# # Call -- skip
+# # Call1 -- skip
+# # Call2 -- skip
+# # Call3 -- skip
+# # Call4 -- skip
+# ChangePythonPath
+# CheckArgs
+# CheckChar
+# CompleteFromDir
+# CreateDbFrame
+# CustomFramesContainerInit
+# DictContains
+# DictItems
+# DictIterItems
+# DictIterValues
+# DictKeys
+# DictPop
+# DictValues
+
+
+# DoExit
+# DoFind
+# EndRedirect
+# # Exec -- skip
+# ExecuteTestsInParallel
+# # Find -- skip
+# FinishDebuggingSession
+# FlattenTestSuite
+# GenerateCompletionsAsXML
+# GenerateImportsTipForModule
+# GenerateTip
+
+
+# testAddExec
+# testComplete
+# testCompleteDoesNotDoPythonMatches
+# testCompletionSocketsAndMessages
+# testConsoleHello
+# testConsoleRequests
+# testDotNetLibraries
+# testEdit
+# testGetCompletions
+# testGetNamespace
+# testGetReferrers1
+# testGetReferrers2
+# testGetReferrers3
+# testGetReferrers4
+# testGetReferrers5
+# testGetReferrers6
+# testGetReferrers7
+# testGettingInfoOnJython
+# testGui
+# testHistory
+# testImports
+# testImports1
+# testImports1a
+# testImports1b
+# testImports1c
+# testImports2
+# testImports2a
+# testImports2b
+# testImports2c
+# testImports3
+# testImports4
+# testImports5
+# testInspect
+# testIt
+# testMessage
+# testPrint
+# testProperty
+# testProperty2
+# testProperty3
+# testQuestionMark
+# testSearch
+# testSearchOnJython
+# testServer
+# testTipOnString
+# toXML
+# updateCustomFrame
+# varToXML
+
+#
+# GetContents
+# GetCoverageFiles
+# GetFile
+# GetFileNameAndBaseFromFile
+# GetFilenameAndBase
+# GetFrame
+# GetGlobalDebugger # -- renamed but kept backward-compatibility
+# GetNormPathsAndBase
+# GetNormPathsAndBaseFromFile
+# GetTestsToRun -- skip
+# GetThreadId
+# GetVmType
+# IPythonEditor -- skip
+# ImportName
+# InitializeServer
+# IterFrames
+
+
+# Method1 -- skip
+# Method1a -- skip
+# Method2 -- skip
+# Method3 -- skip
+
+# NewConsolidate
+# NormFileToClient
+# NormFileToServer
+# # Notify -- skip
+# # NotifyFinished -- skip
+# OnFunButton
+# # OnInit -- skip
+# OnTimeToClose
+# PydevdFindThreadById
+# PydevdLog
+# # RequestInput -- skip
+
+
+# Search -- manual: search_definition
+# ServerProxy -- skip
+# SetGlobalDebugger
+
+# SetServer
+# SetUp
+# SetTrace -- skip
+
+
+# SetVmType
+# SetupType
+# StartCoverageSupport
+# StartCoverageSupportFromParams
+# StartPydevNosePluginSingleton
+# StartRedirect
+# ToTuple
+
+# addAdditionalFrameById
+# removeAdditionalFrameById
+# removeCustomFrame
+# addCustomFrame
+# addError -- skip
+# addExec
+# addFailure -- skip
+# addSuccess -- skip
+# assertArgs
+# assertIn
+
+# basicAsStr
+# changeAttrExpression
+# # changeVariable -- skip (part of public API for console)
+# checkOutput
+# checkOutputRedirect
+# clearBuffer
+
+# # connectToDebugger -- skip (part of public API for console)
+# connectToServer
+# consoleExec
+# createConnections
+# createStdIn
+# customOperation
+# dirObj
+# doAddExec
+# doExecCode
+# dumpFrames
+
+# # enableGui -- skip (part of public API for console)
+# evalInContext
+# evaluateExpression
+# # execLine -- skip (part of public API for console)
+# # execMultipleLines -- skip (part of public API for console)
+# findFrame
+# orig_findFrame
+# finishExec
+# fixGetpass
+
+# forceServerKill
+# formatArg
+# formatCompletionMessage
+# formatParamClassName
+# frameVarsToXML
+# fullyNormalizePath
+
+# getArray -- skip (part of public API for console)
+# getAsDoc
+# getCapturedOutput
+# getCompletions -- skip (part of public API for console)
+
+# getCompletionsMessage
+# getCustomFrame
+# # getDescription -- skip (part of public API for console)
+# getDictionary
+# # getFrame -- skip (part of public API for console)
+# getFrameName
+
+
+
+# getFrameStack
+# getFreeAddresses
+# getInternalQueue
+# getIoFromError
+# getNamespace
+# getTestName
+# getTokenAndData
+# getType
+
+# getVariable -- skip (part of public API for console)
+
+# # haveAliveThreads -> has_threads_alive
+# initializeNetwork
+# isThreadAlive
+# # iterFrames -> _iter_frames
+# # keyStr -> key_to_str
+# killAllPydevThreads
+# longRunning
+# # metA -- skip
+# nativePath
+
+# needMore
+# needMoreForCode
+# # notifyCommands -- skip (part of public API)
+# # notifyConnected -- skip (part of public API)
+# # notifyStartTest -- skip (part of public API)
+# # notifyTest -- skip (part of public API)
+# # notifyTestRunFinished -- skip (part of public API)
+# # notifyTestsCollected -- skip (part of public API)
+# postInternalCommand
+# processInternalCommands
+# readMsg
+
+
+# redirectStdout
+# removeInvalidChars
+# reportCond
+# resolveCompoundVariable
+# resolveVar
+# restoreStdout
+# sendKillMsg
+# sendSignatureCallTrace
+# setTracingForUntracedContexts
+# startClientThread
+# startDebuggerServerThread
+# startExec
+
+# startTest -- skip
+# stopTest -- skip
+# setUp -- skip
+# setUpClass -- skip
+# setUpModule -- skip
+# tearDown -- skip
+
+'''
\ No newline at end of file
diff --git a/ptvsd/pydevd/build_tools/rename_pep8.py b/ptvsd/pydevd/build_tools/rename_pep8.py
new file mode 100644
index 00000000..b673fb50
--- /dev/null
+++ b/ptvsd/pydevd/build_tools/rename_pep8.py
@@ -0,0 +1,123 @@
+'''
+Helper module to do refactoring to convert names to pep8.
+'''
+import re
+import os
+import names_to_rename
+
+_CAMEL_RE = re.compile(r'(?<=[a-z])([A-Z])')
+_CAMEL_DEF_RE = re.compile(r'(def )((([A-Z0-9]+|[a-z0-9])[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*)')
+
+def _normalize(name):
+ return _CAMEL_RE.sub(lambda x: '_' + x.group(1).lower(), name).lower()
+
+def find_matches_in_contents(contents):
+ return [x[1] for x in re.findall(_CAMEL_DEF_RE, contents)]
+
+def iter_files_in_dir(dirname):
+ for root, dirs, files in os.walk(dirname):
+ for name in ('pydevd_attach_to_process', '.git', 'stubs', 'pydev_ipython', 'third_party', 'pydev_ipython'):
+ try:
+ dirs.remove(name)
+ except:
+ pass
+ for filename in files:
+ if filename.endswith('.py') and filename not in ('rename_pep8.py', 'names_to_rename.py'):
+ path = os.path.join(root, filename)
+ with open(path, 'rb') as stream:
+ initial_contents = stream.read()
+
+ yield path, initial_contents
+
+def find_matches():
+ found = set()
+ for path, initial_contents in iter_files_in_dir(os.path.dirname(os.path.dirname(__file__))):
+ found.update(find_matches_in_contents(initial_contents))
+ print '\n'.join(sorted(found))
+ print 'Total', len(found)
+
+def substitute_contents(re_name_to_new_val, initial_contents):
+ contents = initial_contents
+ for key, val in re_name_to_new_val.iteritems():
+ contents = re.sub(key, val, contents)
+ return contents
+
+def make_replace():
+ re_name_to_new_val = load_re_to_new_val(names_to_rename.NAMES)
+ # traverse root directory, and list directories as dirs and files as files
+ for path, initial_contents in iter_files_in_dir(os.path.dirname(os.path.dirname(__file__))):
+ contents = substitute_contents(re_name_to_new_val, initial_contents)
+ if contents != initial_contents:
+ print 'Changed something at: %s' % (path,)
+
+ for val in re_name_to_new_val.itervalues():
+ # Check in initial contents to see if it already existed!
+ if re.findall(r'\b%s\b' % (val,), initial_contents):
+ raise AssertionError('Error in:\n%s\n%s is already being used (and changes may conflict).' % (path, val,))
+
+ with open(path, 'wb') as stream:
+ stream.write(contents)
+
+
+def load_re_to_new_val(names):
+ name_to_new_val = {}
+ for n in names.splitlines():
+ n = n.strip()
+ if not n.startswith('#') and n:
+ name_to_new_val[r'\b'+n+r'\b'] = _normalize(n)
+ return name_to_new_val
+
+def test():
+ assert _normalize('RestoreSysSetTraceFunc') == 'restore_sys_set_trace_func'
+ assert _normalize('restoreSysSetTraceFunc') == 'restore_sys_set_trace_func'
+ assert _normalize('Restore') == 'restore'
+ matches = find_matches_in_contents('''
+ def CamelCase()
+ def camelCase()
+ def ignore()
+ def ignore_this()
+ def Camel()
+ def CamelCaseAnother()
+ ''')
+ assert matches == ['CamelCase', 'camelCase', 'Camel', 'CamelCaseAnother']
+ re_name_to_new_val = load_re_to_new_val('''
+# Call -- skip
+# Call1 -- skip
+# Call2 -- skip
+# Call3 -- skip
+# Call4 -- skip
+CustomFramesContainerInit
+DictContains
+DictItems
+DictIterItems
+DictIterValues
+DictKeys
+DictPop
+DictValues
+''')
+ assert re_name_to_new_val == {'\\bDictPop\\b': 'dict_pop', '\\bDictItems\\b': 'dict_items', '\\bDictIterValues\\b': 'dict_iter_values', '\\bDictKeys\\b': 'dict_keys', '\\bDictContains\\b': 'dict_contains', '\\bDictIterItems\\b': 'dict_iter_items', '\\bCustomFramesContainerInit\\b': 'custom_frames_container_init', '\\bDictValues\\b': 'dict_values'}
+ assert substitute_contents(re_name_to_new_val, '''
+CustomFramesContainerInit
+DictContains
+DictItems
+DictIterItems
+DictIterValues
+DictKeys
+DictPop
+DictValues
+''') == '''
+custom_frames_container_init
+dict_contains
+dict_items
+dict_iter_items
+dict_iter_values
+dict_keys
+dict_pop
+dict_values
+'''
+
+if __name__ == '__main__':
+# find_matches()
+ make_replace()
+# test()
+
diff --git a/ptvsd/pydevd/conftest.py b/ptvsd/pydevd/conftest.py
new file mode 100644
index 00000000..b0ebc7a6
--- /dev/null
+++ b/ptvsd/pydevd/conftest.py
@@ -0,0 +1,163 @@
+import pytest
+import sys
+from _pydevd_bundle.pydevd_constants import IS_JYTHON, IS_IRONPYTHON
+
+
+# see: http://goo.gl/kTQMs
+SYMBOLS = {
+ 'customary' : ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'),
+ 'customary_ext' : ('byte', 'kilo', 'mega', 'giga', 'tera', 'peta', 'exa',
+ 'zetta', 'iotta'),
+ 'iec' : ('Bi', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'),
+ 'iec_ext' : ('byte', 'kibi', 'mebi', 'gibi', 'tebi', 'pebi', 'exbi',
+ 'zebi', 'yobi'),
+}
+
+def bytes2human(n, format='%(value).1f %(symbol)s', symbols='customary'):
+ """
+ Bytes-to-human / human-to-bytes converter.
+ Based on: http://goo.gl/kTQMs
+ Working with Python 2.x and 3.x.
+
+ Author: Giampaolo Rodola'
+ License: MIT
+ """
+
+ """
+ Convert n bytes into a human readable string based on format.
+ symbols can be either "customary", "customary_ext", "iec" or "iec_ext",
+ see: http://goo.gl/kTQMs
+
+ >>> bytes2human(0)
+ '0.0 B'
+ >>> bytes2human(0.9)
+ '0.0 B'
+ >>> bytes2human(1)
+ '1.0 B'
+ >>> bytes2human(1.9)
+ '1.0 B'
+ >>> bytes2human(1024)
+ '1.0 K'
+ >>> bytes2human(1048576)
+ '1.0 M'
+ >>> bytes2human(1099511627776127398123789121)
+ '909.5 Y'
+
+ >>> bytes2human(9856, symbols="customary")
+ '9.6 K'
+ >>> bytes2human(9856, symbols="customary_ext")
+ '9.6 kilo'
+ >>> bytes2human(9856, symbols="iec")
+ '9.6 Ki'
+ >>> bytes2human(9856, symbols="iec_ext")
+ '9.6 kibi'
+
+ >>> bytes2human(10000, "%(value).1f %(symbol)s/sec")
+ '9.8 K/sec'
+
+ >>> # precision can be adjusted by playing with %f operator
+ >>> bytes2human(10000, format="%(value).5f %(symbol)s")
+ '9.76562 K'
+ """
+ n = int(n)
+ if n < 0:
+ raise ValueError("n < 0")
+ symbols = SYMBOLS[symbols]
+ prefix = {}
+ for i, s in enumerate(symbols[1:]):
+ prefix[s] = 1 << (i+1)*10
+ for symbol in reversed(symbols[1:]):
+ if n >= prefix[symbol]:
+ value = float(n) / prefix[symbol]
+ return format % locals()
+ return format % dict(symbol=symbols[0], value=n)
+
+def format_memory_info(memory_info, curr_proc_memory_info):
+ return 'Total: %s, Available: %s, Used: %s %%, Curr process: %s' % (
+ bytes2human(memory_info.total), bytes2human(memory_info.available), memory_info.percent, format_process_memory_info(curr_proc_memory_info))
+
+def format_process_memory_info(proc_memory_info):
+ return bytes2human(proc_memory_info.rss)
+
+DEBUG_MEMORY_INFO = False
+
+_global_collect_info = False
+
+@pytest.yield_fixture(autouse=True)
+def before_after_each_function(request):
+ global _global_collect_info
+ import psutil
+ current_pids = set(proc.pid for proc in psutil.process_iter())
+ before_curr_proc_memory_info = psutil.Process().memory_info()
+
+ if _global_collect_info and DEBUG_MEMORY_INFO:
+ try:
+ from pympler import summary, muppy
+ sum1 = summary.summarize(muppy.get_objects())
+ except:
+ import traceback;traceback.print_exc()
+
+ sys.stdout.write(
+'''
+===============================================================================
+Memory before: %s
+%s
+===============================================================================
+''' % (request.function, format_memory_info(psutil.virtual_memory(), before_curr_proc_memory_info)))
+ yield
+
+ processes_info = []
+ for proc in psutil.process_iter():
+ if proc.pid not in current_pids:
+ try:
+ processes_info.append(
+ 'New Process: %s(%s) - %s' % (
+ proc.name(),
+ proc.pid,
+ format_process_memory_info(proc.memory_info())
+ )
+ )
+ except psutil.NoSuchProcess:
+ pass # The process could've died in the meanwhile
+
+ after_curr_proc_memory_info = psutil.Process().memory_info()
+
+ if DEBUG_MEMORY_INFO:
+ try:
+ if after_curr_proc_memory_info.rss - before_curr_proc_memory_info.rss > 10 * 1000 * 1000:
+ # 10 MB leak
+ if _global_collect_info:
+ sum2 = summary.summarize(muppy.get_objects())
+ diff = summary.get_diff(sum1, sum2)
+ sys.stdout.write('===============================================================================\n')
+ sys.stdout.write('Leak info:\n')
+ sys.stdout.write('===============================================================================\n')
+ summary.print_(diff)
+ sys.stdout.write('===============================================================================\n')
+
+ _global_collect_info = True
+ # We'll only really collect the info on the next test (i.e.: if at one test
+ # we used too much memory, the next one will start collecting)
+ else:
+ _global_collect_info = False
+ except:
+ import traceback;traceback.print_exc()
+
+ sys.stdout.write(
+'''
+===============================================================================
+Memory after: %s
+%s%s
+===============================================================================
+
+
+''' % (
+ request.function,
+ format_memory_info(psutil.virtual_memory(), after_curr_proc_memory_info),
+ '' if not processes_info else '\nLeaked processes:\n'+'\n'.join(processes_info)),
+ )
+
+if IS_JYTHON or IS_IRONPYTHON:
+ # On Jython and IronPython, it's a no-op.
+ def before_after_each_function():
+ pass
\ No newline at end of file
diff --git a/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.jar b/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..13372aef
Binary files /dev/null and b/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.properties b/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..9ee9ac96
--- /dev/null
+++ b/ptvsd/pydevd/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Feb 04 13:39:02 CET 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
diff --git a/ptvsd/pydevd/gradlew b/ptvsd/pydevd/gradlew
new file mode 100644
index 00000000..9d82f789
--- /dev/null
+++ b/ptvsd/pydevd/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/ptvsd/pydevd/gradlew.bat b/ptvsd/pydevd/gradlew.bat
new file mode 100644
index 00000000..8a0b282a
--- /dev/null
+++ b/ptvsd/pydevd/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/ptvsd/pydevd/interpreterInfo.py b/ptvsd/pydevd/interpreterInfo.py
new file mode 100644
index 00000000..40c4ebe7
--- /dev/null
+++ b/ptvsd/pydevd/interpreterInfo.py
@@ -0,0 +1,256 @@
+'''
+This module was created to get information available in the interpreter, such as libraries,
+paths, etc.
+
+what is what:
+sys.builtin_module_names: contains the builtin modules embeeded in python (rigth now, we specify all manually).
+sys.prefix: A string giving the site-specific directory prefix where the platform independent Python files are installed
+
+format is something as
+EXECUTABLE:python.exe|libs@compiled_dlls$builtin_mods
+
+all internal are separated by |
+'''
+import sys
+
+try:
+ import os.path
+ def fully_normalize_path(path):
+ '''fixes the path so that the format of the path really reflects the directories in the system
+ '''
+ return os.path.normpath(path)
+ join = os.path.join
+except: # ImportError or AttributeError.
+ # See: http://stackoverflow.com/questions/10254353/error-while-installing-jython-for-pydev
+ def fully_normalize_path(path):
+ '''fixes the path so that the format of the path really reflects the directories in the system
+ '''
+ return path
+
+ def join(a, b):
+ if a.endswith('/') or a.endswith('\\'):
+ return a + b
+ return a + '/' + b
+
+
+IS_PYTHON_3_ONWARDS = 0
+
+try:
+ IS_PYTHON_3_ONWARDS = sys.version_info[0] >= 3
+except:
+ # That's OK, not all versions of python have sys.version_info
+ pass
+
+try:
+ # Just check if False and True are defined (depends on version, not whether it's jython/python)
+ False
+ True
+except:
+ exec ('True, False = 1,0') # An exec is used so that python 3k does not give a syntax error
+
+if sys.platform == "cygwin":
+
+ try:
+ import ctypes # use from the system if available
+ except ImportError:
+ sys.path.append(join(sys.path[0], 'third_party/wrapped_for_pydev'))
+ import ctypes
+
+ def native_path(path):
+ MAX_PATH = 512 # On cygwin NT, its 260 lately, but just need BIG ENOUGH buffer
+ '''Get the native form of the path, like c:\\Foo for /cygdrive/c/Foo'''
+
+ retval = ctypes.create_string_buffer(MAX_PATH)
+ path = fully_normalize_path(path)
+ path = tobytes(path)
+ CCP_POSIX_TO_WIN_A = 0
+ cygwin1dll = ctypes.cdll.LoadLibrary( 'cygwin1.dll' )
+ cygwin1dll.cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, retval, MAX_PATH)
+
+ return retval.value
+
+else:
+ def native_path(path):
+ return fully_normalize_path(path)
+
+
+
+def __getfilesystemencoding():
+ '''
+ Note: there's a copy of this method in _pydev_filesystem_encoding.py
+ '''
+ try:
+ ret = sys.getfilesystemencoding()
+ if not ret:
+ raise RuntimeError('Unable to get encoding.')
+ return ret
+ except:
+ try:
+ # Handle Jython
+ from java.lang import System # @UnresolvedImport
+ env = System.getProperty("os.name").lower()
+ if env.find('win') != -1:
+ return 'ISO-8859-1' # mbcs does not work on Jython, so, use a (hopefully) suitable replacement
+ return 'utf-8'
+ except:
+ pass
+
+ # Only available from 2.3 onwards.
+ if sys.platform == 'win32':
+ return 'mbcs'
+ return 'utf-8'
+
+def getfilesystemencoding():
+ try:
+ ret = __getfilesystemencoding()
+
+ #Check if the encoding is actually there to be used!
+ if hasattr('', 'encode'):
+ ''.encode(ret)
+ if hasattr('', 'decode'):
+ ''.decode(ret)
+
+ return ret
+ except:
+ return 'utf-8'
+
+file_system_encoding = getfilesystemencoding()
+
+if IS_PYTHON_3_ONWARDS:
+ unicode_type = str
+ bytes_type = bytes
+
+else:
+ unicode_type = unicode
+ bytes_type = str
+
+
+def tounicode(s):
+ if hasattr(s, 'decode'):
+ if not isinstance(s, unicode_type):
+ # Depending on the platform variant we may have decode on string or not.
+ return s.decode(file_system_encoding)
+ return s
+
+def tobytes(s):
+ if hasattr(s, 'encode'):
+ if not isinstance(s, bytes_type):
+ return s.encode(file_system_encoding)
+ return s
+
+def toasciimxl(s):
+ # output for xml without a declared encoding
+
+ # As the output is xml, we have to encode chars (< and > are ok as they're not accepted in the filesystem name --
+ # if it was allowed, we'd have to do things more selectively so that < and > don't get wrongly replaced).
+ s = s.replace("&", "&")
+
+ try:
+ ret = s.encode('ascii', 'xmlcharrefreplace')
+ except:
+ # use workaround
+ ret = ''
+ for c in s:
+ try:
+ ret += c.encode('ascii')
+ except:
+ try:
+ # Python 2: unicode is a valid identifier
+ ret += unicode("%d;") % ord(c)
+ except:
+ # Python 3: a string is already unicode, so, just doing it directly should work.
+ ret += "%d;" % ord(c)
+ return ret
+
+
+if __name__ == '__main__':
+ try:
+ # just give some time to get the reading threads attached (just in case)
+ import time
+ time.sleep(0.1)
+ except:
+ pass
+
+ try:
+ executable = tounicode(native_path(sys.executable))
+ except:
+ executable = tounicode(sys.executable)
+
+ if sys.platform == "cygwin" and not executable.endswith(tounicode('.exe')):
+ executable += tounicode('.exe')
+
+
+ try:
+ major = str(sys.version_info[0])
+ minor = str(sys.version_info[1])
+ except AttributeError:
+ # older versions of python don't have version_info
+ import string
+ s = string.split(sys.version, ' ')[0]
+ s = string.split(s, '.')
+ major = s[0]
+ minor = s[1]
+
+ s = tounicode('%s.%s') % (tounicode(major), tounicode(minor))
+
+ contents = [tounicode('')]
+ contents.append(tounicode('%s ') % (tounicode(s),))
+
+ contents.append(tounicode('%s ') % tounicode(executable))
+
+ # this is the new implementation to get the system folders
+ # (still need to check if it works in linux)
+ # (previously, we were getting the executable dir, but that is not always correct...)
+ prefix = tounicode(native_path(sys.prefix))
+ # print_ 'prefix is', prefix
+
+
+ result = []
+
+ path_used = sys.path
+ try:
+ path_used = path_used[1:] # Use a copy (and don't include the directory of this script as a path.)
+ except:
+ pass # just ignore it...
+
+ for p in path_used:
+ p = tounicode(native_path(p))
+
+ try:
+ import string # to be compatible with older versions
+ if string.find(p, prefix) == 0: # was startswith
+ result.append((p, True))
+ else:
+ result.append((p, False))
+ except (ImportError, AttributeError):
+ # python 3k also does not have it
+ # jython may not have it (depending on how are things configured)
+ if p.startswith(prefix): # was startswith
+ result.append((p, True))
+ else:
+ result.append((p, False))
+
+ for p, b in result:
+ if b:
+ contents.append(tounicode('%s ') % (p,))
+ else:
+ contents.append(tounicode('%s ') % (p,))
+
+ # no compiled libs
+ # nor forced libs
+
+ for builtinMod in sys.builtin_module_names:
+ contents.append(tounicode('%s ') % tounicode(builtinMod))
+
+
+ contents.append(tounicode(' '))
+ unic = tounicode('\n').join(contents)
+ inasciixml = toasciimxl(unic)
+ if IS_PYTHON_3_ONWARDS:
+ # This is the 'official' way of writing binary output in Py3K (see: http://bugs.python.org/issue4571)
+ sys.stdout.buffer.write(inasciixml)
+ else:
+ sys.stdout.write(inasciixml)
+
+ sys.stdout.flush()
+ sys.stderr.flush()
diff --git a/ptvsd/pydevd/jython_test_deps/ant.jar b/ptvsd/pydevd/jython_test_deps/ant.jar
new file mode 100644
index 00000000..24641e74
Binary files /dev/null and b/ptvsd/pydevd/jython_test_deps/ant.jar differ
diff --git a/ptvsd/pydevd/jython_test_deps/junit.jar b/ptvsd/pydevd/jython_test_deps/junit.jar
new file mode 100644
index 00000000..5b4bb849
Binary files /dev/null and b/ptvsd/pydevd/jython_test_deps/junit.jar differ
diff --git a/ptvsd/pydevd/pycompletionserver.py b/ptvsd/pydevd/pycompletionserver.py
new file mode 100644
index 00000000..d73c9020
--- /dev/null
+++ b/ptvsd/pydevd/pycompletionserver.py
@@ -0,0 +1,405 @@
+'''
+Entry-point module to start the code-completion server for PyDev.
+
+@author Fabio Zadrozny
+'''
+import sys
+IS_PYTHON_3_ONWARDS = sys.version_info[0] >= 3
+
+if not IS_PYTHON_3_ONWARDS:
+ import __builtin__
+else:
+ import builtins as __builtin__ # Python 3.0
+
+from _pydevd_bundle.pydevd_constants import IS_JYTHON
+
+if IS_JYTHON:
+ import java.lang # @UnresolvedImport
+ SERVER_NAME = 'jycompletionserver'
+ from _pydev_bundle import _pydev_jy_imports_tipper
+ _pydev_imports_tipper = _pydev_jy_imports_tipper
+
+else:
+ # it is python
+ SERVER_NAME = 'pycompletionserver'
+ from _pydev_bundle import _pydev_imports_tipper
+
+
+from _pydev_imps._pydev_saved_modules import socket
+
+import sys
+if sys.platform == "darwin":
+ # See: https://sourceforge.net/projects/pydev/forums/forum/293649/topic/3454227
+ try:
+ import _CF # Don't fail if it doesn't work -- do it because it must be loaded on the main thread! @UnresolvedImport @UnusedImport
+ except:
+ pass
+
+
+# initial sys.path
+_sys_path = []
+for p in sys.path:
+ # changed to be compatible with 1.5
+ _sys_path.append(p)
+
+# initial sys.modules
+_sys_modules = {}
+for name, mod in sys.modules.items():
+ _sys_modules[name] = mod
+
+
+import traceback
+
+from _pydev_imps._pydev_saved_modules import time
+
+try:
+ import StringIO
+except:
+ import io as StringIO #Python 3.0
+
+try:
+ from urllib import quote_plus, unquote_plus
+except ImportError:
+ from urllib.parse import quote_plus, unquote_plus #Python 3.0
+
+INFO1 = 1
+INFO2 = 2
+WARN = 4
+ERROR = 8
+
+DEBUG = INFO1 | ERROR
+
+def dbg(s, prior):
+ if prior & DEBUG != 0:
+ sys.stdout.write('%s\n' % (s,))
+# f = open('c:/temp/test.txt', 'a')
+# print_ >> f, s
+# f.close()
+
+from _pydev_bundle import pydev_localhost
+HOST = pydev_localhost.get_localhost() # Symbolic name meaning the local host
+
+MSG_KILL_SERVER = '@@KILL_SERVER_END@@'
+MSG_COMPLETIONS = '@@COMPLETIONS'
+MSG_END = 'END@@'
+MSG_INVALID_REQUEST = '@@INVALID_REQUEST'
+MSG_JYTHON_INVALID_REQUEST = '@@JYTHON_INVALID_REQUEST'
+MSG_CHANGE_DIR = '@@CHANGE_DIR:'
+MSG_OK = '@@MSG_OK_END@@'
+MSG_IMPORTS = '@@IMPORTS:'
+MSG_PYTHONPATH = '@@PYTHONPATH_END@@'
+MSG_CHANGE_PYTHONPATH = '@@CHANGE_PYTHONPATH:'
+MSG_JEDI = '@@MSG_JEDI:'
+MSG_SEARCH = '@@SEARCH'
+
+BUFFER_SIZE = 1024
+
+
+
+currDirModule = None
+
+def complete_from_dir(directory):
+ '''
+ This is necessary so that we get the imports from the same directory where the file
+ we are completing is located.
+ '''
+ global currDirModule
+ if currDirModule is not None:
+ if len(sys.path) > 0 and sys.path[0] == currDirModule:
+ del sys.path[0]
+
+ currDirModule = directory
+ sys.path.insert(0, directory)
+
+
+def change_python_path(pythonpath):
+ '''Changes the pythonpath (clears all the previous pythonpath)
+
+ @param pythonpath: string with paths separated by |
+ '''
+
+ split = pythonpath.split('|')
+ sys.path = []
+ for path in split:
+ path = path.strip()
+ if len(path) > 0:
+ sys.path.append(path)
+
+
+class Processor:
+
+ def __init__(self):
+ # nothing to do
+ return
+
+ def remove_invalid_chars(self, msg):
+ try:
+ msg = str(msg)
+ except UnicodeDecodeError:
+ pass
+
+ if msg:
+ try:
+ return quote_plus(msg)
+ except:
+ sys.stdout.write('error making quote plus in %s\n' % (msg,))
+ raise
+ return ' '
+
+ def format_completion_message(self, defFile, completionsList):
+ '''
+ Format the completions suggestions in the following format:
+ @@COMPLETIONS(modFile(token,description),(token,description),(token,description))END@@
+ '''
+ compMsg = []
+ compMsg.append('%s' % defFile)
+ for tup in completionsList:
+ compMsg.append(',')
+
+ compMsg.append('(')
+ compMsg.append(str(self.remove_invalid_chars(tup[0]))) # token
+ compMsg.append(',')
+ compMsg.append(self.remove_invalid_chars(tup[1])) # description
+
+ if(len(tup) > 2):
+ compMsg.append(',')
+ compMsg.append(self.remove_invalid_chars(tup[2])) # args - only if function.
+
+ if(len(tup) > 3):
+ compMsg.append(',')
+ compMsg.append(self.remove_invalid_chars(tup[3])) # TYPE
+
+ compMsg.append(')')
+
+ return '%s(%s)%s' % (MSG_COMPLETIONS, ''.join(compMsg), MSG_END)
+
+class Exit(Exception):
+ pass
+
+class CompletionServer:
+
+ def __init__(self, port):
+ self.ended = False
+ self.port = port
+ self.socket = None # socket to send messages.
+ self.exit_process_on_kill = True
+ self.processor = Processor()
+
+
+ def connect_to_server(self):
+ from _pydev_imps._pydev_saved_modules import socket
+
+ self.socket = s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect((HOST, self.port))
+ except:
+ sys.stderr.write('Error on connect_to_server with parameters: host: %s port: %s\n' % (HOST, self.port))
+ raise
+
+ def get_completions_message(self, defFile, completionsList):
+ '''
+ get message with completions.
+ '''
+ return self.processor.format_completion_message(defFile, completionsList)
+
+ def get_token_and_data(self, data):
+ '''
+ When we receive this, we have 'token):data'
+ '''
+ token = ''
+ for c in data:
+ if c != ')':
+ token = token + c
+ else:
+ break;
+
+ return token, data.lstrip(token + '):')
+
+ def emulated_sendall(self, msg):
+ MSGLEN = 1024 * 20
+
+ totalsent = 0
+ while totalsent < MSGLEN:
+ sent = self.socket.send(msg[totalsent:])
+ if sent == 0:
+ return
+ totalsent = totalsent + sent
+
+
+ def send(self, msg):
+ if not hasattr(self.socket, 'sendall'):
+ #Older versions (jython 2.1)
+ self.emulated_sendall(msg)
+ else:
+ if IS_PYTHON_3_ONWARDS:
+ self.socket.sendall(bytearray(msg, 'utf-8'))
+ else:
+ self.socket.sendall(msg)
+
+
+ def run(self):
+ # Echo server program
+ try:
+ from _pydev_bundle import _pydev_log
+ log = _pydev_log.Log()
+
+ dbg(SERVER_NAME + ' connecting to java server on %s (%s)' % (HOST, self.port) , INFO1)
+ # after being connected, create a socket as a client.
+ self.connect_to_server()
+
+ dbg(SERVER_NAME + ' Connected to java server', INFO1)
+
+
+ while not self.ended:
+ data = ''
+
+ while data.find(MSG_END) == -1:
+ received = self.socket.recv(BUFFER_SIZE)
+ if len(received) == 0:
+ raise Exit() # ok, connection ended
+ if IS_PYTHON_3_ONWARDS:
+ data = data + received.decode('utf-8')
+ else:
+ data = data + received
+
+ try:
+ try:
+ if data.find(MSG_KILL_SERVER) != -1:
+ dbg(SERVER_NAME + ' kill message received', INFO1)
+ # break if we received kill message.
+ self.ended = True
+ raise Exit()
+
+ dbg(SERVER_NAME + ' starting keep alive thread', INFO2)
+
+ if data.find(MSG_PYTHONPATH) != -1:
+ comps = []
+ for p in _sys_path:
+ comps.append((p, ' '))
+ self.send(self.get_completions_message(None, comps))
+
+ else:
+ data = data[:data.rfind(MSG_END)]
+
+ if data.startswith(MSG_IMPORTS):
+ data = data[len(MSG_IMPORTS):]
+ data = unquote_plus(data)
+ defFile, comps = _pydev_imports_tipper.generate_tip(data, log)
+ self.send(self.get_completions_message(defFile, comps))
+
+ elif data.startswith(MSG_CHANGE_PYTHONPATH):
+ data = data[len(MSG_CHANGE_PYTHONPATH):]
+ data = unquote_plus(data)
+ change_python_path(data)
+ self.send(MSG_OK)
+
+ elif data.startswith(MSG_JEDI):
+ data = data[len(MSG_JEDI):]
+ data = unquote_plus(data)
+ line, column, encoding, path, source = data.split('|', 4)
+ try:
+ import jedi # @UnresolvedImport
+ except:
+ self.send(self.get_completions_message(None, [('Error on import jedi', 'Error importing jedi', '')]))
+ else:
+ script = jedi.Script(
+ # Line +1 because it expects lines 1-based (and col 0-based)
+ source=source,
+ line=int(line) + 1,
+ column=int(column),
+ source_encoding=encoding,
+ path=path,
+ )
+ lst = []
+ for completion in script.completions():
+ t = completion.type
+ if t == 'class':
+ t = '1'
+
+ elif t == 'function':
+ t = '2'
+
+ elif t == 'import':
+ t = '0'
+
+ elif t == 'keyword':
+ continue # Keywords are already handled in PyDev
+
+ elif t == 'statement':
+ t = '3'
+
+ else:
+ t = '-1'
+
+ # gen list(tuple(name, doc, args, type))
+ lst.append((completion.name, '', '', t))
+ self.send(self.get_completions_message('empty', lst))
+
+ elif data.startswith(MSG_SEARCH):
+ data = data[len(MSG_SEARCH):]
+ data = unquote_plus(data)
+ (f, line, col), foundAs = _pydev_imports_tipper.search_definition(data)
+ self.send(self.get_completions_message(f, [(line, col, foundAs)]))
+
+ elif data.startswith(MSG_CHANGE_DIR):
+ data = data[len(MSG_CHANGE_DIR):]
+ data = unquote_plus(data)
+ complete_from_dir(data)
+ self.send(MSG_OK)
+
+ else:
+ self.send(MSG_INVALID_REQUEST)
+ except Exit:
+ e = sys.exc_info()[1]
+ msg = self.get_completions_message(None, [('Exit:', 'SystemExit', '')])
+ try:
+ self.send(msg)
+ except socket.error:
+ pass # Ok, may be closed already
+
+ raise e # raise original error.
+
+ except:
+ dbg(SERVER_NAME + ' exception occurred', ERROR)
+ s = StringIO.StringIO()
+ traceback.print_exc(file=s)
+
+ err = s.getvalue()
+ dbg(SERVER_NAME + ' received error: ' + str(err), ERROR)
+ msg = self.get_completions_message(None, [('ERROR:', '%s\nLog:%s' % (err, log.get_contents()), '')])
+ try:
+ self.send(msg)
+ except socket.error:
+ pass # Ok, may be closed already
+
+
+ finally:
+ log.clear_log()
+
+ self.socket.close()
+ self.ended = True
+ raise Exit() # connection broken
+
+
+ except Exit:
+ if self.exit_process_on_kill:
+ sys.exit(0)
+ # No need to log SystemExit error
+ except:
+ s = StringIO.StringIO()
+ exc_info = sys.exc_info()
+
+ traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], limit=None, file=s)
+ err = s.getvalue()
+ dbg(SERVER_NAME + ' received error: ' + str(err), ERROR)
+ raise
+
+
+
+if __name__ == '__main__':
+
+ port = int(sys.argv[1]) # this is from where we want to receive messages.
+
+ t = CompletionServer(port)
+ dbg(SERVER_NAME + ' will start', INFO1)
+ t.run()
diff --git a/ptvsd/pydevd/pydev_app_engine_debug_startup.py b/ptvsd/pydevd/pydev_app_engine_debug_startup.py
new file mode 100644
index 00000000..464f0ddf
--- /dev/null
+++ b/ptvsd/pydevd/pydev_app_engine_debug_startup.py
@@ -0,0 +1,21 @@
+if False:
+ config = None
+
+
+# See: https://docs.google.com/document/d/1CCSaRiIWCLgbD3OwmuKsRoHHDfBffbROWyVWWL0ZXN4/edit
+if ':' not in config.version_id:
+ # The default server version_id does not contain ':'
+ import json
+ import os
+ import sys
+
+ startup = config.python_config.startup_args
+ if not startup:
+ raise AssertionError('Expected --python_startup_args to be passed from the pydev debugger.')
+
+ setup = json.loads(startup)
+ pydevd_path = setup['pydevd']
+ sys.path.append(os.path.dirname(pydevd_path))
+
+ import pydevd
+ pydevd.settrace(setup['client'], port=setup['port'], suspend=False, trace_only_current_thread=False)
diff --git a/ptvsd/pydevd/pydev_coverage.py b/ptvsd/pydevd/pydev_coverage.py
new file mode 100644
index 00000000..279ae65a
--- /dev/null
+++ b/ptvsd/pydevd/pydev_coverage.py
@@ -0,0 +1,62 @@
+'''
+Entry point module to run code-coverage.
+'''
+
+def execute():
+ import os
+ import sys
+
+ files = None
+ if 'combine' not in sys.argv:
+
+ if '--pydev-analyze' in sys.argv:
+
+ #Ok, what we want here is having the files passed through stdin (because
+ #there may be too many files for passing in the command line -- we could
+ #just pass a dir and make the find files here, but as that's already
+ #given in the java side, let's just gather that info here).
+ sys.argv.remove('--pydev-analyze')
+ try:
+ s = raw_input()
+ except:
+ s = input()
+ s = s.replace('\r', '')
+ s = s.replace('\n', '')
+ files = s.split('|')
+ files = [v for v in files if len(v) > 0]
+
+ #Note that in this case we'll already be in the working dir with the coverage files, so, the
+ #coverage file location is not passed.
+
+ else:
+ #For all commands, the coverage file is configured in pydev, and passed as the first argument
+ #in the command line, so, let's make sure this gets to the coverage module.
+ os.environ['COVERAGE_FILE'] = sys.argv[1]
+ del sys.argv[1]
+
+ try:
+ import coverage #@UnresolvedImport
+ except:
+ sys.stderr.write('Error: coverage module could not be imported\n')
+ sys.stderr.write('Please make sure that the coverage module (http://nedbatchelder.com/code/coverage/)\n')
+ sys.stderr.write('is properly installed in your interpreter: %s\n' % (sys.executable,))
+
+ import traceback;traceback.print_exc()
+ return
+
+ version = tuple(map(int, coverage.__version__.split('.')[:2]))
+ if version < (4, 3):
+ sys.stderr.write('Error: minimum supported coverage version is 4.3.\nFound: %s\nLocation: %s' % ('.'.join(str(x) for x in version), coverage.__file__))
+ sys.exit(1)
+
+ #print(coverage.__version__) TODO: Check if the version is a version we support (should be at least 3.4) -- note that maybe the attr is not there.
+ from coverage.cmdline import main #@UnresolvedImport
+
+ if files is not None:
+ sys.argv.append('xml')
+ sys.argv += files
+
+ main()
+
+if __name__ == '__main__':
+ execute()
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydev_ipython/README b/ptvsd/pydevd/pydev_ipython/README
new file mode 100644
index 00000000..185d417d
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/README
@@ -0,0 +1,8 @@
+# Parts of IPython, files from: https://github.com/ipython/ipython/tree/rel-1.0.0/IPython
+# The files in this package are extracted from IPython to aid the main loop integration
+# See tests_mainloop for some manually runable tests
+
+# What we are doing is reusing the "inputhook" functionality (i.e. what in IPython
+# ends up on PyOS_InputHook) and using it in the pydevconsole context.
+# Rather that having the callbacks called in PyOS_InputHook, we use a custom XML-RPC
+# Server (HookableXMLRPCServer) that calls the inputhook when idle
diff --git a/ptvsd/pydevd/pydev_ipython/__init__.py b/ptvsd/pydevd/pydev_ipython/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/ptvsd/pydevd/pydev_ipython/inputhook.py b/ptvsd/pydevd/pydev_ipython/inputhook.py
new file mode 100644
index 00000000..b2769fd3
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhook.py
@@ -0,0 +1,579 @@
+# coding: utf-8
+"""
+Inputhook management for GUI event loop integration.
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2008-2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import sys
+import select
+
+#-----------------------------------------------------------------------------
+# Constants
+#-----------------------------------------------------------------------------
+
+# Constants for identifying the GUI toolkits.
+GUI_WX = 'wx'
+GUI_QT = 'qt'
+GUI_QT4 = 'qt4'
+GUI_QT5 = 'qt5'
+GUI_GTK = 'gtk'
+GUI_TK = 'tk'
+GUI_OSX = 'osx'
+GUI_GLUT = 'glut'
+GUI_PYGLET = 'pyglet'
+GUI_GTK3 = 'gtk3'
+GUI_NONE = 'none' # i.e. disable
+
+#-----------------------------------------------------------------------------
+# Utilities
+#-----------------------------------------------------------------------------
+
+def ignore_CTRL_C():
+ """Ignore CTRL+C (not implemented)."""
+ pass
+
+def allow_CTRL_C():
+ """Take CTRL+C into account (not implemented)."""
+ pass
+
+#-----------------------------------------------------------------------------
+# Main InputHookManager class
+#-----------------------------------------------------------------------------
+
+
+class InputHookManager(object):
+ """Manage PyOS_InputHook for different GUI toolkits.
+
+ This class installs various hooks under ``PyOSInputHook`` to handle
+ GUI event loop integration.
+ """
+
+ def __init__(self):
+ self._return_control_callback = None
+ self._apps = {}
+ self._reset()
+ self.pyplot_imported = False
+
+ def _reset(self):
+ self._callback_pyfunctype = None
+ self._callback = None
+ self._current_gui = None
+
+ def set_return_control_callback(self, return_control_callback):
+ self._return_control_callback = return_control_callback
+
+ def get_return_control_callback(self):
+ return self._return_control_callback
+
+ def return_control(self):
+ return self._return_control_callback()
+
+ def get_inputhook(self):
+ return self._callback
+
+ def set_inputhook(self, callback):
+ """Set inputhook to callback."""
+ # We don't (in the context of PyDev console) actually set PyOS_InputHook, but rather
+ # while waiting for input on xmlrpc we run this code
+ self._callback = callback
+
+ def clear_inputhook(self, app=None):
+ """Clear input hook.
+
+ Parameters
+ ----------
+ app : optional, ignored
+ This parameter is allowed only so that clear_inputhook() can be
+ called with a similar interface as all the ``enable_*`` methods. But
+ the actual value of the parameter is ignored. This uniform interface
+ makes it easier to have user-level entry points in the main IPython
+ app like :meth:`enable_gui`."""
+ self._reset()
+
+ def clear_app_refs(self, gui=None):
+ """Clear IPython's internal reference to an application instance.
+
+ Whenever we create an app for a user on qt4 or wx, we hold a
+ reference to the app. This is needed because in some cases bad things
+ can happen if a user doesn't hold a reference themselves. This
+ method is provided to clear the references we are holding.
+
+ Parameters
+ ----------
+ gui : None or str
+ If None, clear all app references. If ('wx', 'qt4') clear
+ the app for that toolkit. References are not held for gtk or tk
+ as those toolkits don't have the notion of an app.
+ """
+ if gui is None:
+ self._apps = {}
+ elif gui in self._apps:
+ del self._apps[gui]
+
+ def enable_wx(self, app=None):
+ """Enable event loop integration with wxPython.
+
+ Parameters
+ ----------
+ app : WX Application, optional.
+ Running application to use. If not given, we probe WX for an
+ existing application object, and create a new one if none is found.
+
+ Notes
+ -----
+ This methods sets the ``PyOS_InputHook`` for wxPython, which allows
+ the wxPython to integrate with terminal based applications like
+ IPython.
+
+ If ``app`` is not given we probe for an existing one, and return it if
+ found. If no existing app is found, we create an :class:`wx.App` as
+ follows::
+
+ import wx
+ app = wx.App(redirect=False, clearSigInt=False)
+ """
+ import wx
+ from distutils.version import LooseVersion as V
+ wx_version = V(wx.__version__).version # @UndefinedVariable
+
+ if wx_version < [2, 8]:
+ raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__) # @UndefinedVariable
+
+ from pydev_ipython.inputhookwx import inputhook_wx
+ self.set_inputhook(inputhook_wx)
+ self._current_gui = GUI_WX
+
+ if app is None:
+ app = wx.GetApp() # @UndefinedVariable
+ if app is None:
+ app = wx.App(redirect=False, clearSigInt=False) # @UndefinedVariable
+ app._in_event_loop = True
+ self._apps[GUI_WX] = app
+ return app
+
+ def disable_wx(self):
+ """Disable event loop integration with wxPython.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ if GUI_WX in self._apps:
+ self._apps[GUI_WX]._in_event_loop = False
+ self.clear_inputhook()
+
+ def enable_qt4(self, app=None):
+ """Enable event loop integration with PyQt4.
+
+ Parameters
+ ----------
+ app : Qt Application, optional.
+ Running application to use. If not given, we probe Qt for an
+ existing application object, and create a new one if none is found.
+
+ Notes
+ -----
+ This methods sets the PyOS_InputHook for PyQt4, which allows
+ the PyQt4 to integrate with terminal based applications like
+ IPython.
+
+ If ``app`` is not given we probe for an existing one, and return it if
+ found. If no existing app is found, we create an :class:`QApplication`
+ as follows::
+
+ from PyQt4 import QtCore
+ app = QtGui.QApplication(sys.argv)
+ """
+ from pydev_ipython.inputhookqt4 import create_inputhook_qt4
+ app, inputhook_qt4 = create_inputhook_qt4(self, app)
+ self.set_inputhook(inputhook_qt4)
+
+ self._current_gui = GUI_QT4
+ app._in_event_loop = True
+ self._apps[GUI_QT4] = app
+ return app
+
+ def disable_qt4(self):
+ """Disable event loop integration with PyQt4.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ if GUI_QT4 in self._apps:
+ self._apps[GUI_QT4]._in_event_loop = False
+ self.clear_inputhook()
+
+ def enable_qt5(self, app=None):
+ from pydev_ipython.inputhookqt5 import create_inputhook_qt5
+ app, inputhook_qt5 = create_inputhook_qt5(self, app)
+ self.set_inputhook(inputhook_qt5)
+
+ self._current_gui = GUI_QT5
+ app._in_event_loop = True
+ self._apps[GUI_QT5] = app
+ return app
+
+ def disable_qt5(self):
+ if GUI_QT5 in self._apps:
+ self._apps[GUI_QT5]._in_event_loop = False
+ self.clear_inputhook()
+
+ def enable_gtk(self, app=None):
+ """Enable event loop integration with PyGTK.
+
+ Parameters
+ ----------
+ app : ignored
+ Ignored, it's only a placeholder to keep the call signature of all
+ gui activation methods consistent, which simplifies the logic of
+ supporting magics.
+
+ Notes
+ -----
+ This methods sets the PyOS_InputHook for PyGTK, which allows
+ the PyGTK to integrate with terminal based applications like
+ IPython.
+ """
+ from pydev_ipython.inputhookgtk import create_inputhook_gtk
+ self.set_inputhook(create_inputhook_gtk(self._stdin_file))
+ self._current_gui = GUI_GTK
+
+ def disable_gtk(self):
+ """Disable event loop integration with PyGTK.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ self.clear_inputhook()
+
+ def enable_tk(self, app=None):
+ """Enable event loop integration with Tk.
+
+ Parameters
+ ----------
+ app : toplevel :class:`Tkinter.Tk` widget, optional.
+ Running toplevel widget to use. If not given, we probe Tk for an
+ existing one, and create a new one if none is found.
+
+ Notes
+ -----
+ If you have already created a :class:`Tkinter.Tk` object, the only
+ thing done by this method is to register with the
+ :class:`InputHookManager`, since creating that object automatically
+ sets ``PyOS_InputHook``.
+ """
+ self._current_gui = GUI_TK
+ if app is None:
+ try:
+ import Tkinter as _TK
+ except:
+ # Python 3
+ import tkinter as _TK # @UnresolvedImport
+ app = _TK.Tk()
+ app.withdraw()
+ self._apps[GUI_TK] = app
+
+ from pydev_ipython.inputhooktk import create_inputhook_tk
+ self.set_inputhook(create_inputhook_tk(app))
+ return app
+
+ def disable_tk(self):
+ """Disable event loop integration with Tkinter.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ self.clear_inputhook()
+
+
+ def enable_glut(self, app=None):
+ """ Enable event loop integration with GLUT.
+
+ Parameters
+ ----------
+
+ app : ignored
+ Ignored, it's only a placeholder to keep the call signature of all
+ gui activation methods consistent, which simplifies the logic of
+ supporting magics.
+
+ Notes
+ -----
+
+ This methods sets the PyOS_InputHook for GLUT, which allows the GLUT to
+ integrate with terminal based applications like IPython. Due to GLUT
+ limitations, it is currently not possible to start the event loop
+ without first creating a window. You should thus not create another
+ window but use instead the created one. See 'gui-glut.py' in the
+ docs/examples/lib directory.
+
+ The default screen mode is set to:
+ glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH
+ """
+
+ import OpenGL.GLUT as glut # @UnresolvedImport
+ from pydev_ipython.inputhookglut import glut_display_mode, \
+ glut_close, glut_display, \
+ glut_idle, inputhook_glut
+
+ if GUI_GLUT not in self._apps:
+ glut.glutInit(sys.argv)
+ glut.glutInitDisplayMode(glut_display_mode)
+ # This is specific to freeglut
+ if bool(glut.glutSetOption):
+ glut.glutSetOption(glut.GLUT_ACTION_ON_WINDOW_CLOSE,
+ glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS)
+ glut.glutCreateWindow(sys.argv[0])
+ glut.glutReshapeWindow(1, 1)
+ glut.glutHideWindow()
+ glut.glutWMCloseFunc(glut_close)
+ glut.glutDisplayFunc(glut_display)
+ glut.glutIdleFunc(glut_idle)
+ else:
+ glut.glutWMCloseFunc(glut_close)
+ glut.glutDisplayFunc(glut_display)
+ glut.glutIdleFunc(glut_idle)
+ self.set_inputhook(inputhook_glut)
+ self._current_gui = GUI_GLUT
+ self._apps[GUI_GLUT] = True
+
+
+ def disable_glut(self):
+ """Disable event loop integration with glut.
+
+ This sets PyOS_InputHook to NULL and set the display function to a
+ dummy one and set the timer to a dummy timer that will be triggered
+ very far in the future.
+ """
+ import OpenGL.GLUT as glut # @UnresolvedImport
+ from glut_support import glutMainLoopEvent # @UnresolvedImport
+
+ glut.glutHideWindow() # This is an event to be processed below
+ glutMainLoopEvent()
+ self.clear_inputhook()
+
+ def enable_pyglet(self, app=None):
+ """Enable event loop integration with pyglet.
+
+ Parameters
+ ----------
+ app : ignored
+ Ignored, it's only a placeholder to keep the call signature of all
+ gui activation methods consistent, which simplifies the logic of
+ supporting magics.
+
+ Notes
+ -----
+ This methods sets the ``PyOS_InputHook`` for pyglet, which allows
+ pyglet to integrate with terminal based applications like
+ IPython.
+
+ """
+ from pydev_ipython.inputhookpyglet import inputhook_pyglet
+ self.set_inputhook(inputhook_pyglet)
+ self._current_gui = GUI_PYGLET
+ return app
+
+ def disable_pyglet(self):
+ """Disable event loop integration with pyglet.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ self.clear_inputhook()
+
+ def enable_gtk3(self, app=None):
+ """Enable event loop integration with Gtk3 (gir bindings).
+
+ Parameters
+ ----------
+ app : ignored
+ Ignored, it's only a placeholder to keep the call signature of all
+ gui activation methods consistent, which simplifies the logic of
+ supporting magics.
+
+ Notes
+ -----
+ This methods sets the PyOS_InputHook for Gtk3, which allows
+ the Gtk3 to integrate with terminal based applications like
+ IPython.
+ """
+ from pydev_ipython.inputhookgtk3 import create_inputhook_gtk3
+ self.set_inputhook(create_inputhook_gtk3(self._stdin_file))
+ self._current_gui = GUI_GTK
+
+ def disable_gtk3(self):
+ """Disable event loop integration with PyGTK.
+
+ This merely sets PyOS_InputHook to NULL.
+ """
+ self.clear_inputhook()
+
+ def enable_mac(self, app=None):
+ """ Enable event loop integration with MacOSX.
+
+ We call function pyplot.pause, which updates and displays active
+ figure during pause. It's not MacOSX-specific, but it enables to
+ avoid inputhooks in native MacOSX backend.
+ Also we shouldn't import pyplot, until user does it. Cause it's
+ possible to choose backend before importing pyplot for the first
+ time only.
+ """
+ def inputhook_mac(app=None):
+ if self.pyplot_imported:
+ pyplot = sys.modules['matplotlib.pyplot']
+ try:
+ pyplot.pause(0.01)
+ except:
+ pass
+ else:
+ if 'matplotlib.pyplot' in sys.modules:
+ self.pyplot_imported = True
+
+ self.set_inputhook(inputhook_mac)
+ self._current_gui = GUI_OSX
+
+ def disable_mac(self):
+ self.clear_inputhook()
+
+ def current_gui(self):
+ """Return a string indicating the currently active GUI or None."""
+ return self._current_gui
+
+inputhook_manager = InputHookManager()
+
+enable_wx = inputhook_manager.enable_wx
+disable_wx = inputhook_manager.disable_wx
+enable_qt4 = inputhook_manager.enable_qt4
+disable_qt4 = inputhook_manager.disable_qt4
+enable_qt5 = inputhook_manager.enable_qt5
+disable_qt5 = inputhook_manager.disable_qt5
+enable_gtk = inputhook_manager.enable_gtk
+disable_gtk = inputhook_manager.disable_gtk
+enable_tk = inputhook_manager.enable_tk
+disable_tk = inputhook_manager.disable_tk
+enable_glut = inputhook_manager.enable_glut
+disable_glut = inputhook_manager.disable_glut
+enable_pyglet = inputhook_manager.enable_pyglet
+disable_pyglet = inputhook_manager.disable_pyglet
+enable_gtk3 = inputhook_manager.enable_gtk3
+disable_gtk3 = inputhook_manager.disable_gtk3
+enable_mac = inputhook_manager.enable_mac
+disable_mac = inputhook_manager.disable_mac
+clear_inputhook = inputhook_manager.clear_inputhook
+set_inputhook = inputhook_manager.set_inputhook
+current_gui = inputhook_manager.current_gui
+clear_app_refs = inputhook_manager.clear_app_refs
+
+# We maintain this as stdin_ready so that the individual inputhooks
+# can diverge as little as possible from their IPython sources
+stdin_ready = inputhook_manager.return_control
+set_return_control_callback = inputhook_manager.set_return_control_callback
+get_return_control_callback = inputhook_manager.get_return_control_callback
+get_inputhook = inputhook_manager.get_inputhook
+
+# Convenience function to switch amongst them
+def enable_gui(gui=None, app=None):
+ """Switch amongst GUI input hooks by name.
+
+ This is just a utility wrapper around the methods of the InputHookManager
+ object.
+
+ Parameters
+ ----------
+ gui : optional, string or None
+ If None (or 'none'), clears input hook, otherwise it must be one
+ of the recognized GUI names (see ``GUI_*`` constants in module).
+
+ app : optional, existing application object.
+ For toolkits that have the concept of a global app, you can supply an
+ existing one. If not given, the toolkit will be probed for one, and if
+ none is found, a new one will be created. Note that GTK does not have
+ this concept, and passing an app if ``gui=="GTK"`` will raise an error.
+
+ Returns
+ -------
+ The output of the underlying gui switch routine, typically the actual
+ PyOS_InputHook wrapper object or the GUI toolkit app created, if there was
+ one.
+ """
+
+ if get_return_control_callback() is None:
+ raise ValueError("A return_control_callback must be supplied as a reference before a gui can be enabled")
+
+ guis = {GUI_NONE: clear_inputhook,
+ GUI_OSX: enable_mac,
+ GUI_TK: enable_tk,
+ GUI_GTK: enable_gtk,
+ GUI_WX: enable_wx,
+ GUI_QT: enable_qt4, # qt3 not supported
+ GUI_QT4: enable_qt4,
+ GUI_QT5: enable_qt5,
+ GUI_GLUT: enable_glut,
+ GUI_PYGLET: enable_pyglet,
+ GUI_GTK3: enable_gtk3,
+ }
+ try:
+ gui_hook = guis[gui]
+ except KeyError:
+ if gui is None or gui == '':
+ gui_hook = clear_inputhook
+ else:
+ e = "Invalid GUI request %r, valid ones are:%s" % (gui, guis.keys())
+ raise ValueError(e)
+ return gui_hook(app)
+
+__all__ = [
+ "GUI_WX",
+ "GUI_QT",
+ "GUI_QT4",
+ "GUI_QT5",
+ "GUI_GTK",
+ "GUI_TK",
+ "GUI_OSX",
+ "GUI_GLUT",
+ "GUI_PYGLET",
+ "GUI_GTK3",
+ "GUI_NONE",
+
+
+ "ignore_CTRL_C",
+ "allow_CTRL_C",
+
+ "InputHookManager",
+
+ "inputhook_manager",
+
+ "enable_wx",
+ "disable_wx",
+ "enable_qt4",
+ "disable_qt4",
+ "enable_qt5",
+ "disable_qt5",
+ "enable_gtk",
+ "disable_gtk",
+ "enable_tk",
+ "disable_tk",
+ "enable_glut",
+ "disable_glut",
+ "enable_pyglet",
+ "disable_pyglet",
+ "enable_gtk3",
+ "disable_gtk3",
+ "enable_mac",
+ "disable_mac",
+ "clear_inputhook",
+ "set_inputhook",
+ "current_gui",
+ "clear_app_refs",
+
+ "stdin_ready",
+ "set_return_control_callback",
+ "get_return_control_callback",
+ "get_inputhook",
+
+ "enable_gui"]
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookglut.py b/ptvsd/pydevd/pydev_ipython/inputhookglut.py
new file mode 100644
index 00000000..bbd6882f
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookglut.py
@@ -0,0 +1,153 @@
+# coding: utf-8
+"""
+GLUT Inputhook support functions
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2008-2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+# GLUT is quite an old library and it is difficult to ensure proper
+# integration within IPython since original GLUT does not allow to handle
+# events one by one. Instead, it requires for the mainloop to be entered
+# and never returned (there is not even a function to exit he
+# mainloop). Fortunately, there are alternatives such as freeglut
+# (available for linux and windows) and the OSX implementation gives
+# access to a glutCheckLoop() function that blocks itself until a new
+# event is received. This means we have to setup the idle callback to
+# ensure we got at least one event that will unblock the function.
+#
+# Furthermore, it is not possible to install these handlers without a window
+# being first created. We choose to make this window invisible. This means that
+# display mode options are set at this level and user won't be able to change
+# them later without modifying the code. This should probably be made available
+# via IPython options system.
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+import os
+import sys
+from _pydev_imps._pydev_saved_modules import time
+import signal
+import OpenGL.GLUT as glut # @UnresolvedImport
+import OpenGL.platform as platform # @UnresolvedImport
+from timeit import default_timer as clock
+from pydev_ipython.inputhook import stdin_ready
+
+#-----------------------------------------------------------------------------
+# Constants
+#-----------------------------------------------------------------------------
+
+# Frame per second : 60
+# Should probably be an IPython option
+glut_fps = 60
+
+
+# Display mode : double buffeed + rgba + depth
+# Should probably be an IPython option
+glut_display_mode = (glut.GLUT_DOUBLE |
+ glut.GLUT_RGBA |
+ glut.GLUT_DEPTH)
+
+glutMainLoopEvent = None
+if sys.platform == 'darwin':
+ try:
+ glutCheckLoop = platform.createBaseFunction(
+ 'glutCheckLoop', dll=platform.GLUT, resultType=None,
+ argTypes=[],
+ doc='glutCheckLoop( ) -> None',
+ argNames=(),
+ )
+ except AttributeError:
+ raise RuntimeError(
+ '''Your glut implementation does not allow interactive sessions'''
+ '''Consider installing freeglut.''')
+ glutMainLoopEvent = glutCheckLoop
+elif glut.HAVE_FREEGLUT:
+ glutMainLoopEvent = glut.glutMainLoopEvent
+else:
+ raise RuntimeError(
+ '''Your glut implementation does not allow interactive sessions. '''
+ '''Consider installing freeglut.''')
+
+
+#-----------------------------------------------------------------------------
+# Callback functions
+#-----------------------------------------------------------------------------
+
+def glut_display():
+ # Dummy display function
+ pass
+
+def glut_idle():
+ # Dummy idle function
+ pass
+
+def glut_close():
+ # Close function only hides the current window
+ glut.glutHideWindow()
+ glutMainLoopEvent()
+
+def glut_int_handler(signum, frame):
+ # Catch sigint and print the defautl message
+ signal.signal(signal.SIGINT, signal.default_int_handler)
+ print '\nKeyboardInterrupt'
+ # Need to reprint the prompt at this stage
+
+
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+def inputhook_glut():
+ """Run the pyglet event loop by processing pending events only.
+
+ This keeps processing pending events until stdin is ready. After
+ processing all pending events, a call to time.sleep is inserted. This is
+ needed, otherwise, CPU usage is at 100%. This sleep time should be tuned
+ though for best performance.
+ """
+ # We need to protect against a user pressing Control-C when IPython is
+ # idle and this is running. We trap KeyboardInterrupt and pass.
+
+ signal.signal(signal.SIGINT, glut_int_handler)
+
+ try:
+ t = clock()
+
+ # Make sure the default window is set after a window has been closed
+ if glut.glutGetWindow() == 0:
+ glut.glutSetWindow( 1 )
+ glutMainLoopEvent()
+ return 0
+
+ while not stdin_ready():
+ glutMainLoopEvent()
+ # We need to sleep at this point to keep the idle CPU load
+ # low. However, if sleep to long, GUI response is poor. As
+ # a compromise, we watch how often GUI events are being processed
+ # and switch between a short and long sleep time. Here are some
+ # stats useful in helping to tune this.
+ # time CPU load
+ # 0.001 13%
+ # 0.005 3%
+ # 0.01 1.5%
+ # 0.05 0.5%
+ used_time = clock() - t
+ if used_time > 10.0:
+ # print 'Sleep for 1 s' # dbg
+ time.sleep(1.0)
+ elif used_time > 0.1:
+ # Few GUI events coming in, so we can sleep longer
+ # print 'Sleep for 0.05 s' # dbg
+ time.sleep(0.05)
+ else:
+ # Many GUI events coming in, so sleep only very little
+ time.sleep(0.001)
+ except KeyboardInterrupt:
+ pass
+ return 0
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookgtk.py b/ptvsd/pydevd/pydev_ipython/inputhookgtk.py
new file mode 100644
index 00000000..53006cde
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookgtk.py
@@ -0,0 +1,36 @@
+# encoding: utf-8
+"""
+Enable pygtk to be used interacive by setting PyOS_InputHook.
+
+Authors: Brian Granger
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2008-2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import gtk, gobject # @UnresolvedImport
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+
+def _main_quit(*args, **kwargs):
+ gtk.main_quit()
+ return False
+
+def create_inputhook_gtk(stdin_file):
+ def inputhook_gtk():
+ gobject.io_add_watch(stdin_file, gobject.IO_IN, _main_quit)
+ gtk.main()
+ return 0
+ return inputhook_gtk
+
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookgtk3.py b/ptvsd/pydevd/pydev_ipython/inputhookgtk3.py
new file mode 100644
index 00000000..f2ca39f3
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookgtk3.py
@@ -0,0 +1,35 @@
+# encoding: utf-8
+"""
+Enable Gtk3 to be used interacive by IPython.
+
+Authors: Thomi Richards
+"""
+#-----------------------------------------------------------------------------
+# Copyright (c) 2012, the IPython Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from gi.repository import Gtk, GLib # @UnresolvedImport
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def _main_quit(*args, **kwargs):
+ Gtk.main_quit()
+ return False
+
+
+def create_inputhook_gtk3(stdin_file):
+ def inputhook_gtk3():
+ GLib.io_add_watch(stdin_file, GLib.IO_IN, _main_quit)
+ Gtk.main()
+ return 0
+ return inputhook_gtk3
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookpyglet.py b/ptvsd/pydevd/pydev_ipython/inputhookpyglet.py
new file mode 100644
index 00000000..bf08afdc
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookpyglet.py
@@ -0,0 +1,92 @@
+# encoding: utf-8
+"""
+Enable pyglet to be used interacive by setting PyOS_InputHook.
+
+Authors
+-------
+
+* Nicolas P. Rougier
+* Fernando Perez
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2008-2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import os
+import sys
+from _pydev_imps._pydev_saved_modules import time
+from timeit import default_timer as clock
+import pyglet # @UnresolvedImport
+from pydev_ipython.inputhook import stdin_ready
+
+
+# On linux only, window.flip() has a bug that causes an AttributeError on
+# window close. For details, see:
+# http://groups.google.com/group/pyglet-users/browse_thread/thread/47c1aab9aa4a3d23/c22f9e819826799e?#c22f9e819826799e
+
+if sys.platform.startswith('linux'):
+ def flip(window):
+ try:
+ window.flip()
+ except AttributeError:
+ pass
+else:
+ def flip(window):
+ window.flip()
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def inputhook_pyglet():
+ """Run the pyglet event loop by processing pending events only.
+
+ This keeps processing pending events until stdin is ready. After
+ processing all pending events, a call to time.sleep is inserted. This is
+ needed, otherwise, CPU usage is at 100%. This sleep time should be tuned
+ though for best performance.
+ """
+ # We need to protect against a user pressing Control-C when IPython is
+ # idle and this is running. We trap KeyboardInterrupt and pass.
+ try:
+ t = clock()
+ while not stdin_ready():
+ pyglet.clock.tick()
+ for window in pyglet.app.windows:
+ window.switch_to()
+ window.dispatch_events()
+ window.dispatch_event('on_draw')
+ flip(window)
+
+ # We need to sleep at this point to keep the idle CPU load
+ # low. However, if sleep to long, GUI response is poor. As
+ # a compromise, we watch how often GUI events are being processed
+ # and switch between a short and long sleep time. Here are some
+ # stats useful in helping to tune this.
+ # time CPU load
+ # 0.001 13%
+ # 0.005 3%
+ # 0.01 1.5%
+ # 0.05 0.5%
+ used_time = clock() - t
+ if used_time > 10.0:
+ # print 'Sleep for 1 s' # dbg
+ time.sleep(1.0)
+ elif used_time > 0.1:
+ # Few GUI events coming in, so we can sleep longer
+ # print 'Sleep for 0.05 s' # dbg
+ time.sleep(0.05)
+ else:
+ # Many GUI events coming in, so sleep only very little
+ time.sleep(0.001)
+ except KeyboardInterrupt:
+ pass
+ return 0
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookqt4.py b/ptvsd/pydevd/pydev_ipython/inputhookqt4.py
new file mode 100644
index 00000000..b7e1cf05
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookqt4.py
@@ -0,0 +1,196 @@
+# -*- coding: utf-8 -*-
+"""
+Qt4's inputhook support function
+
+Author: Christian Boos
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import os
+import signal
+
+import threading
+
+
+from pydev_ipython.qt_for_kernel import QtCore, QtGui
+from pydev_ipython.inputhook import allow_CTRL_C, ignore_CTRL_C, stdin_ready
+
+# To minimise future merging complexity, rather than edit the entire code base below
+# we fake InteractiveShell here
+class InteractiveShell:
+ _instance = None
+ @classmethod
+ def instance(cls):
+ if cls._instance is None:
+ cls._instance = cls()
+ return cls._instance
+ def set_hook(self, *args, **kwargs):
+ # We don't consider the pre_prompt_hook because we don't have
+ # KeyboardInterrupts to consider since we are running under PyDev
+ pass
+
+
+#-----------------------------------------------------------------------------
+# Module Globals
+#-----------------------------------------------------------------------------
+
+got_kbdint = False
+sigint_timer = None
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def create_inputhook_qt4(mgr, app=None):
+ """Create an input hook for running the Qt4 application event loop.
+
+ Parameters
+ ----------
+ mgr : an InputHookManager
+
+ app : Qt Application, optional.
+ Running application to use. If not given, we probe Qt for an
+ existing application object, and create a new one if none is found.
+
+ Returns
+ -------
+ A pair consisting of a Qt Application (either the one given or the
+ one found or created) and a inputhook.
+
+ Notes
+ -----
+ We use a custom input hook instead of PyQt4's default one, as it
+ interacts better with the readline packages (issue #481).
+
+ The inputhook function works in tandem with a 'pre_prompt_hook'
+ which automatically restores the hook as an inputhook in case the
+ latter has been temporarily disabled after having intercepted a
+ KeyboardInterrupt.
+ """
+
+ if app is None:
+ app = QtCore.QCoreApplication.instance()
+ if app is None:
+ app = QtGui.QApplication([" "])
+
+ # Re-use previously created inputhook if any
+ ip = InteractiveShell.instance()
+ if hasattr(ip, '_inputhook_qt4'):
+ return app, ip._inputhook_qt4
+
+ # Otherwise create the inputhook_qt4/preprompthook_qt4 pair of
+ # hooks (they both share the got_kbdint flag)
+
+ def inputhook_qt4():
+ """PyOS_InputHook python hook for Qt4.
+
+ Process pending Qt events and if there's no pending keyboard
+ input, spend a short slice of time (50ms) running the Qt event
+ loop.
+
+ As a Python ctypes callback can't raise an exception, we catch
+ the KeyboardInterrupt and temporarily deactivate the hook,
+ which will let a *second* CTRL+C be processed normally and go
+ back to a clean prompt line.
+ """
+ try:
+ allow_CTRL_C()
+ app = QtCore.QCoreApplication.instance()
+ if not app: # shouldn't happen, but safer if it happens anyway...
+ return 0
+ app.processEvents(QtCore.QEventLoop.AllEvents, 300)
+ if not stdin_ready():
+ # Generally a program would run QCoreApplication::exec()
+ # from main() to enter and process the Qt event loop until
+ # quit() or exit() is called and the program terminates.
+ #
+ # For our input hook integration, we need to repeatedly
+ # enter and process the Qt event loop for only a short
+ # amount of time (say 50ms) to ensure that Python stays
+ # responsive to other user inputs.
+ #
+ # A naive approach would be to repeatedly call
+ # QCoreApplication::exec(), using a timer to quit after a
+ # short amount of time. Unfortunately, QCoreApplication
+ # emits an aboutToQuit signal before stopping, which has
+ # the undesirable effect of closing all modal windows.
+ #
+ # To work around this problem, we instead create a
+ # QEventLoop and call QEventLoop::exec(). Other than
+ # setting some state variables which do not seem to be
+ # used anywhere, the only thing QCoreApplication adds is
+ # the aboutToQuit signal which is precisely what we are
+ # trying to avoid.
+ timer = QtCore.QTimer()
+ event_loop = QtCore.QEventLoop()
+ timer.timeout.connect(event_loop.quit)
+ while not stdin_ready():
+ timer.start(50)
+ event_loop.exec_()
+ timer.stop()
+ except KeyboardInterrupt:
+ global got_kbdint, sigint_timer
+
+ ignore_CTRL_C()
+ got_kbdint = True
+ mgr.clear_inputhook()
+
+ # This generates a second SIGINT so the user doesn't have to
+ # press CTRL+C twice to get a clean prompt.
+ #
+ # Since we can't catch the resulting KeyboardInterrupt here
+ # (because this is a ctypes callback), we use a timer to
+ # generate the SIGINT after we leave this callback.
+ #
+ # Unfortunately this doesn't work on Windows (SIGINT kills
+ # Python and CTRL_C_EVENT doesn't work).
+ if(os.name == 'posix'):
+ pid = os.getpid()
+ if(not sigint_timer):
+ sigint_timer = threading.Timer(.01, os.kill,
+ args=[pid, signal.SIGINT] )
+ sigint_timer.start()
+ else:
+ print("\nKeyboardInterrupt - Ctrl-C again for new prompt")
+
+
+ except: # NO exceptions are allowed to escape from a ctypes callback
+ ignore_CTRL_C()
+ from traceback import print_exc
+ print_exc()
+ print("Got exception from inputhook_qt4, unregistering.")
+ mgr.clear_inputhook()
+ finally:
+ allow_CTRL_C()
+ return 0
+
+ def preprompthook_qt4(ishell):
+ """'pre_prompt_hook' used to restore the Qt4 input hook
+
+ (in case the latter was temporarily deactivated after a
+ CTRL+C)
+ """
+ global got_kbdint, sigint_timer
+
+ if(sigint_timer):
+ sigint_timer.cancel()
+ sigint_timer = None
+
+ if got_kbdint:
+ mgr.set_inputhook(inputhook_qt4)
+ got_kbdint = False
+
+ ip._inputhook_qt4 = inputhook_qt4
+ ip.set_hook('pre_prompt_hook', preprompthook_qt4)
+
+ return app, inputhook_qt4
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookqt5.py b/ptvsd/pydevd/pydev_ipython/inputhookqt5.py
new file mode 100644
index 00000000..77b938b4
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookqt5.py
@@ -0,0 +1,197 @@
+# -*- coding: utf-8 -*-
+"""
+Qt5's inputhook support function
+
+Author: Christian Boos
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import os
+import signal
+
+import threading
+
+
+from pydev_ipython.qt_for_kernel import QtCore, QtGui
+from pydev_ipython.inputhook import allow_CTRL_C, ignore_CTRL_C, stdin_ready
+
+# To minimise future merging complexity, rather than edit the entire code base below
+# we fake InteractiveShell here
+class InteractiveShell:
+ _instance = None
+ @classmethod
+ def instance(cls):
+ if cls._instance is None:
+ cls._instance = cls()
+ return cls._instance
+ def set_hook(self, *args, **kwargs):
+ # We don't consider the pre_prompt_hook because we don't have
+ # KeyboardInterrupts to consider since we are running under PyDev
+ pass
+
+
+#-----------------------------------------------------------------------------
+# Module Globals
+#-----------------------------------------------------------------------------
+
+got_kbdint = False
+sigint_timer = None
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def create_inputhook_qt5(mgr, app=None):
+ """Create an input hook for running the Qt5 application event loop.
+
+ Parameters
+ ----------
+ mgr : an InputHookManager
+
+ app : Qt Application, optional.
+ Running application to use. If not given, we probe Qt for an
+ existing application object, and create a new one if none is found.
+
+ Returns
+ -------
+ A pair consisting of a Qt Application (either the one given or the
+ one found or created) and a inputhook.
+
+ Notes
+ -----
+ We use a custom input hook instead of PyQt5's default one, as it
+ interacts better with the readline packages (issue #481).
+
+ The inputhook function works in tandem with a 'pre_prompt_hook'
+ which automatically restores the hook as an inputhook in case the
+ latter has been temporarily disabled after having intercepted a
+ KeyboardInterrupt.
+ """
+
+ if app is None:
+ app = QtCore.QCoreApplication.instance()
+ if app is None:
+ from PyQt5 import QtWidgets
+ app = QtWidgets.QApplication([" "])
+
+ # Re-use previously created inputhook if any
+ ip = InteractiveShell.instance()
+ if hasattr(ip, '_inputhook_qt5'):
+ return app, ip._inputhook_qt5
+
+ # Otherwise create the inputhook_qt5/preprompthook_qt5 pair of
+ # hooks (they both share the got_kbdint flag)
+
+ def inputhook_qt5():
+ """PyOS_InputHook python hook for Qt5.
+
+ Process pending Qt events and if there's no pending keyboard
+ input, spend a short slice of time (50ms) running the Qt event
+ loop.
+
+ As a Python ctypes callback can't raise an exception, we catch
+ the KeyboardInterrupt and temporarily deactivate the hook,
+ which will let a *second* CTRL+C be processed normally and go
+ back to a clean prompt line.
+ """
+ try:
+ allow_CTRL_C()
+ app = QtCore.QCoreApplication.instance()
+ if not app: # shouldn't happen, but safer if it happens anyway...
+ return 0
+ app.processEvents(QtCore.QEventLoop.AllEvents, 300)
+ if not stdin_ready():
+ # Generally a program would run QCoreApplication::exec()
+ # from main() to enter and process the Qt event loop until
+ # quit() or exit() is called and the program terminates.
+ #
+ # For our input hook integration, we need to repeatedly
+ # enter and process the Qt event loop for only a short
+ # amount of time (say 50ms) to ensure that Python stays
+ # responsive to other user inputs.
+ #
+ # A naive approach would be to repeatedly call
+ # QCoreApplication::exec(), using a timer to quit after a
+ # short amount of time. Unfortunately, QCoreApplication
+ # emits an aboutToQuit signal before stopping, which has
+ # the undesirable effect of closing all modal windows.
+ #
+ # To work around this problem, we instead create a
+ # QEventLoop and call QEventLoop::exec(). Other than
+ # setting some state variables which do not seem to be
+ # used anywhere, the only thing QCoreApplication adds is
+ # the aboutToQuit signal which is precisely what we are
+ # trying to avoid.
+ timer = QtCore.QTimer()
+ event_loop = QtCore.QEventLoop()
+ timer.timeout.connect(event_loop.quit)
+ while not stdin_ready():
+ timer.start(50)
+ event_loop.exec_()
+ timer.stop()
+ except KeyboardInterrupt:
+ global got_kbdint, sigint_timer
+
+ ignore_CTRL_C()
+ got_kbdint = True
+ mgr.clear_inputhook()
+
+ # This generates a second SIGINT so the user doesn't have to
+ # press CTRL+C twice to get a clean prompt.
+ #
+ # Since we can't catch the resulting KeyboardInterrupt here
+ # (because this is a ctypes callback), we use a timer to
+ # generate the SIGINT after we leave this callback.
+ #
+ # Unfortunately this doesn't work on Windows (SIGINT kills
+ # Python and CTRL_C_EVENT doesn't work).
+ if(os.name == 'posix'):
+ pid = os.getpid()
+ if(not sigint_timer):
+ sigint_timer = threading.Timer(.01, os.kill,
+ args=[pid, signal.SIGINT] )
+ sigint_timer.start()
+ else:
+ print("\nKeyboardInterrupt - Ctrl-C again for new prompt")
+
+
+ except: # NO exceptions are allowed to escape from a ctypes callback
+ ignore_CTRL_C()
+ from traceback import print_exc
+ print_exc()
+ print("Got exception from inputhook_qt5, unregistering.")
+ mgr.clear_inputhook()
+ finally:
+ allow_CTRL_C()
+ return 0
+
+ def preprompthook_qt5(ishell):
+ """'pre_prompt_hook' used to restore the Qt5 input hook
+
+ (in case the latter was temporarily deactivated after a
+ CTRL+C)
+ """
+ global got_kbdint, sigint_timer
+
+ if(sigint_timer):
+ sigint_timer.cancel()
+ sigint_timer = None
+
+ if got_kbdint:
+ mgr.set_inputhook(inputhook_qt5)
+ got_kbdint = False
+
+ ip._inputhook_qt5 = inputhook_qt5
+ ip.set_hook('pre_prompt_hook', preprompthook_qt5)
+
+ return app, inputhook_qt5
diff --git a/ptvsd/pydevd/pydev_ipython/inputhooktk.py b/ptvsd/pydevd/pydev_ipython/inputhooktk.py
new file mode 100644
index 00000000..e245cc05
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhooktk.py
@@ -0,0 +1,23 @@
+# encoding: utf-8
+# Unlike what IPython does, we need to have an explicit inputhook because tkinter handles
+# input hook in the C Source code
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from pydev_ipython.inputhook import stdin_ready
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+TCL_DONT_WAIT = 1 << 1
+
+def create_inputhook_tk(app):
+ def inputhook_tk():
+ while app.dooneevent(TCL_DONT_WAIT) == 1:
+ if stdin_ready():
+ break
+ return 0
+ return inputhook_tk
diff --git a/ptvsd/pydevd/pydev_ipython/inputhookwx.py b/ptvsd/pydevd/pydev_ipython/inputhookwx.py
new file mode 100644
index 00000000..88fe2c6e
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/inputhookwx.py
@@ -0,0 +1,166 @@
+# encoding: utf-8
+"""
+Enable wxPython to be used interacive by setting PyOS_InputHook.
+
+Authors: Robin Dunn, Brian Granger, Ondrej Certik
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2008-2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+import sys
+import signal
+from _pydev_imps._pydev_saved_modules import time
+from timeit import default_timer as clock
+import wx
+
+from pydev_ipython.inputhook import stdin_ready
+
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def inputhook_wx1():
+ """Run the wx event loop by processing pending events only.
+
+ This approach seems to work, but its performance is not great as it
+ relies on having PyOS_InputHook called regularly.
+ """
+ try:
+ app = wx.GetApp() # @UndefinedVariable
+ if app is not None:
+ assert wx.Thread_IsMain() # @UndefinedVariable
+
+ # Make a temporary event loop and process system events until
+ # there are no more waiting, then allow idle events (which
+ # will also deal with pending or posted wx events.)
+ evtloop = wx.EventLoop() # @UndefinedVariable
+ ea = wx.EventLoopActivator(evtloop) # @UndefinedVariable
+ while evtloop.Pending():
+ evtloop.Dispatch()
+ app.ProcessIdle()
+ del ea
+ except KeyboardInterrupt:
+ pass
+ return 0
+
+class EventLoopTimer(wx.Timer): # @UndefinedVariable
+
+ def __init__(self, func):
+ self.func = func
+ wx.Timer.__init__(self) # @UndefinedVariable
+
+ def Notify(self):
+ self.func()
+
+class EventLoopRunner(object):
+
+ def Run(self, time):
+ self.evtloop = wx.EventLoop() # @UndefinedVariable
+ self.timer = EventLoopTimer(self.check_stdin)
+ self.timer.Start(time)
+ self.evtloop.Run()
+
+ def check_stdin(self):
+ if stdin_ready():
+ self.timer.Stop()
+ self.evtloop.Exit()
+
+def inputhook_wx2():
+ """Run the wx event loop, polling for stdin.
+
+ This version runs the wx eventloop for an undetermined amount of time,
+ during which it periodically checks to see if anything is ready on
+ stdin. If anything is ready on stdin, the event loop exits.
+
+ The argument to elr.Run controls how often the event loop looks at stdin.
+ This determines the responsiveness at the keyboard. A setting of 1000
+ enables a user to type at most 1 char per second. I have found that a
+ setting of 10 gives good keyboard response. We can shorten it further,
+ but eventually performance would suffer from calling select/kbhit too
+ often.
+ """
+ try:
+ app = wx.GetApp() # @UndefinedVariable
+ if app is not None:
+ assert wx.Thread_IsMain() # @UndefinedVariable
+ elr = EventLoopRunner()
+ # As this time is made shorter, keyboard response improves, but idle
+ # CPU load goes up. 10 ms seems like a good compromise.
+ elr.Run(time=10) # CHANGE time here to control polling interval
+ except KeyboardInterrupt:
+ pass
+ return 0
+
+def inputhook_wx3():
+ """Run the wx event loop by processing pending events only.
+
+ This is like inputhook_wx1, but it keeps processing pending events
+ until stdin is ready. After processing all pending events, a call to
+ time.sleep is inserted. This is needed, otherwise, CPU usage is at 100%.
+ This sleep time should be tuned though for best performance.
+ """
+ # We need to protect against a user pressing Control-C when IPython is
+ # idle and this is running. We trap KeyboardInterrupt and pass.
+ try:
+ app = wx.GetApp() # @UndefinedVariable
+ if app is not None:
+ assert wx.Thread_IsMain() # @UndefinedVariable
+
+ # The import of wx on Linux sets the handler for signal.SIGINT
+ # to 0. This is a bug in wx or gtk. We fix by just setting it
+ # back to the Python default.
+ if not callable(signal.getsignal(signal.SIGINT)):
+ signal.signal(signal.SIGINT, signal.default_int_handler)
+
+ evtloop = wx.EventLoop() # @UndefinedVariable
+ ea = wx.EventLoopActivator(evtloop) # @UndefinedVariable
+ t = clock()
+ while not stdin_ready():
+ while evtloop.Pending():
+ t = clock()
+ evtloop.Dispatch()
+ app.ProcessIdle()
+ # We need to sleep at this point to keep the idle CPU load
+ # low. However, if sleep to long, GUI response is poor. As
+ # a compromise, we watch how often GUI events are being processed
+ # and switch between a short and long sleep time. Here are some
+ # stats useful in helping to tune this.
+ # time CPU load
+ # 0.001 13%
+ # 0.005 3%
+ # 0.01 1.5%
+ # 0.05 0.5%
+ used_time = clock() - t
+ if used_time > 10.0:
+ # print 'Sleep for 1 s' # dbg
+ time.sleep(1.0)
+ elif used_time > 0.1:
+ # Few GUI events coming in, so we can sleep longer
+ # print 'Sleep for 0.05 s' # dbg
+ time.sleep(0.05)
+ else:
+ # Many GUI events coming in, so sleep only very little
+ time.sleep(0.001)
+ del ea
+ except KeyboardInterrupt:
+ pass
+ return 0
+
+if sys.platform == 'darwin':
+ # On OSX, evtloop.Pending() always returns True, regardless of there being
+ # any events pending. As such we can't use implementations 1 or 3 of the
+ # inputhook as those depend on a pending/dispatch loop.
+ inputhook_wx = inputhook_wx2
+else:
+ # This is our default implementation
+ inputhook_wx = inputhook_wx3
diff --git a/ptvsd/pydevd/pydev_ipython/matplotlibtools.py b/ptvsd/pydevd/pydev_ipython/matplotlibtools.py
new file mode 100644
index 00000000..132cb5b6
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/matplotlibtools.py
@@ -0,0 +1,148 @@
+
+import sys
+
+backends = {'tk': 'TkAgg',
+ 'gtk': 'GTKAgg',
+ 'wx': 'WXAgg',
+ 'qt': 'Qt4Agg', # qt3 not supported
+ 'qt4': 'Qt4Agg',
+ 'qt5': 'Qt5Agg',
+ 'osx': 'MacOSX'}
+
+# We also need a reverse backends2guis mapping that will properly choose which
+# GUI support to activate based on the desired matplotlib backend. For the
+# most part it's just a reverse of the above dict, but we also need to add a
+# few others that map to the same GUI manually:
+backend2gui = dict(zip(backends.values(), backends.keys()))
+backend2gui['Qt4Agg'] = 'qt'
+# In the reverse mapping, there are a few extra valid matplotlib backends that
+# map to the same GUI support
+backend2gui['GTK'] = backend2gui['GTKCairo'] = 'gtk'
+backend2gui['WX'] = 'wx'
+backend2gui['CocoaAgg'] = 'osx'
+
+
+def do_enable_gui(guiname):
+ from _pydev_bundle.pydev_versioncheck import versionok_for_gui
+ if versionok_for_gui():
+ try:
+ from pydev_ipython.inputhook import enable_gui
+ enable_gui(guiname)
+ except:
+ sys.stderr.write("Failed to enable GUI event loop integration for '%s'\n" % guiname)
+ import traceback
+ traceback.print_exc()
+ elif guiname not in ['none', '', None]:
+ # Only print a warning if the guiname was going to do something
+ sys.stderr.write("Debug console: Python version does not support GUI event loop integration for '%s'\n" % guiname)
+ # Return value does not matter, so return back what was sent
+ return guiname
+
+
+def find_gui_and_backend():
+ """Return the gui and mpl backend."""
+ matplotlib = sys.modules['matplotlib']
+ # WARNING: this assumes matplotlib 1.1 or newer!!
+ backend = matplotlib.rcParams['backend']
+ # In this case, we need to find what the appropriate gui selection call
+ # should be for IPython, so we can activate inputhook accordingly
+ gui = backend2gui.get(backend, None)
+ return gui, backend
+
+
+def is_interactive_backend(backend):
+ """ Check if backend is interactive """
+ matplotlib = sys.modules['matplotlib']
+ from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport
+ if backend in interactive_bk:
+ return True
+ elif backend in non_interactive_bk:
+ return False
+ else:
+ return matplotlib.is_interactive()
+
+
+def patch_use(enable_gui_function):
+ """ Patch matplotlib function 'use' """
+ matplotlib = sys.modules['matplotlib']
+ def patched_use(*args, **kwargs):
+ matplotlib.real_use(*args, **kwargs)
+ gui, backend = find_gui_and_backend()
+ enable_gui_function(gui)
+
+ matplotlib.real_use = matplotlib.use
+ matplotlib.use = patched_use
+
+
+def patch_is_interactive():
+ """ Patch matplotlib function 'use' """
+ matplotlib = sys.modules['matplotlib']
+ def patched_is_interactive():
+ return matplotlib.rcParams['interactive']
+
+ matplotlib.real_is_interactive = matplotlib.is_interactive
+ matplotlib.is_interactive = patched_is_interactive
+
+
+def activate_matplotlib(enable_gui_function):
+ """Set interactive to True for interactive backends.
+ enable_gui_function - Function which enables gui, should be run in the main thread.
+ """
+ matplotlib = sys.modules['matplotlib']
+ gui, backend = find_gui_and_backend()
+ is_interactive = is_interactive_backend(backend)
+ if is_interactive:
+ enable_gui_function(gui)
+ if not matplotlib.is_interactive():
+ sys.stdout.write("Backend %s is interactive backend. Turning interactive mode on.\n" % backend)
+ matplotlib.interactive(True)
+ else:
+ if matplotlib.is_interactive():
+ sys.stdout.write("Backend %s is non-interactive backend. Turning interactive mode off.\n" % backend)
+ matplotlib.interactive(False)
+ patch_use(enable_gui_function)
+ patch_is_interactive()
+
+
+def flag_calls(func):
+ """Wrap a function to detect and flag when it gets called.
+
+ This is a decorator which takes a function and wraps it in a function with
+ a 'called' attribute. wrapper.called is initialized to False.
+
+ The wrapper.called attribute is set to False right before each call to the
+ wrapped function, so if the call fails it remains False. After the call
+ completes, wrapper.called is set to True and the output is returned.
+
+ Testing for truth in wrapper.called allows you to determine if a call to
+ func() was attempted and succeeded."""
+
+ # don't wrap twice
+ if hasattr(func, 'called'):
+ return func
+
+ def wrapper(*args,**kw):
+ wrapper.called = False
+ out = func(*args,**kw)
+ wrapper.called = True
+ return out
+
+ wrapper.called = False
+ wrapper.__doc__ = func.__doc__
+ return wrapper
+
+
+def activate_pylab():
+ pylab = sys.modules['pylab']
+ pylab.show._needmain = False
+ # We need to detect at runtime whether show() is called by the user.
+ # For this, we wrap it into a decorator which adds a 'called' flag.
+ pylab.draw_if_interactive = flag_calls(pylab.draw_if_interactive)
+
+
+def activate_pyplot():
+ pyplot = sys.modules['matplotlib.pyplot']
+ pyplot.show._needmain = False
+ # We need to detect at runtime whether show() is called by the user.
+ # For this, we wrap it into a decorator which adds a 'called' flag.
+ pyplot.draw_if_interactive = flag_calls(pyplot.draw_if_interactive)
diff --git a/ptvsd/pydevd/pydev_ipython/qt.py b/ptvsd/pydevd/pydev_ipython/qt.py
new file mode 100644
index 00000000..222c81b9
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/qt.py
@@ -0,0 +1,23 @@
+""" A Qt API selector that can be used to switch between PyQt and PySide.
+
+This uses the ETS 4.0 selection pattern of:
+PySide first, PyQt with API v2. second.
+
+Do not use this if you need PyQt with the old QString/QVariant API.
+"""
+
+import os
+
+from pydev_ipython.qt_loaders import (load_qt, QT_API_PYSIDE,
+ QT_API_PYQT, QT_API_PYQT5)
+
+QT_API = os.environ.get('QT_API', None)
+if QT_API not in [QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT5, None]:
+ raise RuntimeError("Invalid Qt API %r, valid values are: %r, %r" %
+ (QT_API, QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT5))
+if QT_API is None:
+ api_opts = [QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT5]
+else:
+ api_opts = [QT_API]
+
+QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
diff --git a/ptvsd/pydevd/pydev_ipython/qt_for_kernel.py b/ptvsd/pydevd/pydev_ipython/qt_for_kernel.py
new file mode 100644
index 00000000..d18a2183
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/qt_for_kernel.py
@@ -0,0 +1,118 @@
+""" Import Qt in a manner suitable for an IPython kernel.
+
+This is the import used for the `gui=qt` or `matplotlib=qt` initialization.
+
+Import Priority:
+
+if Qt4 has been imported anywhere else:
+ use that
+
+if matplotlib has been imported and doesn't support v2 (<= 1.0.1):
+ use PyQt4 @v1
+
+Next, ask ETS' QT_API env variable
+
+if QT_API not set:
+ ask matplotlib via rcParams['backend.qt4']
+ if it said PyQt:
+ use PyQt4 @v1
+ elif it said PySide:
+ use PySide
+
+ else: (matplotlib said nothing)
+ # this is the default path - nobody told us anything
+ try:
+ PyQt @v1
+ except:
+ fallback on PySide
+else:
+ use PyQt @v2 or PySide, depending on QT_API
+ because ETS doesn't work with PyQt @v1.
+
+"""
+
+import os
+import sys
+
+from pydev_ipython.version import check_version
+from pydev_ipython.qt_loaders import (load_qt, QT_API_PYSIDE,
+ QT_API_PYQT, QT_API_PYQT_DEFAULT,
+ loaded_api, QT_API_PYQT5)
+
+#Constraints placed on an imported matplotlib
+def matplotlib_options(mpl):
+ if mpl is None:
+ return
+
+ # #PyDev-779: In pysrc/pydev_ipython/qt_for_kernel.py, matplotlib_options should be replaced with latest from ipython
+ # (i.e.: properly check backend to decide upon qt4/qt5).
+
+ backend = mpl.rcParams.get('backend', None)
+ if backend == 'Qt4Agg':
+ mpqt = mpl.rcParams.get('backend.qt4', None)
+ if mpqt is None:
+ return None
+ if mpqt.lower() == 'pyside':
+ return [QT_API_PYSIDE]
+ elif mpqt.lower() == 'pyqt4':
+ return [QT_API_PYQT_DEFAULT]
+ elif mpqt.lower() == 'pyqt4v2':
+ return [QT_API_PYQT]
+ raise ImportError("unhandled value for backend.qt4 from matplotlib: %r" %
+ mpqt)
+
+ elif backend == 'Qt5Agg':
+ mpqt = mpl.rcParams.get('backend.qt5', None)
+ if mpqt is None:
+ return None
+ if mpqt.lower() == 'pyqt5':
+ return [QT_API_PYQT5]
+ raise ImportError("unhandled value for backend.qt5 from matplotlib: %r" %
+ mpqt)
+
+
+ # Fallback without checking backend (previous code)
+ mpqt = mpl.rcParams.get('backend.qt4', None)
+ if mpqt is None:
+ mpqt = mpl.rcParams.get('backend.qt5', None)
+
+ if mpqt is None:
+ return None
+ if mpqt.lower() == 'pyside':
+ return [QT_API_PYSIDE]
+ elif mpqt.lower() == 'pyqt4':
+ return [QT_API_PYQT_DEFAULT]
+ elif mpqt.lower() == 'pyqt5':
+ return [QT_API_PYQT5]
+ raise ImportError("unhandled value for qt backend from matplotlib: %r" %
+ mpqt)
+
+
+def get_options():
+ """Return a list of acceptable QT APIs, in decreasing order of
+ preference
+ """
+ #already imported Qt somewhere. Use that
+ loaded = loaded_api()
+ if loaded is not None:
+ return [loaded]
+
+ mpl = sys.modules.get('matplotlib', None)
+
+ if mpl is not None and not check_version(mpl.__version__, '1.0.2'):
+ #1.0.1 only supports PyQt4 v1
+ return [QT_API_PYQT_DEFAULT]
+
+ if os.environ.get('QT_API', None) is None:
+ #no ETS variable. Ask mpl, then use either
+ return matplotlib_options(mpl) or [QT_API_PYQT_DEFAULT, QT_API_PYSIDE, QT_API_PYQT5]
+
+ #ETS variable present. Will fallback to external.qt
+ return None
+
+api_opts = get_options()
+if api_opts is not None:
+ QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
+
+else: # use ETS variable
+ from pydev_ipython.qt import QtCore, QtGui, QtSvg, QT_API
diff --git a/ptvsd/pydevd/pydev_ipython/qt_loaders.py b/ptvsd/pydevd/pydev_ipython/qt_loaders.py
new file mode 100644
index 00000000..55d38ba7
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/qt_loaders.py
@@ -0,0 +1,281 @@
+"""
+This module contains factory functions that attempt
+to return Qt submodules from the various python Qt bindings.
+
+It also protects against double-importing Qt with different
+bindings, which is unstable and likely to crash
+
+This is used primarily by qt and qt_for_kernel, and shouldn't
+be accessed directly from the outside
+"""
+import sys
+from functools import partial
+
+from pydev_ipython.version import check_version
+
+# Available APIs.
+QT_API_PYQT = 'pyqt'
+QT_API_PYQTv1 = 'pyqtv1'
+QT_API_PYQT_DEFAULT = 'pyqtdefault' # don't set SIP explicitly
+QT_API_PYSIDE = 'pyside'
+QT_API_PYQT5 = 'pyqt5'
+
+
+class ImportDenier(object):
+ """Import Hook that will guard against bad Qt imports
+ once IPython commits to a specific binding
+ """
+
+ def __init__(self):
+ self.__forbidden = set()
+
+ def forbid(self, module_name):
+ sys.modules.pop(module_name, None)
+ self.__forbidden.add(module_name)
+
+ def find_module(self, fullname, path=None):
+ if path:
+ return
+ if fullname in self.__forbidden:
+ return self
+
+ def load_module(self, fullname):
+ raise ImportError("""
+ Importing %s disabled by IPython, which has
+ already imported an Incompatible QT Binding: %s
+ """ % (fullname, loaded_api()))
+
+ID = ImportDenier()
+sys.meta_path.append(ID)
+
+
+def commit_api(api):
+ """Commit to a particular API, and trigger ImportErrors on subsequent
+ dangerous imports"""
+
+ if api == QT_API_PYSIDE:
+ ID.forbid('PyQt4')
+ ID.forbid('PyQt5')
+ else:
+ ID.forbid('PySide')
+
+
+def loaded_api():
+ """Return which API is loaded, if any
+
+ If this returns anything besides None,
+ importing any other Qt binding is unsafe.
+
+ Returns
+ -------
+ None, 'pyside', 'pyqt', or 'pyqtv1'
+ """
+ if 'PyQt4.QtCore' in sys.modules:
+ if qtapi_version() == 2:
+ return QT_API_PYQT
+ else:
+ return QT_API_PYQTv1
+ elif 'PySide.QtCore' in sys.modules:
+ return QT_API_PYSIDE
+ elif 'PyQt5.QtCore' in sys.modules:
+ return QT_API_PYQT5
+ return None
+
+
+def has_binding(api):
+ """Safely check for PyQt4 or PySide, without importing
+ submodules
+
+ Parameters
+ ----------
+ api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault']
+ Which module to check for
+
+ Returns
+ -------
+ True if the relevant module appears to be importable
+ """
+ # we can't import an incomplete pyside and pyqt4
+ # this will cause a crash in sip (#1431)
+ # check for complete presence before importing
+ module_name = {QT_API_PYSIDE: 'PySide',
+ QT_API_PYQT: 'PyQt4',
+ QT_API_PYQTv1: 'PyQt4',
+ QT_API_PYQT_DEFAULT: 'PyQt4',
+ QT_API_PYQT5: 'PyQt5',
+ }
+ module_name = module_name[api]
+
+ import imp
+ try:
+ #importing top level PyQt4/PySide module is ok...
+ mod = __import__(module_name)
+ #...importing submodules is not
+ imp.find_module('QtCore', mod.__path__)
+ imp.find_module('QtGui', mod.__path__)
+ imp.find_module('QtSvg', mod.__path__)
+
+ #we can also safely check PySide version
+ if api == QT_API_PYSIDE:
+ return check_version(mod.__version__, '1.0.3')
+ else:
+ return True
+ except ImportError:
+ return False
+
+
+def qtapi_version():
+ """Return which QString API has been set, if any
+
+ Returns
+ -------
+ The QString API version (1 or 2), or None if not set
+ """
+ try:
+ import sip
+ except ImportError:
+ return
+ try:
+ return sip.getapi('QString')
+ except ValueError:
+ return
+
+
+def can_import(api):
+ """Safely query whether an API is importable, without importing it"""
+ if not has_binding(api):
+ return False
+
+ current = loaded_api()
+ if api == QT_API_PYQT_DEFAULT:
+ return current in [QT_API_PYQT, QT_API_PYQTv1, QT_API_PYQT5, None]
+ else:
+ return current in [api, None]
+
+
+def import_pyqt4(version=2):
+ """
+ Import PyQt4
+
+ Parameters
+ ----------
+ version : 1, 2, or None
+ Which QString/QVariant API to use. Set to None to use the system
+ default
+
+ ImportErrors raised within this function are non-recoverable
+ """
+ # The new-style string API (version=2) automatically
+ # converts QStrings to Unicode Python strings. Also, automatically unpacks
+ # QVariants to their underlying objects.
+ import sip
+
+ if version is not None:
+ sip.setapi('QString', version)
+ sip.setapi('QVariant', version)
+
+ from PyQt4 import QtGui, QtCore, QtSvg
+
+ if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
+ raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
+ QtCore.PYQT_VERSION_STR)
+
+ # Alias PyQt-specific functions for PySide compatibility.
+ QtCore.Signal = QtCore.pyqtSignal
+ QtCore.Slot = QtCore.pyqtSlot
+
+ # query for the API version (in case version == None)
+ version = sip.getapi('QString')
+ api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
+ return QtCore, QtGui, QtSvg, api
+
+def import_pyqt5():
+ """
+ Import PyQt5
+
+ ImportErrors raised within this function are non-recoverable
+ """
+ from PyQt5 import QtGui, QtCore, QtSvg
+
+ # Alias PyQt-specific functions for PySide compatibility.
+ QtCore.Signal = QtCore.pyqtSignal
+ QtCore.Slot = QtCore.pyqtSlot
+
+ return QtCore, QtGui, QtSvg, QT_API_PYQT5
+
+
+def import_pyside():
+ """
+ Import PySide
+
+ ImportErrors raised within this function are non-recoverable
+ """
+ from PySide import QtGui, QtCore, QtSvg # @UnresolvedImport
+ return QtCore, QtGui, QtSvg, QT_API_PYSIDE
+
+
+def load_qt(api_options):
+ """
+ Attempt to import Qt, given a preference list
+ of permissible bindings
+
+ It is safe to call this function multiple times.
+
+ Parameters
+ ----------
+ api_options: List of strings
+ The order of APIs to try. Valid items are 'pyside',
+ 'pyqt', and 'pyqtv1'
+
+ Returns
+ -------
+
+ A tuple of QtCore, QtGui, QtSvg, QT_API
+ The first three are the Qt modules. The last is the
+ string indicating which module was loaded.
+
+ Raises
+ ------
+ ImportError, if it isn't possible to import any requested
+ bindings (either becaues they aren't installed, or because
+ an incompatible library has already been installed)
+ """
+ loaders = {QT_API_PYSIDE: import_pyside,
+ QT_API_PYQT: import_pyqt4,
+ QT_API_PYQTv1: partial(import_pyqt4, version=1),
+ QT_API_PYQT_DEFAULT: partial(import_pyqt4, version=None),
+ QT_API_PYQT5: import_pyqt5,
+ }
+
+ for api in api_options:
+
+ if api not in loaders:
+ raise RuntimeError(
+ "Invalid Qt API %r, valid values are: %r, %r, %r, %r" %
+ (api, QT_API_PYSIDE, QT_API_PYQT,
+ QT_API_PYQTv1, QT_API_PYQT_DEFAULT, QT_API_PYQT5))
+
+ if not can_import(api):
+ continue
+
+ #cannot safely recover from an ImportError during this
+ result = loaders[api]()
+ api = result[-1] # changed if api = QT_API_PYQT_DEFAULT
+ commit_api(api)
+ return result
+ else:
+ raise ImportError("""
+ Could not load requested Qt binding. Please ensure that
+ PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
+ and only one is imported per session.
+
+ Currently-imported Qt library: %r
+ PyQt4 installed: %s
+ PyQt5 installed: %s
+ PySide >= 1.0.3 installed: %s
+ Tried to load: %r
+ """ % (loaded_api(),
+ has_binding(QT_API_PYQT),
+ has_binding(QT_API_PYQT5),
+ has_binding(QT_API_PYSIDE),
+ api_options))
diff --git a/ptvsd/pydevd/pydev_ipython/version.py b/ptvsd/pydevd/pydev_ipython/version.py
new file mode 100644
index 00000000..1de0047e
--- /dev/null
+++ b/ptvsd/pydevd/pydev_ipython/version.py
@@ -0,0 +1,36 @@
+# encoding: utf-8
+"""
+Utilities for version comparison
+
+It is a bit ridiculous that we need these.
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2013 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from distutils.version import LooseVersion
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def check_version(v, check):
+ """check version string v >= check
+
+ If dev/prerelease tags result in TypeError for string-number comparison,
+ it is assumed that the dependency is satisfied.
+ Users on dev branches are responsible for keeping their own packages up to date.
+ """
+ try:
+ return LooseVersion(v) >= LooseVersion(check)
+ except TypeError:
+ return True
+
diff --git a/ptvsd/pydevd/pydev_pysrc.py b/ptvsd/pydevd/pydev_pysrc.py
new file mode 100644
index 00000000..b9ed49e8
--- /dev/null
+++ b/ptvsd/pydevd/pydev_pysrc.py
@@ -0,0 +1 @@
+'''An empty file in pysrc that can be imported (from sitecustomize) to find the location of pysrc'''
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydev_run_in_console.py b/ptvsd/pydevd/pydev_run_in_console.py
new file mode 100644
index 00000000..9d862c57
--- /dev/null
+++ b/ptvsd/pydevd/pydev_run_in_console.py
@@ -0,0 +1,84 @@
+'''
+Entry point module to run a file in the interactive console.
+'''
+import os
+import sys
+from pydevconsole import do_exit, InterpreterInterface, process_exec_queue, start_console_server, init_mpl_in_console
+from _pydev_imps._pydev_saved_modules import threading
+
+from _pydev_bundle import pydev_imports
+from _pydevd_bundle.pydevd_utils import save_main_module
+from _pydev_bundle.pydev_console_utils import StdIn
+
+
+def run_file(file, globals=None, locals=None):
+ if os.path.isdir(file):
+ new_target = os.path.join(file, '__main__.py')
+ if os.path.isfile(new_target):
+ file = new_target
+
+ if globals is None:
+ m = save_main_module(file, 'pydev_run_in_console')
+
+ globals = m.__dict__
+ try:
+ globals['__builtins__'] = __builtins__
+ except NameError:
+ pass # Not there on Jython...
+
+ if locals is None:
+ locals = globals
+
+ sys.path.insert(0, os.path.split(file)[0])
+
+ print('Running %s'%file)
+ pydev_imports.execfile(file, globals, locals) # execute the script
+
+ return globals
+
+#=======================================================================================================================
+# main
+#=======================================================================================================================
+if __name__ == '__main__':
+ port, client_port = sys.argv[1:3]
+
+ del sys.argv[1]
+ del sys.argv[1]
+
+ file = sys.argv[1]
+
+ del sys.argv[0]
+
+ from _pydev_bundle import pydev_localhost
+
+ if int(port) == 0 and int(client_port) == 0:
+ (h, p) = pydev_localhost.get_socket_name()
+
+ client_port = p
+
+ host = pydev_localhost.get_localhost()
+
+
+ #replace exit (see comments on method)
+ #note that this does not work in jython!!! (sys method can't be replaced).
+ sys.exit = do_exit
+
+ interpreter = InterpreterInterface(host, int(client_port), threading.currentThread())
+
+ server_thread = threading.Thread(target=start_console_server,
+ name='ServerThread',
+ args=(host, int(port), interpreter))
+ server_thread.setDaemon(True)
+ server_thread.start()
+
+ sys.stdin = StdIn(interpreter, host, client_port, sys.stdin)
+
+ init_mpl_in_console(interpreter)
+
+ globals = run_file(file, None, None)
+
+ interpreter.get_namespace().update(globals)
+
+ interpreter.ShowConsole()
+
+ process_exec_queue(interpreter)
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt b/ptvsd/pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt
new file mode 100644
index 00000000..29cdc5bc
--- /dev/null
+++ b/ptvsd/pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt
@@ -0,0 +1 @@
+(no __init__.py file)
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydev_sitecustomize/sitecustomize.py b/ptvsd/pydevd/pydev_sitecustomize/sitecustomize.py
new file mode 100644
index 00000000..63a6c370
--- /dev/null
+++ b/ptvsd/pydevd/pydev_sitecustomize/sitecustomize.py
@@ -0,0 +1,197 @@
+'''
+ This module will:
+ - change the input() and raw_input() commands to change \r\n or \r into \n
+ - execute the user site customize -- if available
+ - change raw_input() and input() to also remove any trailing \r
+
+ Up to PyDev 3.4 it also was setting the default encoding, but it was removed because of differences when
+ running from a shell (i.e.: now we just set the PYTHONIOENCODING related to that -- which is properly
+ treated on Py 2.7 onwards).
+'''
+DEBUG = 0 #0 or 1 because of jython
+
+import sys
+encoding = None
+
+IS_PYTHON_3_ONWARDS = 0
+
+try:
+ IS_PYTHON_3_ONWARDS = sys.version_info[0] >= 3
+except:
+ #That's OK, not all versions of python have sys.version_info
+ if DEBUG:
+ import traceback;traceback.print_exc() #@Reimport
+
+#-----------------------------------------------------------------------------------------------------------------------
+#Line buffering
+if IS_PYTHON_3_ONWARDS:
+ #Python 3 has a bug (http://bugs.python.org/issue4705) in which -u doesn't properly make output/input unbuffered
+ #so, we need to enable that ourselves here.
+ try:
+ sys.stdout._line_buffering = True
+ except:
+ pass
+ try:
+ sys.stderr._line_buffering = True
+ except:
+ pass
+ try:
+ sys.stdin._line_buffering = True
+ except:
+ pass
+
+
+try:
+ import org.python.core.PyDictionary #@UnresolvedImport @UnusedImport -- just to check if it could be valid
+ def dict_contains(d, key):
+ return d.has_key(key)
+except:
+ try:
+ #Py3k does not have has_key anymore, and older versions don't have __contains__
+ dict_contains = dict.__contains__
+ except:
+ try:
+ dict_contains = dict.has_key
+ except NameError:
+ def dict_contains(d, key):
+ return d.has_key(key)
+
+
+#-----------------------------------------------------------------------------------------------------------------------
+#now that we've finished the needed pydev sitecustomize, let's run the default one (if available)
+
+#Ok, some weirdness going on in Python 3k: when removing this module from the sys.module to import the 'real'
+#sitecustomize, all the variables in this scope become None (as if it was garbage-collected), so, the the reference
+#below is now being kept to create a cyclic reference so that it neven dies)
+__pydev_sitecustomize_module__ = sys.modules.get('sitecustomize') #A ref to this module
+
+
+#remove the pydev site customize (and the pythonpath for it)
+paths_removed = []
+try:
+ for c in sys.path[:]:
+ #Pydev controls the whole classpath in Jython already, so, we don't want a a duplicate for
+ #what we've already added there (this is needed to support Jython 2.5b1 onwards -- otherwise, as
+ #we added the sitecustomize to the pythonpath and to the classpath, we'd have to remove it from the
+ #classpath too -- and I don't think there's a way to do that... or not?)
+ if c.find('pydev_sitecustomize') != -1 or c == '__classpath__' or c == '__pyclasspath__' or \
+ c == '__classpath__/' or c == '__pyclasspath__/' or c == '__classpath__\\' or c == '__pyclasspath__\\':
+ sys.path.remove(c)
+ if c.find('pydev_sitecustomize') == -1:
+ #We'll re-add any paths removed but the pydev_sitecustomize we added from pydev.
+ paths_removed.append(c)
+
+ if dict_contains(sys.modules, 'sitecustomize'):
+ del sys.modules['sitecustomize'] #this module
+except:
+ #print the error... should never happen (so, always show, and not only on debug)!
+ import traceback;traceback.print_exc() #@Reimport
+else:
+ #Now, execute the default sitecustomize
+ try:
+ import sitecustomize #@UnusedImport
+ sitecustomize.__pydev_sitecustomize_module__ = __pydev_sitecustomize_module__
+ except:
+ pass
+
+ if not dict_contains(sys.modules, 'sitecustomize'):
+ #If there was no sitecustomize, re-add the pydev sitecustomize (pypy gives a KeyError if it's not there)
+ sys.modules['sitecustomize'] = __pydev_sitecustomize_module__
+
+ try:
+ if paths_removed:
+ if sys is None:
+ import sys
+ if sys is not None:
+ #And after executing the default sitecustomize, restore the paths (if we didn't remove it before,
+ #the import sitecustomize would recurse).
+ sys.path.extend(paths_removed)
+ except:
+ #print the error... should never happen (so, always show, and not only on debug)!
+ import traceback;traceback.print_exc() #@Reimport
+
+
+
+
+if sys.version_info[0] < 3:
+ try:
+ #Redefine input and raw_input only after the original sitecustomize was executed
+ #(because otherwise, the original raw_input and input would still not be defined)
+ import __builtin__
+ original_raw_input = __builtin__.raw_input
+ original_input = __builtin__.input
+
+
+ def raw_input(prompt=''):
+ #the original raw_input would only remove a trailing \n, so, at
+ #this point if we had a \r\n the \r would remain (which is valid for eclipse)
+ #so, let's remove the remaining \r which python didn't expect.
+ ret = original_raw_input(prompt)
+
+ if ret.endswith('\r'):
+ return ret[:-1]
+
+ return ret
+ raw_input.__doc__ = original_raw_input.__doc__
+
+ def input(prompt=''):
+ #input must also be rebinded for using the new raw_input defined
+ return eval(raw_input(prompt))
+ input.__doc__ = original_input.__doc__
+
+
+ __builtin__.raw_input = raw_input
+ __builtin__.input = input
+
+ except:
+ #Don't report errors at this stage
+ if DEBUG:
+ import traceback;traceback.print_exc() #@Reimport
+
+else:
+ try:
+ import builtins #Python 3.0 does not have the __builtin__ module @UnresolvedImport
+ original_input = builtins.input
+ def input(prompt=''):
+ #the original input would only remove a trailing \n, so, at
+ #this point if we had a \r\n the \r would remain (which is valid for eclipse)
+ #so, let's remove the remaining \r which python didn't expect.
+ ret = original_input(prompt)
+
+ if ret.endswith('\r'):
+ return ret[:-1]
+
+ return ret
+ input.__doc__ = original_input.__doc__
+ builtins.input = input
+ except:
+ #Don't report errors at this stage
+ if DEBUG:
+ import traceback;traceback.print_exc() #@Reimport
+
+
+
+try:
+ #The original getpass doesn't work from the eclipse console, so, let's put a replacement
+ #here (note that it'll not go into echo mode in the console, so, what' the user writes
+ #will actually be seen)
+ #Note: same thing from the fix_getpass module -- but we don't want to import it in this
+ #custom sitecustomize.
+ def fix_get_pass():
+ try:
+ import getpass
+ except ImportError:
+ return #If we can't import it, we can't fix it
+ import warnings
+ fallback = getattr(getpass, 'fallback_getpass', None) # >= 2.6
+ if not fallback:
+ fallback = getpass.default_getpass # <= 2.5
+ getpass.getpass = fallback
+ if hasattr(getpass, 'GetPassWarning'):
+ warnings.simplefilter("ignore", category=getpass.GetPassWarning)
+ fix_get_pass()
+
+except:
+ #Don't report errors at this stage
+ if DEBUG:
+ import traceback;traceback.print_exc() #@Reimport
diff --git a/ptvsd/pydevd/pydevconsole.py b/ptvsd/pydevd/pydevconsole.py
new file mode 100644
index 00000000..e8c58733
--- /dev/null
+++ b/ptvsd/pydevd/pydevconsole.py
@@ -0,0 +1,516 @@
+'''
+Entry point module to start the interactive console.
+'''
+from _pydev_imps._pydev_saved_modules import thread
+from _pydevd_bundle.pydevd_constants import IS_JYTHON, dict_iter_items
+start_new_thread = thread.start_new_thread
+
+try:
+ from code import InteractiveConsole
+except ImportError:
+ from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
+
+from code import compile_command
+from code import InteractiveInterpreter
+
+import os
+import sys
+
+from _pydev_imps._pydev_saved_modules import threading
+from _pydevd_bundle.pydevd_constants import INTERACTIVE_MODE_AVAILABLE
+
+import traceback
+from _pydev_bundle import fix_getpass
+fix_getpass.fix_getpass()
+
+from _pydevd_bundle import pydevd_vars, pydevd_save_locals
+
+from _pydev_bundle.pydev_imports import Exec, _queue
+
+try:
+ import __builtin__
+except:
+ import builtins as __builtin__ # @UnresolvedImport
+
+from _pydev_bundle.pydev_console_utils import BaseInterpreterInterface, BaseStdIn
+from _pydev_bundle.pydev_console_utils import CodeFragment
+
+IS_PYTHON_3_ONWARDS = sys.version_info[0] >= 3
+IS_PY24 = sys.version_info[0] == 2 and sys.version_info[1] == 4
+
+class Command:
+ def __init__(self, interpreter, code_fragment):
+ """
+ :type code_fragment: CodeFragment
+ :type interpreter: InteractiveConsole
+ """
+ self.interpreter = interpreter
+ self.code_fragment = code_fragment
+ self.more = None
+
+
+ def symbol_for_fragment(code_fragment):
+ if code_fragment.is_single_line:
+ symbol = 'single'
+ else:
+ if IS_JYTHON:
+ symbol = 'single' # Jython doesn't support exec
+ else:
+ symbol = 'exec'
+ return symbol
+ symbol_for_fragment = staticmethod(symbol_for_fragment)
+
+ def run(self):
+ text = self.code_fragment.text
+ symbol = self.symbol_for_fragment(self.code_fragment)
+
+ self.more = self.interpreter.runsource(text, ' ', symbol)
+
+try:
+ try:
+ execfile #Not in Py3k
+ except NameError:
+ from _pydev_bundle.pydev_imports import execfile
+
+ __builtin__.execfile = execfile
+except:
+ pass
+
+# Pull in runfile, the interface to UMD that wraps execfile
+from _pydev_bundle.pydev_umd import runfile, _set_globals_function
+if sys.version_info[0] >= 3:
+ import builtins # @UnresolvedImport
+ builtins.runfile = runfile
+else:
+ import __builtin__
+ __builtin__.runfile = runfile
+
+#=======================================================================================================================
+# InterpreterInterface
+#=======================================================================================================================
+class InterpreterInterface(BaseInterpreterInterface):
+ '''
+ The methods in this class should be registered in the xml-rpc server.
+ '''
+
+ def __init__(self, host, client_port, mainThread, show_banner=True):
+ BaseInterpreterInterface.__init__(self, mainThread)
+ self.client_port = client_port
+ self.host = host
+ self.namespace = {}
+ self.interpreter = InteractiveConsole(self.namespace)
+ self._input_error_printed = False
+
+
+ def do_add_exec(self, codeFragment):
+ command = Command(self.interpreter, codeFragment)
+ command.run()
+ return command.more
+
+
+ def get_namespace(self):
+ return self.namespace
+
+
+ def getCompletions(self, text, act_tok):
+ try:
+ from _pydev_bundle._pydev_completer import Completer
+
+ completer = Completer(self.namespace, None)
+ return completer.complete(act_tok)
+ except:
+ import traceback
+
+ traceback.print_exc()
+ return []
+
+ def close(self):
+ sys.exit(0)
+
+ def get_greeting_msg(self):
+ return 'PyDev console: starting.\n'
+
+
+class _ProcessExecQueueHelper:
+ _debug_hook = None
+ _return_control_osc = False
+
+def set_debug_hook(debug_hook):
+ _ProcessExecQueueHelper._debug_hook = debug_hook
+
+
+def init_mpl_in_console(interpreter):
+ from pydev_ipython.inputhook import set_return_control_callback
+
+ def return_control():
+ ''' A function that the inputhooks can call (via inputhook.stdin_ready()) to find
+ out if they should cede control and return '''
+ if _ProcessExecQueueHelper._debug_hook:
+ # Some of the input hooks check return control without doing
+ # a single operation, so we don't return True on every
+ # call when the debug hook is in place to allow the GUI to run
+ # XXX: Eventually the inputhook code will have diverged enough
+ # from the IPython source that it will be worthwhile rewriting
+ # it rather than pretending to maintain the old API
+ _ProcessExecQueueHelper._return_control_osc = not _ProcessExecQueueHelper._return_control_osc
+ if _ProcessExecQueueHelper._return_control_osc:
+ return True
+
+ if not interpreter.exec_queue.empty():
+ return True
+ return False
+
+ set_return_control_callback(return_control)
+
+ if not INTERACTIVE_MODE_AVAILABLE:
+ return
+
+ from _pydev_bundle.pydev_import_hook import import_hook_manager
+ from pydev_ipython.matplotlibtools import activate_matplotlib, activate_pylab, activate_pyplot
+ import_hook_manager.add_module_name("matplotlib", lambda: activate_matplotlib(interpreter.enableGui))
+ # enable_gui_function in activate_matplotlib should be called in main thread. That's why we call
+ # interpreter.enableGui which put it into the interpreter's exec_queue and executes it in the main thread.
+ import_hook_manager.add_module_name("pylab", activate_pylab)
+ import_hook_manager.add_module_name("pyplot", activate_pyplot)
+
+
+def process_exec_queue(interpreter):
+ init_mpl_in_console(interpreter)
+ from pydev_ipython.inputhook import get_inputhook
+
+ while 1:
+ # Running the request may have changed the inputhook in use
+ inputhook = get_inputhook()
+
+ if _ProcessExecQueueHelper._debug_hook:
+ _ProcessExecQueueHelper._debug_hook()
+
+ if inputhook:
+ try:
+ # Note: it'll block here until return_control returns True.
+ inputhook()
+ except:
+ import traceback;traceback.print_exc()
+ try:
+ try:
+ code_fragment = interpreter.exec_queue.get(block=True, timeout=1/20.) # 20 calls/second
+ except _queue.Empty:
+ continue
+
+ if callable(code_fragment):
+ # It can be a callable (i.e.: something that must run in the main
+ # thread can be put in the queue for later execution).
+ code_fragment()
+ else:
+ more = interpreter.add_exec(code_fragment)
+ except KeyboardInterrupt:
+ interpreter.buffer = None
+ continue
+ except SystemExit:
+ raise
+ except:
+ type, value, tb = sys.exc_info()
+ traceback.print_exception(type, value, tb, file=sys.__stderr__)
+ exit()
+
+
+if 'IPYTHONENABLE' in os.environ:
+ IPYTHON = os.environ['IPYTHONENABLE'] == 'True'
+else:
+ IPYTHON = True
+
+try:
+ try:
+ exitfunc = sys.exitfunc
+ except AttributeError:
+ exitfunc = None
+
+ if IPYTHON:
+ from _pydev_bundle.pydev_ipython_console import InterpreterInterface
+ if exitfunc is not None:
+ sys.exitfunc = exitfunc
+ else:
+ try:
+ delattr(sys, 'exitfunc')
+ except:
+ pass
+except:
+ IPYTHON = False
+ pass
+
+#=======================================================================================================================
+# _DoExit
+#=======================================================================================================================
+def do_exit(*args):
+ '''
+ We have to override the exit because calling sys.exit will only actually exit the main thread,
+ and as we're in a Xml-rpc server, that won't work.
+ '''
+
+ try:
+ import java.lang.System
+
+ java.lang.System.exit(1)
+ except ImportError:
+ if len(args) == 1:
+ os._exit(args[0])
+ else:
+ os._exit(0)
+
+
+def handshake():
+ return "PyCharm"
+
+
+#=======================================================================================================================
+# start_console_server
+#=======================================================================================================================
+def start_console_server(host, port, interpreter):
+ if port == 0:
+ host = ''
+
+ #I.e.: supporting the internal Jython version in PyDev to create a Jython interactive console inside Eclipse.
+ from _pydev_bundle.pydev_imports import SimpleXMLRPCServer as XMLRPCServer #@Reimport
+
+ try:
+ if IS_PY24:
+ server = XMLRPCServer((host, port), logRequests=False)
+ else:
+ server = XMLRPCServer((host, port), logRequests=False, allow_none=True)
+
+ except:
+ sys.stderr.write('Error starting server with host: "%s", port: "%s", client_port: "%s"\n' % (host, port, interpreter.client_port))
+ sys.stderr.flush()
+ raise
+
+ # Tell UMD the proper default namespace
+ _set_globals_function(interpreter.get_namespace)
+
+ server.register_function(interpreter.execLine)
+ server.register_function(interpreter.execMultipleLines)
+ server.register_function(interpreter.getCompletions)
+ server.register_function(interpreter.getFrame)
+ server.register_function(interpreter.getVariable)
+ server.register_function(interpreter.changeVariable)
+ server.register_function(interpreter.getDescription)
+ server.register_function(interpreter.close)
+ server.register_function(interpreter.interrupt)
+ server.register_function(handshake)
+ server.register_function(interpreter.connectToDebugger)
+ server.register_function(interpreter.hello)
+ server.register_function(interpreter.getArray)
+ server.register_function(interpreter.evaluate)
+ server.register_function(interpreter.ShowConsole)
+
+ # Functions for GUI main loop integration
+ server.register_function(interpreter.enableGui)
+
+ if port == 0:
+ (h, port) = server.socket.getsockname()
+
+ print(port)
+ print(interpreter.client_port)
+
+
+ sys.stderr.write(interpreter.get_greeting_msg())
+ sys.stderr.flush()
+
+ while True:
+ try:
+ server.serve_forever()
+ except:
+ # Ugly code to be py2/3 compatible
+ # https://sw-brainwy.rhcloud.com/tracker/PyDev/534:
+ # Unhandled "interrupted system call" error in the pydevconsol.py
+ e = sys.exc_info()[1]
+ retry = False
+ try:
+ retry = e.args[0] == 4 #errno.EINTR
+ except:
+ pass
+ if not retry:
+ raise
+ # Otherwise, keep on going
+ return server
+
+
+def start_server(host, port, client_port):
+ #replace exit (see comments on method)
+ #note that this does not work in jython!!! (sys method can't be replaced).
+ sys.exit = do_exit
+
+ interpreter = InterpreterInterface(host, client_port, threading.currentThread())
+
+ start_new_thread(start_console_server,(host, port, interpreter))
+
+ process_exec_queue(interpreter)
+
+
+def get_ipython_hidden_vars():
+ if IPYTHON and hasattr(__builtin__, 'interpreter'):
+ interpreter = get_interpreter()
+ return interpreter.get_ipython_hidden_vars_dict()
+
+
+def get_interpreter():
+ try:
+ interpreterInterface = getattr(__builtin__, 'interpreter')
+ except AttributeError:
+ interpreterInterface = InterpreterInterface(None, None, threading.currentThread())
+ __builtin__.interpreter = interpreterInterface
+ sys.stderr.write(interpreterInterface.get_greeting_msg())
+ sys.stderr.flush()
+
+ return interpreterInterface
+
+
+def get_completions(text, token, globals, locals):
+ interpreterInterface = get_interpreter()
+
+ interpreterInterface.interpreter.update(globals, locals)
+
+ return interpreterInterface.getCompletions(text, token)
+
+#===============================================================================
+# Debugger integration
+#===============================================================================
+
+def exec_code(code, globals, locals, debugger):
+ interpreterInterface = get_interpreter()
+ interpreterInterface.interpreter.update(globals, locals)
+
+ res = interpreterInterface.need_more(code)
+
+ if res:
+ return True
+
+ interpreterInterface.add_exec(code, debugger)
+
+ return False
+
+
+
+class ConsoleWriter(InteractiveInterpreter):
+ skip = 0
+
+ def __init__(self, locals=None):
+ InteractiveInterpreter.__init__(self, locals)
+
+ def write(self, data):
+ #if (data.find("global_vars") == -1 and data.find("pydevd") == -1):
+ if self.skip > 0:
+ self.skip -= 1
+ else:
+ if data == "Traceback (most recent call last):\n":
+ self.skip = 1
+ sys.stderr.write(data)
+
+ def showsyntaxerror(self, filename=None):
+ """Display the syntax error that just occurred."""
+ #Override for avoid using sys.excepthook PY-12600
+ type, value, tb = sys.exc_info()
+ sys.last_type = type
+ sys.last_value = value
+ sys.last_traceback = tb
+ if filename and type is SyntaxError:
+ # Work hard to stuff the correct filename in the exception
+ try:
+ msg, (dummy_filename, lineno, offset, line) = value.args
+ except ValueError:
+ # Not the format we expect; leave it alone
+ pass
+ else:
+ # Stuff in the right filename
+ value = SyntaxError(msg, (filename, lineno, offset, line))
+ sys.last_value = value
+ list = traceback.format_exception_only(type, value)
+ sys.stderr.write(''.join(list))
+
+ def showtraceback(self):
+ """Display the exception that just occurred."""
+ #Override for avoid using sys.excepthook PY-12600
+ try:
+ type, value, tb = sys.exc_info()
+ sys.last_type = type
+ sys.last_value = value
+ sys.last_traceback = tb
+ tblist = traceback.extract_tb(tb)
+ del tblist[:1]
+ lines = traceback.format_list(tblist)
+ if lines:
+ lines.insert(0, "Traceback (most recent call last):\n")
+ lines.extend(traceback.format_exception_only(type, value))
+ finally:
+ tblist = tb = None
+ sys.stderr.write(''.join(lines))
+
+def console_exec(thread_id, frame_id, expression, dbg):
+ """returns 'False' in case expression is partially correct
+ """
+ frame = pydevd_vars.find_frame(thread_id, frame_id)
+
+ is_multiline = expression.count('@LINE@') > 1
+ expression = str(expression.replace('@LINE@', '\n'))
+
+ #Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
+ #(Names not resolved in generator expression in method)
+ #See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
+ updated_globals = {}
+ updated_globals.update(frame.f_globals)
+ updated_globals.update(frame.f_locals) #locals later because it has precedence over the actual globals
+
+ if IPYTHON:
+ need_more = exec_code(CodeFragment(expression), updated_globals, frame.f_locals, dbg)
+ if not need_more:
+ pydevd_save_locals.save_locals(frame)
+ return need_more
+
+
+ interpreter = ConsoleWriter()
+
+ if not is_multiline:
+ try:
+ code = compile_command(expression)
+ except (OverflowError, SyntaxError, ValueError):
+ # Case 1
+ interpreter.showsyntaxerror()
+ return False
+ if code is None:
+ # Case 2
+ return True
+ else:
+ code = expression
+
+ #Case 3
+
+ try:
+ Exec(code, updated_globals, frame.f_locals)
+
+ except SystemExit:
+ raise
+ except:
+ interpreter.showtraceback()
+ else:
+ pydevd_save_locals.save_locals(frame)
+ return False
+
+#=======================================================================================================================
+# main
+#=======================================================================================================================
+if __name__ == '__main__':
+ #Important: don't use this module directly as the __main__ module, rather, import itself as pydevconsole
+ #so that we don't get multiple pydevconsole modules if it's executed directly (otherwise we'd have multiple
+ #representations of its classes).
+ #See: https://sw-brainwy.rhcloud.com/tracker/PyDev/446:
+ #'Variables' and 'Expressions' views stopped working when debugging interactive console
+ import pydevconsole
+ sys.stdin = pydevconsole.BaseStdIn(sys.stdin)
+ port, client_port = sys.argv[1:3]
+ from _pydev_bundle import pydev_localhost
+
+ if int(port) == 0 and int(client_port) == 0:
+ (h, p) = pydev_localhost.get_socket_name()
+
+ client_port = p
+
+ pydevconsole.start_server(pydev_localhost.get_localhost(), int(port), int(client_port))
diff --git a/ptvsd/pydevd/pydevd.py b/ptvsd/pydevd/pydevd.py
new file mode 100644
index 00000000..b9221dd8
--- /dev/null
+++ b/ptvsd/pydevd/pydevd.py
@@ -0,0 +1,1621 @@
+'''
+Entry point module (keep at root):
+
+This module starts the debugger.
+'''
+import sys
+
+if sys.version_info[:2] < (2, 6):
+ raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
+
+import atexit
+import os
+import traceback
+
+from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY3K, IS_PY34_OLDER, get_thread_id, dict_keys, \
+ dict_iter_items, DebugInfoHolder, PYTHON_SUSPEND, STATE_SUSPEND, STATE_RUN, get_frame, xrange, \
+ clear_cached_thread_id, INTERACTIVE_MODE_AVAILABLE
+from _pydev_bundle import fix_getpass
+from _pydev_bundle import pydev_imports, pydev_log
+from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
+from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
+from _pydev_imps._pydev_saved_modules import threading
+from _pydev_imps._pydev_saved_modules import time
+from _pydev_imps._pydev_saved_modules import thread
+from _pydevd_bundle import pydevd_io, pydevd_vm_type
+import pydevd_tracing
+from _pydevd_bundle import pydevd_utils
+from _pydevd_bundle import pydevd_vars
+from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
+from _pydevd_bundle.pydevd_breakpoints import ExceptionBreakpoint, update_exception_hook
+from _pydevd_bundle.pydevd_comm import CMD_SET_BREAK, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO, CMD_STEP_OVER, \
+ CMD_STEP_RETURN, CMD_STEP_INTO_MY_CODE, CMD_THREAD_SUSPEND, CMD_RUN_TO_LINE, \
+ CMD_ADD_EXCEPTION_BREAK, CMD_SMART_STEP_INTO, InternalConsoleExec, NetCommandFactory, \
+ PyDBDaemonThread, _queue, ReaderThread, GetGlobalDebugger, get_global_debugger, \
+ set_global_debugger, WriterThread, pydevd_find_thread_by_id, pydevd_log, \
+ start_client, start_server, InternalGetBreakpointException, InternalSendCurrExceptionTrace, \
+ InternalSendCurrExceptionTraceProceeded
+from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer, custom_frames_container_init
+from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame
+from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
+from _pydevd_bundle.pydevd_trace_dispatch import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips
+from _pydevd_frame_eval.pydevd_frame_eval_main import frame_eval_func, stop_frame_eval, enable_cache_frames_without_breaks, dummy_trace_dispatch
+from _pydevd_bundle.pydevd_utils import save_main_module
+from pydevd_concurrency_analyser.pydevd_concurrency_logger import ThreadingLogger, AsyncioLogger, send_message, cur_time
+from pydevd_concurrency_analyser.pydevd_thread_wrappers import wrap_threads
+
+
+__version_info__ = (1, 1, 1)
+__version_info_str__ = []
+for v in __version_info__:
+ __version_info_str__.append(str(v))
+
+__version__ = '.'.join(__version_info_str__)
+
+#IMPORTANT: pydevd_constants must be the 1st thing defined because it'll keep a reference to the original sys._getframe
+
+
+
+
+
+
+
+SUPPORT_PLUGINS = not IS_JYTH_LESS25
+PluginManager = None
+if SUPPORT_PLUGINS:
+ from _pydevd_bundle.pydevd_plugin_utils import PluginManager
+
+
+threadingEnumerate = threading.enumerate
+threadingCurrentThread = threading.currentThread
+
+try:
+ 'dummy'.encode('utf-8') # Added because otherwise Jython 2.2.1 wasn't finding the encoding (if it wasn't loaded in the main thread).
+except:
+ pass
+
+
+connected = False
+bufferStdOutToServer = False
+bufferStdErrToServer = False
+remote = False
+forked = False
+
+file_system_encoding = getfilesystemencoding()
+
+
+#=======================================================================================================================
+# PyDBCommandThread
+#=======================================================================================================================
+class PyDBCommandThread(PyDBDaemonThread):
+
+ def __init__(self, py_db):
+ PyDBDaemonThread.__init__(self)
+ self._py_db_command_thread_event = py_db._py_db_command_thread_event
+ self.py_db = py_db
+ self.setName('pydevd.CommandThread')
+
+ def _on_run(self):
+ for i in xrange(1, 10):
+ time.sleep(0.5) #this one will only start later on (because otherwise we may not have any non-daemon threads
+ if self.killReceived:
+ return
+
+ if self.pydev_do_not_trace:
+ self.py_db.SetTrace(None) # no debugging on this thread
+
+ try:
+ while not self.killReceived:
+ try:
+ self.py_db.process_internal_commands()
+ except:
+ pydevd_log(0, 'Finishing debug communication...(2)')
+ self._py_db_command_thread_event.clear()
+ self._py_db_command_thread_event.wait(0.5)
+ except:
+ pydev_log.debug(sys.exc_info()[0])
+
+ #only got this error in interpreter shutdown
+ #pydevd_log(0, 'Finishing debug communication...(3)')
+
+
+
+#=======================================================================================================================
+# CheckOutputThread
+# Non-daemonic thread guaranties that all data is written even if program is finished
+#=======================================================================================================================
+class CheckOutputThread(PyDBDaemonThread):
+
+ def __init__(self, py_db):
+ PyDBDaemonThread.__init__(self)
+ self.py_db = py_db
+ self.setName('pydevd.CheckAliveThread')
+ self.daemon = False
+ py_db.output_checker = self
+
+ def _on_run(self):
+ if self.pydev_do_not_trace:
+
+ disable_tracing = True
+
+ if pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON and sys.hexversion <= 0x020201f0:
+ # don't run untraced threads if we're in jython 2.2.1 or lower
+ # jython bug: if we start a thread and another thread changes the tracing facility
+ # it affects other threads (it's not set only for the thread but globally)
+ # Bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1870039&group_id=12867&atid=112867
+ disable_tracing = False
+
+ if disable_tracing:
+ pydevd_tracing.SetTrace(None) # no debugging on this thread
+
+ while not self.killReceived:
+ time.sleep(0.3)
+ if not self.py_db.has_threads_alive() and self.py_db.writer.empty() \
+ and not has_data_to_redirect():
+ try:
+ pydev_log.debug("No alive threads, finishing debug session")
+ self.py_db.finish_debugging_session()
+ kill_all_pydev_threads()
+ except:
+ traceback.print_exc()
+
+ self.killReceived = True
+
+ self.py_db.check_output_redirect()
+
+
+ def do_kill_pydev_thread(self):
+ self.killReceived = True
+
+
+
+#=======================================================================================================================
+# PyDB
+#=======================================================================================================================
+class PyDB:
+ """ Main debugging class
+ Lots of stuff going on here:
+
+ PyDB starts two threads on startup that connect to remote debugger (RDB)
+ The threads continuously read & write commands to RDB.
+ PyDB communicates with these threads through command queues.
+ Every RDB command is processed by calling process_net_command.
+ Every PyDB net command is sent to the net by posting NetCommand to WriterThread queue
+
+ Some commands need to be executed on the right thread (suspend/resume & friends)
+ These are placed on the internal command queue.
+ """
+
+
+ def __init__(self):
+ set_global_debugger(self)
+ pydevd_tracing.replace_sys_set_trace_func()
+ self.reader = None
+ self.writer = None
+ self.output_checker = None
+ self.quitting = None
+ self.cmd_factory = NetCommandFactory()
+ self._cmd_queue = {} # the hash of Queues. Key is thread id, value is thread
+
+ self.breakpoints = {}
+
+ self.file_to_id_to_line_breakpoint = {}
+ self.file_to_id_to_plugin_breakpoint = {}
+
+ # Note: breakpoints dict should not be mutated: a copy should be created
+ # and later it should be assigned back (to prevent concurrency issues).
+ self.break_on_uncaught_exceptions = {}
+ self.break_on_caught_exceptions = {}
+
+ self.ready_to_run = False
+ self._main_lock = thread.allocate_lock()
+ self._lock_running_thread_ids = thread.allocate_lock()
+ self._py_db_command_thread_event = threading.Event()
+ CustomFramesContainer._py_db_command_thread_event = self._py_db_command_thread_event
+ self._finish_debugging_session = False
+ self._termination_event_set = False
+ self.signature_factory = None
+ self.SetTrace = pydevd_tracing.SetTrace
+ self.break_on_exceptions_thrown_in_same_context = False
+ self.ignore_exceptions_thrown_in_lines_with_ignore_exception = True
+
+ # Suspend debugger even if breakpoint condition raises an exception
+ SUSPEND_ON_BREAKPOINT_EXCEPTION = True
+ self.suspend_on_breakpoint_exception = SUSPEND_ON_BREAKPOINT_EXCEPTION
+
+ # By default user can step into properties getter/setter/deleter methods
+ self.disable_property_trace = False
+ self.disable_property_getter_trace = False
+ self.disable_property_setter_trace = False
+ self.disable_property_deleter_trace = False
+
+ #this is a dict of thread ids pointing to thread ids. Whenever a command is passed to the java end that
+ #acknowledges that a thread was created, the thread id should be passed here -- and if at some time we do not
+ #find that thread alive anymore, we must remove it from this list and make the java side know that the thread
+ #was killed.
+ self._running_thread_ids = {}
+ self._set_breakpoints_with_id = False
+
+ # This attribute holds the file-> lines which have an @IgnoreException.
+ self.filename_to_lines_where_exceptions_are_ignored = {}
+
+ #working with plugins (lazily initialized)
+ self.plugin = None
+ self.has_plugin_line_breaks = False
+ self.has_plugin_exception_breaks = False
+ self.thread_analyser = None
+ self.asyncio_analyser = None
+
+ # matplotlib support in debugger and debug console
+ self.mpl_in_use = False
+ self.mpl_hooks_in_debug_console = False
+ self.mpl_modules_for_patching = {}
+
+ self._filename_to_not_in_scope = {}
+ self.first_breakpoint_reached = False
+ self.is_filter_enabled = pydevd_utils.is_filter_enabled()
+ self.is_filter_libraries = pydevd_utils.is_filter_libraries()
+ self.show_return_values = False
+ self.remove_return_values_flag = False
+
+ # this flag disables frame evaluation even if it's available
+ self.do_not_use_frame_eval = False
+
+ def get_plugin_lazy_init(self):
+ if self.plugin is None and SUPPORT_PLUGINS:
+ self.plugin = PluginManager(self)
+ return self.plugin
+
+ def not_in_scope(self, filename):
+ return pydevd_utils.not_in_project_roots(filename)
+
+ def is_ignored_by_filters(self, filename):
+ return pydevd_utils.is_ignored_by_filter(filename)
+
+ def first_appearance_in_scope(self, trace):
+ if trace is None or self.not_in_scope(trace.tb_frame.f_code.co_filename):
+ return False
+ else:
+ trace = trace.tb_next
+ while trace is not None:
+ frame = trace.tb_frame
+ if not self.not_in_scope(frame.f_code.co_filename):
+ return False
+ trace = trace.tb_next
+ return True
+
+ def has_threads_alive(self):
+ for t in threadingEnumerate():
+ if getattr(t, 'is_pydev_daemon_thread', False):
+ #Important: Jython 2.5rc4 has a bug where a thread created with thread.start_new_thread won't be
+ #set as a daemon thread, so, we also have to check for the 'is_pydev_daemon_thread' flag.
+ #See: https://github.com/fabioz/PyDev.Debugger/issues/11
+ continue
+
+ if isinstance(t, PyDBDaemonThread):
+ pydev_log.error_once(
+ 'Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.\n')
+
+ if is_thread_alive(t):
+ if not t.isDaemon() or hasattr(t, "__pydevd_main_thread"):
+ return True
+
+ return False
+
+ def finish_debugging_session(self):
+ self._finish_debugging_session = True
+
+
+ def initialize_network(self, sock):
+ try:
+ sock.settimeout(None) # infinite, no timeouts from now on - jython does not have it
+ except:
+ pass
+ self.writer = WriterThread(sock)
+ self.reader = ReaderThread(sock)
+ self.writer.start()
+ self.reader.start()
+
+ time.sleep(0.1) # give threads time to start
+
+ def connect(self, host, port):
+ if host:
+ s = start_client(host, port)
+ else:
+ s = start_server(port)
+
+ self.initialize_network(s)
+
+
+ def get_internal_queue(self, thread_id):
+ """ returns internal command queue for a given thread.
+ if new queue is created, notify the RDB about it """
+ if thread_id.startswith('__frame__'):
+ thread_id = thread_id[thread_id.rfind('|') + 1:]
+ try:
+ return self._cmd_queue[thread_id]
+ except KeyError:
+ return self._cmd_queue.setdefault(thread_id, _queue.Queue()) #@UndefinedVariable
+
+
+ def post_internal_command(self, int_cmd, thread_id):
+ """ if thread_id is *, post to all """
+ if thread_id == "*":
+ threads = threadingEnumerate()
+ for t in threads:
+ thread_id = get_thread_id(t)
+ queue = self.get_internal_queue(thread_id)
+ queue.put(int_cmd)
+
+ else:
+ queue = self.get_internal_queue(thread_id)
+ queue.put(int_cmd)
+
+ def check_output_redirect(self):
+ global bufferStdOutToServer
+ global bufferStdErrToServer
+
+ if bufferStdOutToServer:
+ init_stdout_redirect()
+ self.check_output(sys.stdoutBuf, 1) #@UndefinedVariable
+
+ if bufferStdErrToServer:
+ init_stderr_redirect()
+ self.check_output(sys.stderrBuf, 2) #@UndefinedVariable
+
+ def check_output(self, out, outCtx):
+ '''Checks the output to see if we have to send some buffered output to the debug server
+
+ @param out: sys.stdout or sys.stderr
+ @param outCtx: the context indicating: 1=stdout and 2=stderr (to know the colors to write it)
+ '''
+
+ try:
+ v = out.getvalue()
+
+ if v:
+ self.cmd_factory.make_io_message(v, outCtx, self)
+ except:
+ traceback.print_exc()
+
+
+ def init_matplotlib_in_debug_console(self):
+ # import hook and patches for matplotlib support in debug console
+ from _pydev_bundle.pydev_import_hook import import_hook_manager
+ for module in dict_keys(self.mpl_modules_for_patching):
+ import_hook_manager.add_module_name(module, self.mpl_modules_for_patching.pop(module))
+
+ def init_matplotlib_support(self):
+ # prepare debugger for integration with matplotlib GUI event loop
+ from pydev_ipython.matplotlibtools import activate_matplotlib, activate_pylab, activate_pyplot, do_enable_gui
+ # enable_gui_function in activate_matplotlib should be called in main thread. Unlike integrated console,
+ # in the debug console we have no interpreter instance with exec_queue, but we run this code in the main
+ # thread and can call it directly.
+ class _MatplotlibHelper:
+ _return_control_osc = False
+
+ def return_control():
+ # Some of the input hooks (e.g. Qt4Agg) check return control without doing
+ # a single operation, so we don't return True on every
+ # call when the debug hook is in place to allow the GUI to run
+ _MatplotlibHelper._return_control_osc = not _MatplotlibHelper._return_control_osc
+ return _MatplotlibHelper._return_control_osc
+
+ from pydev_ipython.inputhook import set_return_control_callback
+ set_return_control_callback(return_control)
+
+ self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
+ "matplotlib.pyplot": activate_pyplot,
+ "pylab": activate_pylab }
+
+ def _activate_mpl_if_needed(self):
+ if len(self.mpl_modules_for_patching) > 0:
+ for module in dict_keys(self.mpl_modules_for_patching):
+ if module in sys.modules:
+ activate_function = self.mpl_modules_for_patching.pop(module)
+ activate_function()
+ self.mpl_in_use = True
+
+ def _call_mpl_hook(self):
+ try:
+ from pydev_ipython.inputhook import get_inputhook
+ inputhook = get_inputhook()
+ if inputhook:
+ inputhook()
+ except:
+ pass
+
+ def suspend_all_other_threads(self, thread_suspended_at_bp):
+ all_threads = threadingEnumerate()
+ for t in all_threads:
+ if getattr(t, 'is_pydev_daemon_thread', False):
+ pass # I.e.: skip the DummyThreads created from pydev daemon threads
+ elif hasattr(t, 'pydev_do_not_trace'):
+ pass # skip some other threads, i.e. ipython history saving thread from debug console
+ else:
+ if t is thread_suspended_at_bp:
+ continue
+ additional_info = None
+ try:
+ additional_info = t.additional_info
+ except AttributeError:
+ pass # that's ok, no info currently set
+
+ if additional_info is not None:
+ for frame in additional_info.iter_frames(t):
+ self.set_trace_for_frame_and_parents(frame, overwrite_prev_trace=True)
+ del frame
+
+ self.set_suspend(t, CMD_THREAD_SUSPEND)
+ else:
+ sys.stderr.write("Can't suspend thread: %s\n" % (t,))
+
+ def process_internal_commands(self):
+ '''This function processes internal commands
+ '''
+ self._main_lock.acquire()
+ try:
+
+ self.check_output_redirect()
+
+ curr_thread_id = get_thread_id(threadingCurrentThread())
+ program_threads_alive = {}
+ all_threads = threadingEnumerate()
+ program_threads_dead = []
+ self._lock_running_thread_ids.acquire()
+ try:
+ for t in all_threads:
+ if getattr(t, 'is_pydev_daemon_thread', False):
+ pass # I.e.: skip the DummyThreads created from pydev daemon threads
+ elif isinstance(t, PyDBDaemonThread):
+ pydev_log.error_once('Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.\n')
+
+ elif is_thread_alive(t):
+ if not self._running_thread_ids:
+ # Fix multiprocessing debug with breakpoints in both main and child processes
+ # (https://youtrack.jetbrains.com/issue/PY-17092) When the new process is created, the main
+ # thread in the new process already has the attribute 'pydevd_id', so the new thread doesn't
+ # get new id with its process number and the debugger loses access to both threads.
+ # Therefore we should update thread_id for every main thread in the new process.
+
+ # TODO: Investigate: should we do this for all threads in threading.enumerate()?
+ # (i.e.: if a fork happens on Linux, this seems likely).
+ old_thread_id = get_thread_id(t)
+ if old_thread_id != 'console_main':
+ # The console_main is a special thread id used in the console and its id should never be reset
+ # (otherwise we may no longer be able to get its variables -- see: https://www.brainwy.com/tracker/PyDev/776).
+ clear_cached_thread_id(t)
+ clear_cached_thread_id(threadingCurrentThread())
+
+ thread_id = get_thread_id(t)
+ curr_thread_id = get_thread_id(threadingCurrentThread())
+ if pydevd_vars.has_additional_frames_by_id(old_thread_id):
+ frames_by_id = pydevd_vars.get_additional_frames_by_id(old_thread_id)
+ pydevd_vars.add_additional_frame_by_id(thread_id, frames_by_id)
+ else:
+ thread_id = get_thread_id(t)
+ program_threads_alive[thread_id] = t
+
+ if thread_id not in self._running_thread_ids:
+ if not hasattr(t, 'additional_info'):
+ # see http://sourceforge.net/tracker/index.php?func=detail&aid=1955428&group_id=85796&atid=577329
+ # Let's create the additional info right away!
+ t.additional_info = PyDBAdditionalThreadInfo()
+ self._running_thread_ids[thread_id] = t
+ self.writer.add_command(self.cmd_factory.make_thread_created_message(t))
+
+
+ queue = self.get_internal_queue(thread_id)
+ cmdsToReadd = [] # some commands must be processed by the thread itself... if that's the case,
+ # we will re-add the commands to the queue after executing.
+ try:
+ while True:
+ int_cmd = queue.get(False)
+
+ if not self.mpl_hooks_in_debug_console and isinstance(int_cmd, InternalConsoleExec):
+ # add import hooks for matplotlib patches if only debug console was started
+ try:
+ self.init_matplotlib_in_debug_console()
+ self.mpl_in_use = True
+ except:
+ pydevd_log(2, "Matplotlib support in debug console failed", traceback.format_exc())
+ self.mpl_hooks_in_debug_console = True
+
+ if int_cmd.can_be_executed_by(curr_thread_id):
+ pydevd_log(2, "processing internal command ", str(int_cmd))
+ int_cmd.do_it(self)
+ else:
+ pydevd_log(2, "NOT processing internal command ", str(int_cmd))
+ cmdsToReadd.append(int_cmd)
+
+
+ except _queue.Empty: #@UndefinedVariable
+ for int_cmd in cmdsToReadd:
+ queue.put(int_cmd)
+ # this is how we exit
+
+
+ thread_ids = list(self._running_thread_ids.keys())
+ for tId in thread_ids:
+ if tId not in program_threads_alive:
+ program_threads_dead.append(tId)
+ finally:
+ self._lock_running_thread_ids.release()
+
+ for tId in program_threads_dead:
+ try:
+ self._process_thread_not_alive(tId)
+ except:
+ sys.stderr.write('Error iterating through %s (%s) - %s\n' % (
+ program_threads_alive, program_threads_alive.__class__, dir(program_threads_alive)))
+ raise
+
+
+ if len(program_threads_alive) == 0:
+ self.finish_debugging_session()
+ for t in all_threads:
+ if hasattr(t, 'do_kill_pydev_thread'):
+ t.do_kill_pydev_thread()
+
+ finally:
+ self._main_lock.release()
+
+ def disable_tracing_while_running_if_frame_eval(self):
+ pydevd_tracing.settrace_while_running_if_frame_eval(self, self.dummy_trace_dispatch)
+
+ def enable_tracing_in_frames_while_running_if_frame_eval(self):
+ pydevd_tracing.settrace_while_running_if_frame_eval(self, self.trace_dispatch)
+
+ def set_tracing_for_untraced_contexts_if_not_frame_eval(self, ignore_frame=None, overwrite_prev_trace=False):
+ if self.frame_eval_func is not None:
+ return
+ self.set_tracing_for_untraced_contexts(ignore_frame, overwrite_prev_trace)
+
+ def set_tracing_for_untraced_contexts(self, ignore_frame=None, overwrite_prev_trace=False):
+ # Enable the tracing for existing threads (because there may be frames being executed that
+ # are currently untraced).
+ if self.frame_eval_func is not None:
+ return
+ threads = threadingEnumerate()
+ try:
+ for t in threads:
+ if getattr(t, 'is_pydev_daemon_thread', False):
+ continue
+
+ # TODO: optimize so that we only actually add that tracing if it's in
+ # the new breakpoint context.
+ additional_info = None
+ try:
+ additional_info = t.additional_info
+ except AttributeError:
+ pass # that's ok, no info currently set
+
+ if additional_info is not None:
+ for frame in additional_info.iter_frames(t):
+ if frame is not ignore_frame:
+ self.set_trace_for_frame_and_parents(frame, overwrite_prev_trace=overwrite_prev_trace)
+ finally:
+ frame = None
+ t = None
+ threads = None
+ additional_info = None
+
+
+ def consolidate_breakpoints(self, file, id_to_breakpoint, breakpoints):
+ break_dict = {}
+ for breakpoint_id, pybreakpoint in dict_iter_items(id_to_breakpoint):
+ break_dict[pybreakpoint.line] = pybreakpoint
+
+ breakpoints[file] = break_dict
+ global_cache_skips.clear()
+ global_cache_frame_skips.clear()
+
+ def add_break_on_exception(
+ self,
+ exception,
+ notify_always,
+ notify_on_terminate,
+ notify_on_first_raise_only,
+ ignore_libraries=False
+ ):
+ try:
+ eb = ExceptionBreakpoint(
+ exception,
+ notify_always,
+ notify_on_terminate,
+ notify_on_first_raise_only,
+ ignore_libraries
+ )
+ except ImportError:
+ pydev_log.error("Error unable to add break on exception for: %s (exception could not be imported)\n" % (exception,))
+ return None
+
+ if eb.notify_on_terminate:
+ cp = self.break_on_uncaught_exceptions.copy()
+ cp[exception] = eb
+ if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
+ pydev_log.error("Exceptions to hook on terminate: %s\n" % (cp,))
+ self.break_on_uncaught_exceptions = cp
+
+ if eb.notify_always:
+ cp = self.break_on_caught_exceptions.copy()
+ cp[exception] = eb
+ if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
+ pydev_log.error("Exceptions to hook always: %s\n" % (cp,))
+ self.break_on_caught_exceptions = cp
+
+ return eb
+
+ def update_after_exceptions_added(self, added):
+ updated_on_caught = False
+ updated_on_uncaught = False
+
+ for eb in added:
+ if not updated_on_uncaught and eb.notify_on_terminate:
+ updated_on_uncaught = True
+ update_exception_hook(self)
+
+ if not updated_on_caught and eb.notify_always:
+ updated_on_caught = True
+ self.set_tracing_for_untraced_contexts_if_not_frame_eval()
+
+ def _process_thread_not_alive(self, threadId):
+ """ if thread is not alive, cancel trace_dispatch processing """
+ self._lock_running_thread_ids.acquire()
+ try:
+ thread = self._running_thread_ids.pop(threadId, None)
+ if thread is None:
+ return
+
+ wasNotified = thread.additional_info.pydev_notify_kill
+ if not wasNotified:
+ thread.additional_info.pydev_notify_kill = True
+
+ finally:
+ self._lock_running_thread_ids.release()
+
+ cmd = self.cmd_factory.make_thread_killed_message(threadId)
+ self.writer.add_command(cmd)
+
+
+ def set_suspend(self, thread, stop_reason):
+ thread.additional_info.suspend_type = PYTHON_SUSPEND
+ thread.additional_info.pydev_state = STATE_SUSPEND
+ thread.stop_reason = stop_reason
+
+ # If conditional breakpoint raises any exception during evaluation send details to Java
+ if stop_reason == CMD_SET_BREAK and self.suspend_on_breakpoint_exception:
+ self._send_breakpoint_condition_exception(thread)
+
+
+ def _send_breakpoint_condition_exception(self, thread):
+ """If conditional breakpoint raises an exception during evaluation
+ send exception details to java
+ """
+ thread_id = get_thread_id(thread)
+ conditional_breakpoint_exception_tuple = thread.additional_info.conditional_breakpoint_exception
+ # conditional_breakpoint_exception_tuple - should contain 2 values (exception_type, stacktrace)
+ if conditional_breakpoint_exception_tuple and len(conditional_breakpoint_exception_tuple) == 2:
+ exc_type, stacktrace = conditional_breakpoint_exception_tuple
+ int_cmd = InternalGetBreakpointException(thread_id, exc_type, stacktrace)
+ # Reset the conditional_breakpoint_exception details to None
+ thread.additional_info.conditional_breakpoint_exception = None
+ self.post_internal_command(int_cmd, thread_id)
+
+
+ def send_caught_exception_stack(self, thread, arg, curr_frame_id):
+ """Sends details on the exception which was caught (and where we stopped) to the java side.
+
+ arg is: exception type, description, traceback object
+ """
+ thread_id = get_thread_id(thread)
+ int_cmd = InternalSendCurrExceptionTrace(thread_id, arg, curr_frame_id)
+ self.post_internal_command(int_cmd, thread_id)
+
+
+ def send_caught_exception_stack_proceeded(self, thread):
+ """Sends that some thread was resumed and is no longer showing an exception trace.
+ """
+ thread_id = get_thread_id(thread)
+ int_cmd = InternalSendCurrExceptionTraceProceeded(thread_id)
+ self.post_internal_command(int_cmd, thread_id)
+ self.process_internal_commands()
+
+
+ def send_process_created_message(self):
+ """Sends a message that a new process has been created.
+ """
+ cmd = self.cmd_factory.make_process_created_message()
+ self.writer.add_command(cmd)
+
+
+ def do_wait_suspend(self, thread, frame, event, arg, suspend_type="trace"): #@UnusedVariable
+ """ busy waits until the thread state changes to RUN
+ it expects thread's state as attributes of the thread.
+ Upon running, processes any outstanding Stepping commands.
+ """
+ self.process_internal_commands()
+
+ message = thread.additional_info.pydev_message
+
+ cmd = self.cmd_factory.make_thread_suspend_message(get_thread_id(thread), frame, thread.stop_reason, message, suspend_type)
+ self.writer.add_command(cmd)
+
+ CustomFramesContainer.custom_frames_lock.acquire() # @UndefinedVariable
+ try:
+ from_this_thread = []
+
+ for frame_id, custom_frame in dict_iter_items(CustomFramesContainer.custom_frames):
+ if custom_frame.thread_id == thread.ident:
+ # print >> sys.stderr, 'Frame created: ', frame_id
+ self.writer.add_command(self.cmd_factory.make_custom_frame_created_message(frame_id, custom_frame.name))
+ self.writer.add_command(self.cmd_factory.make_thread_suspend_message(frame_id, custom_frame.frame, CMD_THREAD_SUSPEND, "", suspend_type))
+
+ from_this_thread.append(frame_id)
+
+ finally:
+ CustomFramesContainer.custom_frames_lock.release() # @UndefinedVariable
+
+ imported = False
+ info = thread.additional_info
+
+ if info.pydev_state == STATE_SUSPEND and not self._finish_debugging_session:
+ # before every stop check if matplotlib modules were imported inside script code
+ self._activate_mpl_if_needed()
+
+ while info.pydev_state == STATE_SUSPEND and not self._finish_debugging_session:
+ if self.mpl_in_use:
+ # call input hooks if only matplotlib is in use
+ self._call_mpl_hook()
+
+ self.process_internal_commands()
+ time.sleep(0.01)
+
+ # process any stepping instructions
+ if info.pydev_step_cmd == CMD_STEP_INTO or info.pydev_step_cmd == CMD_STEP_INTO_MY_CODE:
+ info.pydev_step_stop = None
+ info.pydev_smart_step_stop = None
+
+ elif info.pydev_step_cmd == CMD_STEP_OVER:
+ info.pydev_step_stop = frame
+ info.pydev_smart_step_stop = None
+ self.set_trace_for_frame_and_parents(frame)
+
+ elif info.pydev_step_cmd == CMD_SMART_STEP_INTO:
+ self.set_trace_for_frame_and_parents(frame)
+ info.pydev_step_stop = None
+ info.pydev_smart_step_stop = frame
+
+ elif info.pydev_step_cmd == CMD_RUN_TO_LINE or info.pydev_step_cmd == CMD_SET_NEXT_STATEMENT :
+ self.set_trace_for_frame_and_parents(frame)
+
+ if event == 'line' or event == 'exception':
+ #If we're already in the correct context, we have to stop it now, because we can act only on
+ #line events -- if a return was the next statement it wouldn't work (so, we have this code
+ #repeated at pydevd_frame).
+ stop = False
+ curr_func_name = frame.f_code.co_name
+
+ #global context is set with an empty name
+ if curr_func_name in ('?', ''):
+ curr_func_name = ''
+
+ if curr_func_name == info.pydev_func_name:
+ line = info.pydev_next_line
+ if frame.f_lineno == line:
+ stop = True
+ else :
+ if frame.f_trace is None:
+ frame.f_trace = self.trace_dispatch
+ frame.f_lineno = line
+ frame.f_trace = None
+ stop = True
+ if stop:
+ info.pydev_state = STATE_SUSPEND
+ self.do_wait_suspend(thread, frame, event, arg, "trace")
+ return
+
+
+ elif info.pydev_step_cmd == CMD_STEP_RETURN:
+ back_frame = frame.f_back
+ if back_frame is not None:
+ # steps back to the same frame (in a return call it will stop in the 'back frame' for the user)
+ info.pydev_step_stop = frame
+ self.set_trace_for_frame_and_parents(frame)
+ else:
+ # No back frame?!? -- this happens in jython when we have some frame created from an awt event
+ # (the previous frame would be the awt event, but this doesn't make part of 'jython', only 'java')
+ # so, if we're doing a step return in this situation, it's the same as just making it run
+ info.pydev_step_stop = None
+ info.pydev_step_cmd = -1
+ info.pydev_state = STATE_RUN
+
+ if self.frame_eval_func is not None and info.pydev_state == STATE_RUN:
+ if info.pydev_step_cmd == -1:
+ if not self.do_not_use_frame_eval:
+ self.SetTrace(self.dummy_trace_dispatch)
+ self.set_trace_for_frame_and_parents(frame, overwrite_prev_trace=True, dispatch_func=dummy_trace_dispatch)
+ else:
+ if info.pydev_step_cmd == CMD_STEP_INTO or info.pydev_step_cmd == CMD_STEP_INTO_MY_CODE:
+ self.set_trace_for_frame_and_parents(frame)
+ # enable old tracing function for stepping
+ self.SetTrace(self.trace_dispatch)
+
+ del frame
+ cmd = self.cmd_factory.make_thread_run_message(get_thread_id(thread), info.pydev_step_cmd)
+ self.writer.add_command(cmd)
+
+ CustomFramesContainer.custom_frames_lock.acquire() # @UndefinedVariable
+ try:
+ # The ones that remained on last_running must now be removed.
+ for frame_id in from_this_thread:
+ # print >> sys.stderr, 'Removing created frame: ', frame_id
+ self.writer.add_command(self.cmd_factory.make_thread_killed_message(frame_id))
+
+ finally:
+ CustomFramesContainer.custom_frames_lock.release() # @UndefinedVariable
+
+ def handle_post_mortem_stop(self, thread, frame, frames_byid, exception):
+ pydev_log.debug("We are stopping in post-mortem\n")
+ thread_id = get_thread_id(thread)
+ pydevd_vars.add_additional_frame_by_id(thread_id, frames_byid)
+ try:
+ try:
+ add_exception_to_frame(frame, exception)
+ self.set_suspend(thread, CMD_ADD_EXCEPTION_BREAK)
+ self.do_wait_suspend(thread, frame, 'exception', None, "trace")
+ except:
+ pydev_log.error("We've got an error while stopping in post-mortem: %s\n"%sys.exc_info()[0])
+ finally:
+ pydevd_vars.remove_additional_frame_by_id(thread_id)
+
+
+ def set_trace_for_frame_and_parents(self, frame, also_add_to_passed_frame=True, overwrite_prev_trace=False, dispatch_func=None):
+ if dispatch_func is None:
+ dispatch_func = self.trace_dispatch
+
+ if also_add_to_passed_frame:
+ self.update_trace(frame, dispatch_func, overwrite_prev_trace)
+
+ frame = frame.f_back
+ while frame:
+ self.update_trace(frame, dispatch_func, overwrite_prev_trace)
+
+ frame = frame.f_back
+ del frame
+
+ def update_trace(self, frame, dispatch_func, overwrite_prev):
+ if frame.f_trace is None:
+ frame.f_trace = dispatch_func
+ else:
+ if overwrite_prev:
+ frame.f_trace = dispatch_func
+ else:
+ try:
+ #If it's the trace_exception, go back to the frame trace dispatch!
+ if frame.f_trace.im_func.__name__ == 'trace_exception':
+ frame.f_trace = frame.f_trace.im_self.trace_dispatch
+ except AttributeError:
+ pass
+ frame = frame.f_back
+ del frame
+
+ def prepare_to_run(self):
+ ''' Shared code to prepare debugging by installing traces and registering threads '''
+ self.patch_threads()
+ pydevd_tracing.SetTrace(self.trace_dispatch, self.frame_eval_func, self.dummy_trace_dispatch)
+ # There is no need to set tracing function if frame evaluation is available. Moreover, there is no need to patch thread
+ # functions, because frame evaluation function is set to all threads by default.
+
+ PyDBCommandThread(self).start()
+ if self.signature_factory is not None or self.thread_analyser is not None:
+ # we need all data to be sent to IDE even after program finishes
+ CheckOutputThread(self).start()
+
+
+ def patch_threads(self):
+ try:
+ # not available in jython!
+ import threading
+ threading.settrace(self.trace_dispatch) # for all future threads
+ except:
+ pass
+
+ from _pydev_bundle.pydev_monkey import patch_thread_modules
+ patch_thread_modules()
+
+ def get_fullname(self, mod_name):
+ if IS_PY3K:
+ import pkgutil
+ else:
+ from _pydev_imps import _pydev_pkgutil_old as pkgutil
+ try:
+ loader = pkgutil.get_loader(mod_name)
+ except:
+ return None
+ if loader is not None:
+ for attr in ("get_filename", "_get_filename"):
+ meth = getattr(loader, attr, None)
+ if meth is not None:
+ return meth(mod_name)
+ return None
+
+ def run(self, file, globals=None, locals=None, is_module=False, set_trace=True):
+ module_name = None
+ if is_module:
+ file, _, entry_point_fn = file.partition(':')
+ module_name = file
+ filename = self.get_fullname(file)
+ if filename is None:
+ sys.stderr.write("No module named %s\n" % file)
+ return
+ else:
+ file = filename
+
+ if os.path.isdir(file):
+ new_target = os.path.join(file, '__main__.py')
+ if os.path.isfile(new_target):
+ file = new_target
+
+ if globals is None:
+ m = save_main_module(file, 'pydevd')
+ globals = m.__dict__
+ try:
+ globals['__builtins__'] = __builtins__
+ except NameError:
+ pass # Not there on Jython...
+
+ if locals is None:
+ locals = globals
+
+ if set_trace:
+ # Predefined (writable) attributes: __name__ is the module's name;
+ # __doc__ is the module's documentation string, or None if unavailable;
+ # __file__ is the pathname of the file from which the module was loaded,
+ # if it was loaded from a file. The __file__ attribute is not present for
+ # C modules that are statically linked into the interpreter; for extension modules
+ # loaded dynamically from a shared library, it is the pathname of the shared library file.
+
+
+ # I think this is an ugly hack, bug it works (seems to) for the bug that says that sys.path should be the same in
+ # debug and run.
+ if m.__file__.startswith(sys.path[0]):
+ # print >> sys.stderr, 'Deleting: ', sys.path[0]
+ del sys.path[0]
+
+ if not is_module:
+ # now, the local directory has to be added to the pythonpath
+ # sys.path.insert(0, os.getcwd())
+ # Changed: it's not the local directory, but the directory of the file launched
+ # The file being run must be in the pythonpath (even if it was not before)
+ sys.path.insert(0, os.path.split(file)[0])
+
+ while not self.ready_to_run:
+ time.sleep(0.1) # busy wait until we receive run command
+
+ if self.break_on_caught_exceptions or (self.plugin and self.plugin.has_exception_breaks()) or self.signature_factory:
+ # disable frame evaluation if there are exception breakpoints with 'On raise' activation policy
+ # or if there are plugin exception breakpoints or if collecting run-time types is enabled
+ self.frame_eval_func = None
+
+ # call prepare_to_run when we already have all information about breakpoints
+ self.prepare_to_run()
+
+ if self.thread_analyser is not None:
+ wrap_threads()
+ t = threadingCurrentThread()
+ self.thread_analyser.set_start_time(cur_time())
+ send_message("threading_event", 0, t.getName(), get_thread_id(t), "thread", "start", file, 1, None, parent=get_thread_id(t))
+
+ if self.asyncio_analyser is not None:
+ # we don't have main thread in asyncio graph, so we should add a fake event
+ send_message("asyncio_event", 0, "Task", "Task", "thread", "stop", file, 1, frame=None, parent=None)
+
+ try:
+ if INTERACTIVE_MODE_AVAILABLE:
+ self.init_matplotlib_support()
+ except:
+ sys.stderr.write("Matplotlib support in debugger failed\n")
+ traceback.print_exc()
+
+ if not is_module:
+ pydev_imports.execfile(file, globals, locals) # execute the script
+ else:
+ # treat ':' as a seperator between module and entry point function
+ # if there is no entry point we run we same as with -m switch. Otherwise we perform
+ # an import and execute the entry point
+ if entry_point_fn:
+ mod = __import__(module_name, level=0, fromlist=[entry_point_fn], globals=globals, locals=locals)
+ func = getattr(mod, entry_point_fn)
+ func()
+ else:
+ # Run with the -m switch
+ import runpy
+ if hasattr(runpy, '_run_module_as_main'):
+ # Newer versions of Python actually use this when the -m switch is used.
+ if sys.version_info[:2] <= (2, 6):
+ runpy._run_module_as_main(module_name, set_argv0=False)
+ else:
+ runpy._run_module_as_main(module_name, alter_argv=False)
+ else:
+ runpy.run_module(module_name)
+ return globals
+
+ def exiting(self):
+ sys.stdout.flush()
+ sys.stderr.flush()
+ self.check_output_redirect()
+ cmd = self.cmd_factory.make_exit_message()
+ self.writer.add_command(cmd)
+
+ def wait_for_commands(self, globals):
+ self._activate_mpl_if_needed()
+
+ thread = threading.currentThread()
+ from _pydevd_bundle import pydevd_frame_utils
+ frame = pydevd_frame_utils.Frame(None, -1, pydevd_frame_utils.FCode("Console",
+ os.path.abspath(os.path.dirname(__file__))), globals, globals)
+ thread_id = get_thread_id(thread)
+ pydevd_vars.add_additional_frame_by_id(thread_id, {id(frame): frame})
+
+ cmd = self.cmd_factory.make_show_console_message(thread_id, frame)
+ self.writer.add_command(cmd)
+
+ while True:
+ if self.mpl_in_use:
+ # call input hooks if only matplotlib is in use
+ self._call_mpl_hook()
+ self.process_internal_commands()
+ time.sleep(0.01)
+
+ trace_dispatch = _trace_dispatch
+ frame_eval_func = frame_eval_func
+ dummy_trace_dispatch = dummy_trace_dispatch
+ enable_cache_frames_without_breaks = enable_cache_frames_without_breaks
+
+def set_debug(setup):
+ setup['DEBUG_RECORD_SOCKET_READS'] = True
+ setup['DEBUG_TRACE_BREAKPOINTS'] = 1
+ setup['DEBUG_TRACE_LEVEL'] = 3
+
+
+def enable_qt_support(qt_support_mode):
+ from _pydev_bundle import pydev_monkey_qt
+ pydev_monkey_qt.patch_qt(qt_support_mode)
+
+
+
+def usage(doExit=0):
+ sys.stdout.write('Usage:\n')
+ sys.stdout.write('pydevd.py --port N [(--client hostname) | --server] --file executable [file_options]\n')
+ if doExit:
+ sys.exit(0)
+
+
+def init_stdout_redirect():
+ if not getattr(sys, 'stdoutBuf', None):
+ sys.stdoutBuf = pydevd_io.IOBuf()
+ sys.stdout_original = sys.stdout
+ sys.stdout = pydevd_io.IORedirector(sys.stdout, sys.stdoutBuf) #@UndefinedVariable
+
+def init_stderr_redirect():
+ if not getattr(sys, 'stderrBuf', None):
+ sys.stderrBuf = pydevd_io.IOBuf()
+ sys.stderr_original = sys.stderr
+ sys.stderr = pydevd_io.IORedirector(sys.stderr, sys.stderrBuf) #@UndefinedVariable
+
+
+def has_data_to_redirect():
+ if getattr(sys, 'stdoutBuf', None):
+ if not sys.stdoutBuf.empty():
+ return True
+ if getattr(sys, 'stderrBuf', None):
+ if not sys.stderrBuf.empty():
+ return True
+
+ return False
+
+#=======================================================================================================================
+# settrace
+#=======================================================================================================================
+def settrace(
+ host=None,
+ stdoutToServer=False,
+ stderrToServer=False,
+ port=5678,
+ suspend=True,
+ trace_only_current_thread=False,
+ overwrite_prev_trace=False,
+ patch_multiprocessing=False,
+ ):
+ '''Sets the tracing function with the pydev debug function and initializes needed facilities.
+
+ @param host: the user may specify another host, if the debug server is not in the same machine (default is the local
+ host)
+
+ @param stdoutToServer: when this is true, the stdout is passed to the debug server
+
+ @param stderrToServer: when this is true, the stderr is passed to the debug server
+ so that they are printed in its console and not in this process console.
+
+ @param port: specifies which port to use for communicating with the server (note that the server must be started
+ in the same port). @note: currently it's hard-coded at 5678 in the client
+
+ @param suspend: whether a breakpoint should be emulated as soon as this function is called.
+
+ @param trace_only_current_thread: determines if only the current thread will be traced or all current and future
+ threads will also have the tracing enabled.
+
+ @param overwrite_prev_trace: if True we'll reset the frame.f_trace of frames which are already being traced
+
+ @param patch_multiprocessing: if True we'll patch the functions which create new processes so that launched
+ processes are debugged.
+ '''
+ _set_trace_lock.acquire()
+ try:
+ _locked_settrace(
+ host,
+ stdoutToServer,
+ stderrToServer,
+ port,
+ suspend,
+ trace_only_current_thread,
+ overwrite_prev_trace,
+ patch_multiprocessing,
+ )
+ finally:
+ _set_trace_lock.release()
+
+
+
+_set_trace_lock = thread.allocate_lock()
+
+def _locked_settrace(
+ host,
+ stdoutToServer,
+ stderrToServer,
+ port,
+ suspend,
+ trace_only_current_thread,
+ overwrite_prev_trace,
+ patch_multiprocessing,
+ ):
+ if patch_multiprocessing:
+ try:
+ from _pydev_bundle import pydev_monkey
+ except:
+ pass
+ else:
+ pydev_monkey.patch_new_process_functions()
+
+ if host is None:
+ from _pydev_bundle import pydev_localhost
+ host = pydev_localhost.get_localhost()
+
+ global connected
+ global bufferStdOutToServer
+ global bufferStdErrToServer
+
+ if not connected:
+ pydevd_vm_type.setup_type()
+
+ if SetupHolder.setup is None:
+ setup = {
+ 'client': host, # dispatch expects client to be set to the host address when server is False
+ 'server': False,
+ 'port': int(port),
+ 'multiprocess': patch_multiprocessing,
+ }
+ SetupHolder.setup = setup
+
+ debugger = PyDB()
+ debugger.connect(host, port) # Note: connect can raise error.
+
+ # Mark connected only if it actually succeeded.
+ connected = True
+ bufferStdOutToServer = stdoutToServer
+ bufferStdErrToServer = stderrToServer
+
+ if bufferStdOutToServer:
+ init_stdout_redirect()
+
+ if bufferStdErrToServer:
+ init_stderr_redirect()
+
+ patch_stdin(debugger)
+ debugger.set_trace_for_frame_and_parents(get_frame(), False, overwrite_prev_trace=overwrite_prev_trace)
+
+
+ CustomFramesContainer.custom_frames_lock.acquire() # @UndefinedVariable
+ try:
+ for _frameId, custom_frame in dict_iter_items(CustomFramesContainer.custom_frames):
+ debugger.set_trace_for_frame_and_parents(custom_frame.frame, False)
+ finally:
+ CustomFramesContainer.custom_frames_lock.release() # @UndefinedVariable
+
+
+ t = threadingCurrentThread()
+ try:
+ additional_info = t.additional_info
+ except AttributeError:
+ additional_info = PyDBAdditionalThreadInfo()
+ t.additional_info = additional_info
+
+ while not debugger.ready_to_run:
+ time.sleep(0.1) # busy wait until we receive run command
+
+ global forked
+ frame_eval_for_tracing = debugger.frame_eval_func
+ if frame_eval_func is not None and not forked:
+ # Disable frame evaluation for Remote Debug Server
+ frame_eval_for_tracing = None
+
+ # note that we do that through pydevd_tracing.SetTrace so that the tracing
+ # is not warned to the user!
+ pydevd_tracing.SetTrace(debugger.trace_dispatch, frame_eval_for_tracing, debugger.dummy_trace_dispatch)
+
+ if not trace_only_current_thread:
+ # Trace future threads?
+ debugger.patch_threads()
+
+ # As this is the first connection, also set tracing for any untraced threads
+ debugger.set_tracing_for_untraced_contexts(ignore_frame=get_frame(), overwrite_prev_trace=overwrite_prev_trace)
+
+ # Stop the tracing as the last thing before the actual shutdown for a clean exit.
+ atexit.register(stoptrace)
+
+ PyDBCommandThread(debugger).start()
+ CheckOutputThread(debugger).start()
+
+ #Suspend as the last thing after all tracing is in place.
+ if suspend:
+ debugger.set_suspend(t, CMD_THREAD_SUSPEND)
+
+
+ else:
+ # ok, we're already in debug mode, with all set, so, let's just set the break
+ debugger = get_global_debugger()
+
+ debugger.set_trace_for_frame_and_parents(get_frame(), False)
+
+ t = threadingCurrentThread()
+ try:
+ additional_info = t.additional_info
+ except AttributeError:
+ additional_info = PyDBAdditionalThreadInfo()
+ t.additional_info = additional_info
+
+ pydevd_tracing.SetTrace(debugger.trace_dispatch, debugger.frame_eval_func, debugger.dummy_trace_dispatch)
+
+ if not trace_only_current_thread:
+ # Trace future threads?
+ debugger.patch_threads()
+
+
+ if suspend:
+ debugger.set_suspend(t, CMD_THREAD_SUSPEND)
+
+
+def stoptrace():
+ global connected
+ if connected:
+ pydevd_tracing.restore_sys_set_trace_func()
+ sys.settrace(None)
+ try:
+ #not available in jython!
+ threading.settrace(None) # for all future threads
+ except:
+ pass
+
+ from _pydev_bundle.pydev_monkey import undo_patch_thread_modules
+ undo_patch_thread_modules()
+
+ debugger = get_global_debugger()
+
+ if debugger:
+
+ debugger.set_trace_for_frame_and_parents(
+ get_frame(), also_add_to_passed_frame=True, overwrite_prev_trace=True, dispatch_func=lambda *args:None)
+ debugger.exiting()
+
+ kill_all_pydev_threads()
+
+ connected = False
+
+class Dispatcher(object):
+ def __init__(self):
+ self.port = None
+
+ def connect(self, host, port):
+ self.host = host
+ self.port = port
+ self.client = start_client(self.host, self.port)
+ self.reader = DispatchReader(self)
+ self.reader.pydev_do_not_trace = False #we run reader in the same thread so we don't want to loose tracing
+ self.reader.run()
+
+ def close(self):
+ try:
+ self.reader.do_kill_pydev_thread()
+ except :
+ pass
+
+class DispatchReader(ReaderThread):
+ def __init__(self, dispatcher):
+ self.dispatcher = dispatcher
+ ReaderThread.__init__(self, self.dispatcher.client)
+
+ def _on_run(self):
+ dummy_thread = threading.currentThread()
+ dummy_thread.is_pydev_daemon_thread = False
+ return ReaderThread._on_run(self)
+
+ def handle_except(self):
+ ReaderThread.handle_except(self)
+
+ def process_command(self, cmd_id, seq, text):
+ if cmd_id == 99:
+ self.dispatcher.port = int(text)
+ self.killReceived = True
+
+
+DISPATCH_APPROACH_NEW_CONNECTION = 1 # Used by PyDev
+DISPATCH_APPROACH_EXISTING_CONNECTION = 2 # Used by PyCharm
+DISPATCH_APPROACH = DISPATCH_APPROACH_NEW_CONNECTION
+
+def dispatch():
+ setup = SetupHolder.setup
+ host = setup['client']
+ port = setup['port']
+ if DISPATCH_APPROACH == DISPATCH_APPROACH_EXISTING_CONNECTION:
+ dispatcher = Dispatcher()
+ try:
+ dispatcher.connect(host, port)
+ port = dispatcher.port
+ finally:
+ dispatcher.close()
+ return host, port
+
+
+def settrace_forked():
+ '''
+ When creating a fork from a process in the debugger, we need to reset the whole debugger environment!
+ '''
+ host, port = dispatch()
+
+ import pydevd_tracing
+ pydevd_tracing.restore_sys_set_trace_func()
+
+ if port is not None:
+ global connected
+ connected = False
+ global forked
+ forked = True
+
+ custom_frames_container_init()
+
+ settrace(
+ host,
+ port=port,
+ suspend=False,
+ trace_only_current_thread=False,
+ overwrite_prev_trace=True,
+ patch_multiprocessing=True,
+ )
+
+#=======================================================================================================================
+# SetupHolder
+#=======================================================================================================================
+class SetupHolder:
+
+ setup = None
+
+
+def apply_debugger_options(setup_options):
+ """
+
+ :type setup_options: dict[str, bool]
+ """
+ default_options = {'save-signatures': False, 'qt-support': ''}
+ default_options.update(setup_options)
+ setup_options = default_options
+
+ debugger = GetGlobalDebugger()
+ if setup_options['save-signatures']:
+ if pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON:
+ sys.stderr.write("Collecting run-time type information is not supported for Jython\n")
+ else:
+ # Only import it if we're going to use it!
+ from _pydevd_bundle.pydevd_signature import SignatureFactory
+ debugger.signature_factory = SignatureFactory()
+
+ if setup_options['qt-support']:
+ enable_qt_support(setup_options['qt-support'])
+
+
+def patch_stdin(debugger):
+ from _pydev_bundle.pydev_console_utils import DebugConsoleStdIn
+ orig_stdin = sys.stdin
+ sys.stdin = DebugConsoleStdIn(debugger, orig_stdin)
+
+# Dispatch on_debugger_modules_loaded here, after all primary debugger modules are loaded
+from _pydevd_bundle.pydevd_extension_api import DebuggerEventHandler
+from _pydevd_bundle import pydevd_extension_utils
+
+for handler in pydevd_extension_utils.extensions_of_type(DebuggerEventHandler):
+ handler.on_debugger_modules_loaded(debugger_version=__version__)
+#=======================================================================================================================
+# main
+#=======================================================================================================================
+def main():
+
+ # parse the command line. --file is our last argument that is required
+ try:
+ from _pydevd_bundle.pydevd_command_line_handling import process_command_line
+ setup = process_command_line(sys.argv)
+ SetupHolder.setup = setup
+ except ValueError:
+ traceback.print_exc()
+ usage(1)
+
+ if setup['print-in-debugger-startup']:
+ try:
+ pid = ' (pid: %s)' % os.getpid()
+ except:
+ pid = ''
+ sys.stderr.write("pydev debugger: starting%s\n" % pid)
+
+ fix_getpass.fix_getpass()
+
+ pydev_log.debug("Executing file %s" % setup['file'])
+ pydev_log.debug("arguments: %s"% str(sys.argv))
+
+
+ pydevd_vm_type.setup_type(setup.get('vm_type', None))
+
+ if os.getenv('PYCHARM_DEBUG') == 'True' or os.getenv('PYDEV_DEBUG') == 'True':
+ set_debug(setup)
+
+ DebugInfoHolder.DEBUG_RECORD_SOCKET_READS = setup.get('DEBUG_RECORD_SOCKET_READS', DebugInfoHolder.DEBUG_RECORD_SOCKET_READS)
+ DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS = setup.get('DEBUG_TRACE_BREAKPOINTS', DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS)
+ DebugInfoHolder.DEBUG_TRACE_LEVEL = setup.get('DEBUG_TRACE_LEVEL', DebugInfoHolder.DEBUG_TRACE_LEVEL)
+
+ port = setup['port']
+ host = setup['client']
+ f = setup['file']
+ fix_app_engine_debug = False
+
+ debugger = PyDB()
+
+ try:
+ from _pydev_bundle import pydev_monkey
+ except:
+ pass #Not usable on jython 2.1
+ else:
+ if setup['multiprocess']: # PyDev
+ pydev_monkey.patch_new_process_functions()
+
+ elif setup['multiproc']: # PyCharm
+ pydev_log.debug("Started in multiproc mode\n")
+ # Note: we're not inside method, so, no need for 'global'
+ DISPATCH_APPROACH = DISPATCH_APPROACH_EXISTING_CONNECTION
+
+ dispatcher = Dispatcher()
+ try:
+ dispatcher.connect(host, port)
+ if dispatcher.port is not None:
+ port = dispatcher.port
+ pydev_log.debug("Received port %d\n" %port)
+ pydev_log.info("pydev debugger: process %d is connecting\n"% os.getpid())
+
+ try:
+ pydev_monkey.patch_new_process_functions()
+ except:
+ pydev_log.error("Error patching process functions\n")
+ traceback.print_exc()
+ else:
+ pydev_log.error("pydev debugger: couldn't get port for new debug process\n")
+ finally:
+ dispatcher.close()
+ else:
+ pydev_log.info("pydev debugger: starting\n")
+
+ try:
+ pydev_monkey.patch_new_process_functions_with_warning()
+ except:
+ pydev_log.error("Error patching process functions\n")
+ traceback.print_exc()
+
+ # Only do this patching if we're not running with multiprocess turned on.
+ if f.find('dev_appserver.py') != -1:
+ if os.path.basename(f).startswith('dev_appserver.py'):
+ appserver_dir = os.path.dirname(f)
+ version_file = os.path.join(appserver_dir, 'VERSION')
+ if os.path.exists(version_file):
+ try:
+ stream = open(version_file, 'r')
+ try:
+ for line in stream.read().splitlines():
+ line = line.strip()
+ if line.startswith('release:'):
+ line = line[8:].strip()
+ version = line.replace('"', '')
+ version = version.split('.')
+ if int(version[0]) > 1:
+ fix_app_engine_debug = True
+
+ elif int(version[0]) == 1:
+ if int(version[1]) >= 7:
+ # Only fix from 1.7 onwards
+ fix_app_engine_debug = True
+ break
+ finally:
+ stream.close()
+ except:
+ traceback.print_exc()
+
+ try:
+ # In the default run (i.e.: run directly on debug mode), we try to patch stackless as soon as possible
+ # on a run where we have a remote debug, we may have to be more careful because patching stackless means
+ # that if the user already had a stackless.set_schedule_callback installed, he'd loose it and would need
+ # to call it again (because stackless provides no way of getting the last function which was registered
+ # in set_schedule_callback).
+ #
+ # So, ideally, if there's an application using stackless and the application wants to use the remote debugger
+ # and benefit from stackless debugging, the application itself must call:
+ #
+ # import pydevd_stackless
+ # pydevd_stackless.patch_stackless()
+ #
+ # itself to be able to benefit from seeing the tasklets created before the remote debugger is attached.
+ from _pydevd_bundle import pydevd_stackless
+ pydevd_stackless.patch_stackless()
+ except:
+ # It's ok not having stackless there...
+ try:
+ sys.exc_clear() # the exception information should be cleaned in Python 2
+ except:
+ pass
+
+ is_module = setup['module']
+ patch_stdin(debugger)
+
+ if fix_app_engine_debug:
+ sys.stderr.write("pydev debugger: google app engine integration enabled\n")
+ curr_dir = os.path.dirname(__file__)
+ app_engine_startup_file = os.path.join(curr_dir, 'pydev_app_engine_debug_startup.py')
+
+ sys.argv.insert(1, '--python_startup_script=' + app_engine_startup_file)
+ import json
+ setup['pydevd'] = __file__
+ sys.argv.insert(2, '--python_startup_args=%s' % json.dumps(setup),)
+ sys.argv.insert(3, '--automatic_restart=no')
+ sys.argv.insert(4, '--max_module_instances=1')
+
+ # Run the dev_appserver
+ debugger.run(setup['file'], None, None, is_module, set_trace=False)
+ else:
+ if setup['save-threading']:
+ debugger.thread_analyser = ThreadingLogger()
+ if setup['save-asyncio']:
+ if IS_PY34_OLDER:
+ debugger.asyncio_analyser = AsyncioLogger()
+
+ apply_debugger_options(setup)
+
+ try:
+ debugger.connect(host, port)
+ except:
+ sys.stderr.write("Could not connect to %s: %s\n" % (host, port))
+ traceback.print_exc()
+ sys.exit(1)
+
+ connected = True # Mark that we're connected when started from inside ide.
+
+ globals = debugger.run(setup['file'], None, None, is_module)
+
+ if setup['cmd-line']:
+ debugger.wait_for_commands(globals)
+
+if __name__ == '__main__':
+ main()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/README.txt b/ptvsd/pydevd/pydevd_attach_to_process/README.txt
new file mode 100644
index 00000000..138c1039
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/README.txt
@@ -0,0 +1,11 @@
+This folder contains the utilities to attach a target process to the pydev debugger.
+
+The main module to be called for the attach is:
+
+attach_pydevd.py
+
+it should be called as;
+
+python attach_pydevd.py --port 5678 --pid 1234
+
+Note that the client is responsible for having a remote debugger alive in the given port for the attach to work.
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/_always_live_program.py b/ptvsd/pydevd/pydevd_attach_to_process/_always_live_program.py
new file mode 100644
index 00000000..6369508e
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/_always_live_program.py
@@ -0,0 +1,32 @@
+import sys
+import struct
+print('Executable: %s' % sys.executable)
+import os
+def loop_in_thread():
+ while True:
+ import time
+ time.sleep(.5)
+ sys.stdout.write('#')
+ sys.stdout.flush()
+
+import threading
+threading.Thread(target=loop_in_thread).start()
+
+
+def is_python_64bit():
+ return (struct.calcsize('P') == 8)
+
+print('Is 64: %s' % is_python_64bit())
+
+if __name__ == '__main__':
+ print('pid:%s' % (os.getpid()))
+ i = 0
+ while True:
+ i += 1
+ import time
+ time.sleep(.5)
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ if i % 40 == 0:
+ sys.stdout.write('\n')
+ sys.stdout.flush()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/_check.py b/ptvsd/pydevd/pydevd_attach_to_process/_check.py
new file mode 100644
index 00000000..82f8e122
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/_check.py
@@ -0,0 +1,2 @@
+import add_code_to_python_process
+print add_code_to_python_process.run_python_code(3736, "print(20)", connect_debugger_tracing=False)
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process.py b/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process.py
new file mode 100644
index 00000000..8000aae6
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process.py
@@ -0,0 +1,9 @@
+import subprocess
+import sys
+print(sys.executable)
+
+if __name__ == '__main__':
+ p = subprocess.Popen([sys.executable, '-u', '_always_live_program.py'])
+ import attach_pydevd
+ attach_pydevd.main(attach_pydevd.process_command_line(['--pid', str(p.pid)]))
+ p.wait()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py b/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py
new file mode 100644
index 00000000..8bc3d38b
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py
@@ -0,0 +1,78 @@
+'''
+This module is just for testing concepts. It should be erased later on.
+
+Experiments:
+
+// gdb -p 4957
+// call dlopen("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so", 2)
+// call dlsym($1, "hello")
+// call hello()
+
+
+// call open("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so", 2)
+// call mmap(0, 6672, 1 | 2 | 4, 1, 3 , 0)
+// add-symbol-file
+// cat /proc/pid/maps
+
+// call dlopen("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so", 1|8)
+// call dlsym($1, "hello")
+// call hello()
+'''
+
+import subprocess
+import sys
+import os
+import time
+
+if __name__ == '__main__':
+
+ linux_dir = os.path.join(os.path.dirname(__file__), 'linux')
+ os.chdir(linux_dir)
+ so_location = os.path.join(linux_dir, 'attach_linux.so')
+ try:
+ os.remove(so_location)
+ except:
+ pass
+ subprocess.call('g++ -shared -o attach_linux.so -fPIC -nostartfiles attach_linux.c'.split())
+ print('Finished compiling')
+ assert os.path.exists('/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so')
+ os.chdir(os.path.dirname(linux_dir))
+# import attach_pydevd
+# attach_pydevd.main(attach_pydevd.process_command_line(['--pid', str(p.pid)]))
+ p = subprocess.Popen([sys.executable, '-u', '_always_live_program.py'])
+ print('Size of file: %s' % (os.stat(so_location).st_size))
+
+ #(gdb) set architecture
+ # Requires an argument. Valid arguments are i386, i386:x86-64, i386:x64-32, i8086, i386:intel, i386:x86-64:intel, i386:x64-32:intel, i386:nacl, i386:x86-64:nacl, i386:x64-32:nacl, auto.
+
+ cmd = [
+ 'gdb',
+ '--pid',
+ str(p.pid),
+ '--batch',
+ ]
+
+ arch = 'i386:x86-64'
+ if arch:
+ cmd.extend(["--eval-command='set architecture %s'" % arch])
+
+ cmd.extend([
+ "--eval-command='call dlopen(\"/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so\", 2)'",
+ "--eval-command='call DoAttach(1, \"print(\\\"check11111check\\\")\", 0)'",
+ #"--eval-command='call SetSysTraceFunc(1, 0)'", -- never call this way, always use "--command='...gdb_threads_settrace.py'",
+ #So that threads are all stopped!
+ "--command='/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/gdb_threads_settrace.py'",
+ ])
+
+ cmd.extend(['--command=/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/gdb_threads_settrace.py'])
+
+
+ print(' '.join(cmd))
+ time.sleep(.5)
+ env = os.environ.copy()
+ env.pop('PYTHONIOENCODING', None)
+ env.pop('PYTHONPATH', None)
+ p2 = subprocess.call(' '.join(cmd), env=env, shell=True)
+
+ time.sleep(1)
+ p.kill()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/add_code_to_python_process.py b/ptvsd/pydevd/pydevd_attach_to_process/add_code_to_python_process.py
new file mode 100644
index 00000000..2b5c2929
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/add_code_to_python_process.py
@@ -0,0 +1,620 @@
+r'''
+Copyright: Brainwy Software Ltda.
+
+License: EPL.
+=============
+
+Works for Windows relying on a fork of winappdbg which works in py2/3 (at least for the part we're interested in).
+
+See: https://github.com/fabioz/winappdbg (py3 branch).
+Note that the official branch for winappdbg is: https://github.com/MarioVilas/winappdbg, which should be used when it works in Py3.
+A private copy is added here to make deployment easier, but changes should always be done upstream first.
+
+Works for Linux relying on gdb.
+
+Limitations:
+============
+
+ Linux:
+ ------
+
+ 1. It possible that ptrace is disabled: /etc/sysctl.d/10-ptrace.conf
+
+ Note that even enabling it in /etc/sysctl.d/10-ptrace.conf (i.e.: making the
+ ptrace_scope=0), it's possible that we need to run the application that'll use ptrace (or
+ gdb in this case) as root (so, we must sudo the python which'll run this module).
+
+ 2. It currently doesn't work in debug builds (i.e.: python_d)
+
+
+Other implementations:
+- pyrasite.com:
+ GPL
+ Windows/linux (in Linux it also uses gdb to connect -- although specifics are different as we use a dll to execute
+ code with other threads stopped). It's Windows approach is more limited because it doesn't seem to deal properly with
+ Python 3 if threading is disabled.
+
+- https://github.com/google/pyringe:
+ Apache v2.
+ Only linux/Python 2.
+
+- http://pytools.codeplex.com:
+ Apache V2
+ Windows Only (but supports mixed mode debugging)
+ Our own code relies heavily on a part of it: http://pytools.codeplex.com/SourceControl/latest#Python/Product/PyDebugAttach/PyDebugAttach.cpp
+ to overcome some limitations of attaching and running code in the target python executable on Python 3.
+ See: attach.cpp
+
+Linux: References if we wanted to use a pure-python debugger:
+ https://bitbucket.org/haypo/python-ptrace/
+ http://stackoverflow.com/questions/7841573/how-to-get-an-error-message-for-errno-value-in-python
+ Jugaad:
+ https://www.defcon.org/images/defcon-19/dc-19-presentations/Jakhar/DEFCON-19-Jakhar-Jugaad-Linux-Thread-Injection.pdf
+ https://github.com/aseemjakhar/jugaad
+
+Something else (general and not Python related):
+- http://www.codeproject.com/Articles/4610/Three-Ways-to-Inject-Your-Code-into-Another-Proces
+
+Other references:
+- https://github.com/haypo/faulthandler
+- http://nedbatchelder.com/text/trace-function.html
+- https://github.com/python-git/python/blob/master/Python/sysmodule.c (sys_settrace)
+- https://github.com/python-git/python/blob/master/Python/ceval.c (PyEval_SetTrace)
+- https://github.com/python-git/python/blob/master/Python/thread.c (PyThread_get_key_value)
+
+
+To build the dlls needed on windows, visual studio express 13 was used (see compile_dll.bat)
+
+See: attach_pydevd.py to attach the pydev debugger to a running python process.
+'''
+
+# Note: to work with nasm compiling asm to code and decompiling to see asm with shellcode:
+# x:\nasm\nasm-2.07-win32\nasm-2.07\nasm.exe
+# nasm.asm&x:\nasm\nasm-2.07-win32\nasm-2.07\ndisasm.exe -b arch nasm
+import ctypes
+import os
+import struct
+import subprocess
+import sys
+import time
+
+class AutoExit(object):
+
+ def __init__(self, on_exit):
+ self.on_exit = on_exit
+
+ def __enter__(self):
+ pass
+
+ def __exit__(self, *args):
+ self.on_exit()
+
+
+class GenShellCodeHelper(object):
+
+ def __init__(self, is_64):
+ from winappdbg import compat
+ self.is_64 = is_64
+ self._code = []
+ if not is_64:
+ self._translations = {
+ 'push esi': compat.b('\x56'),
+ 'push eax': compat.b('\x50'),
+ 'push ebp': compat.b('\x55'),
+ 'push ebx': compat.b('\x53'),
+
+ 'pop esi': compat.b('\x5E'),
+ 'pop eax': compat.b('\x58'),
+ 'pop ebp': compat.b('\x5D'),
+ 'pop ebx': compat.b('\x5B'),
+
+ 'mov esi': compat.b('\xBE'),
+ 'mov eax': compat.b('\xB8'),
+ 'mov ebp': compat.b('\xBD'),
+ 'mov ebx': compat.b('\xBB'),
+
+ 'call ebp': compat.b('\xFF\xD5'),
+ 'call eax': compat.b('\xFF\xD0'),
+ 'call ebx': compat.b('\xFF\xD3'),
+
+ 'mov ebx,eax': compat.b('\x89\xC3'),
+ 'mov eax,ebx': compat.b('\x89\xD8'),
+ 'mov ebp,esp': compat.b('\x89\xE5'),
+ 'mov esp,ebp': compat.b('\x89\xEC'),
+ 'push dword': compat.b('\x68'),
+
+ 'mov ebp,eax': compat.b('\x89\xC5'),
+ 'mov eax,ebp': compat.b('\x89\xE8'),
+
+ 'ret': compat.b('\xc3'),
+ }
+ else:
+ # Translate 64 bits
+ self._translations = {
+ 'push rsi': compat.b('\x56'),
+ 'push rax': compat.b('\x50'),
+ 'push rbp': compat.b('\x55'),
+ 'push rbx': compat.b('\x53'),
+ 'push rsp': compat.b('\x54'),
+ 'push rdi': compat.b('\x57'),
+
+ 'pop rsi': compat.b('\x5E'),
+ 'pop rax': compat.b('\x58'),
+ 'pop rbp': compat.b('\x5D'),
+ 'pop rbx': compat.b('\x5B'),
+ 'pop rsp': compat.b('\x5C'),
+ 'pop rdi': compat.b('\x5F'),
+
+ 'mov rsi': compat.b('\x48\xBE'),
+ 'mov rax': compat.b('\x48\xB8'),
+ 'mov rbp': compat.b('\x48\xBD'),
+ 'mov rbx': compat.b('\x48\xBB'),
+ 'mov rdi': compat.b('\x48\xBF'),
+ 'mov rcx': compat.b('\x48\xB9'),
+ 'mov rdx': compat.b('\x48\xBA'),
+
+ 'call rbp': compat.b('\xFF\xD5'),
+ 'call rax': compat.b('\xFF\xD0'),
+ 'call rbx': compat.b('\xFF\xD3'),
+
+ 'mov rbx,rax': compat.b('\x48\x89\xC3'),
+ 'mov rax,rbx': compat.b('\x48\x89\xD8'),
+ 'mov rbp,rsp': compat.b('\x48\x89\xE5'),
+ 'mov rsp,rbp': compat.b('\x48\x89\xEC'),
+ 'mov rcx,rbp': compat.b('\x48\x89\xE9'),
+
+ 'mov rbp,rax': compat.b('\x48\x89\xC5'),
+ 'mov rax,rbp': compat.b('\x48\x89\xE8'),
+
+ 'mov rdi,rbp': compat.b('\x48\x89\xEF'),
+
+ 'ret': compat.b('\xc3'),
+ }
+
+ def push_addr(self, addr):
+ self._code.append(self.translate('push dword'))
+ self._code.append(addr)
+
+ def push(self, register):
+ self._code.append(self.translate('push %s' % register))
+ return AutoExit(lambda: self.pop(register))
+
+ def pop(self, register):
+ self._code.append(self.translate('pop %s' % register))
+
+ def mov_to_register_addr(self, register, addr):
+ self._code.append(self.translate('mov %s' % register))
+ self._code.append(addr)
+
+ def mov_register_to_from(self, register_to, register_from):
+ self._code.append(self.translate('mov %s,%s' % (register_to, register_from)))
+
+ def call(self, register):
+ self._code.append(self.translate('call %s' % register))
+
+ def preserve_stack(self):
+ self.mov_register_to_from('ebp', 'esp')
+ return AutoExit(lambda: self.restore_stack())
+
+ def restore_stack(self):
+ self.mov_register_to_from('esp', 'ebp')
+
+ def ret(self):
+ self._code.append(self.translate('ret'))
+
+ def get_code(self):
+ from winappdbg import compat
+ return compat.b('').join(self._code)
+
+ def translate(self, code):
+ return self._translations[code]
+
+ def pack_address(self, address):
+ if self.is_64:
+ return struct.pack('
+
+// DECLDIR will perform an export for us
+#define DLL_EXPORT
+
+#include "attach.h"
+#include "stdafx.h"
+#include "python.h"
+
+#pragma comment(lib, "kernel32.lib")
+#pragma comment(lib, "user32.lib")
+#pragma comment(lib, "advapi32.lib")
+#pragma comment(lib, "psapi.lib")
+
+// _Always_ is not defined for all versions, so make it a no-op if missing.
+#ifndef _Always_
+#define _Always_(x) x
+#endif
+
+using namespace std;
+
+typedef int (Py_IsInitialized)();
+typedef void (PyEval_Lock)(); // Acquire/Release lock
+typedef void (PyThreadState_API)(PyThreadState *); // Acquire/Release lock
+typedef PyInterpreterState* (PyInterpreterState_Head)();
+typedef PyThreadState* (PyInterpreterState_ThreadHead)(PyInterpreterState* interp);
+typedef PyThreadState* (PyThreadState_Next)(PyThreadState *tstate);
+typedef PyThreadState* (PyThreadState_Swap)(PyThreadState *tstate);
+typedef int (PyRun_SimpleString)(const char *command);
+typedef PyObject* (PyDict_New)();
+typedef PyObject* (PyModule_New)(const char *name);
+typedef PyObject* (PyModule_GetDict)(PyObject *module);
+typedef PyObject* (Py_CompileString)(const char *str, const char *filename, int start);
+typedef PyObject* (PyEval_EvalCode)(PyObject *co, PyObject *globals, PyObject *locals);
+typedef PyObject* (PyDict_GetItemString)(PyObject *p, const char *key);
+typedef PyObject* (PyObject_CallFunctionObjArgs)(PyObject *callable, ...); // call w/ varargs, last arg should be NULL
+typedef void (PyErr_Fetch)(PyObject **, PyObject **, PyObject **);
+typedef PyObject* (PyEval_GetBuiltins)();
+typedef int (PyDict_SetItemString)(PyObject *dp, const char *key, PyObject *item);
+typedef int (PyEval_ThreadsInitialized)();
+typedef void (Py_AddPendingCall)(int (*func)(void *), void*);
+typedef PyObject* (PyInt_FromLong)(long);
+typedef PyObject* (PyString_FromString)(const char* s);
+typedef void PyEval_SetTrace(Py_tracefunc func, PyObject *obj);
+typedef void (PyErr_Restore)(PyObject *type, PyObject *value, PyObject *traceback);
+typedef void (PyErr_Fetch)(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback);
+typedef PyObject* (PyErr_Occurred)();
+typedef PyObject* (PyErr_Print)();
+typedef PyObject* (PyImport_ImportModule) (const char *name);
+typedef PyObject* (PyObject_GetAttrString)(PyObject *o, const char *attr_name);
+typedef PyObject* (PyObject_HasAttrString)(PyObject *o, const char *attr_name);
+typedef PyObject* (PyObject_SetAttrString)(PyObject *o, const char *attr_name, PyObject* value);
+typedef PyObject* (PyBool_FromLong)(long v);
+typedef enum { PyGILState_LOCKED, PyGILState_UNLOCKED } PyGILState_STATE;
+typedef PyGILState_STATE(PyGILState_Ensure)();
+typedef void (PyGILState_Release)(PyGILState_STATE);
+typedef unsigned long (_PyEval_GetSwitchInterval)(void);
+typedef void (_PyEval_SetSwitchInterval)(unsigned long microseconds);
+typedef void* (PyThread_get_key_value)(int);
+typedef int (PyThread_set_key_value)(int, void*);
+typedef void (PyThread_delete_key_value)(int);
+typedef PyGILState_STATE PyGILState_EnsureFunc(void);
+typedef void PyGILState_ReleaseFunc(PyGILState_STATE);
+typedef PyObject* PyInt_FromSize_t(size_t ival);
+typedef PyThreadState *PyThreadState_NewFunc(PyInterpreterState *interp);
+
+class PyObjectHolder;
+PyObject* GetPyObjectPointerNoDebugInfo(bool isDebug, PyObject* object);
+void DecRef(PyObject* object, bool isDebug);
+void IncRef(PyObject* object, bool isDebug);
+
+#define MAX_INTERPRETERS 10
+
+// Helper class so we can use RAII for freeing python objects when they go out of scope
+class PyObjectHolder {
+private:
+ PyObject* _object;
+public:
+ bool _isDebug;
+
+ PyObjectHolder(bool isDebug) {
+ _object = nullptr;
+ _isDebug = isDebug;
+ }
+
+ PyObjectHolder(bool isDebug, PyObject *object) {
+ _object = object;
+ _isDebug = isDebug;
+ };
+
+ PyObjectHolder(bool isDebug, PyObject *object, bool addRef) {
+ _object = object;
+ _isDebug = isDebug;
+ if (_object != nullptr && addRef) {
+ GetPyObjectPointerNoDebugInfo(_isDebug, _object)->ob_refcnt++;
+ }
+ };
+
+ PyObject* ToPython() {
+ return _object;
+ }
+
+ ~PyObjectHolder() {
+ DecRef(_object, _isDebug);
+ }
+
+ PyObject* operator* () {
+ return GetPyObjectPointerNoDebugInfo(_isDebug, _object);
+ }
+};
+
+class InterpreterInfo {
+public:
+ InterpreterInfo(HMODULE module, bool debug) :
+ Interpreter(module),
+ CurrentThread(nullptr),
+ NewThreadFunction(nullptr),
+ PyGILState_Ensure(nullptr),
+ Version(PythonVersion_Unknown),
+ Call(nullptr),
+ IsDebug(debug),
+ SetTrace(nullptr),
+ PyThreadState_New(nullptr),
+ ThreadState_Swap(nullptr) {
+ }
+
+ ~InterpreterInfo() {
+ if (NewThreadFunction != nullptr) {
+ delete NewThreadFunction;
+ }
+ }
+
+ PyObjectHolder* NewThreadFunction;
+ PyThreadState** CurrentThread;
+
+ HMODULE Interpreter;
+ PyGILState_EnsureFunc* PyGILState_Ensure;
+ PyEval_SetTrace* SetTrace;
+ PyThreadState_NewFunc* PyThreadState_New;
+ PyThreadState_Swap* ThreadState_Swap;
+
+ PythonVersion GetVersion() {
+ if (Version == PythonVersion_Unknown) {
+ Version = ::GetPythonVersion(Interpreter);
+ }
+ return Version;
+ }
+
+ PyObject_CallFunctionObjArgs* GetCall() {
+ if (Call == nullptr) {
+ Call = (PyObject_CallFunctionObjArgs*)GetProcAddress(Interpreter, "PyObject_CallFunctionObjArgs");
+ }
+
+ return Call;
+ }
+
+ bool EnsureSetTrace() {
+ if (SetTrace == nullptr) {
+ auto setTrace = (PyEval_SetTrace*)(void*)GetProcAddress(Interpreter, "PyEval_SetTrace");
+ SetTrace = setTrace;
+ }
+ return SetTrace != nullptr;
+ }
+
+ bool EnsureThreadStateSwap() {
+ if (ThreadState_Swap == nullptr) {
+ auto swap = (PyThreadState_Swap*)(void*)GetProcAddress(Interpreter, "PyThreadState_Swap");
+ ThreadState_Swap = swap;
+ }
+ return ThreadState_Swap != nullptr;
+ }
+
+ bool EnsureCurrentThread() {
+ if (CurrentThread == nullptr) {
+ auto curPythonThread = (PyThreadState**)(void*)GetProcAddress(
+ Interpreter, "_PyThreadState_Current");
+ CurrentThread = curPythonThread;
+ }
+
+ return CurrentThread != nullptr;
+ }
+
+private:
+ PythonVersion Version;
+ PyObject_CallFunctionObjArgs* Call;
+ bool IsDebug;
+};
+
+DWORD _interpreterCount = 0;
+InterpreterInfo* _interpreterInfo[MAX_INTERPRETERS];
+
+void PatchIAT(PIMAGE_DOS_HEADER dosHeader, PVOID replacingFunc, LPSTR exportingDll, LPVOID newFunction) {
+ if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
+ return;
+ }
+
+ auto ntHeader = (IMAGE_NT_HEADERS*)(((BYTE*)dosHeader) + dosHeader->e_lfanew);
+ if (ntHeader->Signature != IMAGE_NT_SIGNATURE) {
+ return;
+ }
+
+ auto importAddr = ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
+ if (importAddr == 0) {
+ return;
+ }
+
+ auto import = (PIMAGE_IMPORT_DESCRIPTOR)(importAddr + ((BYTE*)dosHeader));
+
+ while (import->Name) {
+ char* name = (char*)(import->Name + ((BYTE*)dosHeader));
+ if (_stricmp(name, exportingDll) == 0) {
+ auto thunkData = (PIMAGE_THUNK_DATA)((import->FirstThunk) + ((BYTE*)dosHeader));
+
+ while (thunkData->u1.Function) {
+ PVOID funcAddr = (char*)(thunkData->u1.Function);
+
+ if (funcAddr == replacingFunc) {
+ DWORD flOldProtect;
+ if (VirtualProtect(&thunkData->u1, sizeof(SIZE_T), PAGE_READWRITE, &flOldProtect)) {
+ thunkData->u1.Function = (SIZE_T)newFunction;
+ VirtualProtect(&thunkData->u1, sizeof(SIZE_T), flOldProtect, &flOldProtect);
+ }
+ }
+ thunkData++;
+ }
+ }
+
+ import++;
+ }
+}
+
+typedef BOOL WINAPI EnumProcessModulesFunc(
+ __in HANDLE hProcess,
+ __out HMODULE *lphModule,
+ __in DWORD cb,
+ __out LPDWORD lpcbNeeded
+ );
+
+typedef __kernel_entry NTSTATUS NTAPI
+ NtQueryInformationProcessFunc(
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ OUT PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength,
+ OUT PULONG ReturnLength OPTIONAL
+ );
+
+
+// A helper version of EnumProcessModules. On Win7 uses the real EnumProcessModules which
+// lives in kernel32, and so is safe to use in DLLMain. Pre-Win7 we use NtQueryInformationProcess
+// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx) and walk the
+// LDR_DATA_TABLE_ENTRY data structures http://msdn.microsoft.com/en-us/library/windows/desktop/aa813708(v=vs.85).aspx
+// which have changed in Windows 7, and may change more in the future, so we can't use them there.
+__success(return) BOOL EnumProcessModulesHelper(
+ __in HANDLE hProcess,
+ __out HMODULE *lphModule,
+ __in DWORD cb,
+ _Always_(__out) LPDWORD lpcbNeeded
+ ) {
+ if (lpcbNeeded == nullptr) {
+ return FALSE;
+ }
+ *lpcbNeeded = 0;
+
+ auto kernel32 = GetModuleHandle(L"kernel32.dll");
+ if (kernel32 == nullptr) {
+ return FALSE;
+ }
+
+ auto enumProc = (EnumProcessModulesFunc*)GetProcAddress(kernel32, "K32EnumProcessModules");
+ if (enumProc == nullptr) {
+ // Fallback to pre-Win7 method
+ PROCESS_BASIC_INFORMATION basicInfo;
+ auto ntdll = GetModuleHandle(L"ntdll.dll");
+ if (ntdll == nullptr) {
+ return FALSE;
+ }
+
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx
+ NtQueryInformationProcessFunc* queryInfo = (NtQueryInformationProcessFunc*)GetProcAddress(ntdll, "NtQueryInformationProcess");
+ if (queryInfo == nullptr) {
+ return FALSE;
+ }
+
+ auto result = queryInfo(
+ GetCurrentProcess(),
+ ProcessBasicInformation,
+ &basicInfo,
+ sizeof(PROCESS_BASIC_INFORMATION),
+ NULL
+ );
+
+ if (FAILED(result)) {
+ return FALSE;
+ }
+
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/aa813708(v=vs.85).aspx
+ PEB* peb = basicInfo.PebBaseAddress;
+ auto start = (LDR_DATA_TABLE_ENTRY*)(peb->Ldr->InMemoryOrderModuleList.Flink);
+
+ auto cur = start;
+ *lpcbNeeded = 0;
+
+ do {
+ if ((*lpcbNeeded + sizeof(SIZE_T)) <= cb) {
+ PVOID *curLink = (PVOID*)cur;
+ curLink -= 2;
+ LDR_DATA_TABLE_ENTRY* curTable = (LDR_DATA_TABLE_ENTRY*)curLink;
+ if (curTable->DllBase == nullptr) {
+ break;
+ }
+ lphModule[(*lpcbNeeded) / sizeof(SIZE_T)] = (HMODULE)curTable->DllBase;
+ }
+
+ (*lpcbNeeded) += sizeof(SIZE_T);
+ cur = (LDR_DATA_TABLE_ENTRY*)((LIST_ENTRY*)cur)->Flink;
+ } while (cur != start && cur != 0);
+
+ return *lpcbNeeded <= cb;
+ }
+
+ return enumProc(hProcess, lphModule, cb, lpcbNeeded);
+}
+
+// This function will work with Win7 and later versions of the OS and is safe to call under
+// the loader lock (all APIs used are in kernel32).
+BOOL PatchFunction(LPSTR exportingDll, PVOID replacingFunc, LPVOID newFunction) {
+ HANDLE hProcess = GetCurrentProcess();
+ DWORD modSize = sizeof(HMODULE) * 1024;
+ HMODULE* hMods = (HMODULE*)_malloca(modSize);
+ DWORD modsNeeded = 0;
+ if (hMods == nullptr) {
+ modsNeeded = 0;
+ return FALSE;
+ }
+
+ while (!EnumProcessModulesHelper(hProcess, hMods, modSize, &modsNeeded)) {
+ // try again w/ more space...
+ _freea(hMods);
+ hMods = (HMODULE*)_malloca(modsNeeded);
+ if (hMods == nullptr) {
+ modsNeeded = 0;
+ break;
+ }
+ modSize = modsNeeded;
+ }
+
+ for (DWORD tmp = 0; tmp < modsNeeded / sizeof(HMODULE); tmp++) {
+ PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hMods[tmp];
+
+ PatchIAT(dosHeader, replacingFunc, exportingDll, newFunction);
+ }
+
+ return TRUE;
+}
+
+wstring GetCurrentModuleFilename() {
+ HMODULE hModule = NULL;
+ if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)GetCurrentModuleFilename, &hModule) != 0) {
+ wchar_t filename[MAX_PATH];
+ GetModuleFileName(hModule, filename, MAX_PATH);
+ return filename;
+ }
+ return wstring();
+}
+
+struct AttachInfo {
+ PyEval_Lock* InitThreads;
+ HANDLE Event;
+};
+
+HANDLE g_initedEvent;
+int AttachCallback(void *initThreads) {
+ // initialize us for threading, this will acquire the GIL if not already created, and is a nop if the GIL is created.
+ // This leaves us in the proper state when we return back to the runtime whether the GIL was created or not before
+ // we were called.
+ ((PyEval_Lock*)initThreads)();
+ SetEvent(g_initedEvent);
+ return 0;
+}
+
+char* ReadCodeFromFile(wchar_t* filePath) {
+ ifstream filestr;
+ filestr.open(filePath, ios::binary);
+ if (filestr.fail()) {
+ return nullptr;
+ }
+
+ // get length of file:
+ filestr.seekg(0, ios::end);
+ auto length = filestr.tellg();
+ filestr.seekg(0, ios::beg);
+
+ int len = (int)length;
+ char* buffer = new char[len + 1];
+ filestr.read(buffer, len);
+ buffer[len] = 0;
+
+ // remove carriage returns, copy zero byte
+ for (int read = 0, write = 0; read <= len; read++) {
+ if (buffer[read] == '\r') {
+ continue;
+ } else if (write != read) {
+ buffer[write] = buffer[read];
+ }
+ write++;
+ }
+
+ return buffer;
+}
+
+// create a custom heap for our unordered map. This is necessary because if we suspend a thread while in a heap function
+// then we could deadlock here. We need to be VERY careful about what we do while the threads are suspended.
+static HANDLE g_heap = 0;
+
+template
+class PrivateHeapAllocator {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T value_type;
+
+ template
+ struct rebind {
+ typedef PrivateHeapAllocator other;
+ };
+
+ explicit PrivateHeapAllocator() {}
+
+ PrivateHeapAllocator(PrivateHeapAllocator const&) {}
+
+ ~PrivateHeapAllocator() {}
+
+ template
+ PrivateHeapAllocator(PrivateHeapAllocator const&) {}
+
+ pointer allocate(size_type size, allocator::const_pointer hint = 0) {
+ if (g_heap == nullptr) {
+ g_heap = HeapCreate(0, 0, 0);
+ }
+ auto mem = HeapAlloc(g_heap, 0, size * sizeof(T));
+ return static_cast(mem);
+ }
+
+ void deallocate(pointer p, size_type n) {
+ HeapFree(g_heap, 0, p);
+ }
+
+ size_type max_size() const {
+ return (std::numeric_limits::max)() / sizeof(T);
+ }
+
+ void construct(pointer p, const T& t) {
+ new(p) T(t);
+ }
+
+ void destroy(pointer p) {
+ p->~T();
+ }
+};
+
+typedef unordered_map, std::equal_to, PrivateHeapAllocator>> ThreadMap;
+
+void ResumeThreads(ThreadMap &suspendedThreads) {
+ for (auto start = suspendedThreads.begin(); start != suspendedThreads.end(); start++) {
+ ResumeThread((*start).second);
+ CloseHandle((*start).second);
+ }
+ suspendedThreads.clear();
+}
+
+// Suspends all threads ensuring that they are not currently in a call to Py_AddPendingCall.
+void SuspendThreads(ThreadMap &suspendedThreads, Py_AddPendingCall* addPendingCall, PyEval_ThreadsInitialized* threadsInited) {
+ DWORD curThreadId = GetCurrentThreadId();
+ DWORD curProcess = GetCurrentProcessId();
+ // suspend all the threads in the process so we can do things safely...
+ bool suspended;
+
+ do {
+ suspended = false;
+ HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
+ if (h != INVALID_HANDLE_VALUE) {
+
+ THREADENTRY32 te;
+ te.dwSize = sizeof(te);
+ if (Thread32First(h, &te)) {
+ do {
+ if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID) && te.th32OwnerProcessID == curProcess) {
+
+
+ if (te.th32ThreadID != curThreadId && suspendedThreads.find(te.th32ThreadID) == suspendedThreads.end()) {
+ auto hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);
+ if (hThread != nullptr) {
+ SuspendThread(hThread);
+
+ bool addingPendingCall = false;
+
+ CONTEXT context;
+ memset(&context, 0x00, sizeof(CONTEXT));
+ context.ContextFlags = CONTEXT_ALL;
+ GetThreadContext(hThread, &context);
+
+#if defined(_X86_)
+ if(context.Eip >= *((DWORD*)addPendingCall) && context.Eip <= (*((DWORD*)addPendingCall)) + 0x100) {
+ addingPendingCall = true;
+ }
+#elif defined(_AMD64_)
+ if (context.Rip >= *((DWORD64*)addPendingCall) && context.Rip <= *((DWORD64*)addPendingCall + 0x100)) {
+ addingPendingCall = true;
+ }
+#endif
+
+ if (addingPendingCall) {
+ // we appear to be adding a pending call via this thread - wait for this to finish so we can add our own pending call...
+ ResumeThread(hThread);
+ SwitchToThread(); // yield to the resumed thread if it's on our CPU...
+ CloseHandle(hThread);
+ } else {
+ suspendedThreads[te.th32ThreadID] = hThread;
+ }
+ suspended = true;
+ }
+ }
+ }
+
+ te.dwSize = sizeof(te);
+ } while (Thread32Next(h, &te) && !threadsInited());
+ }
+ CloseHandle(h);
+ }
+ } while (suspended && !threadsInited());
+}
+
+PyObject* GetPyObjectPointerNoDebugInfo(bool isDebug, PyObject* object) {
+ if (object != nullptr && isDebug) {
+ // debug builds have 2 extra pointers at the front that we don't care about
+ return (PyObject*)((size_t*)object + 2);
+ }
+ return object;
+}
+
+void DecRef(PyObject* object, bool isDebug) {
+ auto noDebug = GetPyObjectPointerNoDebugInfo(isDebug, object);
+
+ if (noDebug != nullptr && --noDebug->ob_refcnt == 0) {
+ ((PyTypeObject*)GetPyObjectPointerNoDebugInfo(isDebug, noDebug->ob_type))->tp_dealloc(object);
+ }
+}
+
+void IncRef(PyObject* object) {
+ object->ob_refcnt++;
+}
+
+
+// Ensures handles are closed when they go out of scope
+class HandleHolder {
+ HANDLE _handle;
+public:
+ HandleHolder(HANDLE handle) : _handle(handle) {
+ }
+
+ ~HandleHolder() {
+ CloseHandle(_handle);
+ }
+};
+
+long GetPythonThreadId(PythonVersion version, PyThreadState* curThread) {
+ long threadId = 0;
+ if (PyThreadState_25_27::IsFor(version)) {
+ threadId = ((PyThreadState_25_27*)curThread)->thread_id;
+ } else if (PyThreadState_30_33::IsFor(version)) {
+ threadId = ((PyThreadState_30_33*)curThread)->thread_id;
+ } else if (PyThreadState_34_36::IsFor(version)) {
+ threadId = ((PyThreadState_34_36*)curThread)->thread_id;
+ }
+ return threadId;
+}
+
+// holder to ensure we release the GIL even in error conditions
+class GilHolder {
+ PyGILState_STATE _gilState;
+ PyGILState_Release* _release;
+public:
+ GilHolder(PyGILState_Ensure* acquire, PyGILState_Release* release) {
+ _gilState = acquire();
+ _release = release;
+ }
+
+ ~GilHolder() {
+ _release(_gilState);
+ }
+};
+
+bool LoadAndEvaluateCode(
+ wchar_t* filePath, const char* fileName, bool isDebug, PyObject* globalsDict,
+ Py_CompileString* pyCompileString, PyDict_SetItemString* dictSetItem,
+ PyEval_EvalCode* pyEvalCode, PyString_FromString* strFromString, PyEval_GetBuiltins* getBuiltins,
+ PyErr_Print pyErrPrint
+ ) {
+ auto debuggerCode = ReadCodeFromFile(filePath);
+ if (debuggerCode == nullptr) {
+ return false;
+ }
+
+ auto code = PyObjectHolder(isDebug, pyCompileString(debuggerCode, fileName, 257 /*Py_file_input*/));
+ delete[] debuggerCode;
+
+ if (*code == nullptr) {
+ return false;
+ }
+
+ dictSetItem(globalsDict, "__builtins__", getBuiltins());
+ auto size = WideCharToMultiByte(CP_UTF8, 0, filePath, (DWORD)wcslen(filePath), NULL, 0, NULL, NULL);
+ char* filenameBuffer = new char[size];
+ if (WideCharToMultiByte(CP_UTF8, 0, filePath, (DWORD)wcslen(filePath), filenameBuffer, size, NULL, NULL) != 0) {
+ filenameBuffer[size] = 0;
+ dictSetItem(globalsDict, "__file__", strFromString(filenameBuffer));
+ }
+
+ auto evalResult = PyObjectHolder(isDebug, pyEvalCode(code.ToPython(), globalsDict, globalsDict));
+#if !NDEBUG
+ if (*evalResult == nullptr) {
+ pyErrPrint();
+ }
+#endif
+
+ return true;
+}
+
+// Checks to see if the specified module is likely a Python interpreter.
+bool IsPythonModule(HMODULE module, bool &isDebug) {
+ wchar_t mod_name[MAX_PATH];
+ isDebug = false;
+ if (GetModuleBaseName(GetCurrentProcess(), module, mod_name, MAX_PATH)) {
+ if (_wcsnicmp(mod_name, L"python", 6) == 0) {
+ if (wcslen(mod_name) >= 10 && _wcsnicmp(mod_name + 8, L"_d", 2) == 0) {
+ isDebug = true;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+extern "C"
+{
+
+ /**
+ * The returned value signals the error that happened!
+ *
+ * Return codes:
+ * 0 = all OK.
+ * 1 = Py_IsInitialized not found
+ * 2 = Py_IsInitialized returned false
+ * 3 = Missing Python API
+ * 4 = Interpreter not initialized
+ * 5 = Python version unknown
+ * 6 = Connect timeout
+ **/
+ int DoAttach(HMODULE module, bool isDebug, const char *command, bool showDebugInfo )
+ {
+ auto isInit = (Py_IsInitialized*)GetProcAddress(module, "Py_IsInitialized");
+
+ if (isInit == nullptr) {
+ if(showDebugInfo){
+ std::cout << "Py_IsInitialized not found. " << std::endl << std::flush;
+ }
+ return 1;
+ }
+ if (!isInit()) {
+ if(showDebugInfo){
+ std::cout << "Py_IsInitialized returned false. " << std::endl << std::flush;
+ }
+ return 2;
+ }
+
+ auto version = GetPythonVersion(module);
+
+ // found initialized Python runtime, gather and check the APIs we need for a successful attach...
+ auto addPendingCall = (Py_AddPendingCall*)GetProcAddress(module, "Py_AddPendingCall");
+ auto curPythonThread = (PyThreadState**)(void*)GetProcAddress(module, "_PyThreadState_Current");
+ auto interpHead = (PyInterpreterState_Head*)GetProcAddress(module, "PyInterpreterState_Head");
+ auto gilEnsure = (PyGILState_Ensure*)GetProcAddress(module, "PyGILState_Ensure");
+ auto gilRelease = (PyGILState_Release*)GetProcAddress(module, "PyGILState_Release");
+ auto threadHead = (PyInterpreterState_ThreadHead*)GetProcAddress(module, "PyInterpreterState_ThreadHead");
+ auto initThreads = (PyEval_Lock*)GetProcAddress(module, "PyEval_InitThreads");
+ auto acquireLock = (PyEval_Lock*)GetProcAddress(module, "PyEval_AcquireLock");
+ auto releaseLock = (PyEval_Lock*)GetProcAddress(module, "PyEval_ReleaseLock");
+ auto threadsInited = (PyEval_ThreadsInitialized*)GetProcAddress(module, "PyEval_ThreadsInitialized");
+ auto threadNext = (PyThreadState_Next*)GetProcAddress(module, "PyThreadState_Next");
+ auto threadSwap = (PyThreadState_Swap*)GetProcAddress(module, "PyThreadState_Swap");
+ auto pyDictNew = (PyDict_New*)GetProcAddress(module, "PyDict_New");
+ auto pyModuleNew = (PyModule_New*)GetProcAddress(module, "PyModule_New");
+ auto pyModuleGetDict = (PyModule_GetDict*)GetProcAddress(module, "PyModule_GetDict");
+ auto pyCompileString = (Py_CompileString*)GetProcAddress(module, "Py_CompileString");
+ auto pyEvalCode = (PyEval_EvalCode*)GetProcAddress(module, "PyEval_EvalCode");
+ auto getDictItem = (PyDict_GetItemString*)GetProcAddress(module, "PyDict_GetItemString");
+ auto call = (PyObject_CallFunctionObjArgs*)GetProcAddress(module, "PyObject_CallFunctionObjArgs");
+ auto getBuiltins = (PyEval_GetBuiltins*)GetProcAddress(module, "PyEval_GetBuiltins");
+ auto dictSetItem = (PyDict_SetItemString*)GetProcAddress(module, "PyDict_SetItemString");
+ PyInt_FromLong* intFromLong;
+ PyString_FromString* strFromString;
+ PyInt_FromSize_t* intFromSizeT;
+ if (version >= PythonVersion_30) {
+ intFromLong = (PyInt_FromLong*)GetProcAddress(module, "PyLong_FromLong");
+ intFromSizeT = (PyInt_FromSize_t*)GetProcAddress(module, "PyLong_FromSize_t");
+ if (version >= PythonVersion_33) {
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyUnicode_FromString");
+ } else {
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyUnicodeUCS2_FromString");
+ }
+ } else {
+ intFromLong = (PyInt_FromLong*)GetProcAddress(module, "PyInt_FromLong");
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyString_FromString");
+ intFromSizeT = (PyInt_FromSize_t*)GetProcAddress(module, "PyInt_FromSize_t");
+ }
+ auto intervalCheck = (int*)GetProcAddress(module, "_Py_CheckInterval");
+ auto errOccurred = (PyErr_Occurred*)GetProcAddress(module, "PyErr_Occurred");
+ auto pyErrFetch = (PyErr_Fetch*)GetProcAddress(module, "PyErr_Fetch");
+ auto pyErrRestore = (PyErr_Restore*)GetProcAddress(module, "PyErr_Restore");
+ auto pyErrPrint = (PyErr_Print*)GetProcAddress(module, "PyErr_Print");
+ auto pyImportMod = (PyImport_ImportModule*) GetProcAddress(module, "PyImport_ImportModule");
+ auto pyGetAttr = (PyObject_GetAttrString*)GetProcAddress(module, "PyObject_GetAttrString");
+ auto pySetAttr = (PyObject_SetAttrString*)GetProcAddress(module, "PyObject_SetAttrString");
+ auto pyNone = (PyObject*)GetProcAddress(module, "_Py_NoneStruct");
+ auto getSwitchInterval = (_PyEval_GetSwitchInterval*)GetProcAddress(module, "_PyEval_GetSwitchInterval");
+ auto setSwitchInterval = (_PyEval_SetSwitchInterval*)GetProcAddress(module, "_PyEval_SetSwitchInterval");
+ auto boolFromLong = (PyBool_FromLong*)GetProcAddress(module, "PyBool_FromLong");
+ auto getThreadTls = (PyThread_get_key_value*)GetProcAddress(module, "PyThread_get_key_value");
+ auto setThreadTls = (PyThread_set_key_value*)GetProcAddress(module, "PyThread_set_key_value");
+ auto delThreadTls = (PyThread_delete_key_value*)GetProcAddress(module, "PyThread_delete_key_value");
+ auto pyGilStateEnsure = (PyGILState_EnsureFunc*)GetProcAddress(module, "PyGILState_Ensure");
+ auto pyGilStateRelease = (PyGILState_ReleaseFunc*)GetProcAddress(module, "PyGILState_Release");
+ auto PyCFrame_Type = (PyTypeObject*)GetProcAddress(module, "PyCFrame_Type");
+ auto pyRun_SimpleString = (PyRun_SimpleString*)GetProcAddress(module, "PyRun_SimpleString");
+
+ if (addPendingCall == nullptr || curPythonThread == nullptr || interpHead == nullptr || gilEnsure == nullptr || gilRelease == nullptr || threadHead == nullptr ||
+ initThreads == nullptr || releaseLock == nullptr || threadsInited == nullptr || threadNext == nullptr || threadSwap == nullptr ||
+ pyDictNew == nullptr || pyCompileString == nullptr || pyEvalCode == nullptr || getDictItem == nullptr || call == nullptr ||
+ getBuiltins == nullptr || dictSetItem == nullptr || intFromLong == nullptr || pyErrRestore == nullptr || pyErrFetch == nullptr ||
+ errOccurred == nullptr || pyImportMod == nullptr || pyGetAttr == nullptr || pyNone == nullptr || pySetAttr == nullptr || boolFromLong == nullptr ||
+ getThreadTls == nullptr || setThreadTls == nullptr || delThreadTls == nullptr || releaseLock == nullptr ||
+ pyGilStateEnsure == nullptr || pyGilStateRelease == nullptr || pyRun_SimpleString == nullptr) {
+ // we're missing some APIs, we cannot attach.
+ if(showDebugInfo){
+ std::cout << "Error, missing Python API!! " << std::endl << std::flush;
+ }
+ return 3;
+ }
+
+ auto head = interpHead();
+ if (head == nullptr) {
+ // this interpreter is loaded but not initialized.
+ if(showDebugInfo){
+ std::cout << "Interpreter not initialized! " << std::endl << std::flush;
+ }
+ return 4;
+ }
+
+ bool threadSafeAddPendingCall = false;
+
+ // check that we're a supported version
+ if (version == PythonVersion_Unknown) {
+ if(showDebugInfo){
+ std::cout << "Python version unknown! " << std::endl << std::flush;
+ }
+ return 5;
+ } else if (version >= PythonVersion_27 && version != PythonVersion_30) {
+ threadSafeAddPendingCall = true;
+ }
+
+
+
+
+
+
+ if (!threadsInited()) {
+ int saveIntervalCheck;
+ unsigned long saveLongIntervalCheck;
+ if (intervalCheck != nullptr) {
+ // not available on 3.2
+ saveIntervalCheck = *intervalCheck;
+ *intervalCheck = -1; // lower the interval check so pending calls are processed faster
+ } else if (getSwitchInterval != nullptr && setSwitchInterval != nullptr) {
+ saveLongIntervalCheck = getSwitchInterval();
+ setSwitchInterval(0);
+ }
+
+ //
+ // Multiple thread support has not been initialized in the interpreter. We need multi threading support
+ // to block any actively running threads and setup the debugger attach state.
+ //
+ // We need to initialize multiple threading support but we need to do so safely. One option is to call
+ // Py_AddPendingCall and have our callback then initialize multi threading. This is completely safe on 2.7
+ // and up. Unfortunately that doesn't work if we're not actively running code on the main thread (blocked on a lock
+ // or reading input). It's also not thread safe pre-2.7 so we need to make sure it's safe to call on down-level
+ // interpreters.
+ //
+ // Another option is to make sure no code is running - if there is no active thread then we can safely call
+ // PyEval_InitThreads and we're in business. But to know this is safe we need to first suspend all the other
+ // threads in the process and then inspect if any code is running.
+ //
+ // Finally if code is running after we've suspended the threads then we can go ahead and do Py_AddPendingCall
+ // on down-level interpreters as long as we're sure no one else is making a call to Py_AddPendingCall at the same
+ // time.
+ //
+ // Therefore our strategy becomes: Make the Py_AddPendingCall on interpreters where it's thread safe. Then suspend
+ // all threads - if a threads IP is in Py_AddPendingCall resume and try again. Once we've got all of the threads
+ // stopped and not in Py_AddPendingCall (which calls no functions its self, you can see this and it's size in the
+ // debugger) then see if we have a current thread. If not go ahead and initialize multiple threading (it's now safe,
+ // no Python code is running). Otherwise add the pending call and repeat. If at any point during this process
+ // threading becomes initialized (due to our pending call or the Python code creating a new thread) then we're done
+ // and we just resume all of the presently suspended threads.
+
+ ThreadMap suspendedThreads;
+
+ g_initedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ HandleHolder holder(g_initedEvent);
+
+ bool addedPendingCall = false;
+ if (addPendingCall != nullptr && threadSafeAddPendingCall) {
+ // we're on a thread safe Python version, go ahead and pend our call to initialize threading.
+ addPendingCall(&AttachCallback, initThreads);
+ addedPendingCall = true;
+ }
+
+ #define TICKS_DIFF(prev, cur) ((cur) >= (prev)) ? ((cur)-(prev)) : ((0xFFFFFFFF-(prev))+(cur))
+ const DWORD ticksPerSecond = 1000;
+
+ DWORD startTickCount = GetTickCount();
+ do {
+ SuspendThreads(suspendedThreads, addPendingCall, threadsInited);
+
+ if (!threadsInited()) {
+ if (*curPythonThread == nullptr) {
+ // no threads are currently running, it is safe to initialize multi threading.
+ PyGILState_STATE gilState;
+ if (version >= PythonVersion_34) {
+ // in 3.4 due to http://bugs.python.org/issue20891,
+ // we need to create our thread state manually
+ // before we can call PyGILState_Ensure() before we
+ // can call PyEval_InitThreads().
+
+ // Don't require this function unless we need it.
+ auto threadNew = (PyThreadState_NewFunc*)GetProcAddress(module, "PyThreadState_New");
+ if (threadNew != nullptr) {
+ threadNew(head);
+ }
+ }
+
+ if (version >= PythonVersion_32) {
+ // in 3.2 due to the new GIL and later we can't call Py_InitThreads
+ // without a thread being initialized.
+ // So we use PyGilState_Ensure here to first
+ // initialize the current thread, and then we use
+ // Py_InitThreads to bring up multi-threading.
+ // Some context here: http://bugs.python.org/issue11329
+ // http://pytools.codeplex.com/workitem/834
+ gilState = pyGilStateEnsure();
+ }
+ initThreads();
+
+ if (version >= PythonVersion_32) {
+ // we will release the GIL here
+ pyGilStateRelease(gilState);
+ } else {
+ releaseLock();
+ }
+ } else if (!addedPendingCall) {
+ // someone holds the GIL but no one is actively adding any pending calls. We can pend our call
+ // and initialize threads.
+ addPendingCall(&AttachCallback, initThreads);
+ addedPendingCall = true;
+ }
+ }
+ ResumeThreads(suspendedThreads);
+ } while (!threadsInited() &&
+ (TICKS_DIFF(startTickCount, GetTickCount())) < (ticksPerSecond * 20) &&
+ !addedPendingCall);
+
+ if (!threadsInited()) {
+ if (addedPendingCall) {
+ // we've added our call to initialize multi-threading, we can now wait
+ // until Python code actually starts running.
+ if(showDebugInfo){
+ std::cout << "Waiting for threads to be initialized! " << std::endl << std::flush;
+ }
+
+ ::WaitForSingleObject(g_initedEvent, INFINITE);
+ } else {
+ if(showDebugInfo){
+ std::cout << "Connect timeout! " << std::endl << std::flush;
+ }
+ return 6;
+ }
+ } else {
+ if(showDebugInfo){
+ std::cout << "Threads initialized! " << std::endl << std::flush;
+ }
+ }
+
+ if (intervalCheck != nullptr) {
+ *intervalCheck = saveIntervalCheck;
+ } else if (setSwitchInterval != nullptr) {
+ setSwitchInterval(saveLongIntervalCheck);
+ }
+ } else {
+ if(showDebugInfo){
+ std::cout << "Threads already initialized! " << std::endl << std::flush;
+ }
+ }
+
+ if (g_heap != nullptr) {
+ HeapDestroy(g_heap);
+ g_heap = nullptr;
+ }
+
+
+ GilHolder gilLock(gilEnsure, gilRelease); // acquire and hold the GIL until done...
+
+ pyRun_SimpleString(command);
+ return 0;
+
+ }
+
+
+
+
+ int SetSysTraceFunc(HMODULE module, bool isDebug, bool showDebugInfo)
+ {
+
+ if(showDebugInfo){
+ std::cout << "SetSysTraceFunc started. " << std::endl << std::flush;
+ }
+ auto isInit = (Py_IsInitialized*)GetProcAddress(module, "Py_IsInitialized");
+
+ if (isInit == nullptr) {
+ if(showDebugInfo){
+ std::cout << "Py_IsInitialized not found. " << std::endl << std::flush;
+ }
+ return 1;
+ }
+ if (!isInit()) {
+ if(showDebugInfo){
+ std::cout << "Py_IsInitialized returned false. " << std::endl << std::flush;
+ }
+ return 2;
+ }
+
+ auto version = GetPythonVersion(module);
+
+ // found initialized Python runtime, gather and check the APIs we need for a successful attach...
+ auto addPendingCall = (Py_AddPendingCall*)GetProcAddress(module, "Py_AddPendingCall");
+ auto curPythonThread = (PyThreadState**)(void*)GetProcAddress(module, "_PyThreadState_Current");
+ auto interpHead = (PyInterpreterState_Head*)GetProcAddress(module, "PyInterpreterState_Head");
+ auto gilEnsure = (PyGILState_Ensure*)GetProcAddress(module, "PyGILState_Ensure");
+ auto gilRelease = (PyGILState_Release*)GetProcAddress(module, "PyGILState_Release");
+ auto threadHead = (PyInterpreterState_ThreadHead*)GetProcAddress(module, "PyInterpreterState_ThreadHead");
+ auto initThreads = (PyEval_Lock*)GetProcAddress(module, "PyEval_InitThreads");
+ auto acquireLock = (PyEval_Lock*)GetProcAddress(module, "PyEval_AcquireLock");
+ auto releaseLock = (PyEval_Lock*)GetProcAddress(module, "PyEval_ReleaseLock");
+ auto threadsInited = (PyEval_ThreadsInitialized*)GetProcAddress(module, "PyEval_ThreadsInitialized");
+ auto threadNext = (PyThreadState_Next*)GetProcAddress(module, "PyThreadState_Next");
+ auto threadSwap = (PyThreadState_Swap*)GetProcAddress(module, "PyThreadState_Swap");
+ auto pyDictNew = (PyDict_New*)GetProcAddress(module, "PyDict_New");
+ auto pyModuleNew = (PyModule_New*)GetProcAddress(module, "PyModule_New");
+ auto pyModuleGetDict = (PyModule_GetDict*)GetProcAddress(module, "PyModule_GetDict");
+ auto pyCompileString = (Py_CompileString*)GetProcAddress(module, "Py_CompileString");
+ auto pyEvalCode = (PyEval_EvalCode*)GetProcAddress(module, "PyEval_EvalCode");
+ auto getDictItem = (PyDict_GetItemString*)GetProcAddress(module, "PyDict_GetItemString");
+ auto call = (PyObject_CallFunctionObjArgs*)GetProcAddress(module, "PyObject_CallFunctionObjArgs");
+ auto getBuiltins = (PyEval_GetBuiltins*)GetProcAddress(module, "PyEval_GetBuiltins");
+ auto dictSetItem = (PyDict_SetItemString*)GetProcAddress(module, "PyDict_SetItemString");
+ PyInt_FromLong* intFromLong;
+ PyString_FromString* strFromString;
+ PyInt_FromSize_t* intFromSizeT;
+ if (version >= PythonVersion_30) {
+ intFromLong = (PyInt_FromLong*)GetProcAddress(module, "PyLong_FromLong");
+ intFromSizeT = (PyInt_FromSize_t*)GetProcAddress(module, "PyLong_FromSize_t");
+ if (version >= PythonVersion_33) {
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyUnicode_FromString");
+ } else {
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyUnicodeUCS2_FromString");
+ }
+ } else {
+ intFromLong = (PyInt_FromLong*)GetProcAddress(module, "PyInt_FromLong");
+ strFromString = (PyString_FromString*)GetProcAddress(module, "PyString_FromString");
+ intFromSizeT = (PyInt_FromSize_t*)GetProcAddress(module, "PyInt_FromSize_t");
+ }
+ auto intervalCheck = (int*)GetProcAddress(module, "_Py_CheckInterval");
+ auto errOccurred = (PyErr_Occurred*)GetProcAddress(module, "PyErr_Occurred");
+ auto pyErrFetch = (PyErr_Fetch*)GetProcAddress(module, "PyErr_Fetch");
+ auto pyErrRestore = (PyErr_Restore*)GetProcAddress(module, "PyErr_Restore");
+ auto pyErrPrint = (PyErr_Print*)GetProcAddress(module, "PyErr_Print");
+ auto pyImportMod = (PyImport_ImportModule*) GetProcAddress(module, "PyImport_ImportModule");
+ auto pyGetAttr = (PyObject_GetAttrString*)GetProcAddress(module, "PyObject_GetAttrString");
+ auto pySetAttr = (PyObject_SetAttrString*)GetProcAddress(module, "PyObject_SetAttrString");
+ auto pyHasAttr = (PyObject_HasAttrString*)GetProcAddress(module, "PyObject_HasAttrString");
+ auto pyNone = (PyObject*)GetProcAddress(module, "_Py_NoneStruct");
+ auto getSwitchInterval = (_PyEval_GetSwitchInterval*)GetProcAddress(module, "_PyEval_GetSwitchInterval");
+ auto setSwitchInterval = (_PyEval_SetSwitchInterval*)GetProcAddress(module, "_PyEval_SetSwitchInterval");
+ auto boolFromLong = (PyBool_FromLong*)GetProcAddress(module, "PyBool_FromLong");
+ auto getThreadTls = (PyThread_get_key_value*)GetProcAddress(module, "PyThread_get_key_value");
+ auto setThreadTls = (PyThread_set_key_value*)GetProcAddress(module, "PyThread_set_key_value");
+ auto delThreadTls = (PyThread_delete_key_value*)GetProcAddress(module, "PyThread_delete_key_value");
+ auto pyGilStateEnsure = (PyGILState_EnsureFunc*)GetProcAddress(module, "PyGILState_Ensure");
+ auto pyGilStateRelease = (PyGILState_ReleaseFunc*)GetProcAddress(module, "PyGILState_Release");
+ auto PyCFrame_Type = (PyTypeObject*)GetProcAddress(module, "PyCFrame_Type");
+ auto pyRun_SimpleString = (PyRun_SimpleString*)GetProcAddress(module, "PyRun_SimpleString");
+
+ if (addPendingCall == nullptr || curPythonThread == nullptr || interpHead == nullptr || gilEnsure == nullptr || gilRelease == nullptr || threadHead == nullptr ||
+ initThreads == nullptr || releaseLock == nullptr || threadsInited == nullptr || threadNext == nullptr || threadSwap == nullptr ||
+ pyDictNew == nullptr || pyCompileString == nullptr || pyEvalCode == nullptr || getDictItem == nullptr || call == nullptr ||
+ getBuiltins == nullptr || dictSetItem == nullptr || intFromLong == nullptr || pyErrRestore == nullptr || pyErrFetch == nullptr ||
+ errOccurred == nullptr || pyImportMod == nullptr || pyGetAttr == nullptr || pyNone == nullptr || pySetAttr == nullptr || boolFromLong == nullptr ||
+ getThreadTls == nullptr || setThreadTls == nullptr || delThreadTls == nullptr || releaseLock == nullptr ||
+ pyGilStateEnsure == nullptr || pyGilStateRelease == nullptr || pyRun_SimpleString == nullptr) {
+ // we're missing some APIs, we cannot attach.
+ if(showDebugInfo){
+ std::cout << "Error, missing Python API!! " << std::endl << std::flush;
+ }
+ return 3;
+ }
+
+ auto head = interpHead();
+ if (head == nullptr) {
+ // this interpreter is loaded but not initialized.
+ if(showDebugInfo){
+ std::cout << "Interpreter not initialized! " << std::endl << std::flush;
+ }
+ return 4;
+ }
+
+ GilHolder gilLock(gilEnsure, gilRelease); // acquire and hold the GIL until done...
+
+ auto pyTrue = boolFromLong(1);
+ auto pyFalse = boolFromLong(0);
+
+
+ auto pydevdTracingMod = PyObjectHolder(isDebug, pyImportMod("pydevd_tracing"));
+ if (*pydevdTracingMod == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd_tracing module null! " << std::endl << std::flush;
+ }
+ return 7;
+ }
+
+ if(!pyHasAttr(pydevdTracingMod.ToPython(), "_original_settrace")){
+ if(showDebugInfo){
+ std::cout << "pydevd_tracing module has no _original_settrace! " << std::endl << std::flush;
+ }
+ return 8;
+ }
+
+ auto settrace = PyObjectHolder(isDebug, pyGetAttr(pydevdTracingMod.ToPython(), "_original_settrace"));
+ if (*settrace == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd_tracing._original_settrace null! " << std::endl << std::flush;
+ }
+ return 9;
+ }
+
+ auto pydevdMod = PyObjectHolder(isDebug, pyImportMod("pydevd"));
+ if (*pydevdMod == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd module null! " << std::endl << std::flush;
+ }
+ return 10;
+ }
+
+ auto getGlobalDebugger = PyObjectHolder(isDebug, pyGetAttr(pydevdMod.ToPython(), "GetGlobalDebugger"));
+ if (*getGlobalDebugger == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd.GetGlobalDebugger null! " << std::endl << std::flush;
+ }
+ return 11;
+ }
+
+ auto globalDbg = PyObjectHolder(isDebug, call(getGlobalDebugger.ToPython(), NULL));
+ if (*globalDbg == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd.GetGlobalDebugger() returned null! " << std::endl << std::flush;
+ }
+ return 12;
+ }
+
+ if(!pyHasAttr(globalDbg.ToPython(), "trace_dispatch")){
+ if(showDebugInfo){
+ std::cout << "pydevd.GetGlobalDebugger() has no attribute trace_dispatch! " << std::endl << std::flush;
+ }
+ return 13;
+ }
+
+ auto traceFunc = PyObjectHolder(isDebug, pyGetAttr(globalDbg.ToPython(), "trace_dispatch"));
+ if (*traceFunc == nullptr) {
+ if(showDebugInfo){
+ std::cout << "pydevd.GetGlobalDebugger().trace_dispatch returned null! " << std::endl << std::flush;
+ }
+ return 14;
+ }
+
+
+
+ // we need to walk the thread list each time after we've initialized a thread so that we are always
+ // dealing w/ a valid thread list (threads can exit when we run code and therefore the current thread
+ // could be corrupt). We also don't care about newly created threads as our start_new_thread wrapper
+ // will handle those. So we collect the initial set of threads first here so that we don't keep iterating
+ // if the program is spawning large numbers of threads.
+ unordered_set initialThreads;
+ for (auto curThread = threadHead(head); curThread != nullptr; curThread = threadNext(curThread)) {
+ initialThreads.insert(curThread);
+ }
+
+ int retVal = 0;
+ unordered_set seenThreads;
+ {
+ // find what index is holding onto the thread state...
+ auto curPyThread = *curPythonThread;
+ int threadStateIndex = -1;
+ for (int i = 0; i < 100000; i++) {
+ void* value = getThreadTls(i);
+ if (value == curPyThread) {
+ threadStateIndex = i;
+ break;
+ }
+ }
+
+ bool foundThread;
+ int processedThreads = 0;
+ do {
+ foundThread = false;
+ for (auto curThread = threadHead(head); curThread != nullptr; curThread = threadNext(curThread)) {
+ if (initialThreads.find(curThread) == initialThreads.end() ||
+ seenThreads.insert(curThread).second == false) {
+ continue;
+ }
+ foundThread = true;
+ processedThreads++;
+
+ long threadId = GetPythonThreadId(version, curThread);
+ // skip this thread - it doesn't really have any Python code on it...
+ if (threadId != GetCurrentThreadId()) {
+ // create new debugger Thread object on our injected thread
+ auto pyThreadId = PyObjectHolder(isDebug, intFromLong(threadId));
+ PyFrameObject* frame;
+ // update all of the frames so they have our trace func
+ if (PyThreadState_25_27::IsFor(version)) {
+ frame = ((PyThreadState_25_27*)curThread)->frame;
+ } else if (PyThreadState_30_33::IsFor(version)) {
+ frame = ((PyThreadState_30_33*)curThread)->frame;
+ } else if (PyThreadState_34_36::IsFor(version)) {
+ frame = ((PyThreadState_34_36*)curThread)->frame;
+ }else{
+ if(showDebugInfo){
+ std::cout << "Python version not handled! " << version << std::endl << std::flush;
+ }
+ retVal = 15;
+ break;
+ }
+
+ // switch to our new thread so we can call sys.settrace on it...
+ // all of the work here needs to be minimal - in particular we shouldn't
+ // ever evaluate user defined code as we could end up switching to this
+ // thread on the main thread and corrupting state.
+ auto prevThreadState = getThreadTls(threadStateIndex);
+ delThreadTls(threadStateIndex);
+ setThreadTls(threadStateIndex, curThread);
+ auto prevThread = threadSwap(curThread);
+
+ // save and restore the error in case something funky happens...
+ auto errOccured = errOccurred();
+ PyObject *type, *value, *traceback;
+ if (errOccured) {
+ pyErrFetch(&type, &value, &traceback);
+ }
+
+ if(showDebugInfo){
+ std::cout << "setting trace for thread: " << threadId << std::endl << std::flush;
+ }
+
+ DecRef(call(settrace.ToPython(), traceFunc.ToPython(), NULL), isDebug);
+
+ if (errOccured) {
+ pyErrRestore(type, value, traceback);
+ }
+
+ // update all of the frames so they have our trace func
+ auto curFrame = (PyFrameObject*)GetPyObjectPointerNoDebugInfo(isDebug, frame);
+ while (curFrame != nullptr) {
+ // Special case for CFrame objects
+ // Stackless CFrame does not have a trace function
+ // This will just prevent a crash on attach.
+ if (((PyObject*)curFrame)->ob_type != PyCFrame_Type) {
+ DecRef(curFrame->f_trace, isDebug);
+ IncRef(*traceFunc);
+ curFrame->f_trace = traceFunc.ToPython();
+ }
+ curFrame = (PyFrameObject*)GetPyObjectPointerNoDebugInfo(isDebug, curFrame->f_back);
+ }
+
+ delThreadTls(threadStateIndex);
+ setThreadTls(threadStateIndex, prevThread);
+ threadSwap(prevThread);
+ }
+ break;
+ }
+ } while (foundThread);
+ }
+
+
+
+ return retVal;
+
+ }
+
+
+
+ /**
+ * Return codes:
+ *
+ * -2 = could not allocate memory
+ * -3 = could not allocate memory to enumerate processes
+ *
+ * 0 = all OK.
+ * 1 = Py_IsInitialized not found
+ * 2 = Py_IsInitialized returned false
+ * 3 = Missing Python API
+ * 4 = Interpreter not initialized
+ * 5 = Python version unknown
+ * 6 = Connect timeout
+ *
+ * result[0] should have the same result from the return function
+ * result[0] is also used to set the startup info (on whether to show debug info
+ * and if the debugger tracing should be set).
+ **/
+ DECLDIR int AttachAndRunPythonCode(const char *command, int *result )
+ {
+
+ int SHOW_DEBUG_INFO = 1;
+ int CONNECT_DEBUGGER = 2;
+
+ bool showDebugInfo = (result[0] & SHOW_DEBUG_INFO) != 0;
+
+ if(showDebugInfo){
+ std::cout << "AttachAndRunPythonCode started (showing debug info). " << std::endl << std::flush;
+ }
+
+ bool connectDebuggerTracing = (result[0] & CONNECT_DEBUGGER) != 0;
+ if(showDebugInfo){
+ std::cout << "connectDebuggerTracing: " << connectDebuggerTracing << std::endl << std::flush;
+ }
+
+ HANDLE hProcess = GetCurrentProcess();
+ DWORD modSize = sizeof(HMODULE) * 1024;
+ HMODULE* hMods = (HMODULE*)_malloca(modSize);
+ if (hMods == nullptr) {
+ result[0] = -2;
+ return result[0];
+ }
+
+ DWORD modsNeeded;
+ while (!EnumProcessModules(hProcess, hMods, modSize, &modsNeeded)) {
+ // try again w/ more space...
+ _freea(hMods);
+ hMods = (HMODULE*)_malloca(modsNeeded);
+ if (hMods == nullptr) {
+ result[0] = -3;
+ return result[0];
+ }
+ modSize = modsNeeded;
+ }
+ int attached = -1;
+ {
+ bool pythonFound = false;
+ for (size_t i = 0; i < modsNeeded / sizeof(HMODULE); i++) {
+ bool isDebug;
+ if (IsPythonModule(hMods[i], isDebug)) {
+ pythonFound = true;
+ int temp = DoAttach(hMods[i], isDebug, command, showDebugInfo);
+ if (temp == 0) {
+ // we've successfully attached the debugger
+ attached = 0;
+ if(connectDebuggerTracing){
+ if(showDebugInfo){
+ std::cout << "SetSysTraceFunc " << std::endl << std::flush;
+ }
+ attached = SetSysTraceFunc(hMods[i], isDebug, showDebugInfo);
+ }
+ break;
+ }else{
+ if(temp > attached){
+ //I.e.: the higher the value the more significant it is.
+ attached = temp;
+ }
+ }
+ }
+ }
+ }
+
+ if(showDebugInfo){
+ std::cout << "Result: " << attached << std::endl << std::flush;
+ }
+ result[0] = attached;
+ return result[0];
+ }
+
+
+
+
+
+ /**
+ *
+ *
+ *
+ *
+ *
+ **/
+ DECLDIR int AttachDebuggerTracing(bool showDebugInfo)
+ {
+ HANDLE hProcess = GetCurrentProcess();
+ DWORD modSize = sizeof(HMODULE) * 1024;
+ HMODULE* hMods = (HMODULE*)_malloca(modSize);
+ if (hMods == nullptr) {
+ if(showDebugInfo){
+ std::cout << "hmods not allocated! " << std::endl << std::flush;
+ }
+ return -2;
+ }
+
+ DWORD modsNeeded;
+ while (!EnumProcessModules(hProcess, hMods, modSize, &modsNeeded)) {
+ // try again w/ more space...
+ _freea(hMods);
+ hMods = (HMODULE*)_malloca(modsNeeded);
+ if (hMods == nullptr) {
+ if(showDebugInfo){
+ std::cout << "hmods not allocated (2)! " << std::endl << std::flush;
+ }
+ return -3;
+ }
+ modSize = modsNeeded;
+ }
+ int attached = -1;
+ {
+ bool pythonFound = false;
+ for (size_t i = 0; i < modsNeeded / sizeof(HMODULE); i++) {
+ bool isDebug;
+ if (IsPythonModule(hMods[i], isDebug)) {
+ pythonFound = true;
+ if(showDebugInfo){
+ std::cout << "setting sys trace! " << std::endl << std::flush;
+ }
+ int temp = SetSysTraceFunc(hMods[i], isDebug, showDebugInfo);
+ if (temp == 0) {
+ // we've successfully attached the debugger
+ attached = 0;
+ break;
+ }else{
+ if(temp > attached){
+ //I.e.: the higher the value the more significant it is.
+ attached = temp;
+ }
+ }
+ }
+ }
+ }
+
+
+ return attached;
+ }
+
+}
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/attach.h b/ptvsd/pydevd/pydevd_attach_to_process/dll/attach.h
new file mode 100644
index 00000000..24ff0df9
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/attach.h
@@ -0,0 +1,46 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Brainwy software Ltda.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+#ifndef _ATTACH_DLL_H_
+#define _ATTACH_DLL_H_
+
+#if defined DLL_EXPORT
+#define DECLDIR __declspec(dllexport)
+#else
+#define DECLDIR __declspec(dllimport)
+#endif
+
+extern "C"
+{
+ DECLDIR int AttachAndRunPythonCode(const char *command, int *result );
+
+
+ /*
+ Could be used with ctypes (note that the threading should be initialized, so,
+ doing it in a thread as below is recommended):
+
+ def check():
+
+ import ctypes
+ lib = ctypes.cdll.LoadLibrary(r'C:\...\attach_x86.dll')
+ print 'result', lib.AttachDebuggerTracing(0)
+
+ t = threading.Thread(target=check)
+ t.start()
+ t.join()
+ */
+ DECLDIR int AttachDebuggerTracing(bool showDebugInfo);
+}
+
+#endif
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/compile_dll.bat b/ptvsd/pydevd/pydevd_attach_to_process/dll/compile_dll.bat
new file mode 100644
index 00000000..27737f31
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/compile_dll.bat
@@ -0,0 +1,9 @@
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
+cl -DUNICODE -D_UNICODE /EHsc /LD attach.cpp /link /out:attach_x86.dll
+copy attach_x86.dll ..\attach_x86.dll /Y
+
+
+
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
+cl -DUNICODE -D_UNICODE /EHsc /LD attach.cpp /link /out:attach_amd64.dll
+copy attach_amd64.dll ..\attach_amd64.dll /Y
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/python.h b/ptvsd/pydevd/pydevd_attach_to_process/dll/python.h
new file mode 100644
index 00000000..b4cd3f86
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/python.h
@@ -0,0 +1,611 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Microsoft Corporation.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+#ifndef __PYTHON_H__
+#define __PYTHON_H__
+
+// must be kept in sync with PythonLanguageVersion.cs
+enum PythonVersion {
+ PythonVersion_Unknown,
+ PythonVersion_25 = 0x0205,
+ PythonVersion_26 = 0x0206,
+ PythonVersion_27 = 0x0207,
+ PythonVersion_30 = 0x0300,
+ PythonVersion_31 = 0x0301,
+ PythonVersion_32 = 0x0302,
+ PythonVersion_33 = 0x0303,
+ PythonVersion_34 = 0x0304,
+ PythonVersion_35 = 0x0305,
+ PythonVersion_36 = 0x0306
+};
+
+
+// defines limited header of Python API for compatible access across a number of Pythons.
+
+class PyTypeObject;
+class PyThreadState;
+
+#define PyObject_HEAD \
+ size_t ob_refcnt; \
+ PyTypeObject *ob_type;
+
+#define PyObject_VAR_HEAD \
+ PyObject_HEAD \
+ size_t ob_size; /* Number of items in variable part */
+
+class PyObject {
+public:
+ PyObject_HEAD
+};
+
+class PyVarObject : public PyObject {
+public:
+ size_t ob_size; /* Number of items in variable part */
+};
+
+// 2.4 - 2.7 compatible
+class PyCodeObject25_27 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash/cmp */
+ PyObject *co_filename; /* string (where it was loaded from) */
+ PyObject *co_name; /* string (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_25 && version <= PythonVersion_27;
+ }
+};
+
+// 3.0-3.2
+class PyCodeObject30_32 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash or comparisons */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+ void *co_zombieframe; /* for optimization only (see frameobject.c) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 2);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_30 && version <= PythonVersion_32;
+ }
+};
+
+// 3.3-3.5
+class PyCodeObject33_35 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash or comparisons */
+ unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+ void *co_zombieframe; /* for optimization only (see frameobject.c) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 3 && minorVersion <= 5);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_33 && version <= PythonVersion_35;
+ }
+};
+
+// 3.6
+class PyCodeObject36 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash or comparisons */
+ unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+ void *co_zombieframe; /* for optimization only (see frameobject.c) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && minorVersion >= 6;
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_36;
+ }
+};
+
+// 2.5 - 3.6
+class PyFunctionObject : public PyObject {
+public:
+ PyObject *func_code; /* A code object */
+};
+
+// 2.5 - 2.7 compatible
+class PyStringObject : public PyVarObject {
+public:
+ long ob_shash;
+ int ob_sstate;
+ char ob_sval[1];
+
+ /* Invariants:
+ * ob_sval contains space for 'ob_size+1' elements.
+ * ob_sval[ob_size] == 0.
+ * ob_shash is the hash of the string or -1 if not computed yet.
+ * ob_sstate != 0 iff the string object is in stringobject.c's
+ * 'interned' dictionary; in this case the two references
+ * from 'interned' to this object are *not counted* in ob_refcnt.
+ */
+};
+
+// 2.4 - 3.2 compatible
+typedef struct {
+ PyObject_HEAD
+ size_t length; /* Length of raw Unicode data in buffer */
+ wchar_t *str; /* Raw Unicode buffer */
+ long hash; /* Hash value; -1 if not set */
+} PyUnicodeObject;
+
+// 2.4 - 3.6 compatible
+class PyFrameObject : public PyVarObject {
+public:
+ PyFrameObject *f_back; /* previous frame, or NULL */
+ PyObject *f_code; /* code segment */
+ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
+ PyObject *f_globals; /* global symbol table (PyDictObject) */
+ PyObject *f_locals; /* local symbol table (any mapping) */
+ PyObject **f_valuestack; /* points after the last local */
+ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
+ Frame evaluation usually NULLs it, but a frame that yields sets it
+ to the current stack top. */
+ PyObject **f_stacktop;
+ PyObject *f_trace; /* Trace function */
+ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
+};
+
+#define CO_MAXBLOCKS 20
+typedef struct {
+ int b_type; /* what kind of block this is */
+ int b_handler; /* where to jump to find handler */
+ int b_level; /* value stack level to pop to */
+} PyTryBlock;
+
+class PyFrameObject25_33 : public PyFrameObject {
+public:
+ PyThreadState* f_tstate;
+ int f_lasti; /* Last instruction if called */
+ /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
+ f_trace is set) -- at other times use PyCode_Addr2Line instead. */
+ int f_lineno; /* Current line number */
+ int f_iblock; /* index in f_blockstack */
+ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7) ||
+ majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 3);
+ }
+};
+
+class PyFrameObject34_36 : public PyFrameObject {
+public:
+ /* Borrowed reference to a generator, or NULL */
+ PyObject *f_gen;
+
+ int f_lasti; /* Last instruction if called */
+ /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
+ f_trace is set) -- at other times use PyCode_Addr2Line instead. */
+ int f_lineno; /* Current line number */
+ int f_iblock; /* index in f_blockstack */
+ char f_executing; /* whether the frame is still executing */
+ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && minorVersion >= 4 && minorVersion <= 6;
+ }
+};
+
+
+typedef void (*destructor)(PyObject *);
+
+// 2.4 - 3.6
+class PyMethodDef {
+public:
+ char *ml_name; /* The name of the built-in function/method */
+};
+
+
+//
+// 2.4 - 3.5, 2.4 has different compat in 64-bit but we don't support any of the released 64-bit platforms (which includes only IA-64)
+// While these are compatible there are fields only available on later versions.
+class PyTypeObject : public PyVarObject {
+public:
+ const char *tp_name; /* For printing, in format "." */
+ size_t tp_basicsize, tp_itemsize; /* For allocation */
+
+ /* Methods to implement standard operations */
+
+ destructor tp_dealloc;
+ void* tp_print;
+ void* tp_getattr;
+ void* tp_setattr;
+ union {
+ void* tp_compare; /* 2.4 - 3.4 */
+ void* tp_as_async; /* 3.5 - 3.6 */
+ };
+ void* tp_repr;
+
+ /* Method suites for standard classes */
+
+ void *tp_as_number;
+ void*tp_as_sequence;
+ void*tp_as_mapping;
+
+ /* More standard operations (here for binary compatibility) */
+
+ void* tp_hash;
+ void* tp_call;
+ void* tp_str;
+ void* tp_getattro;
+ void* tp_setattro;
+
+ /* Functions to access object as input/output buffer */
+ void*tp_as_buffer;
+
+ /* Flags to define presence of optional/expanded features */
+ long tp_flags;
+
+ const char *tp_doc; /* Documentation string */
+
+ /* Assigned meaning in release 2.0 */
+ /* call function for all accessible objects */
+ void* tp_traverse;
+
+ /* delete references to contained objects */
+ void* tp_clear;
+
+ /* Assigned meaning in release 2.1 */
+ /* rich comparisons */
+ void* tp_richcompare;
+
+ /* weak reference enabler */
+ size_t tp_weaklistoffset;
+
+ /* Added in release 2.2 */
+ /* Iterators */
+ void* tp_iter;
+ void* tp_iternext;
+
+ /* Attribute descriptor and subclassing stuff */
+ PyMethodDef *tp_methods;
+ struct PyMemberDef *tp_members;
+ struct PyGetSetDef *tp_getset;
+ struct _typeobject *tp_base;
+ PyObject *tp_dict;
+ void* tp_descr_get;
+ void* tp_descr_set;
+ size_t tp_dictoffset;
+ void* tp_init;
+ void* tp_alloc;
+ void* tp_new;
+ void* tp_free; /* Low-level free-memory routine */
+ void* tp_is_gc; /* For PyObject_IS_GC */
+ PyObject *tp_bases;
+ PyObject *tp_mro; /* method resolution order */
+ PyObject *tp_cache;
+ PyObject *tp_subclasses;
+ PyObject *tp_weaklist;
+ void* tp_del;
+
+ /* Type attribute cache version tag. Added in version 2.6 */
+ unsigned int tp_version_tag;
+};
+
+// 2.4 - 3.6
+class PyTupleObject : public PyVarObject {
+public:
+ PyObject *ob_item[1];
+
+ /* ob_item contains space for 'ob_size' elements.
+ * Items must normally not be NULL, except during construction when
+ * the tuple is not yet visible outside the function that builds it.
+ */
+};
+
+// 2.4 - 3.6
+class PyCFunctionObject : public PyObject {
+public:
+ PyMethodDef *m_ml; /* Description of the C function to call */
+ PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
+ PyObject *m_module; /* The __module__ attribute, can be anything */
+};
+
+typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
+
+#define PyTrace_CALL 0
+#define PyTrace_EXCEPTION 1
+#define PyTrace_LINE 2
+#define PyTrace_RETURN 3
+#define PyTrace_C_CALL 4
+#define PyTrace_C_EXCEPTION 5
+#define PyTrace_C_RETURN 6
+
+class PyInterpreterState {
+};
+
+class PyThreadState { };
+
+class PyThreadState_25_27 : public PyThreadState {
+public:
+ /* See Python/ceval.c for comments explaining most fields */
+
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ /* tick_counter is incremented whenever the check_interval ticker
+ * reaches zero. The purpose is to give a useful measure of the number
+ * of interpreted bytecode instructions in a given thread. This
+ * extremely lightweight statistic collector may be of interest to
+ * profilers (like psyco.jit()), although nothing in the core uses it.
+ */
+ int tick_counter;
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_25 && version <= PythonVersion_27;
+ }
+};
+
+class PyThreadState_30_33 : public PyThreadState {
+public:
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ char overflowed; /* The stack has overflowed. Allow 50 more calls
+ to handle the runtime error. */
+ char recursion_critical; /* The current calls must not cause
+ a stack overflow. */
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ /* tick_counter is incremented whenever the check_interval ticker
+ * reaches zero. The purpose is to give a useful measure of the number
+ * of interpreted bytecode instructions in a given thread. This
+ * extremely lightweight statistic collector may be of interest to
+ * profilers (like psyco.jit()), although nothing in the core uses it.
+ */
+ int tick_counter;
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 3);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_30 && version <= PythonVersion_33;
+ }
+};
+
+class PyThreadState_34_36 : public PyThreadState {
+public:
+ PyThreadState *prev;
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ char overflowed; /* The stack has overflowed. Allow 50 more calls
+ to handle the runtime error. */
+ char recursion_critical; /* The current calls must not cause
+ a stack overflow. */
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && minorVersion >= 4 && minorVersion <= 6;
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_34 && version <= PythonVersion_36;
+ }
+};
+
+class PyIntObject : public PyObject {
+public:
+ long ob_ival;
+};
+
+class Py3kLongObject : public PyVarObject {
+public:
+ DWORD ob_digit[1];
+};
+
+class PyOldStyleClassObject : public PyObject {
+public:
+ PyObject *cl_bases; /* A tuple of class objects */
+ PyObject *cl_dict; /* A dictionary */
+ PyObject *cl_name; /* A string */
+ /* The following three are functions or NULL */
+ PyObject *cl_getattr;
+ PyObject *cl_setattr;
+ PyObject *cl_delattr;
+};
+
+class PyInstanceObject : public PyObject {
+public:
+ PyOldStyleClassObject *in_class; /* The class object */
+ PyObject *in_dict; /* A dictionary */
+ PyObject *in_weakreflist; /* List of weak references */
+};
+
+typedef const char* (GetVersionFunc) ();
+
+static PythonVersion GetPythonVersion(HMODULE hMod) {
+ auto versionFunc = (GetVersionFunc*)GetProcAddress(hMod, "Py_GetVersion");
+ if(versionFunc != nullptr) {
+ auto version = versionFunc();
+ if(version != nullptr && strlen(version) >= 3 && version[1] == '.') {
+ if(version[0] == '2') {
+ switch(version[2]) {
+ case '5': return PythonVersion_25;
+ case '6': return PythonVersion_26;
+ case '7': return PythonVersion_27;
+ }
+ } else if(version[0] == '3') {
+ switch(version[2]) {
+ case '0': return PythonVersion_30;
+ case '1': return PythonVersion_31;
+ case '2': return PythonVersion_32;
+ case '3': return PythonVersion_33;
+ case '4': return PythonVersion_34;
+ case '5': return PythonVersion_35;
+ case '6': return PythonVersion_36;
+ }
+ }
+ }
+ }
+ return PythonVersion_Unknown;
+}
+
+#endif
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.cpp b/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.cpp
new file mode 100644
index 00000000..4b80b546
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.cpp
@@ -0,0 +1,22 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Microsoft Corporation.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+// stdafx.cpp : source file that includes just the standard includes
+// PyDebugAttach.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.h b/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.h
new file mode 100644
index 00000000..8b75af5d
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/stdafx.h
@@ -0,0 +1,36 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Microsoft Corporation.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#define WIN32_LEAN_AND_MEAN
+#include
+#include
+#include
+#include
+#include
+#include
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/dll/targetver.h b/ptvsd/pydevd/pydevd_attach_to_process/dll/targetver.h
new file mode 100644
index 00000000..acff5416
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/dll/targetver.h
@@ -0,0 +1,22 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Microsoft Corporation.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/Makefile b/ptvsd/pydevd/pydevd_attach_to_process/linux/Makefile
new file mode 100644
index 00000000..aedfe16e
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/Makefile
@@ -0,0 +1,64 @@
+# Defaults which can be overridden.
+OS = macosx
+ARCH_X86 = x86
+ARCH_X86_64 = x86_64
+
+CC=g++
+LD=libtool
+CPPFLAGS = -I.
+CFLAGS +=-fPIC -D_REENTRANT -nostartfiles
+
+ARCH_FLAG_X86 = -arch i386
+ARCH_FLAG_X86_64 = -arch x86_64
+
+INSTALL_DIR_X86 = ../os/$(OS)/$(ARCH_X86)
+INSTALL_DIR_X86_64 = ../os/$(OS)/$(ARCH_X86_64)
+INSTALL_DIR_LINUX_X86 = ../os/$(LINUX)/$(ARCH_X86)
+INSTALL_DIR_LINUX_X86_64 = ../os/$(LINUX)/$(ARCH_X86_64)
+
+ATTACH = attach_mac.so
+ATTACH_NAME_FULL_X86 = $(INSTALL_DIR_X86)/attach_x86.dylib
+ATTACH_NAME_FULL_X86_64 = $(INSTALL_DIR_X86_64)/attach_x86_64.dylib
+
+OBJS_ATTACH_X86 = attach_linux_$(ARCH_X86).o
+OBJS_ATTACH_X86_64 = attach_linux_$(ARCH_X86_64).o
+
+OBJS_X86 = $(OBJS_ATTACH_X86)
+OBJS_X86_64 = $(OBJS_ATTACH_X86_64)
+
+all: x86 x86_64
+
+x86: $(ATTACH_NAME_FULL_X86)
+
+x86_64: $(ATTACH_NAME_FULL_X86_64)
+
+linux_x86: $(ATTACH_NAME_FULL_LINUX_X86)
+linux_x86_64: $(ATTACH_NAME_FULL_LINUX_X86_64)
+
+rebuild: clean all
+
+$(ATTACH_NAME_FULL_X86): $(OBJS_ATTACH_X86)
+ mkdir -p $(INSTALL_DIR_X86)
+ $(CC) -dynamiclib $(ARCH_FLAG_X86) -o $(ATTACH_NAME_FULL_X86) $(OBJS_ATTACH_X86) -lc
+
+$(ATTACH_NAME_FULL_X86_64): $(OBJS_ATTACH_X86_64)
+ mkdir -p $(INSTALL_DIR_X86_64)
+ $(CC) -dynamiclib $(ARCH_FLAG_X86_64) -o $(ATTACH_NAME_FULL_X86_64) $(OBJS_ATTACH_X86_64) -lc
+
+$(ATTACH_NAME_FULL_LINUX_X86): $(OBJS_ATTACH_X86)
+ mkdir -p $(INSTALL_DIR_LINUX_X86)
+ $(CC) -m32 -g -shared -Wl,-soname,$(ATTACH) $(LDFLAGS) -o $(ATTACH_NAME_FULL_LINUX_X86) $(OBJS_ATTACH_X86)
+
+$(ATTACH_NAME_FULL_LINUX_X86_64): $(OBJS_ATTACH_X86_64)
+ mkdir -p $(INSTALL_DIR_LINUX_X86_64)
+ $(CC) -g -shared -Wl,-soname,$(ATTACH) $(LDFLAGS) -o $(ATTACH_NAME_FULL_LINUX_X86_64) $(OBJS_ATTACH_X86_64)
+
+attach_linux_$(ARCH_X86).o: attach_linux.c
+ $(CC) $(CFLAGS) $(ARCH_FLAG_X86) $(CPPFLAGS) -c -o $@ attach_linux.c
+
+attach_linux_$(ARCH_X86_64).o: attach_linux.c
+ $(CC) $(CFLAGS) $(ARCH_FLAG_X86_64) $(CPPFLAGS) -c -o $@ attach_linux.c
+
+clean :
+ $(RM) $(OBJS_X86) $(ATTACH_NAME_FULL_X86)
+ $(RM) $(OBJS_X86_64) $(ATTACH_NAME_FULL_X86_64)
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/attach_linux.c b/ptvsd/pydevd/pydevd_attach_to_process/linux/attach_linux.c
new file mode 100644
index 00000000..3687ba56
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/attach_linux.c
@@ -0,0 +1,284 @@
+// This is much simpler than the windows version because we're using gdb and
+// we assume that gdb will call things in the correct thread already.
+
+//compile with: g++ -shared -o attach_linux.so -fPIC -nostartfiles attach_linux.c
+
+#include
+#include
+#include
+#include
+#include "python.h"
+//#include used for usleep
+
+// Exported function: hello(): Just to print something and check that we've been
+// able to connect.
+extern "C" int hello(void);
+
+int hello()
+{
+ printf("Hello world!\n");
+
+ void *main_hndl = dlopen(NULL, 0x2);
+
+ void *hndl = dlsym (main_hndl, "PyGILState_Ensure");
+ if(hndl == NULL){
+ printf("NULL\n");
+
+ }else{
+ printf("Worked (found PyGILState_Ensure)!\n");
+ }
+
+ printf("%d", GetPythonVersion());
+
+
+ return 2;
+}
+
+
+// This is the function which enables us to set the sys.settrace for all the threads
+// which are already running.
+// isDebug is pretty important! Must be true on python debug builds (python_d)
+// If this value is passed wrongly the program will crash.
+extern "C" int SetSysTraceFunc(bool showDebugInfo, bool isDebug);
+extern "C" int DoAttach(bool isDebug, const char *command, bool showDebugInfo);
+
+// Internal function to keep on the tracing
+int _PYDEVD_ExecWithGILSetSysStrace(bool showDebugInfo, bool isDebug);
+
+// Implementation details below
+typedef int (*Py_IsInitialized) ();
+typedef PyInterpreterState* (*PyInterpreterState_Head)();
+typedef enum { PyGILState_LOCKED, PyGILState_UNLOCKED } PyGILState_STATE;
+typedef PyGILState_STATE(*PyGILState_Ensure)();
+typedef void (*PyGILState_Release)(PyGILState_STATE);
+typedef PyObject* (*PyBool_FromLong)(long v);
+typedef PyObject* (*PyImport_ImportModuleNoBlock) (const char *name);
+typedef PyObject* (*PyObject_HasAttrString)(PyObject *o, const char *attr_name);
+typedef PyObject* (*PyObject_GetAttrString)(PyObject *o, const char *attr_name);
+typedef PyObject* (*PyObject_CallFunctionObjArgs)(PyObject *callable, ...); // call w/ varargs, last arg should be NULL
+typedef int (*PyEval_ThreadsInitialized)();
+typedef unsigned long (*_PyEval_GetSwitchInterval)(void);
+typedef void (*_PyEval_SetSwitchInterval)(unsigned long microseconds);
+typedef int (*PyRun_SimpleString)(const char *command);
+
+// Helper so that we get a PyObject where we can access its fields (in debug or release).
+PyObject* GetPyObjectPointerNoDebugInfo(bool isDebug, PyObject* object) {
+ if (object != NULL && isDebug) {
+ // debug builds have 2 extra pointers at the front that we don't care about
+ return (PyObject*)((size_t*)object + 2);
+ }
+ return object;
+}
+
+// Helper so that we get a PyObject where we can access its fields (in debug or release).
+PyTypeObject * GetPyObjectPointerNoDebugInfo2(bool isDebug, PyTypeObject * object) {
+ if (object != NULL && isDebug) {
+ // debug builds have 2 extra pointers at the front that we don't care about
+ return (PyTypeObject *)((size_t*)object + 2);
+ }
+ return object;
+}
+
+// Helper which will decrement the reference count of an object and dealloc it if
+// it's not there.
+ void DecRef(PyObject* object, bool isDebug) {
+ PyObject* noDebug = GetPyObjectPointerNoDebugInfo(isDebug, object);
+
+ if (noDebug != NULL && --noDebug->ob_refcnt == 0) {
+ PyTypeObject *temp = GetPyObjectPointerNoDebugInfo2(isDebug, noDebug->ob_type);
+ temp->tp_dealloc(object);
+ }
+ }
+
+// Helper to increment the reference count to some object.
+void IncRef(PyObject* object, bool isDebug) {
+ PyObject* noDebug = GetPyObjectPointerNoDebugInfo(isDebug, object);
+
+ if (noDebug != NULL){
+ noDebug->ob_refcnt++;
+ }
+}
+
+class PyObjectHolder {
+private:
+ PyObject* _object;
+ bool _isDebug;
+public:
+ PyObjectHolder(bool isDebug, PyObject *object) {
+ _object = object;
+ _isDebug = isDebug;
+ };
+
+ PyObject* ToPython() {
+ return _object;
+ }
+
+ ~PyObjectHolder() {
+ if(_object != NULL){
+ DecRef(_object, _isDebug);
+ }
+ }
+};
+
+
+# define CHECK_NULL(ptr, msg, returnVal) if(ptr == NULL){if(showDebugInfo){printf(msg);} return returnVal;}
+
+int DoAttach(bool isDebug, const char *command, bool showDebugInfo)
+{
+ Py_IsInitialized isInitFunc;
+ void *main_hndl = dlopen(NULL, 0x2);
+ *(void**)(&isInitFunc) = dlsym(main_hndl, "Py_IsInitialized");
+ CHECK_NULL(isInitFunc, "Py_IsInitialized not found.\n", 1);
+
+ if(!isInitFunc()){
+ if(showDebugInfo){
+ printf("Py_IsInitialized returned false.\n");
+ }
+ return 2;
+ }
+
+ PythonVersion version = GetPythonVersion();
+
+ PyInterpreterState_Head interpHeadFunc;
+ *(void**)(&interpHeadFunc) = dlsym(main_hndl, "PyInterpreterState_Head");
+ CHECK_NULL(interpHeadFunc, "PyInterpreterState_Head not found.\n", 3);
+
+ PyInterpreterState* head = interpHeadFunc();
+ CHECK_NULL(head, "Interpreter not initialized.\n", 4);
+
+ // Note: unlike windows where we have to do many things to enable threading
+ // to work to get the gil, here we'll be executing in an existing thread,
+ // so, it's mostly a matter of getting the GIL and running it and we shouldn't
+ // have any more problems.
+
+ PyGILState_Ensure pyGilStateEnsureFunc;
+ *(void**)(&pyGilStateEnsureFunc) = dlsym(main_hndl, "PyGILState_Ensure");
+ CHECK_NULL(pyGilStateEnsureFunc, "PyGILState_Ensure not found.\n", 5);
+
+ PyGILState_Release pyGilStateReleaseFunc;
+ *(void**)(&pyGilStateReleaseFunc) = dlsym(main_hndl, "PyGILState_Release");
+ CHECK_NULL(pyGilStateReleaseFunc, "PyGILState_Release not found.\n", 6);
+
+ PyRun_SimpleString pyRun_SimpleString;
+ *(void**)(&pyRun_SimpleString) = dlsym(main_hndl, "PyRun_SimpleString");
+ CHECK_NULL(pyRun_SimpleString, "PyRun_SimpleString not found.\n", 6);
+
+ PyGILState_STATE pyGILState = pyGilStateEnsureFunc();
+ pyRun_SimpleString(command);
+ //No matter what happens we have to release it.
+ pyGilStateReleaseFunc(pyGILState);
+}
+
+
+// All of the code below is the same as:
+// sys.settrace(pydevd.GetGlobalDebugger().trace_dispatch)
+//
+// (with error checking)
+int SetSysTraceFunc(bool showDebugInfo, bool isDebug)
+{
+ if(showDebugInfo){
+ printf("SetSysTraceFunc started.\n");
+ }
+ Py_IsInitialized isInitFunc;
+ void *main_hndl = dlopen(NULL, 0x2);
+ *(void**)(&isInitFunc) = dlsym(main_hndl, "Py_IsInitialized");
+ CHECK_NULL(isInitFunc, "Py_IsInitialized not found.\n", 1);
+
+ if(!isInitFunc()){
+ if(showDebugInfo){
+ printf("Py_IsInitialized returned false.\n");
+ }
+ return 2;
+ }
+
+ PythonVersion version = GetPythonVersion();
+
+ PyInterpreterState_Head interpHeadFunc;
+ *(void**)(&interpHeadFunc) = dlsym(main_hndl, "PyInterpreterState_Head");
+ CHECK_NULL(interpHeadFunc, "PyInterpreterState_Head not found.\n", 3);
+
+ PyInterpreterState* head = interpHeadFunc();
+ CHECK_NULL(head, "Interpreter not initialized.\n", 4);
+
+ PyGILState_Ensure pyGilStateEnsureFunc;
+ *(void**)(&pyGilStateEnsureFunc) = dlsym(main_hndl, "PyGILState_Ensure");
+ CHECK_NULL(pyGilStateEnsureFunc, "PyGILState_Ensure not found.\n", 5);
+
+ PyGILState_Release pyGilStateReleaseFunc;
+ *(void**)(&pyGilStateReleaseFunc) = dlsym(main_hndl, "PyGILState_Release");
+ CHECK_NULL(pyGilStateReleaseFunc, "PyGILState_Release not found.\n", 6);
+
+ PyGILState_STATE pyGILState = pyGilStateEnsureFunc();
+ int ret = _PYDEVD_ExecWithGILSetSysStrace(showDebugInfo, isDebug);
+ //No matter what happens we have to release it.
+ pyGilStateReleaseFunc(pyGILState);
+ return ret;
+}
+
+
+int _PYDEVD_ExecWithGILSetSysStrace(bool showDebugInfo, bool isDebug){
+ PyBool_FromLong boolFromLongFunc;
+ void *main_hndl = dlopen(NULL, 0x2);
+
+ *(void**)(&boolFromLongFunc) = dlsym(main_hndl, "PyBool_FromLong");
+ CHECK_NULL(boolFromLongFunc, "PyBool_FromLong not found.\n", 7);
+
+ PyObject_HasAttrString pyHasAttrFunc;
+ *(void**)(&pyHasAttrFunc) = dlsym(main_hndl, "PyObject_HasAttrString");
+ CHECK_NULL(pyHasAttrFunc, "PyObject_HasAttrString not found.\n", 7);
+
+ //Important: we need a non-blocking import here: PyImport_ImportModule
+ //could end up crashing (this makes us work only from 2.6 onwards).
+ PyImport_ImportModuleNoBlock pyImportModFunc;
+ *(void**)(&pyImportModFunc) = dlsym(main_hndl, "PyImport_ImportModuleNoBlock");
+ CHECK_NULL(pyImportModFunc, "PyImport_ImportModuleNoBlock not found.\n", 8);
+
+
+ PyObjectHolder pydevdTracingMod = PyObjectHolder(isDebug, pyImportModFunc("pydevd_tracing"));
+ CHECK_NULL(pydevdTracingMod.ToPython(), "pydevd_tracing module null.\n", 9);
+
+ if(!pyHasAttrFunc(pydevdTracingMod.ToPython(), "_original_settrace")){
+ if(showDebugInfo){
+ printf("pydevd_tracing module has no _original_settrace!\n");
+ }
+ return 8;
+ }
+
+
+ PyObject_GetAttrString pyGetAttr;
+ *(void**)(&pyGetAttr) = dlsym(main_hndl, "PyObject_GetAttrString");
+ CHECK_NULL(pyGetAttr, "PyObject_GetAttrString not found.\n", 8);
+
+ PyObjectHolder settrace = PyObjectHolder(isDebug, pyGetAttr(pydevdTracingMod.ToPython(), "_original_settrace"));
+ CHECK_NULL(settrace.ToPython(), "pydevd_tracing._original_settrace null!\n", 10);
+
+ PyObjectHolder pydevdMod = PyObjectHolder(isDebug, pyImportModFunc("pydevd"));
+ CHECK_NULL(pydevdMod.ToPython(), "pydevd module null.\n", 10);
+
+ PyObjectHolder getGlobalDebugger = PyObjectHolder(isDebug, pyGetAttr(pydevdMod.ToPython(), "GetGlobalDebugger"));
+ CHECK_NULL(getGlobalDebugger.ToPython(), "pydevd.GetGlobalDebugger null.\n", 11);
+
+ PyObject_CallFunctionObjArgs call;
+ *(void**)(&call) = dlsym(main_hndl, "PyObject_CallFunctionObjArgs");
+ CHECK_NULL(call, "PyObject_CallFunctionObjArgs not found.\n", 11);
+
+ PyObjectHolder globalDbg = PyObjectHolder(isDebug, call(getGlobalDebugger.ToPython(), NULL));
+ CHECK_NULL(globalDbg.ToPython(), "pydevd.GetGlobalDebugger() returned null.\n", 12);
+
+ if(!pyHasAttrFunc(globalDbg.ToPython(), "trace_dispatch")){
+ if(showDebugInfo){
+ printf("pydevd.GetGlobalDebugger() has no attribute trace_dispatch!\n");
+ }
+ return 13;
+ }
+
+ PyObjectHolder traceFunc = PyObjectHolder(isDebug, pyGetAttr(globalDbg.ToPython(), "trace_dispatch"));
+ CHECK_NULL(traceFunc.ToPython(), "pydevd.GetGlobalDebugger().trace_dispatch returned null!\n", 14);
+
+ DecRef(call(settrace.ToPython(), traceFunc.ToPython(), NULL), isDebug);
+ if(showDebugInfo){
+ printf("sys.settrace(pydevd.GetGlobalDebugger().trace_dispatch) worked.\n");
+ }
+
+ return 0;
+}
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_mac.sh b/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_mac.sh
new file mode 100755
index 00000000..635330d7
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_mac.sh
@@ -0,0 +1,8 @@
+g++ -fPIC -D_REENTRANT -arch x86_64 I. -c -o attach_linux_x86_64.o attach_linux.c
+g++ -dynamiclib -arch x86_64 -o attach_x86_64.dylib attach_linux_x86_64.o -lc
+
+
+g++ -fPIC -D_REENTRANT -arch i386 -I. -c -o attach_linux_x86.o attach_linux.c
+g++ -dynamiclib -arch i386 -o attach_x86.dylib attach_linux_x86.o -lc
+
+
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_so.sh b/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_so.sh
new file mode 100755
index 00000000..1a043fb2
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/compile_so.sh
@@ -0,0 +1,7 @@
+g++ -m64 -shared -o attach_linux_amd64.so -fPIC -nostartfiles attach_linux.c
+mv attach_linux_amd64.so ../attach_linux_amd64.so
+
+echo Note: may need "sudo apt-get install libx32gcc-4.8-dev" and "sudo apt-get install libc6-dev-i386" and "sudo apt-get install g++-multilib" to compile 32 bits
+
+g++ -m32 -shared -o attach_linux_x86.so -fPIC -nostartfiles attach_linux.c
+mv attach_linux_x86.so ../attach_linux_x86.so
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/gdb_threads_settrace.py b/ptvsd/pydevd/pydevd_attach_to_process/linux/gdb_threads_settrace.py
new file mode 100644
index 00000000..48e3a7bc
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/gdb_threads_settrace.py
@@ -0,0 +1,16 @@
+# This file is meant to be run inside GDB as a command after
+# the attach_linux.so dll has already been loaded to settrace for all threads.
+if __name__ == '__main__':
+ #print('Startup GDB in Python!')
+
+ try:
+ show_debug_info = 0
+ is_debug = 0
+ for t in list(gdb.selected_inferior().threads()):
+ t.switch()
+ if t.is_stopped():
+ #print('Will settrace in: %s' % (t,))
+ gdb.execute("call SetSysTraceFunc(%s, %s)" % (
+ show_debug_info, is_debug))
+ except:
+ import traceback;traceback.print_exc()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_prepare.py b/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_prepare.py
new file mode 100644
index 00000000..8a220542
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_prepare.py
@@ -0,0 +1,54 @@
+# This file is meant to be run inside lldb
+# It registers command to load library and invoke attach function
+# Also it marks process threads to to distinguish them from debugger
+# threads later while settings trace in threads
+
+def load_lib_and_attach(debugger, command, result, internal_dict):
+ import shlex
+ args = shlex.split(command)
+
+ dll = args[0]
+ is_debug = args[1]
+ python_code = args[2]
+ show_debug_info = args[3]
+
+ import lldb
+ options = lldb.SBExpressionOptions()
+ options.SetFetchDynamicValue()
+ options.SetTryAllThreads(run_others=False)
+ options.SetTimeoutInMicroSeconds(timeout=10000000)
+
+ print(dll)
+ target = debugger.GetSelectedTarget()
+ res = target.EvaluateExpression("(void*)dlopen(\"%s\", 2);" % (
+ dll), options)
+ error = res.GetError()
+ if error:
+ print(error)
+
+ print(python_code)
+ res = target.EvaluateExpression("(int)DoAttach(%s, \"%s\", %s);" % (
+ is_debug, python_code.replace('"', "'"), show_debug_info), options)
+ error = res.GetError()
+ if error:
+ print(error)
+
+def __lldb_init_module(debugger, internal_dict):
+ import lldb
+
+ debugger.HandleCommand('command script add -f lldb_prepare.load_lib_and_attach load_lib_and_attach')
+
+ try:
+ target = debugger.GetSelectedTarget()
+ if target:
+ process = target.GetProcess()
+ if process:
+ for thread in process:
+ # print('Marking process thread %d'%thread.GetThreadID())
+ internal_dict['_thread_%d' % thread.GetThreadID()] = True
+ # thread.Suspend()
+ except:
+ import traceback;traceback.print_exc()
+
+
+
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_threads_settrace.py b/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_threads_settrace.py
new file mode 100644
index 00000000..e6ceb911
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/lldb_threads_settrace.py
@@ -0,0 +1,52 @@
+# This file is meant to be run inside lldb as a command after
+# the attach_linux.dylib dll has already been loaded to settrace for all threads.
+def __lldb_init_module(debugger, internal_dict):
+ # Command Initialization code goes here
+ # print('Startup LLDB in Python!')
+ import lldb
+
+ try:
+ show_debug_info = 1
+ is_debug = 0
+
+ options = lldb.SBExpressionOptions()
+ options.SetFetchDynamicValue()
+ options.SetTryAllThreads(run_others=False)
+ options.SetTimeoutInMicroSeconds(timeout=10000000)
+
+ target = debugger.GetSelectedTarget()
+ if target:
+ process = target.GetProcess()
+ if process:
+ for thread in process:
+ # Get the first frame
+ # print('Thread %s, suspended %s\n'%(thread, thread.IsStopped()))
+
+ if internal_dict.get('_thread_%d' % thread.GetThreadID(), False):
+ process.SetSelectedThread(thread)
+ if not thread.IsStopped():
+ # thread.Suspend()
+ error = process.Stop()
+
+ frame = thread.GetSelectedFrame()
+
+ if frame.GetFunctionName() == '__select':
+ # print('We are in __select')
+ # Step over select, otherwise evaluating expression there can terminate thread
+ thread.StepOver()
+ frame = thread.GetSelectedFrame()
+
+ print('Will settrace in: %s' % (frame,))
+
+ for f in thread:
+ print(f)
+
+ res = frame.EvaluateExpression("(int) SetSysTraceFunc(%s, %s)" % (
+ show_debug_info, is_debug), options)
+ error = res.GetError()
+ if error:
+ print(error)
+
+ thread.Resume()
+ except:
+ import traceback;traceback.print_exc()
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/linux/python.h b/ptvsd/pydevd/pydevd_attach_to_process/linux/python.h
new file mode 100644
index 00000000..93bfe6e4
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/linux/python.h
@@ -0,0 +1,576 @@
+/* ****************************************************************************
+ *
+ * Copyright (c) Microsoft Corporation.
+ *
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
+ * copy of the license can be found in the License.html file at the root of this distribution. If
+ * you cannot locate the Apache License, Version 2.0, please send an email to
+ * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
+ * by the terms of the Apache License, Version 2.0.
+ *
+ * You must not remove this notice, or any other, from this software.
+ *
+ * ***************************************************************************/
+
+#ifndef __PYTHON_H__
+#define __PYTHON_H__
+#include
+
+// must be kept in sync with PythonLanguageVersion.cs
+enum PythonVersion {
+ PythonVersion_Unknown,
+ PythonVersion_25 = 0x0205,
+ PythonVersion_26 = 0x0206,
+ PythonVersion_27 = 0x0207,
+ PythonVersion_30 = 0x0300,
+ PythonVersion_31 = 0x0301,
+ PythonVersion_32 = 0x0302,
+ PythonVersion_33 = 0x0303,
+ PythonVersion_34 = 0x0304
+};
+
+
+// defines limited header of Python API for compatible access across a number of Pythons.
+
+class PyTypeObject;
+class PyThreadState;
+
+#define PyObject_HEAD \
+ size_t ob_refcnt; \
+ PyTypeObject *ob_type;
+
+#define PyObject_VAR_HEAD \
+ PyObject_HEAD \
+ size_t ob_size; /* Number of items in variable part */
+
+class PyObject {
+public:
+ PyObject_HEAD
+};
+
+class PyVarObject : public PyObject {
+public:
+ size_t ob_size; /* Number of items in variable part */
+};
+
+// 2.4 - 2.7 compatible
+class PyCodeObject25_27 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash/cmp */
+ PyObject *co_filename; /* string (where it was loaded from) */
+ PyObject *co_name; /* string (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_25 && version <= PythonVersion_27;
+ }
+};
+
+// 3.0-3.2
+class PyCodeObject30_32 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash or comparisons */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+ void *co_zombieframe; /* for optimization only (see frameobject.c) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 2);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_30 && version <= PythonVersion_32;
+ }
+};
+
+// 3.3-3.4
+class PyCodeObject33_34 : public PyObject {
+public:
+ int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
+ int co_nlocals; /* #local variables */
+ int co_stacksize; /* #entries needed for evaluation stack */
+ int co_flags; /* CO_..., see below */
+ PyObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ PyObject *co_freevars; /* tuple of strings (free variable names) */
+ PyObject *co_cellvars; /* tuple of strings (cell variable names) */
+ /* The rest doesn't count for hash or comparisons */
+ unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
+ int co_firstlineno; /* first source line number */
+ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
+ void *co_zombieframe; /* for optimization only (see frameobject.c) */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 3 && minorVersion <= 4);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_33 && version <= PythonVersion_34;
+ }
+};
+
+// 2.5 - 3.1
+class PyFunctionObject : public PyObject {
+public:
+ PyObject *func_code; /* A code object */
+};
+
+// 2.5 - 2.7 compatible
+class PyStringObject : public PyVarObject {
+public:
+ long ob_shash;
+ int ob_sstate;
+ char ob_sval[1];
+
+ /* Invariants:
+ * ob_sval contains space for 'ob_size+1' elements.
+ * ob_sval[ob_size] == 0.
+ * ob_shash is the hash of the string or -1 if not computed yet.
+ * ob_sstate != 0 iff the string object is in stringobject.c's
+ * 'interned' dictionary; in this case the two references
+ * from 'interned' to this object are *not counted* in ob_refcnt.
+ */
+};
+
+// 2.4 - 3.2 compatible
+typedef struct {
+ PyObject_HEAD
+ size_t length; /* Length of raw Unicode data in buffer */
+ wchar_t *str; /* Raw Unicode buffer */
+ long hash; /* Hash value; -1 if not set */
+} PyUnicodeObject;
+
+// 2.4 - 3.4 compatible
+class PyFrameObject : public PyVarObject {
+public:
+ PyFrameObject *f_back; /* previous frame, or NULL */
+ PyObject *f_code; /* code segment */
+ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
+ PyObject *f_globals; /* global symbol table (PyDictObject) */
+ PyObject *f_locals; /* local symbol table (any mapping) */
+ PyObject **f_valuestack; /* points after the last local */
+ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
+ Frame evaluation usually NULLs it, but a frame that yields sets it
+ to the current stack top. */
+ PyObject **f_stacktop;
+ PyObject *f_trace; /* Trace function */
+ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
+};
+
+#define CO_MAXBLOCKS 20
+typedef struct {
+ int b_type; /* what kind of block this is */
+ int b_handler; /* where to jump to find handler */
+ int b_level; /* value stack level to pop to */
+} PyTryBlock;
+
+class PyFrameObject25_33 : public PyFrameObject {
+public:
+ PyThreadState* f_tstate;
+ int f_lasti; /* Last instruction if called */
+ /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
+ f_trace is set) -- at other times use PyCode_Addr2Line instead. */
+ int f_lineno; /* Current line number */
+ int f_iblock; /* index in f_blockstack */
+ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7) ||
+ majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 3);
+ }
+};
+
+class PyFrameObject34 : public PyFrameObject {
+public:
+ /* Borrowed reference to a generator, or NULL */
+ PyObject *f_gen;
+
+ int f_lasti; /* Last instruction if called */
+ /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
+ f_trace is set) -- at other times use PyCode_Addr2Line instead. */
+ int f_lineno; /* Current line number */
+ int f_iblock; /* index in f_blockstack */
+ char f_executing; /* whether the frame is still executing */
+ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
+
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && minorVersion == 4;
+ }
+};
+
+
+typedef void (*destructor)(PyObject *);
+
+// 2.4 - 3.4
+class PyMethodDef {
+public:
+ char *ml_name; /* The name of the built-in function/method */
+};
+
+
+//
+// 2.4 - 3.4, 2.4 has different compat in 64-bit but we don't support any of the released 64-bit platforms (which includes only IA-64)
+// While these are compatible there are fields only available on later versions.
+class PyTypeObject : public PyVarObject {
+public:
+ const char *tp_name; /* For printing, in format "." */
+ size_t tp_basicsize, tp_itemsize; /* For allocation */
+
+ /* Methods to implement standard operations */
+
+ destructor tp_dealloc;
+ void* tp_print;
+ void* tp_getattr;
+ void* tp_setattr;
+ void* tp_compare;
+ void* tp_repr;
+
+ /* Method suites for standard classes */
+
+ void *tp_as_number;
+ void*tp_as_sequence;
+ void*tp_as_mapping;
+
+ /* More standard operations (here for binary compatibility) */
+
+ void* tp_hash;
+ void* tp_call;
+ void* tp_str;
+ void* tp_getattro;
+ void* tp_setattro;
+
+ /* Functions to access object as input/output buffer */
+ void*tp_as_buffer;
+
+ /* Flags to define presence of optional/expanded features */
+ long tp_flags;
+
+ const char *tp_doc; /* Documentation string */
+
+ /* Assigned meaning in release 2.0 */
+ /* call function for all accessible objects */
+ void* tp_traverse;
+
+ /* delete references to contained objects */
+ void* tp_clear;
+
+ /* Assigned meaning in release 2.1 */
+ /* rich comparisons */
+ void* tp_richcompare;
+
+ /* weak reference enabler */
+ size_t tp_weaklistoffset;
+
+ /* Added in release 2.2 */
+ /* Iterators */
+ void* tp_iter;
+ void* tp_iternext;
+
+ /* Attribute descriptor and subclassing stuff */
+ PyMethodDef *tp_methods;
+ struct PyMemberDef *tp_members;
+ struct PyGetSetDef *tp_getset;
+ struct _typeobject *tp_base;
+ PyObject *tp_dict;
+ void* tp_descr_get;
+ void* tp_descr_set;
+ size_t tp_dictoffset;
+ void* tp_init;
+ void* tp_alloc;
+ void* tp_new;
+ void* tp_free; /* Low-level free-memory routine */
+ void* tp_is_gc; /* For PyObject_IS_GC */
+ PyObject *tp_bases;
+ PyObject *tp_mro; /* method resolution order */
+ PyObject *tp_cache;
+ PyObject *tp_subclasses;
+ PyObject *tp_weaklist;
+ void* tp_del;
+
+ /* Type attribute cache version tag. Added in version 2.6 */
+ unsigned int tp_version_tag;
+};
+
+// 2.4 - 3.4
+class PyTupleObject : public PyVarObject {
+public:
+ PyObject *ob_item[1];
+
+ /* ob_item contains space for 'ob_size' elements.
+ * Items must normally not be NULL, except during construction when
+ * the tuple is not yet visible outside the function that builds it.
+ */
+};
+
+// 2.4 - 3.4
+class PyCFunctionObject : public PyObject {
+public:
+ PyMethodDef *m_ml; /* Description of the C function to call */
+ PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
+ PyObject *m_module; /* The __module__ attribute, can be anything */
+};
+
+typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
+
+#define PyTrace_CALL 0
+#define PyTrace_EXCEPTION 1
+#define PyTrace_LINE 2
+#define PyTrace_RETURN 3
+#define PyTrace_C_CALL 4
+#define PyTrace_C_EXCEPTION 5
+#define PyTrace_C_RETURN 6
+
+class PyInterpreterState {
+};
+
+class PyThreadState { };
+
+class PyThreadState_25_27 : public PyThreadState {
+public:
+ /* See Python/ceval.c for comments explaining most fields */
+
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ /* tick_counter is incremented whenever the check_interval ticker
+ * reaches zero. The purpose is to give a useful measure of the number
+ * of interpreted bytecode instructions in a given thread. This
+ * extremely lightweight statistic collector may be of interest to
+ * profilers (like psyco.jit()), although nothing in the core uses it.
+ */
+ int tick_counter;
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 2 && (minorVersion >= 5 && minorVersion <= 7);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_25 && version <= PythonVersion_27;
+ }
+};
+
+class PyThreadState_30_33 : public PyThreadState {
+public:
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ char overflowed; /* The stack has overflowed. Allow 50 more calls
+ to handle the runtime error. */
+ char recursion_critical; /* The current calls must not cause
+ a stack overflow. */
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ /* tick_counter is incremented whenever the check_interval ticker
+ * reaches zero. The purpose is to give a useful measure of the number
+ * of interpreted bytecode instructions in a given thread. This
+ * extremely lightweight statistic collector may be of interest to
+ * profilers (like psyco.jit()), although nothing in the core uses it.
+ */
+ int tick_counter;
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && (minorVersion >= 0 && minorVersion <= 3);
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version >= PythonVersion_30 && version <= PythonVersion_33;
+ }
+};
+
+class PyThreadState_34 : public PyThreadState {
+public:
+ PyThreadState *prev;
+ PyThreadState *next;
+ PyInterpreterState *interp;
+
+ PyFrameObject *frame;
+ int recursion_depth;
+ char overflowed; /* The stack has overflowed. Allow 50 more calls
+ to handle the runtime error. */
+ char recursion_critical; /* The current calls must not cause
+ a stack overflow. */
+ /* 'tracing' keeps track of the execution depth when tracing/profiling.
+ This is to prevent the actual trace/profile code from being recorded in
+ the trace/profile. */
+ int tracing;
+ int use_tracing;
+
+ Py_tracefunc c_profilefunc;
+ Py_tracefunc c_tracefunc;
+ PyObject *c_profileobj;
+ PyObject *c_traceobj;
+
+ PyObject *curexc_type;
+ PyObject *curexc_value;
+ PyObject *curexc_traceback;
+
+ PyObject *exc_type;
+ PyObject *exc_value;
+ PyObject *exc_traceback;
+
+ PyObject *dict; /* Stores per-thread state */
+
+ int gilstate_counter;
+
+ PyObject *async_exc; /* Asynchronous exception to raise */
+ long thread_id; /* Thread id where this tstate was created */
+
+ /* XXX signal handlers should also be here */
+ static bool IsFor(int majorVersion, int minorVersion) {
+ return majorVersion == 3 && minorVersion == 4;
+ }
+
+ static bool IsFor(PythonVersion version) {
+ return version == PythonVersion_34;
+ }
+};
+
+class PyIntObject : public PyObject {
+public:
+ long ob_ival;
+};
+
+//class Py3kLongObject : public PyVarObject {
+//public:
+// DWORD ob_digit[1];
+//};
+
+class PyOldStyleClassObject : public PyObject {
+public:
+ PyObject *cl_bases; /* A tuple of class objects */
+ PyObject *cl_dict; /* A dictionary */
+ PyObject *cl_name; /* A string */
+ /* The following three are functions or NULL */
+ PyObject *cl_getattr;
+ PyObject *cl_setattr;
+ PyObject *cl_delattr;
+};
+
+class PyInstanceObject : public PyObject {
+public:
+ PyOldStyleClassObject *in_class; /* The class object */
+ PyObject *in_dict; /* A dictionary */
+ PyObject *in_weakreflist; /* List of weak references */
+};
+
+typedef const char* (*GetVersionFunc) ();
+
+static PythonVersion GetPythonVersion() {
+ GetVersionFunc versionFunc;
+ void *main_hndl = dlopen(NULL, 0x2);
+ *(void**)(&versionFunc) = dlsym(main_hndl, "Py_GetVersion");
+ if(versionFunc != NULL) {
+ const char* version = versionFunc();
+ if(version != NULL && strlen(version) >= 3 && version[1] == '.') {
+ if(version[0] == '2') {
+ switch(version[2]) {
+ case '5': return PythonVersion_25;
+ case '6': return PythonVersion_26;
+ case '7': return PythonVersion_27;
+ }
+ } else if(version[0] == '3') {
+ switch(version[2]) {
+ case '0': return PythonVersion_30;
+ case '1': return PythonVersion_31;
+ case '2': return PythonVersion_32;
+ case '3': return PythonVersion_33;
+ case '4': return PythonVersion_34;
+ }
+ }
+ }
+ }
+ return PythonVersion_Unknown;
+}
+
+#endif
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/__init__.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/__init__.py
new file mode 100644
index 00000000..aa138ccf
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/__init__.py
@@ -0,0 +1,263 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Windows application debugging engine for Python.
+
+by Mario Vilas (mvilas at gmail.com)
+
+Project: U{http://sourceforge.net/projects/winappdbg/}
+
+Web: U{http://winappdbg.sourceforge.net/}
+
+Blog: U{http://breakingcode.wordpress.com}
+
+@group Debugging:
+ Debug, EventHandler, EventSift, DebugLog
+
+@group Instrumentation:
+ System, Process, Thread, Module, Window, Registry
+
+@group Disassemblers:
+ Disassembler,
+ BeaEngine, DistormEngine, PyDasmEngine
+
+@group Crash reporting:
+ Crash, CrashDump, CrashDAO, CrashDictionary
+
+@group Memory search:
+ Search,
+ Pattern,
+ BytePattern,
+ TextPattern,
+ RegExpPattern,
+ HexPattern
+
+@group Debug events:
+ Event,
+ NoEvent,
+ CreateProcessEvent,
+ CreateThreadEvent,
+ ExitProcessEvent,
+ ExitThreadEvent,
+ LoadDLLEvent,
+ UnloadDLLEvent,
+ OutputDebugStringEvent,
+ RIPEvent,
+ ExceptionEvent
+
+@group Win32 API wrappers:
+ win32, Handle, ProcessHandle, ThreadHandle, FileHandle
+
+@group Helpers:
+ HexInput, HexOutput, HexDump, Color, Table, Logger,
+ PathOperations,
+ MemoryAddresses,
+ CustomAddressIterator,
+ DataAddressIterator,
+ ImageAddressIterator,
+ MappedAddressIterator,
+ ExecutableAddressIterator,
+ ReadableAddressIterator,
+ WriteableAddressIterator,
+ ExecutableAndWriteableAddressIterator,
+ DebugRegister,
+ Regenerator
+
+@group Warnings:
+ MixedBitsWarning, BreakpointWarning, BreakpointCallbackWarning,
+ EventCallbackWarning, DebugSymbolsWarning, CrashWarning
+
+@group Deprecated classes:
+ CrashContainer, CrashTable, CrashTableMSSQL,
+ VolatileCrashContainer, DummyCrashContainer
+
+@type version_number: float
+@var version_number: This WinAppDbg major and minor version,
+ as a floating point number. Use this for compatibility checking.
+
+@type version: str
+@var version: This WinAppDbg release version,
+ as a printable string. Use this to show to the user.
+
+@undocumented: plugins
+"""
+
+__revision__ = "$Id$"
+
+# List of all public symbols
+__all__ = [
+ # Library version
+ 'version',
+ 'version_number',
+
+ # from breakpoint import *
+## 'Breakpoint',
+## 'CodeBreakpoint',
+## 'PageBreakpoint',
+## 'HardwareBreakpoint',
+## 'Hook',
+## 'ApiHook',
+## 'BufferWatch',
+ 'BreakpointWarning',
+ 'BreakpointCallbackWarning',
+
+ # from crash import *
+ 'Crash',
+ 'CrashWarning',
+ 'CrashDictionary',
+ 'CrashContainer',
+ 'CrashTable',
+ 'CrashTableMSSQL',
+ 'VolatileCrashContainer',
+ 'DummyCrashContainer',
+
+ # from debug import *
+ 'Debug',
+ 'MixedBitsWarning',
+
+ # from disasm import *
+ 'Disassembler',
+ 'BeaEngine',
+ 'DistormEngine',
+ 'PyDasmEngine',
+
+ # from event import *
+ 'EventHandler',
+ 'EventSift',
+## 'EventFactory',
+## 'EventDispatcher',
+ 'EventCallbackWarning',
+ 'Event',
+## 'NoEvent',
+ 'CreateProcessEvent',
+ 'CreateThreadEvent',
+ 'ExitProcessEvent',
+ 'ExitThreadEvent',
+ 'LoadDLLEvent',
+ 'UnloadDLLEvent',
+ 'OutputDebugStringEvent',
+ 'RIPEvent',
+ 'ExceptionEvent',
+
+ # from interactive import *
+## 'ConsoleDebugger',
+
+ # from module import *
+ 'Module',
+ 'DebugSymbolsWarning',
+
+ # from process import *
+ 'Process',
+
+ # from system import *
+ 'System',
+
+ # from search import *
+ 'Search',
+ 'Pattern',
+ 'BytePattern',
+ 'TextPattern',
+ 'RegExpPattern',
+ 'HexPattern',
+
+ # from registry import *
+ 'Registry',
+
+ # from textio import *
+ 'HexDump',
+ 'HexInput',
+ 'HexOutput',
+ 'Color',
+ 'Table',
+ 'CrashDump',
+ 'DebugLog',
+ 'Logger',
+
+ # from thread import *
+ 'Thread',
+
+ # from util import *
+ 'PathOperations',
+ 'MemoryAddresses',
+ 'CustomAddressIterator',
+ 'DataAddressIterator',
+ 'ImageAddressIterator',
+ 'MappedAddressIterator',
+ 'ExecutableAddressIterator',
+ 'ReadableAddressIterator',
+ 'WriteableAddressIterator',
+ 'ExecutableAndWriteableAddressIterator',
+ 'DebugRegister',
+
+ # from window import *
+ 'Window',
+
+ # import win32
+ 'win32',
+
+ # from win32 import Handle, ProcessHandle, ThreadHandle, FileHandle
+ 'Handle',
+ 'ProcessHandle',
+ 'ThreadHandle',
+ 'FileHandle',
+ ]
+
+# Import all public symbols
+from winappdbg.breakpoint import *
+from winappdbg.crash import *
+from winappdbg.debug import *
+from winappdbg.disasm import *
+from winappdbg.event import *
+from winappdbg.interactive import *
+from winappdbg.module import *
+from winappdbg.process import *
+from winappdbg.registry import *
+from winappdbg.system import *
+from winappdbg.search import *
+from winappdbg.textio import *
+from winappdbg.thread import *
+from winappdbg.util import *
+from winappdbg.window import *
+
+import winappdbg.win32
+from winappdbg.win32 import Handle, ProcessHandle, ThreadHandle, FileHandle
+
+try:
+ from sql import *
+ __all__.append('CrashDAO')
+except ImportError:
+ import warnings
+ warnings.warn("No SQL database support present (missing dependencies?)",
+ ImportWarning)
+
+# Library version
+version_number = 1.5
+version = "Version %s" % version_number
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py
new file mode 100644
index 00000000..3b9ca73f
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py
@@ -0,0 +1,4822 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Breakpoints.
+
+@group Breakpoints:
+ Breakpoint, CodeBreakpoint, PageBreakpoint, HardwareBreakpoint,
+ BufferWatch, Hook, ApiHook
+
+@group Warnings:
+ BreakpointWarning, BreakpointCallbackWarning
+"""
+
+__revision__ = "$Id$"
+
+__all__ = [
+
+ # Base class for breakpoints
+ 'Breakpoint',
+
+ # Breakpoint implementations
+ 'CodeBreakpoint',
+ 'PageBreakpoint',
+ 'HardwareBreakpoint',
+
+ # Hooks and watches
+ 'Hook',
+ 'ApiHook',
+ 'BufferWatch',
+
+ # Warnings
+ 'BreakpointWarning',
+ 'BreakpointCallbackWarning',
+
+ ]
+
+from winappdbg import win32
+from winappdbg import compat
+import sys
+from winappdbg.process import Process, Thread
+from winappdbg.util import DebugRegister, MemoryAddresses
+from winappdbg.textio import HexDump
+
+import ctypes
+import warnings
+import traceback
+
+#==============================================================================
+
+class BreakpointWarning (UserWarning):
+ """
+ This warning is issued when a non-fatal error occurs that's related to
+ breakpoints.
+ """
+
+class BreakpointCallbackWarning (RuntimeWarning):
+ """
+ This warning is issued when an uncaught exception was raised by a
+ breakpoint's user-defined callback.
+ """
+
+#==============================================================================
+
+class Breakpoint (object):
+ """
+ Base class for breakpoints.
+ Here's the breakpoints state machine.
+
+ @see: L{CodeBreakpoint}, L{PageBreakpoint}, L{HardwareBreakpoint}
+
+ @group Breakpoint states:
+ DISABLED, ENABLED, ONESHOT, RUNNING
+ @group State machine:
+ hit, disable, enable, one_shot, running,
+ is_disabled, is_enabled, is_one_shot, is_running,
+ get_state, get_state_name
+ @group Information:
+ get_address, get_size, get_span, is_here
+ @group Conditional breakpoints:
+ is_conditional, is_unconditional,
+ get_condition, set_condition, eval_condition
+ @group Automatic breakpoints:
+ is_automatic, is_interactive,
+ get_action, set_action, run_action
+
+ @cvar DISABLED: I{Disabled} S{->} Enabled, OneShot
+ @cvar ENABLED: I{Enabled} S{->} I{Running}, Disabled
+ @cvar ONESHOT: I{OneShot} S{->} I{Disabled}
+ @cvar RUNNING: I{Running} S{->} I{Enabled}, Disabled
+
+ @type DISABLED: int
+ @type ENABLED: int
+ @type ONESHOT: int
+ @type RUNNING: int
+
+ @type stateNames: dict E{lb} int S{->} str E{rb}
+ @cvar stateNames: User-friendly names for each breakpoint state.
+
+ @type typeName: str
+ @cvar typeName: User friendly breakpoint type string.
+ """
+
+ # I don't think transitions Enabled <-> OneShot should be allowed... plus
+ # it would require special handling to avoid setting the same bp twice
+
+ DISABLED = 0
+ ENABLED = 1
+ ONESHOT = 2
+ RUNNING = 3
+
+ typeName = 'breakpoint'
+
+ stateNames = {
+ DISABLED : 'disabled',
+ ENABLED : 'enabled',
+ ONESHOT : 'one shot',
+ RUNNING : 'running',
+ }
+
+ def __init__(self, address, size = 1, condition = True, action = None):
+ """
+ Breakpoint object.
+
+ @type address: int
+ @param address: Memory address for breakpoint.
+
+ @type size: int
+ @param size: Size of breakpoint in bytes (defaults to 1).
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ The callback signature is::
+
+ def condition_callback(event):
+ return True # returns True or False
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ If specified, the event is handled by this callback instead of
+ being dispatched normally.
+
+ The callback signature is::
+
+ def action_callback(event):
+ pass # no return value
+
+ Where B{event} is an L{Event} object.
+ """
+ self.__address = address
+ self.__size = size
+ self.__state = self.DISABLED
+
+ self.set_condition(condition)
+ self.set_action(action)
+
+ def __repr__(self):
+ if self.is_disabled():
+ state = 'Disabled'
+ else:
+ state = 'Active (%s)' % self.get_state_name()
+ if self.is_conditional():
+ condition = 'conditional'
+ else:
+ condition = 'unconditional'
+ name = self.typeName
+ size = self.get_size()
+ if size == 1:
+ address = HexDump.address( self.get_address() )
+ else:
+ begin = self.get_address()
+ end = begin + size
+ begin = HexDump.address(begin)
+ end = HexDump.address(end)
+ address = "range %s-%s" % (begin, end)
+ msg = "<%s %s %s at remote address %s>"
+ msg = msg % (state, condition, name, address)
+ return msg
+
+#------------------------------------------------------------------------------
+
+ def is_disabled(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint is in L{DISABLED} state.
+ """
+ return self.get_state() == self.DISABLED
+
+ def is_enabled(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint is in L{ENABLED} state.
+ """
+ return self.get_state() == self.ENABLED
+
+ def is_one_shot(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint is in L{ONESHOT} state.
+ """
+ return self.get_state() == self.ONESHOT
+
+ def is_running(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint is in L{RUNNING} state.
+ """
+ return self.get_state() == self.RUNNING
+
+ def is_here(self, address):
+ """
+ @rtype: bool
+ @return: C{True} if the address is within the range of the breakpoint.
+ """
+ begin = self.get_address()
+ end = begin + self.get_size()
+ return begin <= address < end
+
+ def get_address(self):
+ """
+ @rtype: int
+ @return: The target memory address for the breakpoint.
+ """
+ return self.__address
+
+ def get_size(self):
+ """
+ @rtype: int
+ @return: The size in bytes of the breakpoint.
+ """
+ return self.__size
+
+ def get_span(self):
+ """
+ @rtype: tuple( int, int )
+ @return:
+ Starting and ending address of the memory range
+ covered by the breakpoint.
+ """
+ address = self.get_address()
+ size = self.get_size()
+ return ( address, address + size )
+
+ def get_state(self):
+ """
+ @rtype: int
+ @return: The current state of the breakpoint
+ (L{DISABLED}, L{ENABLED}, L{ONESHOT}, L{RUNNING}).
+ """
+ return self.__state
+
+ def get_state_name(self):
+ """
+ @rtype: str
+ @return: The name of the current state of the breakpoint.
+ """
+ return self.stateNames[ self.get_state() ]
+
+#------------------------------------------------------------------------------
+
+ def is_conditional(self):
+ """
+ @see: L{__init__}
+ @rtype: bool
+ @return: C{True} if the breakpoint has a condition callback defined.
+ """
+ # Do not evaluate as boolean! Test for identity with True instead.
+ return self.__condition is not True
+
+ def is_unconditional(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint doesn't have a condition callback defined.
+ """
+ # Do not evaluate as boolean! Test for identity with True instead.
+ return self.__condition is True
+
+ def get_condition(self):
+ """
+ @rtype: bool, function
+ @return: Returns the condition callback for conditional breakpoints.
+ Returns C{True} for unconditional breakpoints.
+ """
+ return self.__condition
+
+ def set_condition(self, condition = True):
+ """
+ Sets a new condition callback for the breakpoint.
+
+ @see: L{__init__}
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+ """
+ if condition is None:
+ self.__condition = True
+ else:
+ self.__condition = condition
+
+ def eval_condition(self, event):
+ """
+ Evaluates the breakpoint condition, if any was set.
+
+ @type event: L{Event}
+ @param event: Debug event triggered by the breakpoint.
+
+ @rtype: bool
+ @return: C{True} to dispatch the event, C{False} otherwise.
+ """
+ condition = self.get_condition()
+ if condition is True: # shortcut for unconditional breakpoints
+ return True
+ if callable(condition):
+ try:
+ return bool( condition(event) )
+ except Exception:
+ e = sys.exc_info()[1]
+ msg = ("Breakpoint condition callback %r"
+ " raised an exception: %s")
+ msg = msg % (condition, traceback.format_exc(e))
+ warnings.warn(msg, BreakpointCallbackWarning)
+ return False
+ return bool( condition ) # force evaluation now
+
+#------------------------------------------------------------------------------
+
+ def is_automatic(self):
+ """
+ @rtype: bool
+ @return: C{True} if the breakpoint has an action callback defined.
+ """
+ return self.__action is not None
+
+ def is_interactive(self):
+ """
+ @rtype: bool
+ @return:
+ C{True} if the breakpoint doesn't have an action callback defined.
+ """
+ return self.__action is None
+
+ def get_action(self):
+ """
+ @rtype: bool, function
+ @return: Returns the action callback for automatic breakpoints.
+ Returns C{None} for interactive breakpoints.
+ """
+ return self.__action
+
+ def set_action(self, action = None):
+ """
+ Sets a new action callback for the breakpoint.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ """
+ self.__action = action
+
+ def run_action(self, event):
+ """
+ Executes the breakpoint action callback, if any was set.
+
+ @type event: L{Event}
+ @param event: Debug event triggered by the breakpoint.
+ """
+ action = self.get_action()
+ if action is not None:
+ try:
+ return bool( action(event) )
+ except Exception:
+ e = sys.exc_info()[1]
+ msg = ("Breakpoint action callback %r"
+ " raised an exception: %s")
+ msg = msg % (action, traceback.format_exc(e))
+ warnings.warn(msg, BreakpointCallbackWarning)
+ return False
+ return True
+
+#------------------------------------------------------------------------------
+
+ def __bad_transition(self, state):
+ """
+ Raises an C{AssertionError} exception for an invalid state transition.
+
+ @see: L{stateNames}
+
+ @type state: int
+ @param state: Intended breakpoint state.
+
+ @raise Exception: Always.
+ """
+ statemsg = ""
+ oldState = self.stateNames[ self.get_state() ]
+ newState = self.stateNames[ state ]
+ msg = "Invalid state transition (%s -> %s)" \
+ " for breakpoint at address %s"
+ msg = msg % (oldState, newState, HexDump.address(self.get_address()))
+ raise AssertionError(msg)
+
+ def disable(self, aProcess, aThread):
+ """
+ Transition to L{DISABLED} state.
+ - When hit: OneShot S{->} Disabled
+ - Forced by user: Enabled, OneShot, Running S{->} Disabled
+ - Transition from running state may require special handling
+ by the breakpoint implementation class.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+## if self.__state not in (self.ENABLED, self.ONESHOT, self.RUNNING):
+## self.__bad_transition(self.DISABLED)
+ self.__state = self.DISABLED
+
+ def enable(self, aProcess, aThread):
+ """
+ Transition to L{ENABLED} state.
+ - When hit: Running S{->} Enabled
+ - Forced by user: Disabled, Running S{->} Enabled
+ - Transition from running state may require special handling
+ by the breakpoint implementation class.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+## if self.__state not in (self.DISABLED, self.RUNNING):
+## self.__bad_transition(self.ENABLED)
+ self.__state = self.ENABLED
+
+ def one_shot(self, aProcess, aThread):
+ """
+ Transition to L{ONESHOT} state.
+ - Forced by user: Disabled S{->} OneShot
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+## if self.__state != self.DISABLED:
+## self.__bad_transition(self.ONESHOT)
+ self.__state = self.ONESHOT
+
+ def running(self, aProcess, aThread):
+ """
+ Transition to L{RUNNING} state.
+ - When hit: Enabled S{->} Running
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+ if self.__state != self.ENABLED:
+ self.__bad_transition(self.RUNNING)
+ self.__state = self.RUNNING
+
+ def hit(self, event):
+ """
+ Notify a breakpoint that it's been hit.
+
+ This triggers the corresponding state transition and sets the
+ C{breakpoint} property of the given L{Event} object.
+
+ @see: L{disable}, L{enable}, L{one_shot}, L{running}
+
+ @type event: L{Event}
+ @param event: Debug event to handle (depends on the breakpoint type).
+
+ @raise AssertionError: Disabled breakpoints can't be hit.
+ """
+ aProcess = event.get_process()
+ aThread = event.get_thread()
+ state = self.get_state()
+
+ event.breakpoint = self
+
+ if state == self.ENABLED:
+ self.running(aProcess, aThread)
+
+ elif state == self.RUNNING:
+ self.enable(aProcess, aThread)
+
+ elif state == self.ONESHOT:
+ self.disable(aProcess, aThread)
+
+ elif state == self.DISABLED:
+ # this should not happen
+ msg = "Hit a disabled breakpoint at address %s"
+ msg = msg % HexDump.address( self.get_address() )
+ warnings.warn(msg, BreakpointWarning)
+
+#==============================================================================
+
+# XXX TODO
+# Check if the user is trying to set a code breakpoint on a memory mapped file,
+# so we don't end up writing the int3 instruction in the file by accident.
+
+class CodeBreakpoint (Breakpoint):
+ """
+ Code execution breakpoints (using an int3 opcode).
+
+ @see: L{Debug.break_at}
+
+ @type bpInstruction: str
+ @cvar bpInstruction: Breakpoint instruction for the current processor.
+ """
+
+ typeName = 'code breakpoint'
+
+ if win32.arch in (win32.ARCH_I386, win32.ARCH_AMD64):
+ bpInstruction = '\xCC' # int 3
+
+ def __init__(self, address, condition = True, action = None):
+ """
+ Code breakpoint object.
+
+ @see: L{Breakpoint.__init__}
+
+ @type address: int
+ @param address: Memory address for breakpoint.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ """
+ if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
+ msg = "Code breakpoints not supported for %s" % win32.arch
+ raise NotImplementedError(msg)
+ Breakpoint.__init__(self, address, len(self.bpInstruction),
+ condition, action)
+ self.__previousValue = self.bpInstruction
+
+ def __set_bp(self, aProcess):
+ """
+ Writes a breakpoint instruction at the target address.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+ """
+ address = self.get_address()
+ self.__previousValue = aProcess.read(address, len(self.bpInstruction))
+ if self.__previousValue == self.bpInstruction:
+ msg = "Possible overlapping code breakpoints at %s"
+ msg = msg % HexDump.address(address)
+ warnings.warn(msg, BreakpointWarning)
+ aProcess.write(address, self.bpInstruction)
+
+ def __clear_bp(self, aProcess):
+ """
+ Restores the original byte at the target address.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+ """
+ address = self.get_address()
+ currentValue = aProcess.read(address, len(self.bpInstruction))
+ if currentValue == self.bpInstruction:
+ # Only restore the previous value if the int3 is still there.
+ aProcess.write(self.get_address(), self.__previousValue)
+ else:
+ self.__previousValue = currentValue
+ msg = "Overwritten code breakpoint at %s"
+ msg = msg % HexDump.address(address)
+ warnings.warn(msg, BreakpointWarning)
+
+ def disable(self, aProcess, aThread):
+ if not self.is_disabled() and not self.is_running():
+ self.__clear_bp(aProcess)
+ super(CodeBreakpoint, self).disable(aProcess, aThread)
+
+ def enable(self, aProcess, aThread):
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aProcess)
+ super(CodeBreakpoint, self).enable(aProcess, aThread)
+
+ def one_shot(self, aProcess, aThread):
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aProcess)
+ super(CodeBreakpoint, self).one_shot(aProcess, aThread)
+
+ # FIXME race condition here (however unlikely)
+ # If another thread runs on over the target address while
+ # the breakpoint is in RUNNING state, we'll miss it. There
+ # is a solution to this but it's somewhat complicated, so
+ # I'm leaving it for another version of the debugger. :(
+ def running(self, aProcess, aThread):
+ if self.is_enabled():
+ self.__clear_bp(aProcess)
+ aThread.set_tf()
+ super(CodeBreakpoint, self).running(aProcess, aThread)
+
+#==============================================================================
+
+# TODO:
+# * If the original page was already a guard page, the exception should be
+# passed to the debugee instead of being handled by the debugger.
+# * If the original page was already a guard page, it should NOT be converted
+# to a no-access page when disabling the breakpoint.
+# * If the page permissions were modified after the breakpoint was enabled,
+# no change should be done on them when disabling the breakpoint. For this
+# we need to remember the original page permissions instead of blindly
+# setting and clearing the guard page bit on them.
+# * Some pages seem to be "magic" and resist all attempts at changing their
+# protect bits (for example the pages where the PEB and TEB reside). Maybe
+# a more descriptive error message could be shown in this case.
+
+class PageBreakpoint (Breakpoint):
+ """
+ Page access breakpoint (using guard pages).
+
+ @see: L{Debug.watch_buffer}
+
+ @group Information:
+ get_size_in_pages
+ """
+
+ typeName = 'page breakpoint'
+
+#------------------------------------------------------------------------------
+
+ def __init__(self, address, pages = 1, condition = True, action = None):
+ """
+ Page breakpoint object.
+
+ @see: L{Breakpoint.__init__}
+
+ @type address: int
+ @param address: Memory address for breakpoint.
+
+ @type pages: int
+ @param address: Size of breakpoint in pages.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ """
+ Breakpoint.__init__(self, address, pages * MemoryAddresses.pageSize,
+ condition, action)
+## if (address & 0x00000FFF) != 0:
+ floordiv_align = long(address) // long(MemoryAddresses.pageSize)
+ truediv_align = float(address) / float(MemoryAddresses.pageSize)
+ if floordiv_align != truediv_align:
+ msg = "Address of page breakpoint " \
+ "must be aligned to a page size boundary " \
+ "(value %s received)" % HexDump.address(address)
+ raise ValueError(msg)
+
+ def get_size_in_pages(self):
+ """
+ @rtype: int
+ @return: The size in pages of the breakpoint.
+ """
+ # The size is always a multiple of the page size.
+ return self.get_size() // MemoryAddresses.pageSize
+
+ def __set_bp(self, aProcess):
+ """
+ Sets the target pages as guard pages.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+ """
+ lpAddress = self.get_address()
+ dwSize = self.get_size()
+ flNewProtect = aProcess.mquery(lpAddress).Protect
+ flNewProtect = flNewProtect | win32.PAGE_GUARD
+ aProcess.mprotect(lpAddress, dwSize, flNewProtect)
+
+ def __clear_bp(self, aProcess):
+ """
+ Restores the original permissions of the target pages.
+
+ @type aProcess: L{Process}
+ @param aProcess: Process object.
+ """
+ lpAddress = self.get_address()
+ flNewProtect = aProcess.mquery(lpAddress).Protect
+ flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD
+ aProcess.mprotect(lpAddress, self.get_size(), flNewProtect)
+
+ def disable(self, aProcess, aThread):
+ if not self.is_disabled():
+ self.__clear_bp(aProcess)
+ super(PageBreakpoint, self).disable(aProcess, aThread)
+
+ def enable(self, aProcess, aThread):
+ if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
+ msg = "Only one-shot page breakpoints are supported for %s"
+ raise NotImplementedError(msg % win32.arch)
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aProcess)
+ super(PageBreakpoint, self).enable(aProcess, aThread)
+
+ def one_shot(self, aProcess, aThread):
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aProcess)
+ super(PageBreakpoint, self).one_shot(aProcess, aThread)
+
+ def running(self, aProcess, aThread):
+ aThread.set_tf()
+ super(PageBreakpoint, self).running(aProcess, aThread)
+
+#==============================================================================
+
+class HardwareBreakpoint (Breakpoint):
+ """
+ Hardware breakpoint (using debug registers).
+
+ @see: L{Debug.watch_variable}
+
+ @group Information:
+ get_slot, get_trigger, get_watch
+
+ @group Trigger flags:
+ BREAK_ON_EXECUTION, BREAK_ON_WRITE, BREAK_ON_ACCESS
+
+ @group Watch size flags:
+ WATCH_BYTE, WATCH_WORD, WATCH_DWORD, WATCH_QWORD
+
+ @type BREAK_ON_EXECUTION: int
+ @cvar BREAK_ON_EXECUTION: Break on execution.
+
+ @type BREAK_ON_WRITE: int
+ @cvar BREAK_ON_WRITE: Break on write.
+
+ @type BREAK_ON_ACCESS: int
+ @cvar BREAK_ON_ACCESS: Break on read or write.
+
+ @type WATCH_BYTE: int
+ @cvar WATCH_BYTE: Watch a byte.
+
+ @type WATCH_WORD: int
+ @cvar WATCH_WORD: Watch a word (2 bytes).
+
+ @type WATCH_DWORD: int
+ @cvar WATCH_DWORD: Watch a double word (4 bytes).
+
+ @type WATCH_QWORD: int
+ @cvar WATCH_QWORD: Watch one quad word (8 bytes).
+
+ @type validTriggers: tuple
+ @cvar validTriggers: Valid trigger flag values.
+
+ @type validWatchSizes: tuple
+ @cvar validWatchSizes: Valid watch flag values.
+ """
+
+ typeName = 'hardware breakpoint'
+
+ BREAK_ON_EXECUTION = DebugRegister.BREAK_ON_EXECUTION
+ BREAK_ON_WRITE = DebugRegister.BREAK_ON_WRITE
+ BREAK_ON_ACCESS = DebugRegister.BREAK_ON_ACCESS
+
+ WATCH_BYTE = DebugRegister.WATCH_BYTE
+ WATCH_WORD = DebugRegister.WATCH_WORD
+ WATCH_DWORD = DebugRegister.WATCH_DWORD
+ WATCH_QWORD = DebugRegister.WATCH_QWORD
+
+ validTriggers = (
+ BREAK_ON_EXECUTION,
+ BREAK_ON_WRITE,
+ BREAK_ON_ACCESS,
+ )
+
+ validWatchSizes = (
+ WATCH_BYTE,
+ WATCH_WORD,
+ WATCH_DWORD,
+ WATCH_QWORD,
+ )
+
+ def __init__(self, address, triggerFlag = BREAK_ON_ACCESS,
+ sizeFlag = WATCH_DWORD,
+ condition = True,
+ action = None):
+ """
+ Hardware breakpoint object.
+
+ @see: L{Breakpoint.__init__}
+
+ @type address: int
+ @param address: Memory address for breakpoint.
+
+ @type triggerFlag: int
+ @param triggerFlag: Trigger of breakpoint. Must be one of the following:
+
+ - L{BREAK_ON_EXECUTION}
+
+ Break on code execution.
+
+ - L{BREAK_ON_WRITE}
+
+ Break on memory read or write.
+
+ - L{BREAK_ON_ACCESS}
+
+ Break on memory write.
+
+ @type sizeFlag: int
+ @param sizeFlag: Size of breakpoint. Must be one of the following:
+
+ - L{WATCH_BYTE}
+
+ One (1) byte in size.
+
+ - L{WATCH_WORD}
+
+ Two (2) bytes in size.
+
+ - L{WATCH_DWORD}
+
+ Four (4) bytes in size.
+
+ - L{WATCH_QWORD}
+
+ Eight (8) bytes in size.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ """
+ if win32.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
+ msg = "Hardware breakpoints not supported for %s" % win32.arch
+ raise NotImplementedError(msg)
+ if sizeFlag == self.WATCH_BYTE:
+ size = 1
+ elif sizeFlag == self.WATCH_WORD:
+ size = 2
+ elif sizeFlag == self.WATCH_DWORD:
+ size = 4
+ elif sizeFlag == self.WATCH_QWORD:
+ size = 8
+ else:
+ msg = "Invalid size flag for hardware breakpoint (%s)"
+ msg = msg % repr(sizeFlag)
+ raise ValueError(msg)
+
+ if triggerFlag not in self.validTriggers:
+ msg = "Invalid trigger flag for hardware breakpoint (%s)"
+ msg = msg % repr(triggerFlag)
+ raise ValueError(msg)
+
+ Breakpoint.__init__(self, address, size, condition, action)
+ self.__trigger = triggerFlag
+ self.__watch = sizeFlag
+ self.__slot = None
+
+ def __clear_bp(self, aThread):
+ """
+ Clears this breakpoint from the debug registers.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+ if self.__slot is not None:
+ aThread.suspend()
+ try:
+ ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
+ DebugRegister.clear_bp(ctx, self.__slot)
+ aThread.set_context(ctx)
+ self.__slot = None
+ finally:
+ aThread.resume()
+
+ def __set_bp(self, aThread):
+ """
+ Sets this breakpoint in the debug registers.
+
+ @type aThread: L{Thread}
+ @param aThread: Thread object.
+ """
+ if self.__slot is None:
+ aThread.suspend()
+ try:
+ ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
+ self.__slot = DebugRegister.find_slot(ctx)
+ if self.__slot is None:
+ msg = "No available hardware breakpoint slots for thread ID %d"
+ msg = msg % aThread.get_tid()
+ raise RuntimeError(msg)
+ DebugRegister.set_bp(ctx, self.__slot, self.get_address(),
+ self.__trigger, self.__watch)
+ aThread.set_context(ctx)
+ finally:
+ aThread.resume()
+
+ def get_slot(self):
+ """
+ @rtype: int
+ @return: The debug register number used by this breakpoint,
+ or C{None} if the breakpoint is not active.
+ """
+ return self.__slot
+
+ def get_trigger(self):
+ """
+ @see: L{validTriggers}
+ @rtype: int
+ @return: The breakpoint trigger flag.
+ """
+ return self.__trigger
+
+ def get_watch(self):
+ """
+ @see: L{validWatchSizes}
+ @rtype: int
+ @return: The breakpoint watch flag.
+ """
+ return self.__watch
+
+ def disable(self, aProcess, aThread):
+ if not self.is_disabled():
+ self.__clear_bp(aThread)
+ super(HardwareBreakpoint, self).disable(aProcess, aThread)
+
+ def enable(self, aProcess, aThread):
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aThread)
+ super(HardwareBreakpoint, self).enable(aProcess, aThread)
+
+ def one_shot(self, aProcess, aThread):
+ if not self.is_enabled() and not self.is_one_shot():
+ self.__set_bp(aThread)
+ super(HardwareBreakpoint, self).one_shot(aProcess, aThread)
+
+ def running(self, aProcess, aThread):
+ self.__clear_bp(aThread)
+ super(HardwareBreakpoint, self).running(aProcess, aThread)
+ aThread.set_tf()
+
+#==============================================================================
+
+# XXX FIXME
+#
+# The implementation of function hooks is very simple. A breakpoint is set at
+# the entry point. Each time it's hit the "pre" callback is executed. If a
+# "post" callback was defined, a one-shot breakpoint is set at the return
+# address - and when that breakpoint hits, the "post" callback is executed.
+#
+# Functions hooks, as they are implemented now, don't work correctly for
+# recursive functions. The problem is we don't know when to remove the
+# breakpoint at the return address. Also there could be more than one return
+# address.
+#
+# One possible solution would involve a dictionary of lists, where the key
+# would be the thread ID and the value a stack of return addresses. But we
+# still don't know what to do if the "wrong" return address is hit for some
+# reason (maybe check the stack pointer?). Or if both a code and a hardware
+# breakpoint are hit simultaneously.
+#
+# For now, the workaround for the user is to set only the "pre" callback for
+# functions that are known to be recursive.
+#
+# If an exception is thrown by a hooked function and caught by one of it's
+# parent functions, the "post" callback won't be called and weird stuff may
+# happen. A possible solution is to put a breakpoint in the system call that
+# unwinds the stack, to detect this case and remove the "post" breakpoint.
+#
+# Hooks may also behave oddly if the return address is overwritten by a buffer
+# overflow bug (this is similar to the exception problem). But it's probably a
+# minor issue since when you're fuzzing a function for overflows you're usually
+# not interested in the return value anyway.
+
+# TODO: an API to modify the hooked function's arguments
+
+class Hook (object):
+ """
+ Factory class to produce hook objects. Used by L{Debug.hook_function} and
+ L{Debug.stalk_function}.
+
+ When you try to instance this class, one of the architecture specific
+ implementations is returned instead.
+
+ Instances act as an action callback for code breakpoints set at the
+ beginning of a function. It automatically retrieves the parameters from
+ the stack, sets a breakpoint at the return address and retrieves the
+ return value from the function call.
+
+ @see: L{_Hook_i386}, L{_Hook_amd64}
+
+ @type useHardwareBreakpoints: bool
+ @cvar useHardwareBreakpoints: C{True} to try to use hardware breakpoints,
+ C{False} otherwise.
+ """
+
+ # This is a factory class that returns
+ # the architecture specific implementation.
+ def __new__(cls, *argv, **argd):
+ try:
+ arch = argd['arch']
+ del argd['arch']
+ except KeyError:
+ try:
+ arch = argv[4]
+ argv = argv[:4] + argv[5:]
+ except IndexError:
+ raise TypeError("Missing 'arch' argument!")
+ if arch is None:
+ arch = win32.arch
+ if arch == win32.ARCH_I386:
+ return _Hook_i386(*argv, **argd)
+ if arch == win32.ARCH_AMD64:
+ return _Hook_amd64(*argv, **argd)
+ return object.__new__(cls, *argv, **argd)
+
+ # XXX FIXME
+ #
+ # Hardware breakpoints don't work correctly (or al all) in old VirtualBox
+ # versions (3.0 and below).
+ #
+ # Maybe there should be a way to autodetect the buggy VirtualBox versions
+ # and tell Hook objects not to use hardware breakpoints?
+ #
+ # For now the workaround is to manually set this variable to True when
+ # WinAppDbg is installed on a physical machine.
+ #
+ useHardwareBreakpoints = False
+
+ def __init__(self, preCB = None, postCB = None,
+ paramCount = None, signature = None,
+ arch = None):
+ """
+ @type preCB: function
+ @param preCB: (Optional) Callback triggered on function entry.
+
+ The signature for the callback should be something like this::
+
+ def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags):
+
+ # return address
+ ra = params[0]
+
+ # function arguments start from here...
+ szFilename = event.get_process().peek_string(lpFilename)
+
+ # (...)
+
+ Note that all pointer types are treated like void pointers, so your
+ callback won't get the string or structure pointed to by it, but
+ the remote memory address instead. This is so to prevent the ctypes
+ library from being "too helpful" and trying to dereference the
+ pointer. To get the actual data being pointed to, use one of the
+ L{Process.read} methods.
+
+ @type postCB: function
+ @param postCB: (Optional) Callback triggered on function exit.
+
+ The signature for the callback should be something like this::
+
+ def post_LoadLibraryEx(event, return_value):
+
+ # (...)
+
+ @type paramCount: int
+ @param paramCount:
+ (Optional) Number of parameters for the C{preCB} callback,
+ not counting the return address. Parameters are read from
+ the stack and assumed to be DWORDs in 32 bits and QWORDs in 64.
+
+ This is a faster way to pull stack parameters in 32 bits, but in 64
+ bits (or with some odd APIs in 32 bits) it won't be useful, since
+ not all arguments to the hooked function will be of the same size.
+
+ For a more reliable and cross-platform way of hooking use the
+ C{signature} argument instead.
+
+ @type signature: tuple
+ @param signature:
+ (Optional) Tuple of C{ctypes} data types that constitute the
+ hooked function signature. When the function is called, this will
+ be used to parse the arguments from the stack. Overrides the
+ C{paramCount} argument.
+
+ @type arch: str
+ @param arch: (Optional) Target architecture. Defaults to the current
+ architecture. See: L{win32.arch}
+ """
+ self.__preCB = preCB
+ self.__postCB = postCB
+ self.__paramStack = dict() # tid -> list of tuple( arg, arg, arg... )
+
+ self._paramCount = paramCount
+
+ if win32.arch != win32.ARCH_I386:
+ self.useHardwareBreakpoints = False
+
+ if win32.bits == 64 and paramCount and not signature:
+ signature = (win32.QWORD,) * paramCount
+
+ if signature:
+ self._signature = self._calc_signature(signature)
+ else:
+ self._signature = None
+
+ def _cast_signature_pointers_to_void(self, signature):
+ c_void_p = ctypes.c_void_p
+ c_char_p = ctypes.c_char_p
+ c_wchar_p = ctypes.c_wchar_p
+ _Pointer = ctypes._Pointer
+ cast = ctypes.cast
+ for i in compat.xrange(len(signature)):
+ t = signature[i]
+ if t is not c_void_p and (issubclass(t, _Pointer) \
+ or t in [c_char_p, c_wchar_p]):
+ signature[i] = cast(t, c_void_p)
+
+ def _calc_signature(self, signature):
+ raise NotImplementedError(
+ "Hook signatures are not supported for architecture: %s" \
+ % win32.arch)
+
+ def _get_return_address(self, aProcess, aThread):
+ return None
+
+ def _get_function_arguments(self, aProcess, aThread):
+ if self._signature or self._paramCount:
+ raise NotImplementedError(
+ "Hook signatures are not supported for architecture: %s" \
+ % win32.arch)
+ return ()
+
+ def _get_return_value(self, aThread):
+ return None
+
+ # By using break_at() to set a process-wide breakpoint on the function's
+ # return address, we might hit a race condition when more than one thread
+ # is being debugged.
+ #
+ # Hardware breakpoints should be used instead. But since a thread can run
+ # out of those, we need to fall back to this method when needed.
+
+ def __call__(self, event):
+ """
+ Handles the breakpoint event on entry of the function.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint hit event.
+
+ @raise WindowsError: An error occured.
+ """
+ debug = event.debug
+
+ dwProcessId = event.get_pid()
+ dwThreadId = event.get_tid()
+ aProcess = event.get_process()
+ aThread = event.get_thread()
+
+ # Get the return address and function arguments.
+ ra = self._get_return_address(aProcess, aThread)
+ params = self._get_function_arguments(aProcess, aThread)
+
+ # Keep the function arguments for later use.
+ self.__push_params(dwThreadId, params)
+
+ # If we need to hook the return from the function...
+ bHookedReturn = False
+ if ra is not None and self.__postCB is not None:
+
+ # Try to set a one shot hardware breakpoint at the return address.
+ useHardwareBreakpoints = self.useHardwareBreakpoints
+ if useHardwareBreakpoints:
+ try:
+ debug.define_hardware_breakpoint(
+ dwThreadId,
+ ra,
+ event.debug.BP_BREAK_ON_EXECUTION,
+ event.debug.BP_WATCH_BYTE,
+ True,
+ self.__postCallAction_hwbp
+ )
+ debug.enable_one_shot_hardware_breakpoint(dwThreadId, ra)
+ bHookedReturn = True
+ except Exception:
+ e = sys.exc_info()[1]
+ useHardwareBreakpoints = False
+ msg = ("Failed to set hardware breakpoint"
+ " at address %s for thread ID %d")
+ msg = msg % (HexDump.address(ra), dwThreadId)
+ warnings.warn(msg, BreakpointWarning)
+
+ # If not possible, set a code breakpoint instead.
+ if not useHardwareBreakpoints:
+ try:
+ debug.break_at(dwProcessId, ra,
+ self.__postCallAction_codebp)
+ bHookedReturn = True
+ except Exception:
+ e = sys.exc_info()[1]
+ msg = ("Failed to set code breakpoint"
+ " at address %s for process ID %d")
+ msg = msg % (HexDump.address(ra), dwProcessId)
+ warnings.warn(msg, BreakpointWarning)
+
+ # Call the "pre" callback.
+ try:
+ self.__callHandler(self.__preCB, event, ra, *params)
+
+ # If no "post" callback is defined, forget the function arguments.
+ finally:
+ if not bHookedReturn:
+ self.__pop_params(dwThreadId)
+
+ def __postCallAction_hwbp(self, event):
+ """
+ Handles hardware breakpoint events on return from the function.
+
+ @type event: L{ExceptionEvent}
+ @param event: Single step event.
+ """
+
+ # Remove the one shot hardware breakpoint
+ # at the return address location in the stack.
+ tid = event.get_tid()
+ address = event.breakpoint.get_address()
+ event.debug.erase_hardware_breakpoint(tid, address)
+
+ # Call the "post" callback.
+ try:
+ self.__postCallAction(event)
+
+ # Forget the parameters.
+ finally:
+ self.__pop_params(tid)
+
+ def __postCallAction_codebp(self, event):
+ """
+ Handles code breakpoint events on return from the function.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint hit event.
+ """
+
+ # If the breakpoint was accidentally hit by another thread,
+ # pass it to the debugger instead of calling the "post" callback.
+ #
+ # XXX FIXME:
+ # I suppose this check will fail under some weird conditions...
+ #
+ tid = event.get_tid()
+ if tid not in self.__paramStack:
+ return True
+
+ # Remove the code breakpoint at the return address.
+ pid = event.get_pid()
+ address = event.breakpoint.get_address()
+ event.debug.dont_break_at(pid, address)
+
+ # Call the "post" callback.
+ try:
+ self.__postCallAction(event)
+
+ # Forget the parameters.
+ finally:
+ self.__pop_params(tid)
+
+ def __postCallAction(self, event):
+ """
+ Calls the "post" callback.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint hit event.
+ """
+ aThread = event.get_thread()
+ retval = self._get_return_value(aThread)
+ self.__callHandler(self.__postCB, event, retval)
+
+ def __callHandler(self, callback, event, *params):
+ """
+ Calls a "pre" or "post" handler, if set.
+
+ @type callback: function
+ @param callback: Callback function to call.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint hit event.
+
+ @type params: tuple
+ @param params: Parameters for the callback function.
+ """
+ if callback is not None:
+ event.hook = self
+ callback(event, *params)
+
+ def __push_params(self, tid, params):
+ """
+ Remembers the arguments tuple for the last call to the hooked function
+ from this thread.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type params: tuple( arg, arg, arg... )
+ @param params: Tuple of arguments.
+ """
+ stack = self.__paramStack.get( tid, [] )
+ stack.append(params)
+ self.__paramStack[tid] = stack
+
+ def __pop_params(self, tid):
+ """
+ Forgets the arguments tuple for the last call to the hooked function
+ from this thread.
+
+ @type tid: int
+ @param tid: Thread global ID.
+ """
+ stack = self.__paramStack[tid]
+ stack.pop()
+ if not stack:
+ del self.__paramStack[tid]
+
+ def get_params(self, tid):
+ """
+ Returns the parameters found in the stack when the hooked function
+ was last called by this thread.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @rtype: tuple( arg, arg, arg... )
+ @return: Tuple of arguments.
+ """
+ try:
+ params = self.get_params_stack(tid)[-1]
+ except IndexError:
+ msg = "Hooked function called from thread %d already returned"
+ raise IndexError(msg % tid)
+ return params
+
+ def get_params_stack(self, tid):
+ """
+ Returns the parameters found in the stack each time the hooked function
+ was called by this thread and hasn't returned yet.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @rtype: list of tuple( arg, arg, arg... )
+ @return: List of argument tuples.
+ """
+ try:
+ stack = self.__paramStack[tid]
+ except KeyError:
+ msg = "Hooked function was not called from thread %d"
+ raise KeyError(msg % tid)
+ return stack
+
+ def hook(self, debug, pid, address):
+ """
+ Installs the function hook at a given process and address.
+
+ @see: L{unhook}
+
+ @warning: Do not call from an function hook callback.
+
+ @type debug: L{Debug}
+ @param debug: Debug object.
+
+ @type pid: int
+ @param pid: Process ID.
+
+ @type address: int
+ @param address: Function address.
+ """
+ return debug.break_at(pid, address, self)
+
+ def unhook(self, debug, pid, address):
+ """
+ Removes the function hook at a given process and address.
+
+ @see: L{hook}
+
+ @warning: Do not call from an function hook callback.
+
+ @type debug: L{Debug}
+ @param debug: Debug object.
+
+ @type pid: int
+ @param pid: Process ID.
+
+ @type address: int
+ @param address: Function address.
+ """
+ return debug.dont_break_at(pid, address)
+
+class _Hook_i386 (Hook):
+ """
+ Implementation details for L{Hook} on the L{win32.ARCH_I386} architecture.
+ """
+
+ # We don't want to inherit the parent class __new__ method.
+ __new__ = object.__new__
+
+ def _calc_signature(self, signature):
+ self._cast_signature_pointers_to_void(signature)
+ class Arguments (ctypes.Structure):
+ _fields_ = [ ("arg_%s" % i, signature[i]) \
+ for i in compat.xrange(len(signature) - 1, -1, -1) ]
+ return Arguments
+
+ def _get_return_address(self, aProcess, aThread):
+ return aProcess.read_pointer( aThread.get_sp() )
+
+ def _get_function_arguments(self, aProcess, aThread):
+ if self._signature:
+ params = aThread.read_stack_structure(self._signature,
+ offset = win32.sizeof(win32.LPVOID))
+ elif self._paramCount:
+ params = aThread.read_stack_dwords(self._paramCount,
+ offset = win32.sizeof(win32.LPVOID))
+ else:
+ params = ()
+ return params
+
+ def _get_return_value(self, aThread):
+ ctx = aThread.get_context(win32.CONTEXT_INTEGER)
+ return ctx['Eax']
+
+class _Hook_amd64 (Hook):
+ """
+ Implementation details for L{Hook} on the L{win32.ARCH_AMD64} architecture.
+ """
+
+ # We don't want to inherit the parent class __new__ method.
+ __new__ = object.__new__
+
+ # Make a list of floating point types.
+ __float_types = (
+ ctypes.c_double,
+ ctypes.c_float,
+ )
+ # Long doubles are not supported in old versions of ctypes!
+ try:
+ __float_types += (ctypes.c_longdouble,)
+ except AttributeError:
+ pass
+
+ def _calc_signature(self, signature):
+ self._cast_signature_pointers_to_void(signature)
+
+ float_types = self.__float_types
+ c_sizeof = ctypes.sizeof
+ reg_size = c_sizeof(ctypes.c_size_t)
+
+ reg_int_sig = []
+ reg_float_sig = []
+ stack_sig = []
+
+ for i in compat.xrange(len(signature)):
+ arg = signature[i]
+ name = "arg_%d" % i
+ stack_sig.insert( 0, (name, arg) )
+ if i < 4:
+ if type(arg) in float_types:
+ reg_float_sig.append( (name, arg) )
+ elif c_sizeof(arg) <= reg_size:
+ reg_int_sig.append( (name, arg) )
+ else:
+ msg = ("Hook signatures don't support structures"
+ " within the first 4 arguments of a function"
+ " for the %s architecture") % win32.arch
+ raise NotImplementedError(msg)
+
+ if reg_int_sig:
+ class RegisterArguments (ctypes.Structure):
+ _fields_ = reg_int_sig
+ else:
+ RegisterArguments = None
+ if reg_float_sig:
+ class FloatArguments (ctypes.Structure):
+ _fields_ = reg_float_sig
+ else:
+ FloatArguments = None
+ if stack_sig:
+ class StackArguments (ctypes.Structure):
+ _fields_ = stack_sig
+ else:
+ StackArguments = None
+
+ return (len(signature),
+ RegisterArguments,
+ FloatArguments,
+ StackArguments)
+
+ def _get_return_address(self, aProcess, aThread):
+ return aProcess.read_pointer( aThread.get_sp() )
+
+ def _get_function_arguments(self, aProcess, aThread):
+ if self._signature:
+ (args_count,
+ RegisterArguments,
+ FloatArguments,
+ StackArguments) = self._signature
+ arguments = {}
+ if StackArguments:
+ address = aThread.get_sp() + win32.sizeof(win32.LPVOID)
+ stack_struct = aProcess.read_structure(address,
+ StackArguments)
+ stack_args = dict(
+ [ (name, stack_struct.__getattribute__(name))
+ for (name, type) in stack_struct._fields_ ]
+ )
+ arguments.update(stack_args)
+ flags = 0
+ if RegisterArguments:
+ flags = flags | win32.CONTEXT_INTEGER
+ if FloatArguments:
+ flags = flags | win32.CONTEXT_MMX_REGISTERS
+ if flags:
+ ctx = aThread.get_context(flags)
+ if RegisterArguments:
+ buffer = (win32.QWORD * 4)(ctx['Rcx'], ctx['Rdx'],
+ ctx['R8'], ctx['R9'])
+ reg_args = self._get_arguments_from_buffer(buffer,
+ RegisterArguments)
+ arguments.update(reg_args)
+ if FloatArguments:
+ buffer = (win32.M128A * 4)(ctx['XMM0'], ctx['XMM1'],
+ ctx['XMM2'], ctx['XMM3'])
+ float_args = self._get_arguments_from_buffer(buffer,
+ FloatArguments)
+ arguments.update(float_args)
+ params = tuple( [ arguments["arg_%d" % i]
+ for i in compat.xrange(args_count) ] )
+ else:
+ params = ()
+ return params
+
+ def _get_arguments_from_buffer(self, buffer, structure):
+ b_ptr = ctypes.pointer(buffer)
+ v_ptr = ctypes.cast(b_ptr, ctypes.c_void_p)
+ s_ptr = ctypes.cast(v_ptr, ctypes.POINTER(structure))
+ struct = s_ptr.contents
+ return dict(
+ [ (name, struct.__getattribute__(name))
+ for (name, type) in struct._fields_ ]
+ )
+
+ def _get_return_value(self, aThread):
+ ctx = aThread.get_context(win32.CONTEXT_INTEGER)
+ return ctx['Rax']
+
+#------------------------------------------------------------------------------
+
+# This class acts as a factory of Hook objects, one per target process.
+# Said objects are deleted by the unhook() method.
+
+class ApiHook (object):
+ """
+ Used by L{EventHandler}.
+
+ This class acts as an action callback for code breakpoints set at the
+ beginning of a function. It automatically retrieves the parameters from
+ the stack, sets a breakpoint at the return address and retrieves the
+ return value from the function call.
+
+ @see: L{EventHandler.apiHooks}
+
+ @type modName: str
+ @ivar modName: Module name.
+
+ @type procName: str
+ @ivar procName: Procedure name.
+ """
+
+ def __init__(self, eventHandler, modName, procName, paramCount = None,
+ signature = None):
+ """
+ @type eventHandler: L{EventHandler}
+ @param eventHandler: Event handler instance. This is where the hook
+ callbacks are to be defined (see below).
+
+ @type modName: str
+ @param modName: Module name.
+
+ @type procName: str
+ @param procName: Procedure name.
+ The pre and post callbacks will be deduced from it.
+
+ For example, if the procedure is "LoadLibraryEx" the callback
+ routines will be "pre_LoadLibraryEx" and "post_LoadLibraryEx".
+
+ The signature for the callbacks should be something like this::
+
+ def pre_LoadLibraryEx(self, event, ra, lpFilename, hFile, dwFlags):
+
+ # return address
+ ra = params[0]
+
+ # function arguments start from here...
+ szFilename = event.get_process().peek_string(lpFilename)
+
+ # (...)
+
+ def post_LoadLibraryEx(self, event, return_value):
+
+ # (...)
+
+ Note that all pointer types are treated like void pointers, so your
+ callback won't get the string or structure pointed to by it, but
+ the remote memory address instead. This is so to prevent the ctypes
+ library from being "too helpful" and trying to dereference the
+ pointer. To get the actual data being pointed to, use one of the
+ L{Process.read} methods.
+
+ @type paramCount: int
+ @param paramCount:
+ (Optional) Number of parameters for the C{preCB} callback,
+ not counting the return address. Parameters are read from
+ the stack and assumed to be DWORDs in 32 bits and QWORDs in 64.
+
+ This is a faster way to pull stack parameters in 32 bits, but in 64
+ bits (or with some odd APIs in 32 bits) it won't be useful, since
+ not all arguments to the hooked function will be of the same size.
+
+ For a more reliable and cross-platform way of hooking use the
+ C{signature} argument instead.
+
+ @type signature: tuple
+ @param signature:
+ (Optional) Tuple of C{ctypes} data types that constitute the
+ hooked function signature. When the function is called, this will
+ be used to parse the arguments from the stack. Overrides the
+ C{paramCount} argument.
+ """
+ self.__modName = modName
+ self.__procName = procName
+ self.__paramCount = paramCount
+ self.__signature = signature
+ self.__preCB = getattr(eventHandler, 'pre_%s' % procName, None)
+ self.__postCB = getattr(eventHandler, 'post_%s' % procName, None)
+ self.__hook = dict()
+
+ def __call__(self, event):
+ """
+ Handles the breakpoint event on entry of the function.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint hit event.
+
+ @raise WindowsError: An error occured.
+ """
+ pid = event.get_pid()
+ try:
+ hook = self.__hook[pid]
+ except KeyError:
+ hook = Hook(self.__preCB, self.__postCB,
+ self.__paramCount, self.__signature,
+ event.get_process().get_arch() )
+ self.__hook[pid] = hook
+ return hook(event)
+
+ @property
+ def modName(self):
+ return self.__modName
+
+ @property
+ def procName(self):
+ return self.__procName
+
+ def hook(self, debug, pid):
+ """
+ Installs the API hook on a given process and module.
+
+ @warning: Do not call from an API hook callback.
+
+ @type debug: L{Debug}
+ @param debug: Debug object.
+
+ @type pid: int
+ @param pid: Process ID.
+ """
+ label = "%s!%s" % (self.__modName, self.__procName)
+ try:
+ hook = self.__hook[pid]
+ except KeyError:
+ try:
+ aProcess = debug.system.get_process(pid)
+ except KeyError:
+ aProcess = Process(pid)
+ hook = Hook(self.__preCB, self.__postCB,
+ self.__paramCount, self.__signature,
+ aProcess.get_arch() )
+ self.__hook[pid] = hook
+ hook.hook(debug, pid, label)
+
+ def unhook(self, debug, pid):
+ """
+ Removes the API hook from the given process and module.
+
+ @warning: Do not call from an API hook callback.
+
+ @type debug: L{Debug}
+ @param debug: Debug object.
+
+ @type pid: int
+ @param pid: Process ID.
+ """
+ try:
+ hook = self.__hook[pid]
+ except KeyError:
+ return
+ label = "%s!%s" % (self.__modName, self.__procName)
+ hook.unhook(debug, pid, label)
+ del self.__hook[pid]
+
+#==============================================================================
+
+class BufferWatch (object):
+ """
+ Returned by L{Debug.watch_buffer}.
+
+ This object uniquely references a buffer being watched, even if there are
+ multiple watches set on the exact memory region.
+
+ @type pid: int
+ @ivar pid: Process ID.
+
+ @type start: int
+ @ivar start: Memory address of the start of the buffer.
+
+ @type end: int
+ @ivar end: Memory address of the end of the buffer.
+
+ @type action: callable
+ @ivar action: Action callback.
+
+ @type oneshot: bool
+ @ivar oneshot: C{True} for one shot breakpoints, C{False} otherwise.
+ """
+
+ def __init__(self, pid, start, end, action = None, oneshot = False):
+ self.__pid = pid
+ self.__start = start
+ self.__end = end
+ self.__action = action
+ self.__oneshot = oneshot
+
+ @property
+ def pid(self):
+ return self.__pid
+
+ @property
+ def start(self):
+ return self.__start
+
+ @property
+ def end(self):
+ return self.__end
+
+ @property
+ def action(self):
+ return self.__action
+
+ @property
+ def oneshot(self):
+ return self.__oneshot
+
+ def match(self, address):
+ """
+ Determine if the given memory address lies within the watched buffer.
+
+ @rtype: bool
+ @return: C{True} if the given memory address lies within the watched
+ buffer, C{False} otherwise.
+ """
+ return self.__start <= address < self.__end
+
+#==============================================================================
+
+class _BufferWatchCondition (object):
+ """
+ Used by L{Debug.watch_buffer}.
+
+ This class acts as a condition callback for page breakpoints.
+ It emulates page breakpoints that can overlap and/or take up less
+ than a page's size.
+ """
+
+ def __init__(self):
+ self.__ranges = list() # list of BufferWatch in definition order
+
+ def add(self, bw):
+ """
+ Adds a buffer watch identifier.
+
+ @type bw: L{BufferWatch}
+ @param bw:
+ Buffer watch identifier.
+ """
+ self.__ranges.append(bw)
+
+ def remove(self, bw):
+ """
+ Removes a buffer watch identifier.
+
+ @type bw: L{BufferWatch}
+ @param bw:
+ Buffer watch identifier.
+
+ @raise KeyError: The buffer watch identifier was already removed.
+ """
+ try:
+ self.__ranges.remove(bw)
+ except KeyError:
+ if not bw.oneshot:
+ raise
+
+ def remove_last_match(self, address, size):
+ """
+ Removes the last buffer from the watch object
+ to match the given address and size.
+
+ @type address: int
+ @param address: Memory address of buffer to stop watching.
+
+ @type size: int
+ @param size: Size in bytes of buffer to stop watching.
+
+ @rtype: int
+ @return: Number of matching elements found. Only the last one to be
+ added is actually deleted upon calling this method.
+
+ This counter allows you to know if there are more matching elements
+ and how many.
+ """
+ count = 0
+ start = address
+ end = address + size - 1
+ matched = None
+ for item in self.__ranges:
+ if item.match(start) and item.match(end):
+ matched = item
+ count += 1
+ self.__ranges.remove(matched)
+ return count
+
+ def count(self):
+ """
+ @rtype: int
+ @return: Number of buffers being watched.
+ """
+ return len(self.__ranges)
+
+ def __call__(self, event):
+ """
+ Breakpoint condition callback.
+
+ This method will also call the action callbacks for each
+ buffer being watched.
+
+ @type event: L{ExceptionEvent}
+ @param event: Guard page exception event.
+
+ @rtype: bool
+ @return: C{True} if the address being accessed belongs
+ to at least one of the buffers that was being watched
+ and had no action callback.
+ """
+ address = event.get_exception_information(1)
+ bCondition = False
+ for bw in self.__ranges:
+ bMatched = bw.match(address)
+ try:
+ action = bw.action
+ if bMatched and action is not None:
+ try:
+ action(event)
+ except Exception:
+ e = sys.exc_info()[1]
+ msg = ("Breakpoint action callback %r"
+ " raised an exception: %s")
+ msg = msg % (action, traceback.format_exc(e))
+ warnings.warn(msg, BreakpointCallbackWarning)
+ else:
+ bCondition = bCondition or bMatched
+ finally:
+ if bMatched and bw.oneshot:
+ event.debug.dont_watch_buffer(bw)
+ return bCondition
+
+#==============================================================================
+
+class _BreakpointContainer (object):
+ """
+ Encapsulates the capability to contain Breakpoint objects.
+
+ @group Breakpoints:
+ break_at, watch_variable, watch_buffer, hook_function,
+ dont_break_at, dont_watch_variable, dont_watch_buffer,
+ dont_hook_function, unhook_function,
+ break_on_error, dont_break_on_error
+
+ @group Stalking:
+ stalk_at, stalk_variable, stalk_buffer, stalk_function,
+ dont_stalk_at, dont_stalk_variable, dont_stalk_buffer,
+ dont_stalk_function
+
+ @group Tracing:
+ is_tracing, get_traced_tids,
+ start_tracing, stop_tracing,
+ start_tracing_process, stop_tracing_process,
+ start_tracing_all, stop_tracing_all
+
+ @group Symbols:
+ resolve_label, resolve_exported_function
+
+ @group Advanced breakpoint use:
+ define_code_breakpoint,
+ define_page_breakpoint,
+ define_hardware_breakpoint,
+ has_code_breakpoint,
+ has_page_breakpoint,
+ has_hardware_breakpoint,
+ get_code_breakpoint,
+ get_page_breakpoint,
+ get_hardware_breakpoint,
+ erase_code_breakpoint,
+ erase_page_breakpoint,
+ erase_hardware_breakpoint,
+ enable_code_breakpoint,
+ enable_page_breakpoint,
+ enable_hardware_breakpoint,
+ enable_one_shot_code_breakpoint,
+ enable_one_shot_page_breakpoint,
+ enable_one_shot_hardware_breakpoint,
+ disable_code_breakpoint,
+ disable_page_breakpoint,
+ disable_hardware_breakpoint
+
+ @group Listing breakpoints:
+ get_all_breakpoints,
+ get_all_code_breakpoints,
+ get_all_page_breakpoints,
+ get_all_hardware_breakpoints,
+ get_process_breakpoints,
+ get_process_code_breakpoints,
+ get_process_page_breakpoints,
+ get_process_hardware_breakpoints,
+ get_thread_hardware_breakpoints,
+ get_all_deferred_code_breakpoints,
+ get_process_deferred_code_breakpoints
+
+ @group Batch operations on breakpoints:
+ enable_all_breakpoints,
+ enable_one_shot_all_breakpoints,
+ disable_all_breakpoints,
+ erase_all_breakpoints,
+ enable_process_breakpoints,
+ enable_one_shot_process_breakpoints,
+ disable_process_breakpoints,
+ erase_process_breakpoints
+
+ @group Breakpoint types:
+ BP_TYPE_ANY, BP_TYPE_CODE, BP_TYPE_PAGE, BP_TYPE_HARDWARE
+ @group Breakpoint states:
+ BP_STATE_DISABLED, BP_STATE_ENABLED, BP_STATE_ONESHOT, BP_STATE_RUNNING
+ @group Memory breakpoint trigger flags:
+ BP_BREAK_ON_EXECUTION, BP_BREAK_ON_WRITE, BP_BREAK_ON_ACCESS
+ @group Memory breakpoint size flags:
+ BP_WATCH_BYTE, BP_WATCH_WORD, BP_WATCH_DWORD, BP_WATCH_QWORD
+
+ @type BP_TYPE_ANY: int
+ @cvar BP_TYPE_ANY: To get all breakpoints
+ @type BP_TYPE_CODE: int
+ @cvar BP_TYPE_CODE: To get code breakpoints only
+ @type BP_TYPE_PAGE: int
+ @cvar BP_TYPE_PAGE: To get page breakpoints only
+ @type BP_TYPE_HARDWARE: int
+ @cvar BP_TYPE_HARDWARE: To get hardware breakpoints only
+
+ @type BP_STATE_DISABLED: int
+ @cvar BP_STATE_DISABLED: Breakpoint is disabled.
+ @type BP_STATE_ENABLED: int
+ @cvar BP_STATE_ENABLED: Breakpoint is enabled.
+ @type BP_STATE_ONESHOT: int
+ @cvar BP_STATE_ONESHOT: Breakpoint is enabled for one shot.
+ @type BP_STATE_RUNNING: int
+ @cvar BP_STATE_RUNNING: Breakpoint is running (recently hit).
+
+ @type BP_BREAK_ON_EXECUTION: int
+ @cvar BP_BREAK_ON_EXECUTION: Break on code execution.
+ @type BP_BREAK_ON_WRITE: int
+ @cvar BP_BREAK_ON_WRITE: Break on memory write.
+ @type BP_BREAK_ON_ACCESS: int
+ @cvar BP_BREAK_ON_ACCESS: Break on memory read or write.
+ """
+
+ # Breakpoint types
+ BP_TYPE_ANY = 0 # to get all breakpoints
+ BP_TYPE_CODE = 1
+ BP_TYPE_PAGE = 2
+ BP_TYPE_HARDWARE = 3
+
+ # Breakpoint states
+ BP_STATE_DISABLED = Breakpoint.DISABLED
+ BP_STATE_ENABLED = Breakpoint.ENABLED
+ BP_STATE_ONESHOT = Breakpoint.ONESHOT
+ BP_STATE_RUNNING = Breakpoint.RUNNING
+
+ # Memory breakpoint trigger flags
+ BP_BREAK_ON_EXECUTION = HardwareBreakpoint.BREAK_ON_EXECUTION
+ BP_BREAK_ON_WRITE = HardwareBreakpoint.BREAK_ON_WRITE
+ BP_BREAK_ON_ACCESS = HardwareBreakpoint.BREAK_ON_ACCESS
+
+ # Memory breakpoint size flags
+ BP_WATCH_BYTE = HardwareBreakpoint.WATCH_BYTE
+ BP_WATCH_WORD = HardwareBreakpoint.WATCH_WORD
+ BP_WATCH_QWORD = HardwareBreakpoint.WATCH_QWORD
+ BP_WATCH_DWORD = HardwareBreakpoint.WATCH_DWORD
+
+ def __init__(self):
+ self.__codeBP = dict() # (pid, address) -> CodeBreakpoint
+ self.__pageBP = dict() # (pid, address) -> PageBreakpoint
+ self.__hardwareBP = dict() # tid -> [ HardwareBreakpoint ]
+ self.__runningBP = dict() # tid -> set( Breakpoint )
+ self.__tracing = set() # set( tid )
+ self.__deferredBP = dict() # pid -> label -> (action, oneshot)
+
+#------------------------------------------------------------------------------
+
+ # This operates on the dictionary of running breakpoints.
+ # Since the bps are meant to stay alive no cleanup is done here.
+
+ def __get_running_bp_set(self, tid):
+ "Auxiliary method."
+ return self.__runningBP.get(tid, ())
+
+ def __add_running_bp(self, tid, bp):
+ "Auxiliary method."
+ if tid not in self.__runningBP:
+ self.__runningBP[tid] = set()
+ self.__runningBP[tid].add(bp)
+
+ def __del_running_bp(self, tid, bp):
+ "Auxiliary method."
+ self.__runningBP[tid].remove(bp)
+ if not self.__runningBP[tid]:
+ del self.__runningBP[tid]
+
+ def __del_running_bp_from_all_threads(self, bp):
+ "Auxiliary method."
+ for (tid, bpset) in compat.iteritems(self.__runningBP):
+ if bp in bpset:
+ bpset.remove(bp)
+ self.system.get_thread(tid).clear_tf()
+
+#------------------------------------------------------------------------------
+
+ # This is the cleanup code. Mostly called on response to exit/unload debug
+ # events. If possible it shouldn't raise exceptions on runtime errors.
+ # The main goal here is to avoid memory or handle leaks.
+
+ def __cleanup_breakpoint(self, event, bp):
+ "Auxiliary method."
+ try:
+ process = event.get_process()
+ thread = event.get_thread()
+ bp.disable(process, thread) # clear the debug regs / trap flag
+ except Exception:
+ pass
+ bp.set_condition(True) # break possible circular reference
+ bp.set_action(None) # break possible circular reference
+
+ def __cleanup_thread(self, event):
+ """
+ Auxiliary method for L{_notify_exit_thread}
+ and L{_notify_exit_process}.
+ """
+ tid = event.get_tid()
+
+ # Cleanup running breakpoints
+ try:
+ for bp in self.__runningBP[tid]:
+ self.__cleanup_breakpoint(event, bp)
+ del self.__runningBP[tid]
+ except KeyError:
+ pass
+
+ # Cleanup hardware breakpoints
+ try:
+ for bp in self.__hardwareBP[tid]:
+ self.__cleanup_breakpoint(event, bp)
+ del self.__hardwareBP[tid]
+ except KeyError:
+ pass
+
+ # Cleanup set of threads being traced
+ if tid in self.__tracing:
+ self.__tracing.remove(tid)
+
+ def __cleanup_process(self, event):
+ """
+ Auxiliary method for L{_notify_exit_process}.
+ """
+ pid = event.get_pid()
+ process = event.get_process()
+
+ # Cleanup code breakpoints
+ for (bp_pid, bp_address) in compat.keys(self.__codeBP):
+ if bp_pid == pid:
+ bp = self.__codeBP[ (bp_pid, bp_address) ]
+ self.__cleanup_breakpoint(event, bp)
+ del self.__codeBP[ (bp_pid, bp_address) ]
+
+ # Cleanup page breakpoints
+ for (bp_pid, bp_address) in compat.keys(self.__pageBP):
+ if bp_pid == pid:
+ bp = self.__pageBP[ (bp_pid, bp_address) ]
+ self.__cleanup_breakpoint(event, bp)
+ del self.__pageBP[ (bp_pid, bp_address) ]
+
+ # Cleanup deferred code breakpoints
+ try:
+ del self.__deferredBP[pid]
+ except KeyError:
+ pass
+
+ def __cleanup_module(self, event):
+ """
+ Auxiliary method for L{_notify_unload_dll}.
+ """
+ pid = event.get_pid()
+ process = event.get_process()
+ module = event.get_module()
+
+ # Cleanup thread breakpoints on this module
+ for tid in process.iter_thread_ids():
+ thread = process.get_thread(tid)
+
+ # Running breakpoints
+ if tid in self.__runningBP:
+ bplist = list(self.__runningBP[tid])
+ for bp in bplist:
+ bp_address = bp.get_address()
+ if process.get_module_at_address(bp_address) == module:
+ self.__cleanup_breakpoint(event, bp)
+ self.__runningBP[tid].remove(bp)
+
+ # Hardware breakpoints
+ if tid in self.__hardwareBP:
+ bplist = list(self.__hardwareBP[tid])
+ for bp in bplist:
+ bp_address = bp.get_address()
+ if process.get_module_at_address(bp_address) == module:
+ self.__cleanup_breakpoint(event, bp)
+ self.__hardwareBP[tid].remove(bp)
+
+ # Cleanup code breakpoints on this module
+ for (bp_pid, bp_address) in compat.keys(self.__codeBP):
+ if bp_pid == pid:
+ if process.get_module_at_address(bp_address) == module:
+ bp = self.__codeBP[ (bp_pid, bp_address) ]
+ self.__cleanup_breakpoint(event, bp)
+ del self.__codeBP[ (bp_pid, bp_address) ]
+
+ # Cleanup page breakpoints on this module
+ for (bp_pid, bp_address) in compat.keys(self.__pageBP):
+ if bp_pid == pid:
+ if process.get_module_at_address(bp_address) == module:
+ bp = self.__pageBP[ (bp_pid, bp_address) ]
+ self.__cleanup_breakpoint(event, bp)
+ del self.__pageBP[ (bp_pid, bp_address) ]
+
+#------------------------------------------------------------------------------
+
+ # Defining breakpoints.
+
+ # Code breakpoints.
+ def define_code_breakpoint(self, dwProcessId, address, condition = True,
+ action = None):
+ """
+ Creates a disabled code breakpoint at the given address.
+
+ @see:
+ L{has_code_breakpoint},
+ L{get_code_breakpoint},
+ L{enable_code_breakpoint},
+ L{enable_one_shot_code_breakpoint},
+ L{disable_code_breakpoint},
+ L{erase_code_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of the code instruction to break at.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ The callback signature is::
+
+ def condition_callback(event):
+ return True # returns True or False
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ If specified, the event is handled by this callback instead of
+ being dispatched normally.
+
+ The callback signature is::
+
+ def action_callback(event):
+ pass # no return value
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @rtype: L{CodeBreakpoint}
+ @return: The code breakpoint object.
+ """
+ process = self.system.get_process(dwProcessId)
+ bp = CodeBreakpoint(address, condition, action)
+
+ key = (dwProcessId, bp.get_address())
+ if key in self.__codeBP:
+ msg = "Already exists (PID %d) : %r"
+ raise KeyError(msg % (dwProcessId, self.__codeBP[key]))
+ self.__codeBP[key] = bp
+ return bp
+
+ # Page breakpoints.
+ def define_page_breakpoint(self, dwProcessId, address, pages = 1,
+ condition = True,
+ action = None):
+ """
+ Creates a disabled page breakpoint at the given address.
+
+ @see:
+ L{has_page_breakpoint},
+ L{get_page_breakpoint},
+ L{enable_page_breakpoint},
+ L{enable_one_shot_page_breakpoint},
+ L{disable_page_breakpoint},
+ L{erase_page_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of the first page to watch.
+
+ @type pages: int
+ @param pages: Number of pages to watch.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ The callback signature is::
+
+ def condition_callback(event):
+ return True # returns True or False
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ If specified, the event is handled by this callback instead of
+ being dispatched normally.
+
+ The callback signature is::
+
+ def action_callback(event):
+ pass # no return value
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @rtype: L{PageBreakpoint}
+ @return: The page breakpoint object.
+ """
+ process = self.system.get_process(dwProcessId)
+ bp = PageBreakpoint(address, pages, condition, action)
+ begin = bp.get_address()
+ end = begin + bp.get_size()
+
+ address = begin
+ pageSize = MemoryAddresses.pageSize
+ while address < end:
+ key = (dwProcessId, address)
+ if key in self.__pageBP:
+ msg = "Already exists (PID %d) : %r"
+ msg = msg % (dwProcessId, self.__pageBP[key])
+ raise KeyError(msg)
+ address = address + pageSize
+
+ address = begin
+ while address < end:
+ key = (dwProcessId, address)
+ self.__pageBP[key] = bp
+ address = address + pageSize
+ return bp
+
+ # Hardware breakpoints.
+ def define_hardware_breakpoint(self, dwThreadId, address,
+ triggerFlag = BP_BREAK_ON_ACCESS,
+ sizeFlag = BP_WATCH_DWORD,
+ condition = True,
+ action = None):
+ """
+ Creates a disabled hardware breakpoint at the given address.
+
+ @see:
+ L{has_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{enable_hardware_breakpoint},
+ L{enable_one_shot_hardware_breakpoint},
+ L{disable_hardware_breakpoint},
+ L{erase_hardware_breakpoint}
+
+ @note:
+ Hardware breakpoints do not seem to work properly on VirtualBox.
+ See U{http://www.virtualbox.org/ticket/477}.
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address to watch.
+
+ @type triggerFlag: int
+ @param triggerFlag: Trigger of breakpoint. Must be one of the following:
+
+ - L{BP_BREAK_ON_EXECUTION}
+
+ Break on code execution.
+
+ - L{BP_BREAK_ON_WRITE}
+
+ Break on memory read or write.
+
+ - L{BP_BREAK_ON_ACCESS}
+
+ Break on memory write.
+
+ @type sizeFlag: int
+ @param sizeFlag: Size of breakpoint. Must be one of the following:
+
+ - L{BP_WATCH_BYTE}
+
+ One (1) byte in size.
+
+ - L{BP_WATCH_WORD}
+
+ Two (2) bytes in size.
+
+ - L{BP_WATCH_DWORD}
+
+ Four (4) bytes in size.
+
+ - L{BP_WATCH_QWORD}
+
+ Eight (8) bytes in size.
+
+ @type condition: function
+ @param condition: (Optional) Condition callback function.
+
+ The callback signature is::
+
+ def condition_callback(event):
+ return True # returns True or False
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+ If specified, the event is handled by this callback instead of
+ being dispatched normally.
+
+ The callback signature is::
+
+ def action_callback(event):
+ pass # no return value
+
+ Where B{event} is an L{Event} object,
+ and the return value is a boolean
+ (C{True} to dispatch the event, C{False} otherwise).
+
+ @rtype: L{HardwareBreakpoint}
+ @return: The hardware breakpoint object.
+ """
+ thread = self.system.get_thread(dwThreadId)
+ bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition,
+ action)
+ begin = bp.get_address()
+ end = begin + bp.get_size()
+
+ if dwThreadId in self.__hardwareBP:
+ bpSet = self.__hardwareBP[dwThreadId]
+ for oldbp in bpSet:
+ old_begin = oldbp.get_address()
+ old_end = old_begin + oldbp.get_size()
+ if MemoryAddresses.do_ranges_intersect(begin, end, old_begin,
+ old_end):
+ msg = "Already exists (TID %d) : %r" % (dwThreadId, oldbp)
+ raise KeyError(msg)
+ else:
+ bpSet = set()
+ self.__hardwareBP[dwThreadId] = bpSet
+ bpSet.add(bp)
+ return bp
+
+#------------------------------------------------------------------------------
+
+ # Checking breakpoint definitions.
+
+ def has_code_breakpoint(self, dwProcessId, address):
+ """
+ Checks if a code breakpoint is defined at the given address.
+
+ @see:
+ L{define_code_breakpoint},
+ L{get_code_breakpoint},
+ L{erase_code_breakpoint},
+ L{enable_code_breakpoint},
+ L{enable_one_shot_code_breakpoint},
+ L{disable_code_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint is defined, C{False} otherwise.
+ """
+ return (dwProcessId, address) in self.__codeBP
+
+ def has_page_breakpoint(self, dwProcessId, address):
+ """
+ Checks if a page breakpoint is defined at the given address.
+
+ @see:
+ L{define_page_breakpoint},
+ L{get_page_breakpoint},
+ L{erase_page_breakpoint},
+ L{enable_page_breakpoint},
+ L{enable_one_shot_page_breakpoint},
+ L{disable_page_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint is defined, C{False} otherwise.
+ """
+ return (dwProcessId, address) in self.__pageBP
+
+ def has_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Checks if a hardware breakpoint is defined at the given address.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{erase_hardware_breakpoint},
+ L{enable_hardware_breakpoint},
+ L{enable_one_shot_hardware_breakpoint},
+ L{disable_hardware_breakpoint}
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint is defined, C{False} otherwise.
+ """
+ if dwThreadId in self.__hardwareBP:
+ bpSet = self.__hardwareBP[dwThreadId]
+ for bp in bpSet:
+ if bp.get_address() == address:
+ return True
+ return False
+
+#------------------------------------------------------------------------------
+
+ # Getting breakpoints.
+
+ def get_code_breakpoint(self, dwProcessId, address):
+ """
+ Returns the internally used breakpoint object,
+ for the code breakpoint defined at the given address.
+
+ @warning: It's usually best to call the L{Debug} methods
+ instead of accessing the breakpoint objects directly.
+
+ @see:
+ L{define_code_breakpoint},
+ L{has_code_breakpoint},
+ L{enable_code_breakpoint},
+ L{enable_one_shot_code_breakpoint},
+ L{disable_code_breakpoint},
+ L{erase_code_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address where the breakpoint is defined.
+
+ @rtype: L{CodeBreakpoint}
+ @return: The code breakpoint object.
+ """
+ key = (dwProcessId, address)
+ if key not in self.__codeBP:
+ msg = "No breakpoint at process %d, address %s"
+ address = HexDump.address(address)
+ raise KeyError(msg % (dwProcessId, address))
+ return self.__codeBP[key]
+
+ def get_page_breakpoint(self, dwProcessId, address):
+ """
+ Returns the internally used breakpoint object,
+ for the page breakpoint defined at the given address.
+
+ @warning: It's usually best to call the L{Debug} methods
+ instead of accessing the breakpoint objects directly.
+
+ @see:
+ L{define_page_breakpoint},
+ L{has_page_breakpoint},
+ L{enable_page_breakpoint},
+ L{enable_one_shot_page_breakpoint},
+ L{disable_page_breakpoint},
+ L{erase_page_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address where the breakpoint is defined.
+
+ @rtype: L{PageBreakpoint}
+ @return: The page breakpoint object.
+ """
+ key = (dwProcessId, address)
+ if key not in self.__pageBP:
+ msg = "No breakpoint at process %d, address %s"
+ address = HexDump.addresS(address)
+ raise KeyError(msg % (dwProcessId, address))
+ return self.__pageBP[key]
+
+ def get_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Returns the internally used breakpoint object,
+ for the code breakpoint defined at the given address.
+
+ @warning: It's usually best to call the L{Debug} methods
+ instead of accessing the breakpoint objects directly.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{has_hardware_breakpoint},
+ L{get_code_breakpoint},
+ L{enable_hardware_breakpoint},
+ L{enable_one_shot_hardware_breakpoint},
+ L{disable_hardware_breakpoint},
+ L{erase_hardware_breakpoint}
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address where the breakpoint is defined.
+
+ @rtype: L{HardwareBreakpoint}
+ @return: The hardware breakpoint object.
+ """
+ if dwThreadId not in self.__hardwareBP:
+ msg = "No hardware breakpoints set for thread %d"
+ raise KeyError(msg % dwThreadId)
+ for bp in self.__hardwareBP[dwThreadId]:
+ if bp.is_here(address):
+ return bp
+ msg = "No hardware breakpoint at thread %d, address %s"
+ raise KeyError(msg % (dwThreadId, HexDump.address(address)))
+
+#------------------------------------------------------------------------------
+
+ # Enabling and disabling breakpoints.
+
+ def enable_code_breakpoint(self, dwProcessId, address):
+ """
+ Enables the code breakpoint at the given address.
+
+ @see:
+ L{define_code_breakpoint},
+ L{has_code_breakpoint},
+ L{enable_one_shot_code_breakpoint},
+ L{disable_code_breakpoint}
+ L{erase_code_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_code_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.enable(p, None) # XXX HACK thread is not used
+
+ def enable_page_breakpoint(self, dwProcessId, address):
+ """
+ Enables the page breakpoint at the given address.
+
+ @see:
+ L{define_page_breakpoint},
+ L{has_page_breakpoint},
+ L{get_page_breakpoint},
+ L{enable_one_shot_page_breakpoint},
+ L{disable_page_breakpoint}
+ L{erase_page_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_page_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.enable(p, None) # XXX HACK thread is not used
+
+ def enable_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Enables the hardware breakpoint at the given address.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{has_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{enable_one_shot_hardware_breakpoint},
+ L{disable_hardware_breakpoint}
+ L{erase_hardware_breakpoint},
+
+ @note: Do not set hardware breakpoints while processing the system
+ breakpoint event.
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ t = self.system.get_thread(dwThreadId)
+ bp = self.get_hardware_breakpoint(dwThreadId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.enable(None, t) # XXX HACK process is not used
+
+ def enable_one_shot_code_breakpoint(self, dwProcessId, address):
+ """
+ Enables the code breakpoint at the given address for only one shot.
+
+ @see:
+ L{define_code_breakpoint},
+ L{has_code_breakpoint},
+ L{get_code_breakpoint},
+ L{enable_code_breakpoint},
+ L{disable_code_breakpoint}
+ L{erase_code_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_code_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.one_shot(p, None) # XXX HACK thread is not used
+
+ def enable_one_shot_page_breakpoint(self, dwProcessId, address):
+ """
+ Enables the page breakpoint at the given address for only one shot.
+
+ @see:
+ L{define_page_breakpoint},
+ L{has_page_breakpoint},
+ L{get_page_breakpoint},
+ L{enable_page_breakpoint},
+ L{disable_page_breakpoint}
+ L{erase_page_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_page_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.one_shot(p, None) # XXX HACK thread is not used
+
+ def enable_one_shot_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Enables the hardware breakpoint at the given address for only one shot.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{has_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{enable_hardware_breakpoint},
+ L{disable_hardware_breakpoint}
+ L{erase_hardware_breakpoint},
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ t = self.system.get_thread(dwThreadId)
+ bp = self.get_hardware_breakpoint(dwThreadId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.one_shot(None, t) # XXX HACK process is not used
+
+ def disable_code_breakpoint(self, dwProcessId, address):
+ """
+ Disables the code breakpoint at the given address.
+
+ @see:
+ L{define_code_breakpoint},
+ L{has_code_breakpoint},
+ L{get_code_breakpoint},
+ L{enable_code_breakpoint}
+ L{enable_one_shot_code_breakpoint},
+ L{erase_code_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_code_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.disable(p, None) # XXX HACK thread is not used
+
+ def disable_page_breakpoint(self, dwProcessId, address):
+ """
+ Disables the page breakpoint at the given address.
+
+ @see:
+ L{define_page_breakpoint},
+ L{has_page_breakpoint},
+ L{get_page_breakpoint},
+ L{enable_page_breakpoint}
+ L{enable_one_shot_page_breakpoint},
+ L{erase_page_breakpoint},
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ p = self.system.get_process(dwProcessId)
+ bp = self.get_page_breakpoint(dwProcessId, address)
+ if bp.is_running():
+ self.__del_running_bp_from_all_threads(bp)
+ bp.disable(p, None) # XXX HACK thread is not used
+
+ def disable_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Disables the hardware breakpoint at the given address.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{has_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{enable_hardware_breakpoint}
+ L{enable_one_shot_hardware_breakpoint},
+ L{erase_hardware_breakpoint},
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ t = self.system.get_thread(dwThreadId)
+ p = t.get_process()
+ bp = self.get_hardware_breakpoint(dwThreadId, address)
+ if bp.is_running():
+ self.__del_running_bp(dwThreadId, bp)
+ bp.disable(p, t)
+
+#------------------------------------------------------------------------------
+
+ # Undefining (erasing) breakpoints.
+
+ def erase_code_breakpoint(self, dwProcessId, address):
+ """
+ Erases the code breakpoint at the given address.
+
+ @see:
+ L{define_code_breakpoint},
+ L{has_code_breakpoint},
+ L{get_code_breakpoint},
+ L{enable_code_breakpoint},
+ L{enable_one_shot_code_breakpoint},
+ L{disable_code_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ bp = self.get_code_breakpoint(dwProcessId, address)
+ if not bp.is_disabled():
+ self.disable_code_breakpoint(dwProcessId, address)
+ del self.__codeBP[ (dwProcessId, address) ]
+
+ def erase_page_breakpoint(self, dwProcessId, address):
+ """
+ Erases the page breakpoint at the given address.
+
+ @see:
+ L{define_page_breakpoint},
+ L{has_page_breakpoint},
+ L{get_page_breakpoint},
+ L{enable_page_breakpoint},
+ L{enable_one_shot_page_breakpoint},
+ L{disable_page_breakpoint}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ bp = self.get_page_breakpoint(dwProcessId, address)
+ begin = bp.get_address()
+ end = begin + bp.get_size()
+ if not bp.is_disabled():
+ self.disable_page_breakpoint(dwProcessId, address)
+ address = begin
+ pageSize = MemoryAddresses.pageSize
+ while address < end:
+ del self.__pageBP[ (dwProcessId, address) ]
+ address = address + pageSize
+
+ def erase_hardware_breakpoint(self, dwThreadId, address):
+ """
+ Erases the hardware breakpoint at the given address.
+
+ @see:
+ L{define_hardware_breakpoint},
+ L{has_hardware_breakpoint},
+ L{get_hardware_breakpoint},
+ L{enable_hardware_breakpoint},
+ L{enable_one_shot_hardware_breakpoint},
+ L{disable_hardware_breakpoint}
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of breakpoint.
+ """
+ bp = self.get_hardware_breakpoint(dwThreadId, address)
+ if not bp.is_disabled():
+ self.disable_hardware_breakpoint(dwThreadId, address)
+ bpSet = self.__hardwareBP[dwThreadId]
+ bpSet.remove(bp)
+ if not bpSet:
+ del self.__hardwareBP[dwThreadId]
+
+#------------------------------------------------------------------------------
+
+ # Listing breakpoints.
+
+ def get_all_breakpoints(self):
+ """
+ Returns all breakpoint objects as a list of tuples.
+
+ Each tuple contains:
+ - Process global ID to which the breakpoint applies.
+ - Thread global ID to which the breakpoint applies, or C{None}.
+ - The L{Breakpoint} object itself.
+
+ @note: If you're only interested in a specific breakpoint type, or in
+ breakpoints for a specific process or thread, it's probably faster
+ to call one of the following methods:
+ - L{get_all_code_breakpoints}
+ - L{get_all_page_breakpoints}
+ - L{get_all_hardware_breakpoints}
+ - L{get_process_code_breakpoints}
+ - L{get_process_page_breakpoints}
+ - L{get_process_hardware_breakpoints}
+ - L{get_thread_hardware_breakpoints}
+
+ @rtype: list of tuple( pid, tid, bp )
+ @return: List of all breakpoints.
+ """
+ bplist = list()
+
+ # Get the code breakpoints.
+ for (pid, bp) in self.get_all_code_breakpoints():
+ bplist.append( (pid, None, bp) )
+
+ # Get the page breakpoints.
+ for (pid, bp) in self.get_all_page_breakpoints():
+ bplist.append( (pid, None, bp) )
+
+ # Get the hardware breakpoints.
+ for (tid, bp) in self.get_all_hardware_breakpoints():
+ pid = self.system.get_thread(tid).get_pid()
+ bplist.append( (pid, tid, bp) )
+
+ # Return the list of breakpoints.
+ return bplist
+
+ def get_all_code_breakpoints(self):
+ """
+ @rtype: list of tuple( int, L{CodeBreakpoint} )
+ @return: All code breakpoints as a list of tuples (pid, bp).
+ """
+ return [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__codeBP) ]
+
+ def get_all_page_breakpoints(self):
+ """
+ @rtype: list of tuple( int, L{PageBreakpoint} )
+ @return: All page breakpoints as a list of tuples (pid, bp).
+ """
+## return list( set( [ (pid, bp) for ((pid, address), bp) in compat.iteritems(self.__pageBP) ] ) )
+ result = set()
+ for ((pid, address), bp) in compat.iteritems(self.__pageBP):
+ result.add( (pid, bp) )
+ return list(result)
+
+ def get_all_hardware_breakpoints(self):
+ """
+ @rtype: list of tuple( int, L{HardwareBreakpoint} )
+ @return: All hardware breakpoints as a list of tuples (tid, bp).
+ """
+ result = list()
+ for (tid, bplist) in compat.iteritems(self.__hardwareBP):
+ for bp in bplist:
+ result.append( (tid, bp) )
+ return result
+
+ def get_process_breakpoints(self, dwProcessId):
+ """
+ Returns all breakpoint objects for the given process as a list of tuples.
+
+ Each tuple contains:
+ - Process global ID to which the breakpoint applies.
+ - Thread global ID to which the breakpoint applies, or C{None}.
+ - The L{Breakpoint} object itself.
+
+ @note: If you're only interested in a specific breakpoint type, or in
+ breakpoints for a specific process or thread, it's probably faster
+ to call one of the following methods:
+ - L{get_all_code_breakpoints}
+ - L{get_all_page_breakpoints}
+ - L{get_all_hardware_breakpoints}
+ - L{get_process_code_breakpoints}
+ - L{get_process_page_breakpoints}
+ - L{get_process_hardware_breakpoints}
+ - L{get_thread_hardware_breakpoints}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: list of tuple( pid, tid, bp )
+ @return: List of all breakpoints for the given process.
+ """
+ bplist = list()
+
+ # Get the code breakpoints.
+ for bp in self.get_process_code_breakpoints(dwProcessId):
+ bplist.append( (dwProcessId, None, bp) )
+
+ # Get the page breakpoints.
+ for bp in self.get_process_page_breakpoints(dwProcessId):
+ bplist.append( (dwProcessId, None, bp) )
+
+ # Get the hardware breakpoints.
+ for (tid, bp) in self.get_process_hardware_breakpoints(dwProcessId):
+ pid = self.system.get_thread(tid).get_pid()
+ bplist.append( (dwProcessId, tid, bp) )
+
+ # Return the list of breakpoints.
+ return bplist
+
+ def get_process_code_breakpoints(self, dwProcessId):
+ """
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: list of L{CodeBreakpoint}
+ @return: All code breakpoints for the given process.
+ """
+ return [ bp for ((pid, address), bp) in compat.iteritems(self.__codeBP) \
+ if pid == dwProcessId ]
+
+ def get_process_page_breakpoints(self, dwProcessId):
+ """
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: list of L{PageBreakpoint}
+ @return: All page breakpoints for the given process.
+ """
+ return [ bp for ((pid, address), bp) in compat.iteritems(self.__pageBP) \
+ if pid == dwProcessId ]
+
+ def get_thread_hardware_breakpoints(self, dwThreadId):
+ """
+ @see: L{get_process_hardware_breakpoints}
+
+ @type dwThreadId: int
+ @param dwThreadId: Thread global ID.
+
+ @rtype: list of L{HardwareBreakpoint}
+ @return: All hardware breakpoints for the given thread.
+ """
+ result = list()
+ for (tid, bplist) in compat.iteritems(self.__hardwareBP):
+ if tid == dwThreadId:
+ for bp in bplist:
+ result.append(bp)
+ return result
+
+ def get_process_hardware_breakpoints(self, dwProcessId):
+ """
+ @see: L{get_thread_hardware_breakpoints}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: list of tuple( int, L{HardwareBreakpoint} )
+ @return: All hardware breakpoints for each thread in the given process
+ as a list of tuples (tid, bp).
+ """
+ result = list()
+ aProcess = self.system.get_process(dwProcessId)
+ for dwThreadId in aProcess.iter_thread_ids():
+ if dwThreadId in self.__hardwareBP:
+ bplist = self.__hardwareBP[dwThreadId]
+ for bp in bplist:
+ result.append( (dwThreadId, bp) )
+ return result
+
+## def get_all_hooks(self):
+## """
+## @see: L{get_process_hooks}
+##
+## @rtype: list of tuple( int, int, L{Hook} )
+## @return: All defined hooks as a list of tuples (pid, address, hook).
+## """
+## return [ (pid, address, hook) \
+## for ((pid, address), hook) in self.__hook_objects ]
+##
+## def get_process_hooks(self, dwProcessId):
+## """
+## @see: L{get_all_hooks}
+##
+## @type dwProcessId: int
+## @param dwProcessId: Process global ID.
+##
+## @rtype: list of tuple( int, int, L{Hook} )
+## @return: All hooks for the given process as a list of tuples
+## (pid, address, hook).
+## """
+## return [ (pid, address, hook) \
+## for ((pid, address), hook) in self.__hook_objects \
+## if pid == dwProcessId ]
+
+#------------------------------------------------------------------------------
+
+ # Batch operations on all breakpoints.
+
+ def enable_all_breakpoints(self):
+ """
+ Enables all disabled breakpoints in all processes.
+
+ @see:
+ enable_code_breakpoint,
+ enable_page_breakpoint,
+ enable_hardware_breakpoint
+ """
+
+ # disable code breakpoints
+ for (pid, bp) in self.get_all_code_breakpoints():
+ if bp.is_disabled():
+ self.enable_code_breakpoint(pid, bp.get_address())
+
+ # disable page breakpoints
+ for (pid, bp) in self.get_all_page_breakpoints():
+ if bp.is_disabled():
+ self.enable_page_breakpoint(pid, bp.get_address())
+
+ # disable hardware breakpoints
+ for (tid, bp) in self.get_all_hardware_breakpoints():
+ if bp.is_disabled():
+ self.enable_hardware_breakpoint(tid, bp.get_address())
+
+ def enable_one_shot_all_breakpoints(self):
+ """
+ Enables for one shot all disabled breakpoints in all processes.
+
+ @see:
+ enable_one_shot_code_breakpoint,
+ enable_one_shot_page_breakpoint,
+ enable_one_shot_hardware_breakpoint
+ """
+
+ # disable code breakpoints for one shot
+ for (pid, bp) in self.get_all_code_breakpoints():
+ if bp.is_disabled():
+ self.enable_one_shot_code_breakpoint(pid, bp.get_address())
+
+ # disable page breakpoints for one shot
+ for (pid, bp) in self.get_all_page_breakpoints():
+ if bp.is_disabled():
+ self.enable_one_shot_page_breakpoint(pid, bp.get_address())
+
+ # disable hardware breakpoints for one shot
+ for (tid, bp) in self.get_all_hardware_breakpoints():
+ if bp.is_disabled():
+ self.enable_one_shot_hardware_breakpoint(tid, bp.get_address())
+
+ def disable_all_breakpoints(self):
+ """
+ Disables all breakpoints in all processes.
+
+ @see:
+ disable_code_breakpoint,
+ disable_page_breakpoint,
+ disable_hardware_breakpoint
+ """
+
+ # disable code breakpoints
+ for (pid, bp) in self.get_all_code_breakpoints():
+ self.disable_code_breakpoint(pid, bp.get_address())
+
+ # disable page breakpoints
+ for (pid, bp) in self.get_all_page_breakpoints():
+ self.disable_page_breakpoint(pid, bp.get_address())
+
+ # disable hardware breakpoints
+ for (tid, bp) in self.get_all_hardware_breakpoints():
+ self.disable_hardware_breakpoint(tid, bp.get_address())
+
+ def erase_all_breakpoints(self):
+ """
+ Erases all breakpoints in all processes.
+
+ @see:
+ erase_code_breakpoint,
+ erase_page_breakpoint,
+ erase_hardware_breakpoint
+ """
+
+ # This should be faster but let's not trust the GC so much :P
+ # self.disable_all_breakpoints()
+ # self.__codeBP = dict()
+ # self.__pageBP = dict()
+ # self.__hardwareBP = dict()
+ # self.__runningBP = dict()
+ # self.__hook_objects = dict()
+
+## # erase hooks
+## for (pid, address, hook) in self.get_all_hooks():
+## self.dont_hook_function(pid, address)
+
+ # erase code breakpoints
+ for (pid, bp) in self.get_all_code_breakpoints():
+ self.erase_code_breakpoint(pid, bp.get_address())
+
+ # erase page breakpoints
+ for (pid, bp) in self.get_all_page_breakpoints():
+ self.erase_page_breakpoint(pid, bp.get_address())
+
+ # erase hardware breakpoints
+ for (tid, bp) in self.get_all_hardware_breakpoints():
+ self.erase_hardware_breakpoint(tid, bp.get_address())
+
+#------------------------------------------------------------------------------
+
+ # Batch operations on breakpoints per process.
+
+ def enable_process_breakpoints(self, dwProcessId):
+ """
+ Enables all disabled breakpoints for the given process.
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+ """
+
+ # enable code breakpoints
+ for bp in self.get_process_code_breakpoints(dwProcessId):
+ if bp.is_disabled():
+ self.enable_code_breakpoint(dwProcessId, bp.get_address())
+
+ # enable page breakpoints
+ for bp in self.get_process_page_breakpoints(dwProcessId):
+ if bp.is_disabled():
+ self.enable_page_breakpoint(dwProcessId, bp.get_address())
+
+ # enable hardware breakpoints
+ if self.system.has_process(dwProcessId):
+ aProcess = self.system.get_process(dwProcessId)
+ else:
+ aProcess = Process(dwProcessId)
+ aProcess.scan_threads()
+ for aThread in aProcess.iter_threads():
+ dwThreadId = aThread.get_tid()
+ for bp in self.get_thread_hardware_breakpoints(dwThreadId):
+ if bp.is_disabled():
+ self.enable_hardware_breakpoint(dwThreadId, bp.get_address())
+
+ def enable_one_shot_process_breakpoints(self, dwProcessId):
+ """
+ Enables for one shot all disabled breakpoints for the given process.
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+ """
+
+ # enable code breakpoints for one shot
+ for bp in self.get_process_code_breakpoints(dwProcessId):
+ if bp.is_disabled():
+ self.enable_one_shot_code_breakpoint(dwProcessId, bp.get_address())
+
+ # enable page breakpoints for one shot
+ for bp in self.get_process_page_breakpoints(dwProcessId):
+ if bp.is_disabled():
+ self.enable_one_shot_page_breakpoint(dwProcessId, bp.get_address())
+
+ # enable hardware breakpoints for one shot
+ if self.system.has_process(dwProcessId):
+ aProcess = self.system.get_process(dwProcessId)
+ else:
+ aProcess = Process(dwProcessId)
+ aProcess.scan_threads()
+ for aThread in aProcess.iter_threads():
+ dwThreadId = aThread.get_tid()
+ for bp in self.get_thread_hardware_breakpoints(dwThreadId):
+ if bp.is_disabled():
+ self.enable_one_shot_hardware_breakpoint(dwThreadId, bp.get_address())
+
+ def disable_process_breakpoints(self, dwProcessId):
+ """
+ Disables all breakpoints for the given process.
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+ """
+
+ # disable code breakpoints
+ for bp in self.get_process_code_breakpoints(dwProcessId):
+ self.disable_code_breakpoint(dwProcessId, bp.get_address())
+
+ # disable page breakpoints
+ for bp in self.get_process_page_breakpoints(dwProcessId):
+ self.disable_page_breakpoint(dwProcessId, bp.get_address())
+
+ # disable hardware breakpoints
+ if self.system.has_process(dwProcessId):
+ aProcess = self.system.get_process(dwProcessId)
+ else:
+ aProcess = Process(dwProcessId)
+ aProcess.scan_threads()
+ for aThread in aProcess.iter_threads():
+ dwThreadId = aThread.get_tid()
+ for bp in self.get_thread_hardware_breakpoints(dwThreadId):
+ self.disable_hardware_breakpoint(dwThreadId, bp.get_address())
+
+ def erase_process_breakpoints(self, dwProcessId):
+ """
+ Erases all breakpoints for the given process.
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+ """
+
+ # disable breakpoints first
+ # if an error occurs, no breakpoint is erased
+ self.disable_process_breakpoints(dwProcessId)
+
+## # erase hooks
+## for address, hook in self.get_process_hooks(dwProcessId):
+## self.dont_hook_function(dwProcessId, address)
+
+ # erase code breakpoints
+ for bp in self.get_process_code_breakpoints(dwProcessId):
+ self.erase_code_breakpoint(dwProcessId, bp.get_address())
+
+ # erase page breakpoints
+ for bp in self.get_process_page_breakpoints(dwProcessId):
+ self.erase_page_breakpoint(dwProcessId, bp.get_address())
+
+ # erase hardware breakpoints
+ if self.system.has_process(dwProcessId):
+ aProcess = self.system.get_process(dwProcessId)
+ else:
+ aProcess = Process(dwProcessId)
+ aProcess.scan_threads()
+ for aThread in aProcess.iter_threads():
+ dwThreadId = aThread.get_tid()
+ for bp in self.get_thread_hardware_breakpoints(dwThreadId):
+ self.erase_hardware_breakpoint(dwThreadId, bp.get_address())
+
+#------------------------------------------------------------------------------
+
+ # Internal handlers of debug events.
+
+ def _notify_guard_page(self, event):
+ """
+ Notify breakpoints of a guard page exception event.
+
+ @type event: L{ExceptionEvent}
+ @param event: Guard page exception event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ address = event.get_fault_address()
+ pid = event.get_pid()
+ bCallHandler = True
+
+ # Align address to page boundary.
+ mask = ~(MemoryAddresses.pageSize - 1)
+ address = address & mask
+
+ # Do we have an active page breakpoint there?
+ key = (pid, address)
+ if key in self.__pageBP:
+ bp = self.__pageBP[key]
+ if bp.is_enabled() or bp.is_one_shot():
+
+ # Breakpoint is ours.
+ event.continueStatus = win32.DBG_CONTINUE
+## event.continueStatus = win32.DBG_EXCEPTION_HANDLED
+
+ # Hit the breakpoint.
+ bp.hit(event)
+
+ # Remember breakpoints in RUNNING state.
+ if bp.is_running():
+ tid = event.get_tid()
+ self.__add_running_bp(tid, bp)
+
+ # Evaluate the breakpoint condition.
+ bCondition = bp.eval_condition(event)
+
+ # If the breakpoint is automatic, run the action.
+ # If not, notify the user.
+ if bCondition and bp.is_automatic():
+ bp.run_action(event)
+ bCallHandler = False
+ else:
+ bCallHandler = bCondition
+
+ # If we don't have a breakpoint here pass the exception to the debugee.
+ # This is a normally occurring exception so we shouldn't swallow it.
+ else:
+ event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+
+ return bCallHandler
+
+ def _notify_breakpoint(self, event):
+ """
+ Notify breakpoints of a breakpoint exception event.
+
+ @type event: L{ExceptionEvent}
+ @param event: Breakpoint exception event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ address = event.get_exception_address()
+ pid = event.get_pid()
+ bCallHandler = True
+
+ # Do we have an active code breakpoint there?
+ key = (pid, address)
+ if key in self.__codeBP:
+ bp = self.__codeBP[key]
+ if not bp.is_disabled():
+
+ # Change the program counter (PC) to the exception address.
+ # This accounts for the change in PC caused by
+ # executing the breakpoint instruction, no matter
+ # the size of it.
+ aThread = event.get_thread()
+ aThread.set_pc(address)
+
+ # Swallow the exception.
+ event.continueStatus = win32.DBG_CONTINUE
+
+ # Hit the breakpoint.
+ bp.hit(event)
+
+ # Remember breakpoints in RUNNING state.
+ if bp.is_running():
+ tid = event.get_tid()
+ self.__add_running_bp(tid, bp)
+
+ # Evaluate the breakpoint condition.
+ bCondition = bp.eval_condition(event)
+
+ # If the breakpoint is automatic, run the action.
+ # If not, notify the user.
+ if bCondition and bp.is_automatic():
+ bCallHandler = bp.run_action(event)
+ else:
+ bCallHandler = bCondition
+
+ # Handle the system breakpoint.
+ # TODO: examine the stack trace to figure out if it's really a
+ # system breakpoint or an antidebug trick. The caller should be
+ # inside ntdll if it's legit.
+ elif event.get_process().is_system_defined_breakpoint(address):
+ event.continueStatus = win32.DBG_CONTINUE
+
+ # In hostile mode, if we don't have a breakpoint here pass the
+ # exception to the debugee. In normal mode assume all breakpoint
+ # exceptions are to be handled by the debugger.
+ else:
+ if self.in_hostile_mode():
+ event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+ else:
+ event.continueStatus = win32.DBG_CONTINUE
+
+ return bCallHandler
+
+ def _notify_single_step(self, event):
+ """
+ Notify breakpoints of a single step exception event.
+
+ @type event: L{ExceptionEvent}
+ @param event: Single step exception event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ pid = event.get_pid()
+ tid = event.get_tid()
+ aThread = event.get_thread()
+ aProcess = event.get_process()
+ bCallHandler = True
+ bIsOurs = False
+
+ # In hostile mode set the default to pass the exception to the debugee.
+ # If we later determine the exception is ours, hide it instead.
+ old_continueStatus = event.continueStatus
+ try:
+ if self.in_hostile_mode():
+ event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+
+ # Single step support is implemented on x86/x64 architectures only.
+ if self.system.arch not in (win32.ARCH_I386, win32.ARCH_AMD64):
+ return bCallHandler
+
+ # In hostile mode, read the last executed bytes to try to detect
+ # some antidebug tricks. Skip this check in normal mode because
+ # it'd slow things down.
+ #
+ # FIXME: weird opcode encodings may bypass this check!
+ #
+ # bFakeSingleStep: Ice Breakpoint undocumented instruction.
+ # bHideTrapFlag: Don't let pushf instructions get the real value of
+ # the trap flag.
+ # bNextIsPopFlags: Don't let popf instructions clear the trap flag.
+ #
+ bFakeSingleStep = False
+ bLastIsPushFlags = False
+ bNextIsPopFlags = False
+ if self.in_hostile_mode():
+ pc = aThread.get_pc()
+ c = aProcess.read_char(pc - 1)
+ if c == 0xF1: # int1
+ bFakeSingleStep = True
+ elif c == 0x9C: # pushf
+ bLastIsPushFlags = True
+ c = aProcess.peek_char(pc)
+ if c == 0x66: # the only valid prefix for popf
+ c = aProcess.peek_char(pc + 1)
+ if c == 0x9D: # popf
+ if bLastIsPushFlags:
+ bLastIsPushFlags = False # they cancel each other out
+ else:
+ bNextIsPopFlags = True
+
+ # When the thread is in tracing mode,
+ # don't pass the exception to the debugee
+ # and set the trap flag again.
+ if self.is_tracing(tid):
+ bIsOurs = True
+ if not bFakeSingleStep:
+ event.continueStatus = win32.DBG_CONTINUE
+ aThread.set_tf()
+
+ # Don't let the debugee read or write the trap flag.
+ # This code works in 32 and 64 bits thanks to the endianness.
+ if bLastIsPushFlags or bNextIsPopFlags:
+ sp = aThread.get_sp()
+ flags = aProcess.read_dword(sp)
+ if bLastIsPushFlags:
+ flags &= ~Thread.Flags.Trap
+ else: # if bNextIsPopFlags:
+ flags |= Thread.Flags.Trap
+ aProcess.write_dword(sp, flags)
+
+ # Handle breakpoints in RUNNING state.
+ running = self.__get_running_bp_set(tid)
+ if running:
+ bIsOurs = True
+ if not bFakeSingleStep:
+ event.continueStatus = win32.DBG_CONTINUE
+ bCallHandler = False
+ while running:
+ try:
+ running.pop().hit(event)
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), BreakpointWarning)
+
+ # Handle hardware breakpoints.
+ if tid in self.__hardwareBP:
+ ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
+ Dr6 = ctx['Dr6']
+ ctx['Dr6'] = Dr6 & DebugRegister.clearHitMask
+ aThread.set_context(ctx)
+ bFoundBreakpoint = False
+ bCondition = False
+ hwbpList = [ bp for bp in self.__hardwareBP[tid] ]
+ for bp in hwbpList:
+ if not bp in self.__hardwareBP[tid]:
+ continue # it was removed by a user-defined callback
+ slot = bp.get_slot()
+ if (slot is not None) and \
+ (Dr6 & DebugRegister.hitMask[slot]):
+ if not bFoundBreakpoint: #set before actions are called
+ if not bFakeSingleStep:
+ event.continueStatus = win32.DBG_CONTINUE
+ bFoundBreakpoint = True
+ bIsOurs = True
+ bp.hit(event)
+ if bp.is_running():
+ self.__add_running_bp(tid, bp)
+ bThisCondition = bp.eval_condition(event)
+ if bThisCondition and bp.is_automatic():
+ bp.run_action(event)
+ bThisCondition = False
+ bCondition = bCondition or bThisCondition
+ if bFoundBreakpoint:
+ bCallHandler = bCondition
+
+ # Always call the user-defined handler
+ # when the thread is in tracing mode.
+ if self.is_tracing(tid):
+ bCallHandler = True
+
+ # If we're not in hostile mode, by default we assume all single
+ # step exceptions are caused by the debugger.
+ if not bIsOurs and not self.in_hostile_mode():
+ aThread.clear_tf()
+
+ # If the user hit Control-C while we were inside the try block,
+ # set the default continueStatus back.
+ except:
+ event.continueStatus = old_continueStatus
+ raise
+
+ return bCallHandler
+
+ def _notify_load_dll(self, event):
+ """
+ Notify the loading of a DLL.
+
+ @type event: L{LoadDLLEvent}
+ @param event: Load DLL event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handler, C{False} otherwise.
+ """
+ self.__set_deferred_breakpoints(event)
+ return True
+
+ def _notify_unload_dll(self, event):
+ """
+ Notify the unloading of a DLL.
+
+ @type event: L{UnloadDLLEvent}
+ @param event: Unload DLL event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handler, C{False} otherwise.
+ """
+ self.__cleanup_module(event)
+ return True
+
+ def _notify_exit_thread(self, event):
+ """
+ Notify the termination of a thread.
+
+ @type event: L{ExitThreadEvent}
+ @param event: Exit thread event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handler, C{False} otherwise.
+ """
+ self.__cleanup_thread(event)
+ return True
+
+ def _notify_exit_process(self, event):
+ """
+ Notify the termination of a process.
+
+ @type event: L{ExitProcessEvent}
+ @param event: Exit process event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handler, C{False} otherwise.
+ """
+ self.__cleanup_process(event)
+ self.__cleanup_thread(event)
+ return True
+
+#------------------------------------------------------------------------------
+
+ # This is the high level breakpoint interface. Here we don't have to care
+ # about defining or enabling breakpoints, and many errors are ignored
+ # (like for example setting the same breakpoint twice, here the second
+ # breakpoint replaces the first, much like in WinDBG). It should be easier
+ # and more intuitive, if less detailed. It also allows the use of deferred
+ # breakpoints.
+
+#------------------------------------------------------------------------------
+
+ # Code breakpoints
+
+ def __set_break(self, pid, address, action, oneshot):
+ """
+ Used by L{break_at} and L{stalk_at}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_code_breakpoint} for more details.
+
+ @type oneshot: bool
+ @param oneshot: C{True} for one-shot breakpoints, C{False} otherwise.
+
+ @rtype: L{Breakpoint}
+ @return: Returns the new L{Breakpoint} object, or C{None} if the label
+ couldn't be resolved and the breakpoint was deferred. Deferred
+ breakpoints are set when the DLL they point to is loaded.
+ """
+ if type(address) not in (int, long):
+ label = address
+ try:
+ address = self.system.get_process(pid).resolve_label(address)
+ if not address:
+ raise Exception()
+ except Exception:
+ try:
+ deferred = self.__deferredBP[pid]
+ except KeyError:
+ deferred = dict()
+ self.__deferredBP[pid] = deferred
+ if label in deferred:
+ msg = "Redefined deferred code breakpoint at %s in process ID %d"
+ msg = msg % (label, pid)
+ warnings.warn(msg, BreakpointWarning)
+ deferred[label] = (action, oneshot)
+ return None
+ if self.has_code_breakpoint(pid, address):
+ bp = self.get_code_breakpoint(pid, address)
+ if bp.get_action() != action: # can't use "is not", fails for bound methods
+ bp.set_action(action)
+ msg = "Redefined code breakpoint at %s in process ID %d"
+ msg = msg % (label, pid)
+ warnings.warn(msg, BreakpointWarning)
+ else:
+ self.define_code_breakpoint(pid, address, True, action)
+ bp = self.get_code_breakpoint(pid, address)
+ if oneshot:
+ if not bp.is_one_shot():
+ self.enable_one_shot_code_breakpoint(pid, address)
+ else:
+ if not bp.is_enabled():
+ self.enable_code_breakpoint(pid, address)
+ return bp
+
+ def __clear_break(self, pid, address):
+ """
+ Used by L{dont_break_at} and L{dont_stalk_at}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+ """
+ if type(address) not in (int, long):
+ unknown = True
+ label = address
+ try:
+ deferred = self.__deferredBP[pid]
+ del deferred[label]
+ unknown = False
+ except KeyError:
+## traceback.print_last() # XXX DEBUG
+ pass
+ aProcess = self.system.get_process(pid)
+ try:
+ address = aProcess.resolve_label(label)
+ if not address:
+ raise Exception()
+ except Exception:
+## traceback.print_last() # XXX DEBUG
+ if unknown:
+ msg = ("Can't clear unknown code breakpoint"
+ " at %s in process ID %d")
+ msg = msg % (label, pid)
+ warnings.warn(msg, BreakpointWarning)
+ return
+ if self.has_code_breakpoint(pid, address):
+ self.erase_code_breakpoint(pid, address)
+
+ def __set_deferred_breakpoints(self, event):
+ """
+ Used internally. Sets all deferred breakpoints for a DLL when it's
+ loaded.
+
+ @type event: L{LoadDLLEvent}
+ @param event: Load DLL event.
+ """
+ pid = event.get_pid()
+ try:
+ deferred = self.__deferredBP[pid]
+ except KeyError:
+ return
+ aProcess = event.get_process()
+ for (label, (action, oneshot)) in deferred.items():
+ try:
+ address = aProcess.resolve_label(label)
+ except Exception:
+ continue
+ del deferred[label]
+ try:
+ self.__set_break(pid, address, action, oneshot)
+ except Exception:
+ msg = "Can't set deferred breakpoint %s at process ID %d"
+ msg = msg % (label, pid)
+ warnings.warn(msg, BreakpointWarning)
+
+ def get_all_deferred_code_breakpoints(self):
+ """
+ Returns a list of deferred code breakpoints.
+
+ @rtype: tuple of (int, str, callable, bool)
+ @return: Tuple containing the following elements:
+ - Process ID where to set the breakpoint.
+ - Label pointing to the address where to set the breakpoint.
+ - Action callback for the breakpoint.
+ - C{True} of the breakpoint is one-shot, C{False} otherwise.
+ """
+ result = []
+ for pid, deferred in compat.iteritems(self.__deferredBP):
+ for (label, (action, oneshot)) in compat.iteritems(deferred):
+ result.add( (pid, label, action, oneshot) )
+ return result
+
+ def get_process_deferred_code_breakpoints(self, dwProcessId):
+ """
+ Returns a list of deferred code breakpoints.
+
+ @type dwProcessId: int
+ @param dwProcessId: Process ID.
+
+ @rtype: tuple of (int, str, callable, bool)
+ @return: Tuple containing the following elements:
+ - Label pointing to the address where to set the breakpoint.
+ - Action callback for the breakpoint.
+ - C{True} of the breakpoint is one-shot, C{False} otherwise.
+ """
+ return [ (label, action, oneshot)
+ for (label, (action, oneshot))
+ in compat.iteritems(self.__deferredBP.get(dwProcessId, {})) ]
+
+ def stalk_at(self, pid, address, action = None):
+ """
+ Sets a one shot code breakpoint at the given process and address.
+
+ If instead of an address you pass a label, the breakpoint may be
+ deferred until the DLL it points to is loaded.
+
+ @see: L{break_at}, L{dont_stalk_at}
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_code_breakpoint} for more details.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint was set immediately, or C{False} if
+ it was deferred.
+ """
+ bp = self.__set_break(pid, address, action, oneshot = True)
+ return bp is not None
+
+ def break_at(self, pid, address, action = None):
+ """
+ Sets a code breakpoint at the given process and address.
+
+ If instead of an address you pass a label, the breakpoint may be
+ deferred until the DLL it points to is loaded.
+
+ @see: L{stalk_at}, L{dont_break_at}
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_code_breakpoint} for more details.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint was set immediately, or C{False} if
+ it was deferred.
+ """
+ bp = self.__set_break(pid, address, action, oneshot = False)
+ return bp is not None
+
+ def dont_break_at(self, pid, address):
+ """
+ Clears a code breakpoint set by L{break_at}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+ """
+ self.__clear_break(pid, address)
+
+ def dont_stalk_at(self, pid, address):
+ """
+ Clears a code breakpoint set by L{stalk_at}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+ """
+ self.__clear_break(pid, address)
+
+#------------------------------------------------------------------------------
+
+ # Function hooks
+
+ def hook_function(self, pid, address,
+ preCB = None, postCB = None,
+ paramCount = None, signature = None):
+ """
+ Sets a function hook at the given address.
+
+ If instead of an address you pass a label, the hook may be
+ deferred until the DLL it points to is loaded.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+
+ @type preCB: function
+ @param preCB: (Optional) Callback triggered on function entry.
+
+ The signature for the callback should be something like this::
+
+ def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags):
+
+ # return address
+ ra = params[0]
+
+ # function arguments start from here...
+ szFilename = event.get_process().peek_string(lpFilename)
+
+ # (...)
+
+ Note that all pointer types are treated like void pointers, so your
+ callback won't get the string or structure pointed to by it, but
+ the remote memory address instead. This is so to prevent the ctypes
+ library from being "too helpful" and trying to dereference the
+ pointer. To get the actual data being pointed to, use one of the
+ L{Process.read} methods.
+
+ @type postCB: function
+ @param postCB: (Optional) Callback triggered on function exit.
+
+ The signature for the callback should be something like this::
+
+ def post_LoadLibraryEx(event, return_value):
+
+ # (...)
+
+ @type paramCount: int
+ @param paramCount:
+ (Optional) Number of parameters for the C{preCB} callback,
+ not counting the return address. Parameters are read from
+ the stack and assumed to be DWORDs in 32 bits and QWORDs in 64.
+
+ This is a faster way to pull stack parameters in 32 bits, but in 64
+ bits (or with some odd APIs in 32 bits) it won't be useful, since
+ not all arguments to the hooked function will be of the same size.
+
+ For a more reliable and cross-platform way of hooking use the
+ C{signature} argument instead.
+
+ @type signature: tuple
+ @param signature:
+ (Optional) Tuple of C{ctypes} data types that constitute the
+ hooked function signature. When the function is called, this will
+ be used to parse the arguments from the stack. Overrides the
+ C{paramCount} argument.
+
+ @rtype: bool
+ @return: C{True} if the hook was set immediately, or C{False} if
+ it was deferred.
+ """
+ try:
+ aProcess = self.system.get_process(pid)
+ except KeyError:
+ aProcess = Process(pid)
+ arch = aProcess.get_arch()
+ hookObj = Hook(preCB, postCB, paramCount, signature, arch)
+ bp = self.break_at(pid, address, hookObj)
+ return bp is not None
+
+ def stalk_function(self, pid, address,
+ preCB = None, postCB = None,
+ paramCount = None, signature = None):
+ """
+ Sets a one-shot function hook at the given address.
+
+ If instead of an address you pass a label, the hook may be
+ deferred until the DLL it points to is loaded.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+
+ @type preCB: function
+ @param preCB: (Optional) Callback triggered on function entry.
+
+ The signature for the callback should be something like this::
+
+ def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags):
+
+ # return address
+ ra = params[0]
+
+ # function arguments start from here...
+ szFilename = event.get_process().peek_string(lpFilename)
+
+ # (...)
+
+ Note that all pointer types are treated like void pointers, so your
+ callback won't get the string or structure pointed to by it, but
+ the remote memory address instead. This is so to prevent the ctypes
+ library from being "too helpful" and trying to dereference the
+ pointer. To get the actual data being pointed to, use one of the
+ L{Process.read} methods.
+
+ @type postCB: function
+ @param postCB: (Optional) Callback triggered on function exit.
+
+ The signature for the callback should be something like this::
+
+ def post_LoadLibraryEx(event, return_value):
+
+ # (...)
+
+ @type paramCount: int
+ @param paramCount:
+ (Optional) Number of parameters for the C{preCB} callback,
+ not counting the return address. Parameters are read from
+ the stack and assumed to be DWORDs in 32 bits and QWORDs in 64.
+
+ This is a faster way to pull stack parameters in 32 bits, but in 64
+ bits (or with some odd APIs in 32 bits) it won't be useful, since
+ not all arguments to the hooked function will be of the same size.
+
+ For a more reliable and cross-platform way of hooking use the
+ C{signature} argument instead.
+
+ @type signature: tuple
+ @param signature:
+ (Optional) Tuple of C{ctypes} data types that constitute the
+ hooked function signature. When the function is called, this will
+ be used to parse the arguments from the stack. Overrides the
+ C{paramCount} argument.
+
+ @rtype: bool
+ @return: C{True} if the breakpoint was set immediately, or C{False} if
+ it was deferred.
+ """
+ try:
+ aProcess = self.system.get_process(pid)
+ except KeyError:
+ aProcess = Process(pid)
+ arch = aProcess.get_arch()
+ hookObj = Hook(preCB, postCB, paramCount, signature, arch)
+ bp = self.stalk_at(pid, address, hookObj)
+ return bp is not None
+
+ def dont_hook_function(self, pid, address):
+ """
+ Removes a function hook set by L{hook_function}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+ """
+ self.dont_break_at(pid, address)
+
+ # alias
+ unhook_function = dont_hook_function
+
+ def dont_stalk_function(self, pid, address):
+ """
+ Removes a function hook set by L{stalk_function}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int or str
+ @param address:
+ Memory address of code instruction to break at. It can be an
+ integer value for the actual address or a string with a label
+ to be resolved.
+ """
+ self.dont_stalk_at(pid, address)
+
+#------------------------------------------------------------------------------
+
+ # Variable watches
+
+ def __set_variable_watch(self, tid, address, size, action):
+ """
+ Used by L{watch_variable} and L{stalk_variable}.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to watch.
+
+ @type size: int
+ @param size: Size of variable to watch. The only supported sizes are:
+ byte (1), word (2), dword (4) and qword (8).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_hardware_breakpoint} for more details.
+
+ @rtype: L{HardwareBreakpoint}
+ @return: Hardware breakpoint at the requested address.
+ """
+
+ # TODO
+ # We should merge the breakpoints instead of overwriting them.
+ # We'll have the same problem as watch_buffer and we'll need to change
+ # the API again.
+
+ if size == 1:
+ sizeFlag = self.BP_WATCH_BYTE
+ elif size == 2:
+ sizeFlag = self.BP_WATCH_WORD
+ elif size == 4:
+ sizeFlag = self.BP_WATCH_DWORD
+ elif size == 8:
+ sizeFlag = self.BP_WATCH_QWORD
+ else:
+ raise ValueError("Bad size for variable watch: %r" % size)
+
+ if self.has_hardware_breakpoint(tid, address):
+ warnings.warn(
+ "Hardware breakpoint in thread %d at address %s was overwritten!" \
+ % (tid, HexDump.address(address,
+ self.system.get_thread(tid).get_bits())),
+ BreakpointWarning)
+
+ bp = self.get_hardware_breakpoint(tid, address)
+ if bp.get_trigger() != self.BP_BREAK_ON_ACCESS or \
+ bp.get_watch() != sizeFlag:
+ self.erase_hardware_breakpoint(tid, address)
+ self.define_hardware_breakpoint(tid, address,
+ self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
+ bp = self.get_hardware_breakpoint(tid, address)
+
+ else:
+ self.define_hardware_breakpoint(tid, address,
+ self.BP_BREAK_ON_ACCESS, sizeFlag, True, action)
+ bp = self.get_hardware_breakpoint(tid, address)
+
+ return bp
+
+ def __clear_variable_watch(self, tid, address):
+ """
+ Used by L{dont_watch_variable} and L{dont_stalk_variable}.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to stop watching.
+ """
+ if self.has_hardware_breakpoint(tid, address):
+ self.erase_hardware_breakpoint(tid, address)
+
+ def watch_variable(self, tid, address, size, action = None):
+ """
+ Sets a hardware breakpoint at the given thread, address and size.
+
+ @see: L{dont_watch_variable}
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to watch.
+
+ @type size: int
+ @param size: Size of variable to watch. The only supported sizes are:
+ byte (1), word (2), dword (4) and qword (8).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_hardware_breakpoint} for more details.
+ """
+ bp = self.__set_variable_watch(tid, address, size, action)
+ if not bp.is_enabled():
+ self.enable_hardware_breakpoint(tid, address)
+
+ def stalk_variable(self, tid, address, size, action = None):
+ """
+ Sets a one-shot hardware breakpoint at the given thread,
+ address and size.
+
+ @see: L{dont_watch_variable}
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to watch.
+
+ @type size: int
+ @param size: Size of variable to watch. The only supported sizes are:
+ byte (1), word (2), dword (4) and qword (8).
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_hardware_breakpoint} for more details.
+ """
+ bp = self.__set_variable_watch(tid, address, size, action)
+ if not bp.is_one_shot():
+ self.enable_one_shot_hardware_breakpoint(tid, address)
+
+ def dont_watch_variable(self, tid, address):
+ """
+ Clears a hardware breakpoint set by L{watch_variable}.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to stop watching.
+ """
+ self.__clear_variable_watch(tid, address)
+
+ def dont_stalk_variable(self, tid, address):
+ """
+ Clears a hardware breakpoint set by L{stalk_variable}.
+
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @type address: int
+ @param address: Memory address of variable to stop watching.
+ """
+ self.__clear_variable_watch(tid, address)
+
+#------------------------------------------------------------------------------
+
+ # Buffer watches
+
+ def __set_buffer_watch(self, pid, address, size, action, bOneShot):
+ """
+ Used by L{watch_buffer} and L{stalk_buffer}.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int
+ @param address: Memory address of buffer to watch.
+
+ @type size: int
+ @param size: Size in bytes of buffer to watch.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_page_breakpoint} for more details.
+
+ @type bOneShot: bool
+ @param bOneShot:
+ C{True} to set a one-shot breakpoint,
+ C{False} to set a normal breakpoint.
+ """
+
+ # Check the size isn't zero or negative.
+ if size < 1:
+ raise ValueError("Bad size for buffer watch: %r" % size)
+
+ # Create the buffer watch identifier.
+ bw = BufferWatch(pid, address, address + size, action, bOneShot)
+
+ # Get the base address and size in pages required for this buffer.
+ base = MemoryAddresses.align_address_to_page_start(address)
+ limit = MemoryAddresses.align_address_to_page_end(address + size)
+ pages = MemoryAddresses.get_buffer_size_in_pages(address, size)
+
+ try:
+
+ # For each page:
+ # + if a page breakpoint exists reuse it
+ # + if it doesn't exist define it
+
+ bset = set() # all breakpoints used
+ nset = set() # newly defined breakpoints
+ cset = set() # condition objects
+
+ page_addr = base
+ pageSize = MemoryAddresses.pageSize
+ while page_addr < limit:
+
+ # If a breakpoints exists, reuse it.
+ if self.has_page_breakpoint(pid, page_addr):
+ bp = self.get_page_breakpoint(pid, page_addr)
+ if bp not in bset:
+ condition = bp.get_condition()
+ if not condition in cset:
+ if not isinstance(condition,_BufferWatchCondition):
+ # this shouldn't happen unless you tinkered
+ # with it or defined your own page breakpoints
+ # manually.
+ msg = "Can't watch buffer at page %s"
+ msg = msg % HexDump.address(page_addr)
+ raise RuntimeError(msg)
+ cset.add(condition)
+ bset.add(bp)
+
+ # If it doesn't, define it.
+ else:
+ condition = _BufferWatchCondition()
+ bp = self.define_page_breakpoint(pid, page_addr, 1,
+ condition = condition)
+ bset.add(bp)
+ nset.add(bp)
+ cset.add(condition)
+
+ # Next page.
+ page_addr = page_addr + pageSize
+
+ # For each breakpoint, enable it if needed.
+ aProcess = self.system.get_process(pid)
+ for bp in bset:
+ if bp.is_disabled() or bp.is_one_shot():
+ bp.enable(aProcess, None)
+
+ # On error...
+ except:
+
+ # Erase the newly defined breakpoints.
+ for bp in nset:
+ try:
+ self.erase_page_breakpoint(pid, bp.get_address())
+ except:
+ pass
+
+ # Pass the exception to the caller
+ raise
+
+ # For each condition object, add the new buffer.
+ for condition in cset:
+ condition.add(bw)
+
+ def __clear_buffer_watch_old_method(self, pid, address, size):
+ """
+ Used by L{dont_watch_buffer} and L{dont_stalk_buffer}.
+
+ @warn: Deprecated since WinAppDbg 1.5.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int
+ @param address: Memory address of buffer to stop watching.
+
+ @type size: int
+ @param size: Size in bytes of buffer to stop watching.
+ """
+ warnings.warn("Deprecated since WinAppDbg 1.5", DeprecationWarning)
+
+ # Check the size isn't zero or negative.
+ if size < 1:
+ raise ValueError("Bad size for buffer watch: %r" % size)
+
+ # Get the base address and size in pages required for this buffer.
+ base = MemoryAddresses.align_address_to_page_start(address)
+ limit = MemoryAddresses.align_address_to_page_end(address + size)
+ pages = MemoryAddresses.get_buffer_size_in_pages(address, size)
+
+ # For each page, get the breakpoint and it's condition object.
+ # For each condition, remove the buffer.
+ # For each breakpoint, if no buffers are on watch, erase it.
+ cset = set() # condition objects
+ page_addr = base
+ pageSize = MemoryAddresses.pageSize
+ while page_addr < limit:
+ if self.has_page_breakpoint(pid, page_addr):
+ bp = self.get_page_breakpoint(pid, page_addr)
+ condition = bp.get_condition()
+ if condition not in cset:
+ if not isinstance(condition, _BufferWatchCondition):
+ # this shouldn't happen unless you tinkered with it
+ # or defined your own page breakpoints manually.
+ continue
+ cset.add(condition)
+ condition.remove_last_match(address, size)
+ if condition.count() == 0:
+ try:
+ self.erase_page_breakpoint(pid, bp.get_address())
+ except WindowsError:
+ pass
+ page_addr = page_addr + pageSize
+
+ def __clear_buffer_watch(self, bw):
+ """
+ Used by L{dont_watch_buffer} and L{dont_stalk_buffer}.
+
+ @type bw: L{BufferWatch}
+ @param bw: Buffer watch identifier.
+ """
+
+ # Get the PID and the start and end addresses of the buffer.
+ pid = bw.pid
+ start = bw.start
+ end = bw.end
+
+ # Get the base address and size in pages required for the buffer.
+ base = MemoryAddresses.align_address_to_page_start(start)
+ limit = MemoryAddresses.align_address_to_page_end(end)
+ pages = MemoryAddresses.get_buffer_size_in_pages(start, end - start)
+
+ # For each page, get the breakpoint and it's condition object.
+ # For each condition, remove the buffer.
+ # For each breakpoint, if no buffers are on watch, erase it.
+ cset = set() # condition objects
+ page_addr = base
+ pageSize = MemoryAddresses.pageSize
+ while page_addr < limit:
+ if self.has_page_breakpoint(pid, page_addr):
+ bp = self.get_page_breakpoint(pid, page_addr)
+ condition = bp.get_condition()
+ if condition not in cset:
+ if not isinstance(condition, _BufferWatchCondition):
+ # this shouldn't happen unless you tinkered with it
+ # or defined your own page breakpoints manually.
+ continue
+ cset.add(condition)
+ condition.remove(bw)
+ if condition.count() == 0:
+ try:
+ self.erase_page_breakpoint(pid, bp.get_address())
+ except WindowsError:
+ msg = "Cannot remove page breakpoint at address %s"
+ msg = msg % HexDump.address( bp.get_address() )
+ warnings.warn(msg, BreakpointWarning)
+ page_addr = page_addr + pageSize
+
+ def watch_buffer(self, pid, address, size, action = None):
+ """
+ Sets a page breakpoint and notifies when the given buffer is accessed.
+
+ @see: L{dont_watch_variable}
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int
+ @param address: Memory address of buffer to watch.
+
+ @type size: int
+ @param size: Size in bytes of buffer to watch.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_page_breakpoint} for more details.
+
+ @rtype: L{BufferWatch}
+ @return: Buffer watch identifier.
+ """
+ self.__set_buffer_watch(pid, address, size, action, False)
+
+ def stalk_buffer(self, pid, address, size, action = None):
+ """
+ Sets a one-shot page breakpoint and notifies
+ when the given buffer is accessed.
+
+ @see: L{dont_watch_variable}
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type address: int
+ @param address: Memory address of buffer to watch.
+
+ @type size: int
+ @param size: Size in bytes of buffer to watch.
+
+ @type action: function
+ @param action: (Optional) Action callback function.
+
+ See L{define_page_breakpoint} for more details.
+
+ @rtype: L{BufferWatch}
+ @return: Buffer watch identifier.
+ """
+ self.__set_buffer_watch(pid, address, size, action, True)
+
+ def dont_watch_buffer(self, bw, *argv, **argd):
+ """
+ Clears a page breakpoint set by L{watch_buffer}.
+
+ @type bw: L{BufferWatch}
+ @param bw:
+ Buffer watch identifier returned by L{watch_buffer}.
+ """
+
+ # The sane way to do it.
+ if not (argv or argd):
+ self.__clear_buffer_watch(bw)
+
+ # Backwards compatibility with WinAppDbg 1.4.
+ else:
+ argv = list(argv)
+ argv.insert(0, bw)
+ if 'pid' in argd:
+ argv.insert(0, argd.pop('pid'))
+ if 'address' in argd:
+ argv.insert(1, argd.pop('address'))
+ if 'size' in argd:
+ argv.insert(2, argd.pop('size'))
+ if argd:
+ raise TypeError("Wrong arguments for dont_watch_buffer()")
+ try:
+ pid, address, size = argv
+ except ValueError:
+ raise TypeError("Wrong arguments for dont_watch_buffer()")
+ self.__clear_buffer_watch_old_method(pid, address, size)
+
+ def dont_stalk_buffer(self, bw, *argv, **argd):
+ """
+ Clears a page breakpoint set by L{stalk_buffer}.
+
+ @type bw: L{BufferWatch}
+ @param bw:
+ Buffer watch identifier returned by L{stalk_buffer}.
+ """
+ self.dont_watch_buffer(bw, *argv, **argd)
+
+#------------------------------------------------------------------------------
+
+ # Tracing
+
+# XXX TODO
+# Add "action" parameter to tracing mode
+
+ def __start_tracing(self, thread):
+ """
+ @type thread: L{Thread}
+ @param thread: Thread to start tracing.
+ """
+ tid = thread.get_tid()
+ if not tid in self.__tracing:
+ thread.set_tf()
+ self.__tracing.add(tid)
+
+ def __stop_tracing(self, thread):
+ """
+ @type thread: L{Thread}
+ @param thread: Thread to stop tracing.
+ """
+ tid = thread.get_tid()
+ if tid in self.__tracing:
+ self.__tracing.remove(tid)
+ if thread.is_alive():
+ thread.clear_tf()
+
+ def is_tracing(self, tid):
+ """
+ @type tid: int
+ @param tid: Thread global ID.
+
+ @rtype: bool
+ @return: C{True} if the thread is being traced, C{False} otherwise.
+ """
+ return tid in self.__tracing
+
+ def get_traced_tids(self):
+ """
+ Retrieves the list of global IDs of all threads being traced.
+
+ @rtype: list( int... )
+ @return: List of thread global IDs.
+ """
+ tids = list(self.__tracing)
+ tids.sort()
+ return tids
+
+ def start_tracing(self, tid):
+ """
+ Start tracing mode in the given thread.
+
+ @type tid: int
+ @param tid: Global ID of thread to start tracing.
+ """
+ if not self.is_tracing(tid):
+ thread = self.system.get_thread(tid)
+ self.__start_tracing(thread)
+
+ def stop_tracing(self, tid):
+ """
+ Stop tracing mode in the given thread.
+
+ @type tid: int
+ @param tid: Global ID of thread to stop tracing.
+ """
+ if self.is_tracing(tid):
+ thread = self.system.get_thread(tid)
+ self.__stop_tracing(thread)
+
+ def start_tracing_process(self, pid):
+ """
+ Start tracing mode for all threads in the given process.
+
+ @type pid: int
+ @param pid: Global ID of process to start tracing.
+ """
+ for thread in self.system.get_process(pid).iter_threads():
+ self.__start_tracing(thread)
+
+ def stop_tracing_process(self, pid):
+ """
+ Stop tracing mode for all threads in the given process.
+
+ @type pid: int
+ @param pid: Global ID of process to stop tracing.
+ """
+ for thread in self.system.get_process(pid).iter_threads():
+ self.__stop_tracing(thread)
+
+ def start_tracing_all(self):
+ """
+ Start tracing mode for all threads in all debugees.
+ """
+ for pid in self.get_debugee_pids():
+ self.start_tracing_process(pid)
+
+ def stop_tracing_all(self):
+ """
+ Stop tracing mode for all threads in all debugees.
+ """
+ for pid in self.get_debugee_pids():
+ self.stop_tracing_process(pid)
+
+#------------------------------------------------------------------------------
+
+ # Break on LastError values (only available since Windows Server 2003)
+
+ def break_on_error(self, pid, errorCode):
+ """
+ Sets or clears the system breakpoint for a given Win32 error code.
+
+ Use L{Process.is_system_defined_breakpoint} to tell if a breakpoint
+ exception was caused by a system breakpoint or by the application
+ itself (for example because of a failed assertion in the code).
+
+ @note: This functionality is only available since Windows Server 2003.
+ In 2003 it only breaks on error values set externally to the
+ kernel32.dll library, but this was fixed in Windows Vista.
+
+ @warn: This method will fail if the debug symbols for ntdll (kernel32
+ in Windows 2003) are not present. For more information see:
+ L{System.fix_symbol_store_path}.
+
+ @see: U{http://www.nynaeve.net/?p=147}
+
+ @type pid: int
+ @param pid: Process ID.
+
+ @type errorCode: int
+ @param errorCode: Win32 error code to stop on. Set to C{0} or
+ C{ERROR_SUCCESS} to clear the breakpoint instead.
+
+ @raise NotImplementedError:
+ The functionality is not supported in this system.
+
+ @raise WindowsError:
+ An error occurred while processing this request.
+ """
+ aProcess = self.system.get_process(pid)
+ address = aProcess.get_break_on_error_ptr()
+ if not address:
+ raise NotImplementedError(
+ "The functionality is not supported in this system.")
+ aProcess.write_dword(address, errorCode)
+
+ def dont_break_on_error(self, pid):
+ """
+ Alias to L{break_on_error}C{(pid, ERROR_SUCCESS)}.
+
+ @type pid: int
+ @param pid: Process ID.
+
+ @raise NotImplementedError:
+ The functionality is not supported in this system.
+
+ @raise WindowsError:
+ An error occurred while processing this request.
+ """
+ self.break_on_error(pid, 0)
+
+#------------------------------------------------------------------------------
+
+ # Simplified symbol resolving, useful for hooking functions
+
+ def resolve_exported_function(self, pid, modName, procName):
+ """
+ Resolves the exported DLL function for the given process.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type modName: str
+ @param modName: Name of the module that exports the function.
+
+ @type procName: str
+ @param procName: Name of the exported function to resolve.
+
+ @rtype: int, None
+ @return: On success, the address of the exported function.
+ On failure, returns C{None}.
+ """
+ aProcess = self.system.get_process(pid)
+ aModule = aProcess.get_module_by_name(modName)
+ if not aModule:
+ aProcess.scan_modules()
+ aModule = aProcess.get_module_by_name(modName)
+ if aModule:
+ address = aModule.resolve(procName)
+ return address
+ return None
+
+ def resolve_label(self, pid, label):
+ """
+ Resolves a label for the given process.
+
+ @type pid: int
+ @param pid: Process global ID.
+
+ @type label: str
+ @param label: Label to resolve.
+
+ @rtype: int
+ @return: Memory address pointed to by the label.
+
+ @raise ValueError: The label is malformed or impossible to resolve.
+ @raise RuntimeError: Cannot resolve the module or function.
+ """
+ return self.get_process(pid).resolve_label(label)
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/compat.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/compat.py
new file mode 100644
index 00000000..ad64901c
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/compat.py
@@ -0,0 +1,183 @@
+# Partial copy of https://bitbucket.org/gutworth/six/src/8e634686c53a35092dd705172440a9231c90ddd1/six.py?at=default
+# With some differences to take into account that the iterXXX version may be defined in user code.
+
+# Original __author__ = "Benjamin Peterson "
+# Base __version__ = "1.7.3"
+
+# Copyright (c) 2010-2014 Benjamin Peterson
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+import sys
+import types
+
+
+
+# Useful for very coarse version differentiation.
+PY2 = sys.version_info[0] == 2
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+ string_types = str,
+ integer_types = int,
+ class_types = type,
+ text_type = str
+ binary_type = bytes
+
+ MAXSIZE = sys.maxsize
+else:
+ string_types = basestring,
+ integer_types = (int, long)
+ class_types = (type, types.ClassType)
+ text_type = unicode
+ binary_type = str
+
+ if sys.platform.startswith("java"):
+ # Jython always uses 32 bits.
+ MAXSIZE = int((1 << 31) - 1)
+ else:
+ # It's possible to have sizeof(long) != sizeof(Py_ssize_t).
+ class X(object):
+ def __len__(self):
+ return 1 << 31
+ try:
+ len(X())
+ except OverflowError:
+ # 32-bit
+ MAXSIZE = int((1 << 31) - 1)
+ else:
+ # 64-bit
+ MAXSIZE = int((1 << 63) - 1)
+ del X
+
+
+if PY3:
+ xrange = range
+ unicode = str
+ bytes = bytes
+ def iterkeys(d, **kw):
+ if hasattr(d, 'iterkeys'):
+ return iter(d.iterkeys(**kw))
+ return iter(d.keys(**kw))
+
+ def itervalues(d, **kw):
+ if hasattr(d, 'itervalues'):
+ return iter(d.itervalues(**kw))
+ return iter(d.values(**kw))
+
+ def iteritems(d, **kw):
+ if hasattr(d, 'iteritems'):
+ return iter(d.iteritems(**kw))
+ return iter(d.items(**kw))
+
+ def iterlists(d, **kw):
+ if hasattr(d, 'iterlists'):
+ return iter(d.iterlists(**kw))
+ return iter(d.lists(**kw))
+
+ def keys(d, **kw):
+ return list(iterkeys(d, **kw))
+else:
+ unicode = unicode
+ xrange = xrange
+ bytes = str
+ def keys(d, **kw):
+ return d.keys(**kw)
+
+ def iterkeys(d, **kw):
+ return iter(d.iterkeys(**kw))
+
+ def itervalues(d, **kw):
+ return iter(d.itervalues(**kw))
+
+ def iteritems(d, **kw):
+ return iter(d.iteritems(**kw))
+
+ def iterlists(d, **kw):
+ return iter(d.iterlists(**kw))
+
+if PY3:
+ import builtins
+ exec_ = getattr(builtins, "exec")
+
+
+ def reraise(tp, value, tb=None):
+ if value is None:
+ value = tp()
+ if value.__traceback__ is not tb:
+ raise value.with_traceback(tb)
+ raise value
+
+else:
+ def exec_(_code_, _globs_=None, _locs_=None):
+ """Execute code in a namespace."""
+ if _globs_ is None:
+ frame = sys._getframe(1)
+ _globs_ = frame.f_globals
+ if _locs_ is None:
+ _locs_ = frame.f_locals
+ del frame
+ elif _locs_ is None:
+ _locs_ = _globs_
+ exec("""exec _code_ in _globs_, _locs_""")
+
+
+ exec_("""def reraise(tp, value, tb=None):
+ raise tp, value, tb
+""")
+
+
+if PY3:
+ import operator
+ def b(s):
+ if isinstance(s, str):
+ return s.encode("latin-1")
+ assert isinstance(s, bytes)
+ return s
+ def u(s):
+ return s
+ unichr = chr
+ if sys.version_info[1] <= 1:
+ def int2byte(i):
+ return bytes((i,))
+ else:
+ # This is about 2x faster than the implementation above on 3.2+
+ int2byte = operator.methodcaller("to_bytes", 1, "big")
+ byte2int = operator.itemgetter(0)
+ indexbytes = operator.getitem
+ iterbytes = iter
+ import io
+ StringIO = io.StringIO
+ BytesIO = io.BytesIO
+else:
+ def b(s):
+ return s
+ # Workaround for standalone backslash
+ def u(s):
+ return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
+ unichr = unichr
+ int2byte = chr
+ def byte2int(bs):
+ return ord(bs[0])
+ def indexbytes(buf, i):
+ return ord(buf[i])
+ def iterbytes(buf):
+ return (ord(byte) for byte in buf)
+ import StringIO
+ StringIO = BytesIO = StringIO.StringIO
\ No newline at end of file
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/crash.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/crash.py
new file mode 100644
index 00000000..a53172e5
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/crash.py
@@ -0,0 +1,1853 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Crash dump support.
+
+@group Crash reporting:
+ Crash, CrashDictionary
+
+@group Warnings:
+ CrashWarning
+
+@group Deprecated classes:
+ CrashContainer, CrashTable, CrashTableMSSQL,
+ VolatileCrashContainer, DummyCrashContainer
+"""
+
+__revision__ = "$Id$"
+
+__all__ = [
+
+ # Object that represents a crash in the debugee.
+ 'Crash',
+
+ # Crash storage.
+ 'CrashDictionary',
+
+ # Warnings.
+ 'CrashWarning',
+
+ # Backwards compatibility with WinAppDbg 1.4 and before.
+ 'CrashContainer',
+ 'CrashTable',
+ 'CrashTableMSSQL',
+ 'VolatileCrashContainer',
+ 'DummyCrashContainer',
+]
+
+from winappdbg import win32
+from winappdbg import compat
+from winappdbg.system import System
+from winappdbg.textio import HexDump, CrashDump
+from winappdbg.util import StaticClass, MemoryAddresses, PathOperations
+
+import sys
+import os
+import time
+import zlib
+import warnings
+
+# lazy imports
+sql = None
+anydbm = None
+
+#==============================================================================
+
+# Secure alternative to pickle, use it if present.
+try:
+ import cerealizer
+ pickle = cerealizer
+
+ # There is no optimization function for cerealized objects.
+ def optimize(picklestring):
+ return picklestring
+
+ # There is no HIGHEST_PROTOCOL in cerealizer.
+ HIGHEST_PROTOCOL = 0
+
+ # Note: it's important NOT to provide backwards compatibility, otherwise
+ # it'd be just the same as not having this!
+ #
+ # To disable this security upgrade simply uncomment the following line:
+ #
+ # raise ImportError("Fallback to pickle for backwards compatibility")
+
+# If cerealizer is not present fallback to the insecure pickle module.
+except ImportError:
+
+ # Faster implementation of the pickle module as a C extension.
+ try:
+ import cPickle as pickle
+
+ # If all fails fallback to the classic pickle module.
+ except ImportError:
+ import pickle
+
+ # Fetch the highest protocol version.
+ HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL
+
+ # Try to use the pickle optimizer if found.
+ try:
+ from pickletools import optimize
+ except ImportError:
+ def optimize(picklestring):
+ return picklestring
+
+class Marshaller (StaticClass):
+ """
+ Custom pickler for L{Crash} objects. Optimizes the pickled data when using
+ the standard C{pickle} (or C{cPickle}) module. The pickled data is then
+ compressed using zlib.
+ """
+
+ @staticmethod
+ def dumps(obj, protocol=HIGHEST_PROTOCOL):
+ return zlib.compress(optimize(pickle.dumps(obj)), 9)
+
+ @staticmethod
+ def loads(data):
+ return pickle.loads(zlib.decompress(data))
+
+#==============================================================================
+
+class CrashWarning (Warning):
+ """
+ An error occurred while gathering crash data.
+ Some data may be incomplete or missing.
+ """
+
+#==============================================================================
+
+# Crash object. Must be serializable.
+class Crash (object):
+ """
+ Represents a crash, bug, or another interesting event in the debugee.
+
+ @group Basic information:
+ timeStamp, signature, eventCode, eventName, pid, tid, arch, os, bits,
+ registers, labelPC, pc, sp, fp
+
+ @group Optional information:
+ debugString,
+ modFileName,
+ lpBaseOfDll,
+ exceptionCode,
+ exceptionName,
+ exceptionDescription,
+ exceptionAddress,
+ exceptionLabel,
+ firstChance,
+ faultType,
+ faultAddress,
+ faultLabel,
+ isOurBreakpoint,
+ isSystemBreakpoint,
+ stackTrace,
+ stackTracePC,
+ stackTraceLabels,
+ stackTracePretty
+
+ @group Extra information:
+ commandLine,
+ environment,
+ environmentData,
+ registersPeek,
+ stackRange,
+ stackFrame,
+ stackPeek,
+ faultCode,
+ faultMem,
+ faultPeek,
+ faultDisasm,
+ memoryMap
+
+ @group Report:
+ briefReport, fullReport, notesReport, environmentReport, isExploitable
+
+ @group Notes:
+ addNote, getNotes, iterNotes, hasNotes, clearNotes, notes
+
+ @group Miscellaneous:
+ fetch_extra_data
+
+ @type timeStamp: float
+ @ivar timeStamp: Timestamp as returned by time.time().
+
+ @type signature: object
+ @ivar signature: Approximately unique signature for the Crash object.
+
+ This signature can be used as an heuristic to determine if two crashes
+ were caused by the same software error. Ideally it should be treated as
+ as opaque serializable object that can be tested for equality.
+
+ @type notes: list( str )
+ @ivar notes: List of strings, each string is a note.
+
+ @type eventCode: int
+ @ivar eventCode: Event code as defined by the Win32 API.
+
+ @type eventName: str
+ @ivar eventName: Event code user-friendly name.
+
+ @type pid: int
+ @ivar pid: Process global ID.
+
+ @type tid: int
+ @ivar tid: Thread global ID.
+
+ @type arch: str
+ @ivar arch: Processor architecture.
+
+ @type os: str
+ @ivar os: Operating system version.
+
+ May indicate a 64 bit version even if L{arch} and L{bits} indicate 32
+ bits. This means the crash occurred inside a WOW64 process.
+
+ @type bits: int
+ @ivar bits: C{32} or C{64} bits.
+
+ @type commandLine: None or str
+ @ivar commandLine: Command line for the target process.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type environmentData: None or list of str
+ @ivar environmentData: Environment data for the target process.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type environment: None or dict( str S{->} str )
+ @ivar environment: Environment variables for the target process.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type registers: dict( str S{->} int )
+ @ivar registers: Dictionary mapping register names to their values.
+
+ @type registersPeek: None or dict( str S{->} str )
+ @ivar registersPeek: Dictionary mapping register names to the data they point to.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type labelPC: None or str
+ @ivar labelPC: Label pointing to the program counter.
+
+ C{None} or invalid if unapplicable or unable to retrieve.
+
+ @type debugString: None or str
+ @ivar debugString: Debug string sent by the debugee.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type exceptionCode: None or int
+ @ivar exceptionCode: Exception code as defined by the Win32 API.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type exceptionName: None or str
+ @ivar exceptionName: Exception code user-friendly name.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type exceptionDescription: None or str
+ @ivar exceptionDescription: Exception description.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type exceptionAddress: None or int
+ @ivar exceptionAddress: Memory address where the exception occured.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type exceptionLabel: None or str
+ @ivar exceptionLabel: Label pointing to the exception address.
+
+ C{None} or invalid if unapplicable or unable to retrieve.
+
+ @type faultType: None or int
+ @ivar faultType: Access violation type.
+ Only applicable to memory faults.
+ Should be one of the following constants:
+
+ - L{win32.ACCESS_VIOLATION_TYPE_READ}
+ - L{win32.ACCESS_VIOLATION_TYPE_WRITE}
+ - L{win32.ACCESS_VIOLATION_TYPE_DEP}
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type faultAddress: None or int
+ @ivar faultAddress: Access violation memory address.
+ Only applicable to memory faults.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type faultLabel: None or str
+ @ivar faultLabel: Label pointing to the access violation memory address.
+ Only applicable to memory faults.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type firstChance: None or bool
+ @ivar firstChance:
+ C{True} for first chance exceptions, C{False} for second chance.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type isOurBreakpoint: bool
+ @ivar isOurBreakpoint:
+ C{True} for breakpoints defined by the L{Debug} class,
+ C{False} otherwise.
+
+ C{None} if unapplicable.
+
+ @type isSystemBreakpoint: bool
+ @ivar isSystemBreakpoint:
+ C{True} for known system-defined breakpoints,
+ C{False} otherwise.
+
+ C{None} if unapplicable.
+
+ @type modFileName: None or str
+ @ivar modFileName: File name of module where the program counter points to.
+
+ C{None} or invalid if unapplicable or unable to retrieve.
+
+ @type lpBaseOfDll: None or int
+ @ivar lpBaseOfDll: Base of module where the program counter points to.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type stackTrace: None or tuple of tuple( int, int, str )
+ @ivar stackTrace:
+ Stack trace of the current thread as a tuple of
+ ( frame pointer, return address, module filename ).
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type stackTracePretty: None or tuple of tuple( int, str )
+ @ivar stackTracePretty:
+ Stack trace of the current thread as a tuple of
+ ( frame pointer, return location ).
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type stackTracePC: None or tuple( int... )
+ @ivar stackTracePC: Tuple of return addresses in the stack trace.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type stackTraceLabels: None or tuple( str... )
+ @ivar stackTraceLabels:
+ Tuple of labels pointing to the return addresses in the stack trace.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type stackRange: tuple( int, int )
+ @ivar stackRange:
+ Stack beginning and end pointers, in memory addresses order.
+
+ C{None} if unapplicable or unable to retrieve.
+
+ @type stackFrame: None or str
+ @ivar stackFrame: Data pointed to by the stack pointer.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type stackPeek: None or dict( int S{->} str )
+ @ivar stackPeek: Dictionary mapping stack offsets to the data they point to.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type faultCode: None or str
+ @ivar faultCode: Data pointed to by the program counter.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type faultMem: None or str
+ @ivar faultMem: Data pointed to by the exception address.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type faultPeek: None or dict( intS{->} str )
+ @ivar faultPeek: Dictionary mapping guessed pointers at L{faultMem} to the data they point to.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type faultDisasm: None or tuple of tuple( long, int, str, str )
+ @ivar faultDisasm: Dissassembly around the program counter.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type memoryMap: None or list of L{win32.MemoryBasicInformation} objects.
+ @ivar memoryMap: Memory snapshot of the program. May contain the actual
+ data from the entire process memory if requested.
+ See L{fetch_extra_data} for more details.
+
+ C{None} or empty if unapplicable or unable to retrieve.
+
+ @type _rowid: int
+ @ivar _rowid: Row ID in the database. Internally used by the DAO layer.
+ Only present in crash dumps retrieved from the database. Do not rely
+ on this property to be present in future versions of WinAppDbg.
+ """
+
+ def __init__(self, event):
+ """
+ @type event: L{Event}
+ @param event: Event object for crash.
+ """
+
+ # First of all, take the timestamp.
+ self.timeStamp = time.time()
+
+ # Notes are initially empty.
+ self.notes = list()
+
+ # Get the process and thread, but dont't store them in the DB.
+ process = event.get_process()
+ thread = event.get_thread()
+
+ # Determine the architecture.
+ self.os = System.os
+ self.arch = process.get_arch()
+ self.bits = process.get_bits()
+
+ # The following properties are always retrieved for all events.
+ self.eventCode = event.get_event_code()
+ self.eventName = event.get_event_name()
+ self.pid = event.get_pid()
+ self.tid = event.get_tid()
+ self.registers = dict(thread.get_context())
+ self.labelPC = process.get_label_at_address(self.pc)
+
+ # The following properties are only retrieved for some events.
+ self.commandLine = None
+ self.environment = None
+ self.environmentData = None
+ self.registersPeek = None
+ self.debugString = None
+ self.modFileName = None
+ self.lpBaseOfDll = None
+ self.exceptionCode = None
+ self.exceptionName = None
+ self.exceptionDescription = None
+ self.exceptionAddress = None
+ self.exceptionLabel = None
+ self.firstChance = None
+ self.faultType = None
+ self.faultAddress = None
+ self.faultLabel = None
+ self.isOurBreakpoint = None
+ self.isSystemBreakpoint = None
+ self.stackTrace = None
+ self.stackTracePC = None
+ self.stackTraceLabels = None
+ self.stackTracePretty = None
+ self.stackRange = None
+ self.stackFrame = None
+ self.stackPeek = None
+ self.faultCode = None
+ self.faultMem = None
+ self.faultPeek = None
+ self.faultDisasm = None
+ self.memoryMap = None
+
+ # Get information for debug string events.
+ if self.eventCode == win32.OUTPUT_DEBUG_STRING_EVENT:
+ self.debugString = event.get_debug_string()
+
+ # Get information for module load and unload events.
+ # For create and exit process events, get the information
+ # for the main module.
+ elif self.eventCode in (win32.CREATE_PROCESS_DEBUG_EVENT,
+ win32.EXIT_PROCESS_DEBUG_EVENT,
+ win32.LOAD_DLL_DEBUG_EVENT,
+ win32.UNLOAD_DLL_DEBUG_EVENT):
+ aModule = event.get_module()
+ self.modFileName = event.get_filename()
+ if not self.modFileName:
+ self.modFileName = aModule.get_filename()
+ self.lpBaseOfDll = event.get_module_base()
+ if not self.lpBaseOfDll:
+ self.lpBaseOfDll = aModule.get_base()
+
+ # Get some information for exception events.
+ # To get the remaining information call fetch_extra_data().
+ elif self.eventCode == win32.EXCEPTION_DEBUG_EVENT:
+
+ # Exception information.
+ self.exceptionCode = event.get_exception_code()
+ self.exceptionName = event.get_exception_name()
+ self.exceptionDescription = event.get_exception_description()
+ self.exceptionAddress = event.get_exception_address()
+ self.firstChance = event.is_first_chance()
+ self.exceptionLabel = process.get_label_at_address(
+ self.exceptionAddress)
+ if self.exceptionCode in (win32.EXCEPTION_ACCESS_VIOLATION,
+ win32.EXCEPTION_GUARD_PAGE,
+ win32.EXCEPTION_IN_PAGE_ERROR):
+ self.faultType = event.get_fault_type()
+ self.faultAddress = event.get_fault_address()
+ self.faultLabel = process.get_label_at_address(
+ self.faultAddress)
+ elif self.exceptionCode in (win32.EXCEPTION_BREAKPOINT,
+ win32.EXCEPTION_SINGLE_STEP):
+ self.isOurBreakpoint = hasattr(event, 'breakpoint') \
+ and event.breakpoint
+ self.isSystemBreakpoint = \
+ process.is_system_defined_breakpoint(self.exceptionAddress)
+
+ # Stack trace.
+ try:
+ self.stackTracePretty = thread.get_stack_trace_with_labels()
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn(
+ "Cannot get stack trace with labels, reason: %s" % str(e),
+ CrashWarning)
+ try:
+ self.stackTrace = thread.get_stack_trace()
+ stackTracePC = [ ra for (_,ra,_) in self.stackTrace ]
+ self.stackTracePC = tuple(stackTracePC)
+ stackTraceLabels = [ process.get_label_at_address(ra) \
+ for ra in self.stackTracePC ]
+ self.stackTraceLabels = tuple(stackTraceLabels)
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn("Cannot get stack trace, reason: %s" % str(e),
+ CrashWarning)
+
+ def fetch_extra_data(self, event, takeMemorySnapshot = 0):
+ """
+ Fetch extra data from the L{Event} object.
+
+ @note: Since this method may take a little longer to run, it's best to
+ call it only after you've determined the crash is interesting and
+ you want to save it.
+
+ @type event: L{Event}
+ @param event: Event object for crash.
+
+ @type takeMemorySnapshot: int
+ @param takeMemorySnapshot:
+ Memory snapshot behavior:
+ - C{0} to take no memory information (default).
+ - C{1} to take only the memory map.
+ See L{Process.get_memory_map}.
+ - C{2} to take a full memory snapshot.
+ See L{Process.take_memory_snapshot}.
+ - C{3} to take a live memory snapshot.
+ See L{Process.generate_memory_snapshot}.
+ """
+
+ # Get the process and thread, we'll use them below.
+ process = event.get_process()
+ thread = event.get_thread()
+
+ # Get the command line for the target process.
+ try:
+ self.commandLine = process.get_command_line()
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn("Cannot get command line, reason: %s" % str(e),
+ CrashWarning)
+
+ # Get the environment variables for the target process.
+ try:
+ self.environmentData = process.get_environment_data()
+ self.environment = process.parse_environment_data(
+ self.environmentData)
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn("Cannot get environment, reason: %s" % str(e),
+ CrashWarning)
+
+ # Data pointed to by registers.
+ self.registersPeek = thread.peek_pointers_in_registers()
+
+ # Module where execution is taking place.
+ aModule = process.get_module_at_address(self.pc)
+ if aModule is not None:
+ self.modFileName = aModule.get_filename()
+ self.lpBaseOfDll = aModule.get_base()
+
+ # Contents of the stack frame.
+ try:
+ self.stackRange = thread.get_stack_range()
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn("Cannot get stack range, reason: %s" % str(e),
+ CrashWarning)
+ try:
+ self.stackFrame = thread.get_stack_frame()
+ stackFrame = self.stackFrame
+ except Exception:
+ self.stackFrame = thread.peek_stack_data()
+ stackFrame = self.stackFrame[:64]
+ if stackFrame:
+ self.stackPeek = process.peek_pointers_in_data(stackFrame)
+
+ # Code being executed.
+ self.faultCode = thread.peek_code_bytes()
+ try:
+ self.faultDisasm = thread.disassemble_around_pc(32)
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn("Cannot disassemble, reason: %s" % str(e),
+ CrashWarning)
+
+ # For memory related exceptions, get the memory contents
+ # of the location that caused the exception to be raised.
+ if self.eventCode == win32.EXCEPTION_DEBUG_EVENT:
+ if self.pc != self.exceptionAddress and self.exceptionCode in (
+ win32.EXCEPTION_ACCESS_VIOLATION,
+ win32.EXCEPTION_ARRAY_BOUNDS_EXCEEDED,
+ win32.EXCEPTION_DATATYPE_MISALIGNMENT,
+ win32.EXCEPTION_IN_PAGE_ERROR,
+ win32.EXCEPTION_STACK_OVERFLOW,
+ win32.EXCEPTION_GUARD_PAGE,
+ ):
+ self.faultMem = process.peek(self.exceptionAddress, 64)
+ if self.faultMem:
+ self.faultPeek = process.peek_pointers_in_data(
+ self.faultMem)
+
+ # TODO: maybe add names and versions of DLLs and EXE?
+
+ # Take a snapshot of the process memory. Additionally get the
+ # memory contents if requested.
+ if takeMemorySnapshot == 1:
+ self.memoryMap = process.get_memory_map()
+ mappedFilenames = process.get_mapped_filenames(self.memoryMap)
+ for mbi in self.memoryMap:
+ mbi.filename = mappedFilenames.get(mbi.BaseAddress, None)
+ mbi.content = None
+ elif takeMemorySnapshot == 2:
+ self.memoryMap = process.take_memory_snapshot()
+ elif takeMemorySnapshot == 3:
+ self.memoryMap = process.generate_memory_snapshot()
+
+ @property
+ def pc(self):
+ """
+ Value of the program counter register.
+
+ @rtype: int
+ """
+ try:
+ return self.registers['Eip'] # i386
+ except KeyError:
+ return self.registers['Rip'] # amd64
+
+ @property
+ def sp(self):
+ """
+ Value of the stack pointer register.
+
+ @rtype: int
+ """
+ try:
+ return self.registers['Esp'] # i386
+ except KeyError:
+ return self.registers['Rsp'] # amd64
+
+ @property
+ def fp(self):
+ """
+ Value of the frame pointer register.
+
+ @rtype: int
+ """
+ try:
+ return self.registers['Ebp'] # i386
+ except KeyError:
+ return self.registers['Rbp'] # amd64
+
+ def __str__(self):
+ return self.fullReport()
+
+ def key(self):
+ """
+ Alias of L{signature}. Deprecated since WinAppDbg 1.5.
+ """
+ warnings.warn("Crash.key() method was deprecated in WinAppDbg 1.5",
+ DeprecationWarning)
+ return self.signature
+
+ @property
+ def signature(self):
+ if self.labelPC:
+ pc = self.labelPC
+ else:
+ pc = self.pc
+ if self.stackTraceLabels:
+ trace = self.stackTraceLabels
+ else:
+ trace = self.stackTracePC
+ return (
+ self.arch,
+ self.eventCode,
+ self.exceptionCode,
+ pc,
+ trace,
+ self.debugString,
+ )
+ # TODO
+ # add the name and version of the binary where the crash happened?
+
+ def isExploitable(self):
+ """
+ Guess how likely is it that the bug causing the crash can be leveraged
+ into an exploitable vulnerability.
+
+ @note: Don't take this as an equivalent of a real exploitability
+ analysis, that can only be done by a human being! This is only
+ a guideline, useful for example to sort crashes - placing the most
+ interesting ones at the top.
+
+ @see: The heuristics are similar to those of the B{!exploitable}
+ extension for I{WinDBG}, which can be downloaded from here:
+
+ U{http://www.codeplex.com/msecdbg}
+
+ @rtype: tuple( str, str, str )
+ @return: The first element of the tuple is the result of the analysis,
+ being one of the following:
+
+ - Not an exception
+ - Not exploitable
+ - Not likely exploitable
+ - Unknown
+ - Probably exploitable
+ - Exploitable
+
+ The second element of the tuple is a code to identify the matched
+ heuristic rule.
+
+ The third element of the tuple is a description string of the
+ reason behind the result.
+ """
+
+ # Terminal rules
+
+ if self.eventCode != win32.EXCEPTION_DEBUG_EVENT:
+ return ("Not an exception", "NotAnException", "The event is not an exception.")
+
+ if self.stackRange and self.pc is not None and self.stackRange[0] <= self.pc < self.stackRange[1]:
+ return ("Exploitable", "StackCodeExecution", "Code execution from the stack is considered exploitable.")
+
+ # This rule is NOT from !exploitable
+ if self.stackRange and self.sp is not None and not (self.stackRange[0] <= self.sp < self.stackRange[1]):
+ return ("Exploitable", "StackPointerCorruption", "Stack pointer corruption is considered exploitable.")
+
+ if self.exceptionCode == win32.EXCEPTION_ILLEGAL_INSTRUCTION:
+ return ("Exploitable", "IllegalInstruction", "An illegal instruction exception indicates that the attacker controls execution flow.")
+
+ if self.exceptionCode == win32.EXCEPTION_PRIV_INSTRUCTION:
+ return ("Exploitable", "PrivilegedInstruction", "A privileged instruction exception indicates that the attacker controls execution flow.")
+
+ if self.exceptionCode == win32.EXCEPTION_GUARD_PAGE:
+ return ("Exploitable", "GuardPage", "A guard page violation indicates a stack overflow has occured, and the stack of another thread was reached (possibly the overflow length is not controlled by the attacker).")
+
+ if self.exceptionCode == win32.STATUS_STACK_BUFFER_OVERRUN:
+ return ("Exploitable", "GSViolation", "An overrun of a protected stack buffer has been detected. This is considered exploitable, and must be fixed.")
+
+ if self.exceptionCode == win32.STATUS_HEAP_CORRUPTION:
+ return ("Exploitable", "HeapCorruption", "Heap Corruption has been detected. This is considered exploitable, and must be fixed.")
+
+ if self.exceptionCode == win32.EXCEPTION_ACCESS_VIOLATION:
+ nearNull = self.faultAddress is None or MemoryAddresses.align_address_to_page_start(self.faultAddress) == 0
+ controlFlow = self.__is_control_flow()
+ blockDataMove = self.__is_block_data_move()
+ if self.faultType == win32.EXCEPTION_EXECUTE_FAULT:
+ if nearNull:
+ return ("Probably exploitable", "DEPViolation", "User mode DEP access violations are probably exploitable if near NULL.")
+ else:
+ return ("Exploitable", "DEPViolation", "User mode DEP access violations are exploitable.")
+ elif self.faultType == win32.EXCEPTION_WRITE_FAULT:
+ if nearNull:
+ return ("Probably exploitable", "WriteAV", "User mode write access violations that are near NULL are probably exploitable.")
+ else:
+ return ("Exploitable", "WriteAV", "User mode write access violations that are not near NULL are exploitable.")
+ elif self.faultType == win32.EXCEPTION_READ_FAULT:
+ if self.faultAddress == self.pc:
+ if nearNull:
+ return ("Probably exploitable", "ReadAVonIP", "Access violations at the instruction pointer are probably exploitable if near NULL.")
+ else:
+ return ("Exploitable", "ReadAVonIP", "Access violations at the instruction pointer are exploitable if not near NULL.")
+ if controlFlow:
+ if nearNull:
+ return ("Probably exploitable", "ReadAVonControlFlow", "Access violations near null in control flow instructions are considered probably exploitable.")
+ else:
+ return ("Exploitable", "ReadAVonControlFlow", "Access violations not near null in control flow instructions are considered exploitable.")
+ if blockDataMove:
+ return ("Probably exploitable", "ReadAVonBlockMove", "This is a read access violation in a block data move, and is therefore classified as probably exploitable.")
+
+ # Rule: Tainted information used to control branch addresses is considered probably exploitable
+ # Rule: Tainted information used to control the target of a later write is probably exploitable
+
+ # Non terminal rules
+
+ # XXX TODO add rule to check if code is in writeable memory (probably exploitable)
+
+ # XXX TODO maybe we should be returning a list of tuples instead?
+
+ result = ("Unknown", "Unknown", "Exploitability unknown.")
+
+ if self.exceptionCode == win32.EXCEPTION_ACCESS_VIOLATION:
+ if self.faultType == win32.EXCEPTION_READ_FAULT:
+ if nearNull:
+ result = ("Not likely exploitable", "ReadAVNearNull", "This is a user mode read access violation near null, and is probably not exploitable.")
+
+ elif self.exceptionCode == win32.EXCEPTION_INT_DIVIDE_BY_ZERO:
+ result = ("Not likely exploitable", "DivideByZero", "This is an integer divide by zero, and is probably not exploitable.")
+
+ elif self.exceptionCode == win32.EXCEPTION_FLT_DIVIDE_BY_ZERO:
+ result = ("Not likely exploitable", "DivideByZero", "This is a floating point divide by zero, and is probably not exploitable.")
+
+ elif self.exceptionCode in (win32.EXCEPTION_BREAKPOINT, win32.STATUS_WX86_BREAKPOINT):
+ result = ("Unknown", "Breakpoint", "While a breakpoint itself is probably not exploitable, it may also be an indication that an attacker is testing a target. In either case breakpoints should not exist in production code.")
+
+ # Rule: If the stack contains unknown symbols in user mode, call that out
+ # Rule: Tainted information used to control the source of a later block move unknown, but called out explicitly
+ # Rule: Tainted information used as an argument to a function is an unknown risk, but called out explicitly
+ # Rule: Tainted information used to control branch selection is an unknown risk, but called out explicitly
+
+ return result
+
+ def __is_control_flow(self):
+ """
+ Private method to tell if the instruction pointed to by the program
+ counter is a control flow instruction.
+
+ Currently only works for x86 and amd64 architectures.
+ """
+ jump_instructions = (
+ 'jmp', 'jecxz', 'jcxz',
+ 'ja', 'jnbe', 'jae', 'jnb', 'jb', 'jnae', 'jbe', 'jna', 'jc', 'je',
+ 'jz', 'jnc', 'jne', 'jnz', 'jnp', 'jpo', 'jp', 'jpe', 'jg', 'jnle',
+ 'jge', 'jnl', 'jl', 'jnge', 'jle', 'jng', 'jno', 'jns', 'jo', 'js'
+ )
+ call_instructions = ( 'call', 'ret', 'retn' )
+ loop_instructions = ( 'loop', 'loopz', 'loopnz', 'loope', 'loopne' )
+ control_flow_instructions = call_instructions + loop_instructions + \
+ jump_instructions
+ isControlFlow = False
+ instruction = None
+ if self.pc is not None and self.faultDisasm:
+ for disasm in self.faultDisasm:
+ if disasm[0] == self.pc:
+ instruction = disasm[2].lower().strip()
+ break
+ if instruction:
+ for x in control_flow_instructions:
+ if x in instruction:
+ isControlFlow = True
+ break
+ return isControlFlow
+
+ def __is_block_data_move(self):
+ """
+ Private method to tell if the instruction pointed to by the program
+ counter is a block data move instruction.
+
+ Currently only works for x86 and amd64 architectures.
+ """
+ block_data_move_instructions = ('movs', 'stos', 'lods')
+ isBlockDataMove = False
+ instruction = None
+ if self.pc is not None and self.faultDisasm:
+ for disasm in self.faultDisasm:
+ if disasm[0] == self.pc:
+ instruction = disasm[2].lower().strip()
+ break
+ if instruction:
+ for x in block_data_move_instructions:
+ if x in instruction:
+ isBlockDataMove = True
+ break
+ return isBlockDataMove
+
+ def briefReport(self):
+ """
+ @rtype: str
+ @return: Short description of the event.
+ """
+ if self.exceptionCode is not None:
+ if self.exceptionCode == win32.EXCEPTION_BREAKPOINT:
+ if self.isOurBreakpoint:
+ what = "Breakpoint hit"
+ elif self.isSystemBreakpoint:
+ what = "System breakpoint hit"
+ else:
+ what = "Assertion failed"
+ elif self.exceptionDescription:
+ what = self.exceptionDescription
+ elif self.exceptionName:
+ what = self.exceptionName
+ else:
+ what = "Exception %s" % \
+ HexDump.integer(self.exceptionCode, self.bits)
+ if self.firstChance:
+ chance = 'first'
+ else:
+ chance = 'second'
+ if self.exceptionLabel:
+ where = self.exceptionLabel
+ elif self.exceptionAddress:
+ where = HexDump.address(self.exceptionAddress, self.bits)
+ elif self.labelPC:
+ where = self.labelPC
+ else:
+ where = HexDump.address(self.pc, self.bits)
+ msg = "%s (%s chance) at %s" % (what, chance, where)
+ elif self.debugString is not None:
+ if self.labelPC:
+ where = self.labelPC
+ else:
+ where = HexDump.address(self.pc, self.bits)
+ msg = "Debug string from %s: %r" % (where, self.debugString)
+ else:
+ if self.labelPC:
+ where = self.labelPC
+ else:
+ where = HexDump.address(self.pc, self.bits)
+ msg = "%s (%s) at %s" % (
+ self.eventName,
+ HexDump.integer(self.eventCode, self.bits),
+ where
+ )
+ return msg
+
+ def fullReport(self, bShowNotes = True):
+ """
+ @type bShowNotes: bool
+ @param bShowNotes: C{True} to show the user notes, C{False} otherwise.
+
+ @rtype: str
+ @return: Long description of the event.
+ """
+ msg = self.briefReport()
+ msg += '\n'
+
+ if self.bits == 32:
+ width = 16
+ else:
+ width = 8
+
+ if self.eventCode == win32.EXCEPTION_DEBUG_EVENT:
+ (exploitability, expcode, expdescription) = self.isExploitable()
+ msg += '\nSecurity risk level: %s\n' % exploitability
+ msg += ' %s\n' % expdescription
+
+ if bShowNotes and self.notes:
+ msg += '\nNotes:\n'
+ msg += self.notesReport()
+
+ if self.commandLine:
+ msg += '\nCommand line: %s\n' % self.commandLine
+
+ if self.environment:
+ msg += '\nEnvironment:\n'
+ msg += self.environmentReport()
+
+ if not self.labelPC:
+ base = HexDump.address(self.lpBaseOfDll, self.bits)
+ if self.modFileName:
+ fn = PathOperations.pathname_to_filename(self.modFileName)
+ msg += '\nRunning in %s (%s)\n' % (fn, base)
+ else:
+ msg += '\nRunning in module at %s\n' % base
+
+ if self.registers:
+ msg += '\nRegisters:\n'
+ msg += CrashDump.dump_registers(self.registers)
+ if self.registersPeek:
+ msg += '\n'
+ msg += CrashDump.dump_registers_peek(self.registers,
+ self.registersPeek,
+ width = width)
+
+ if self.faultDisasm:
+ msg += '\nCode disassembly:\n'
+ msg += CrashDump.dump_code(self.faultDisasm, self.pc,
+ bits = self.bits)
+
+ if self.stackTrace:
+ msg += '\nStack trace:\n'
+ if self.stackTracePretty:
+ msg += CrashDump.dump_stack_trace_with_labels(
+ self.stackTracePretty,
+ bits = self.bits)
+ else:
+ msg += CrashDump.dump_stack_trace(self.stackTrace,
+ bits = self.bits)
+
+ if self.stackFrame:
+ if self.stackPeek:
+ msg += '\nStack pointers:\n'
+ msg += CrashDump.dump_stack_peek(self.stackPeek, width = width)
+ msg += '\nStack dump:\n'
+ msg += HexDump.hexblock(self.stackFrame, self.sp,
+ bits = self.bits, width = width)
+
+ if self.faultCode and not self.modFileName:
+ msg += '\nCode dump:\n'
+ msg += HexDump.hexblock(self.faultCode, self.pc,
+ bits = self.bits, width = width)
+
+ if self.faultMem:
+ if self.faultPeek:
+ msg += '\nException address pointers:\n'
+ msg += CrashDump.dump_data_peek(self.faultPeek,
+ self.exceptionAddress,
+ bits = self.bits,
+ width = width)
+ msg += '\nException address dump:\n'
+ msg += HexDump.hexblock(self.faultMem, self.exceptionAddress,
+ bits = self.bits, width = width)
+
+ if self.memoryMap:
+ msg += '\nMemory map:\n'
+ mappedFileNames = dict()
+ for mbi in self.memoryMap:
+ if hasattr(mbi, 'filename') and mbi.filename:
+ mappedFileNames[mbi.BaseAddress] = mbi.filename
+ msg += CrashDump.dump_memory_map(self.memoryMap, mappedFileNames,
+ bits = self.bits)
+
+ if not msg.endswith('\n\n'):
+ if not msg.endswith('\n'):
+ msg += '\n'
+ msg += '\n'
+ return msg
+
+ def environmentReport(self):
+ """
+ @rtype: str
+ @return: The process environment variables,
+ merged and formatted for a report.
+ """
+ msg = ''
+ if self.environment:
+ for key, value in compat.iteritems(self.environment):
+ msg += ' %s=%s\n' % (key, value)
+ return msg
+
+ def notesReport(self):
+ """
+ @rtype: str
+ @return: All notes, merged and formatted for a report.
+ """
+ msg = ''
+ if self.notes:
+ for n in self.notes:
+ n = n.strip('\n')
+ if '\n' in n:
+ n = n.strip('\n')
+ msg += ' * %s\n' % n.pop(0)
+ for x in n:
+ msg += ' %s\n' % x
+ else:
+ msg += ' * %s\n' % n
+ return msg
+
+ def addNote(self, msg):
+ """
+ Add a note to the crash event.
+
+ @type msg: str
+ @param msg: Note text.
+ """
+ self.notes.append(msg)
+
+ def clearNotes(self):
+ """
+ Clear the notes of this crash event.
+ """
+ self.notes = list()
+
+ def getNotes(self):
+ """
+ Get the list of notes of this crash event.
+
+ @rtype: list( str )
+ @return: List of notes.
+ """
+ return self.notes
+
+ def iterNotes(self):
+ """
+ Iterate the notes of this crash event.
+
+ @rtype: listiterator
+ @return: Iterator of the list of notes.
+ """
+ return self.notes.__iter__()
+
+ def hasNotes(self):
+ """
+ @rtype: bool
+ @return: C{True} if there are notes for this crash event.
+ """
+ return bool( self.notes )
+
+#==============================================================================
+
+class CrashContainer (object):
+ """
+ Old crash dump persistencer using a DBM database.
+ Doesn't support duplicate crashes.
+
+ @warning:
+ DBM database support is provided for backwards compatibility with older
+ versions of WinAppDbg. New applications should not use this class.
+ Also, DBM databases in Python suffer from multiple problems that can
+ easily be avoided by switching to a SQL database.
+
+ @see: If you really must use a DBM database, try the standard C{shelve}
+ module instead: U{http://docs.python.org/library/shelve.html}
+
+ @group Marshalling configuration:
+ optimizeKeys, optimizeValues, compressKeys, compressValues, escapeKeys,
+ escapeValues, binaryKeys, binaryValues
+
+ @type optimizeKeys: bool
+ @cvar optimizeKeys: Ignored by the current implementation.
+
+ Up to WinAppDbg 1.4 this setting caused the database keys to be
+ optimized when pickled with the standard C{pickle} module.
+
+ But with a DBM database backend that causes inconsistencies, since the
+ same key can be serialized into multiple optimized pickles, thus losing
+ uniqueness.
+
+ @type optimizeValues: bool
+ @cvar optimizeValues: C{True} to optimize the marshalling of keys, C{False}
+ otherwise. Only used with the C{pickle} module, ignored when using the
+ more secure C{cerealizer} module.
+
+ @type compressKeys: bool
+ @cvar compressKeys: C{True} to compress keys when marshalling, C{False}
+ to leave them uncompressed.
+
+ @type compressValues: bool
+ @cvar compressValues: C{True} to compress values when marshalling, C{False}
+ to leave them uncompressed.
+
+ @type escapeKeys: bool
+ @cvar escapeKeys: C{True} to escape keys when marshalling, C{False}
+ to leave them uncompressed.
+
+ @type escapeValues: bool
+ @cvar escapeValues: C{True} to escape values when marshalling, C{False}
+ to leave them uncompressed.
+
+ @type binaryKeys: bool
+ @cvar binaryKeys: C{True} to marshall keys to binary format (the Python
+ C{buffer} type), C{False} to use text marshalled keys (C{str} type).
+
+ @type binaryValues: bool
+ @cvar binaryValues: C{True} to marshall values to binary format (the Python
+ C{buffer} type), C{False} to use text marshalled values (C{str} type).
+ """
+
+ optimizeKeys = False
+ optimizeValues = True
+ compressKeys = False
+ compressValues = True
+ escapeKeys = False
+ escapeValues = False
+ binaryKeys = False
+ binaryValues = False
+
+ def __init__(self, filename = None, allowRepeatedKeys = False):
+ """
+ @type filename: str
+ @param filename: (Optional) File name for crash database.
+ If no filename is specified, the container is volatile.
+
+ Volatile containers are stored only in memory and
+ destroyed when they go out of scope.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ Currently not supported, always use C{False}.
+ """
+ if allowRepeatedKeys:
+ raise NotImplementedError()
+ self.__filename = filename
+ if filename:
+ global anydbm
+ if not anydbm:
+ import anydbm
+ self.__db = anydbm.open(filename, 'c')
+ self.__keys = dict([ (self.unmarshall_key(mk), mk)
+ for mk in self.__db.keys() ])
+ else:
+ self.__db = dict()
+ self.__keys = dict()
+
+ def remove_key(self, key):
+ """
+ Removes the given key from the set of known keys.
+
+ @type key: L{Crash} key.
+ @param key: Key to remove.
+ """
+ del self.__keys[key]
+
+ def marshall_key(self, key):
+ """
+ Marshalls a Crash key to be used in the database.
+
+ @see: L{__init__}
+
+ @type key: L{Crash} key.
+ @param key: Key to convert.
+
+ @rtype: str or buffer
+ @return: Converted key.
+ """
+ if key in self.__keys:
+ return self.__keys[key]
+ skey = pickle.dumps(key, protocol = 0)
+ if self.compressKeys:
+ skey = zlib.compress(skey, zlib.Z_BEST_COMPRESSION)
+ if self.escapeKeys:
+ skey = skey.encode('hex')
+ if self.binaryKeys:
+ skey = buffer(skey)
+ self.__keys[key] = skey
+ return skey
+
+ def unmarshall_key(self, key):
+ """
+ Unmarshalls a Crash key read from the database.
+
+ @type key: str or buffer
+ @param key: Key to convert.
+
+ @rtype: L{Crash} key.
+ @return: Converted key.
+ """
+ key = str(key)
+ if self.escapeKeys:
+ key = key.decode('hex')
+ if self.compressKeys:
+ key = zlib.decompress(key)
+ key = pickle.loads(key)
+ return key
+
+ def marshall_value(self, value, storeMemoryMap = False):
+ """
+ Marshalls a Crash object to be used in the database.
+ By default the C{memoryMap} member is B{NOT} stored here.
+
+ @warning: Setting the C{storeMemoryMap} argument to C{True} can lead to
+ a severe performance penalty!
+
+ @type value: L{Crash}
+ @param value: Object to convert.
+
+ @type storeMemoryMap: bool
+ @param storeMemoryMap: C{True} to store the memory map, C{False}
+ otherwise.
+
+ @rtype: str
+ @return: Converted object.
+ """
+ if hasattr(value, 'memoryMap'):
+ crash = value
+ memoryMap = crash.memoryMap
+ try:
+ crash.memoryMap = None
+ if storeMemoryMap and memoryMap is not None:
+ # convert the generator to a list
+ crash.memoryMap = list(memoryMap)
+ if self.optimizeValues:
+ value = pickle.dumps(crash, protocol = HIGHEST_PROTOCOL)
+ value = optimize(value)
+ else:
+ value = pickle.dumps(crash, protocol = 0)
+ finally:
+ crash.memoryMap = memoryMap
+ del memoryMap
+ del crash
+ if self.compressValues:
+ value = zlib.compress(value, zlib.Z_BEST_COMPRESSION)
+ if self.escapeValues:
+ value = value.encode('hex')
+ if self.binaryValues:
+ value = buffer(value)
+ return value
+
+ def unmarshall_value(self, value):
+ """
+ Unmarshalls a Crash object read from the database.
+
+ @type value: str
+ @param value: Object to convert.
+
+ @rtype: L{Crash}
+ @return: Converted object.
+ """
+ value = str(value)
+ if self.escapeValues:
+ value = value.decode('hex')
+ if self.compressValues:
+ value = zlib.decompress(value)
+ value = pickle.loads(value)
+ return value
+
+ # The interface is meant to be similar to a Python set.
+ # However it may not be necessary to implement all of the set methods.
+ # Other methods like get, has_key, iterkeys and itervalues
+ # are dictionary-like.
+
+ def __len__(self):
+ """
+ @rtype: int
+ @return: Count of known keys.
+ """
+ return len(self.__keys)
+
+ def __bool__(self):
+ """
+ @rtype: bool
+ @return: C{False} if there are no known keys.
+ """
+ return bool(self.__keys)
+
+ def __contains__(self, crash):
+ """
+ @type crash: L{Crash}
+ @param crash: Crash object.
+
+ @rtype: bool
+ @return:
+ C{True} if a Crash object with the same key is in the container.
+ """
+ return self.has_key( crash.key() )
+
+ def has_key(self, key):
+ """
+ @type key: L{Crash} key.
+ @param key: Key to find.
+
+ @rtype: bool
+ @return: C{True} if the key is present in the set of known keys.
+ """
+ return key in self.__keys
+
+ def iterkeys(self):
+ """
+ @rtype: iterator
+ @return: Iterator of known L{Crash} keys.
+ """
+ return compat.iterkeys(self.__keys)
+
+ class __CrashContainerIterator (object):
+ """
+ Iterator of Crash objects. Returned by L{CrashContainer.__iter__}.
+ """
+
+ def __init__(self, container):
+ """
+ @type container: L{CrashContainer}
+ @param container: Crash set to iterate.
+ """
+ # It's important to keep a reference to the CrashContainer,
+ # rather than it's underlying database.
+ # Otherwise the destructor of CrashContainer may close the
+ # database while we're still iterating it.
+ #
+ # TODO: lock the database when iterating it.
+ #
+ self.__container = container
+ self.__keys_iter = compat.iterkeys(container)
+
+ def next(self):
+ """
+ @rtype: L{Crash}
+ @return: A B{copy} of a Crash object in the L{CrashContainer}.
+ @raise StopIteration: No more items left.
+ """
+ key = self.__keys_iter.next()
+ return self.__container.get(key)
+
+ def __del__(self):
+ "Class destructor. Closes the database when this object is destroyed."
+ try:
+ if self.__filename:
+ self.__db.close()
+ except:
+ pass
+
+ def __iter__(self):
+ """
+ @see: L{itervalues}
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} objects.
+ """
+ return self.itervalues()
+
+ def itervalues(self):
+ """
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} objects.
+
+ @warning: A B{copy} of each object is returned,
+ so any changes made to them will be lost.
+
+ To preserve changes do the following:
+ 1. Keep a reference to the object.
+ 2. Delete the object from the set.
+ 3. Modify the object and add it again.
+ """
+ return self.__CrashContainerIterator(self)
+
+ def add(self, crash):
+ """
+ Adds a new crash to the container.
+ If the crash appears to be already known, it's ignored.
+
+ @see: L{Crash.key}
+
+ @type crash: L{Crash}
+ @param crash: Crash object to add.
+ """
+ if crash not in self:
+ key = crash.key()
+ skey = self.marshall_key(key)
+ data = self.marshall_value(crash, storeMemoryMap = True)
+ self.__db[skey] = data
+
+ def __delitem__(self, key):
+ """
+ Removes a crash from the container.
+
+ @type key: L{Crash} unique key.
+ @param key: Key of the crash to get.
+ """
+ skey = self.marshall_key(key)
+ del self.__db[skey]
+ self.remove_key(key)
+
+ def remove(self, crash):
+ """
+ Removes a crash from the container.
+
+ @type crash: L{Crash}
+ @param crash: Crash object to remove.
+ """
+ del self[ crash.key() ]
+
+ def get(self, key):
+ """
+ Retrieves a crash from the container.
+
+ @type key: L{Crash} unique key.
+ @param key: Key of the crash to get.
+
+ @rtype: L{Crash} object.
+ @return: Crash matching the given key.
+
+ @see: L{iterkeys}
+ @warning: A B{copy} of each object is returned,
+ so any changes made to them will be lost.
+
+ To preserve changes do the following:
+ 1. Keep a reference to the object.
+ 2. Delete the object from the set.
+ 3. Modify the object and add it again.
+ """
+ skey = self.marshall_key(key)
+ data = self.__db[skey]
+ crash = self.unmarshall_value(data)
+ return crash
+
+ def __getitem__(self, key):
+ """
+ Retrieves a crash from the container.
+
+ @type key: L{Crash} unique key.
+ @param key: Key of the crash to get.
+
+ @rtype: L{Crash} object.
+ @return: Crash matching the given key.
+
+ @see: L{iterkeys}
+ @warning: A B{copy} of each object is returned,
+ so any changes made to them will be lost.
+
+ To preserve changes do the following:
+ 1. Keep a reference to the object.
+ 2. Delete the object from the set.
+ 3. Modify the object and add it again.
+ """
+ return self.get(key)
+
+#==============================================================================
+
+class CrashDictionary(object):
+ """
+ Dictionary-like persistence interface for L{Crash} objects.
+
+ Currently the only implementation is through L{sql.CrashDAO}.
+ """
+
+ def __init__(self, url, creator = None, allowRepeatedKeys = True):
+ """
+ @type url: str
+ @param url: Connection URL of the crash database.
+ See L{sql.CrashDAO.__init__} for more details.
+
+ @type creator: callable
+ @param creator: (Optional) Callback function that creates the SQL
+ database connection.
+
+ Normally it's not necessary to use this argument. However in some
+ odd cases you may need to customize the database connection, for
+ example when using the integrated authentication in MSSQL.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ If C{True} all L{Crash} objects are stored.
+
+ If C{False} any L{Crash} object with the same signature as a
+ previously existing object will be ignored.
+ """
+ global sql
+ if sql is None:
+ from winappdbg import sql
+ self._allowRepeatedKeys = allowRepeatedKeys
+ self._dao = sql.CrashDAO(url, creator)
+
+ def add(self, crash):
+ """
+ Adds a new crash to the container.
+
+ @note:
+ When the C{allowRepeatedKeys} parameter of the constructor
+ is set to C{False}, duplicated crashes are ignored.
+
+ @see: L{Crash.key}
+
+ @type crash: L{Crash}
+ @param crash: Crash object to add.
+ """
+ self._dao.add(crash, self._allowRepeatedKeys)
+
+ def get(self, key):
+ """
+ Retrieves a crash from the container.
+
+ @type key: L{Crash} signature.
+ @param key: Heuristic signature of the crash to get.
+
+ @rtype: L{Crash} object.
+ @return: Crash matching the given signature. If more than one is found,
+ retrieve the newest one.
+
+ @see: L{iterkeys}
+ @warning: A B{copy} of each object is returned,
+ so any changes made to them will be lost.
+
+ To preserve changes do the following:
+ 1. Keep a reference to the object.
+ 2. Delete the object from the set.
+ 3. Modify the object and add it again.
+ """
+ found = self._dao.find(signature=key, limit=1, order=-1)
+ if not found:
+ raise KeyError(key)
+ return found[0]
+
+ def __iter__(self):
+ """
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} objects.
+ """
+ offset = 0
+ limit = 10
+ while 1:
+ found = self._dao.find(offset=offset, limit=limit)
+ if not found:
+ break
+ offset += len(found)
+ for crash in found:
+ yield crash
+
+ def itervalues(self):
+ """
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} objects.
+ """
+ return self.__iter__()
+
+ def iterkeys(self):
+ """
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} heuristic signatures.
+ """
+ for crash in self:
+ yield crash.signature # FIXME this gives repeated results!
+
+ def __contains__(self, crash):
+ """
+ @type crash: L{Crash}
+ @param crash: Crash object.
+
+ @rtype: bool
+ @return: C{True} if the Crash object is in the container.
+ """
+ return self._dao.count(signature=crash.signature) > 0
+
+ def has_key(self, key):
+ """
+ @type key: L{Crash} signature.
+ @param key: Heuristic signature of the crash to get.
+
+ @rtype: bool
+ @return: C{True} if a matching L{Crash} object is in the container.
+ """
+ return self._dao.count(signature=key) > 0
+
+ def __len__(self):
+ """
+ @rtype: int
+ @return: Count of L{Crash} elements in the container.
+ """
+ return self._dao.count()
+
+ def __bool__(self):
+ """
+ @rtype: bool
+ @return: C{False} if the container is empty.
+ """
+ return bool( len(self) )
+
+class CrashTable(CrashDictionary):
+ """
+ Old crash dump persistencer using a SQLite database.
+
+ @warning:
+ Superceded by L{CrashDictionary} since WinAppDbg 1.5.
+ New applications should not use this class.
+ """
+
+ def __init__(self, location = None, allowRepeatedKeys = True):
+ """
+ @type location: str
+ @param location: (Optional) Location of the crash database.
+ If the location is a filename, it's an SQLite database file.
+
+ If no location is specified, the container is volatile.
+ Volatile containers are stored only in memory and
+ destroyed when they go out of scope.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ If C{True} all L{Crash} objects are stored.
+
+ If C{False} any L{Crash} object with the same signature as a
+ previously existing object will be ignored.
+ """
+ warnings.warn(
+ "The %s class is deprecated since WinAppDbg 1.5." % self.__class__,
+ DeprecationWarning)
+ if location:
+ url = "sqlite:///%s" % location
+ else:
+ url = "sqlite://"
+ super(CrashTable, self).__init__(url, allowRepeatedKeys)
+
+class CrashTableMSSQL (CrashDictionary):
+ """
+ Old crash dump persistencer using a Microsoft SQL Server database.
+
+ @warning:
+ Superceded by L{CrashDictionary} since WinAppDbg 1.5.
+ New applications should not use this class.
+ """
+
+ def __init__(self, location = None, allowRepeatedKeys = True):
+ """
+ @type location: str
+ @param location: Location of the crash database.
+ It must be an ODBC connection string.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ If C{True} all L{Crash} objects are stored.
+
+ If C{False} any L{Crash} object with the same signature as a
+ previously existing object will be ignored.
+ """
+ warnings.warn(
+ "The %s class is deprecated since WinAppDbg 1.5." % self.__class__,
+ DeprecationWarning)
+ import urllib
+ url = "mssql+pyodbc:///?odbc_connect=" + urllib.quote_plus(location)
+ super(CrashTableMSSQL, self).__init__(url, allowRepeatedKeys)
+
+class VolatileCrashContainer (CrashTable):
+ """
+ Old in-memory crash dump storage.
+
+ @warning:
+ Superceded by L{CrashDictionary} since WinAppDbg 1.5.
+ New applications should not use this class.
+ """
+
+ def __init__(self, allowRepeatedKeys = True):
+ """
+ Volatile containers are stored only in memory and
+ destroyed when they go out of scope.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ If C{True} all L{Crash} objects are stored.
+
+ If C{False} any L{Crash} object with the same key as a
+ previously existing object will be ignored.
+ """
+ super(VolatileCrashContainer, self).__init__(
+ allowRepeatedKeys=allowRepeatedKeys)
+
+class DummyCrashContainer(object):
+ """
+ Fakes a database of volatile Crash objects,
+ trying to mimic part of it's interface, but
+ doesn't actually store anything.
+
+ Normally applications don't need to use this.
+
+ @see: L{CrashDictionary}
+ """
+
+ def __init__(self, allowRepeatedKeys = True):
+ """
+ Fake containers don't store L{Crash} objects, but they implement the
+ interface properly.
+
+ @type allowRepeatedKeys: bool
+ @param allowRepeatedKeys:
+ Mimics the duplicate filter behavior found in real containers.
+ """
+ self.__keys = set()
+ self.__count = 0
+ self.__allowRepeatedKeys = allowRepeatedKeys
+
+ def __contains__(self, crash):
+ """
+ @type crash: L{Crash}
+ @param crash: Crash object.
+
+ @rtype: bool
+ @return: C{True} if the Crash object is in the container.
+ """
+ return crash.signature in self.__keys
+
+ def __len__(self):
+ """
+ @rtype: int
+ @return: Count of L{Crash} elements in the container.
+ """
+ if self.__allowRepeatedKeys:
+ return self.__count
+ return len( self.__keys )
+
+ def __bool__(self):
+ """
+ @rtype: bool
+ @return: C{False} if the container is empty.
+ """
+ return bool( len(self) )
+
+ def add(self, crash):
+ """
+ Adds a new crash to the container.
+
+ @note:
+ When the C{allowRepeatedKeys} parameter of the constructor
+ is set to C{False}, duplicated crashes are ignored.
+
+ @see: L{Crash.key}
+
+ @type crash: L{Crash}
+ @param crash: Crash object to add.
+ """
+ self.__keys.add( crash.signature )
+ self.__count += 1
+
+ def get(self, key):
+ """
+ This method is not supported.
+ """
+ raise NotImplementedError()
+
+ def has_key(self, key):
+ """
+ @type key: L{Crash} signature.
+ @param key: Heuristic signature of the crash to get.
+
+ @rtype: bool
+ @return: C{True} if a matching L{Crash} object is in the container.
+ """
+ return self.__keys.has_key( key )
+
+ def iterkeys(self):
+ """
+ @rtype: iterator
+ @return: Iterator of the contained L{Crash} object keys.
+
+ @see: L{get}
+ @warning: A B{copy} of each object is returned,
+ so any changes made to them will be lost.
+
+ To preserve changes do the following:
+ 1. Keep a reference to the object.
+ 2. Delete the object from the set.
+ 3. Modify the object and add it again.
+ """
+ return iter(self.__keys)
+
+#==============================================================================
+# Register the Crash class with the secure serializer.
+
+try:
+ cerealizer.register(Crash)
+ cerealizer.register(win32.MemoryBasicInformation)
+except NameError:
+ pass
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/debug.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/debug.py
new file mode 100644
index 00000000..8364a5b8
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/debug.py
@@ -0,0 +1,1543 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Debugging.
+
+@group Debugging:
+ Debug
+
+@group Warnings:
+ MixedBitsWarning
+"""
+
+__revision__ = "$Id$"
+
+__all__ = [ 'Debug', 'MixedBitsWarning' ]
+
+import sys
+from winappdbg import win32
+from winappdbg.system import System
+from winappdbg.process import Process
+from winappdbg.thread import Thread
+from winappdbg.module import Module
+from winappdbg.window import Window
+from winappdbg.breakpoint import _BreakpointContainer, CodeBreakpoint
+from winappdbg.event import Event, EventHandler, EventDispatcher, EventFactory
+from winappdbg.interactive import ConsoleDebugger
+
+import warnings
+##import traceback
+
+#==============================================================================
+
+# If you set this warning to be considered as an error, you can stop the
+# debugger from attaching to 64-bit processes from a 32-bit Python VM and
+# visceversa.
+class MixedBitsWarning (RuntimeWarning):
+ """
+ This warning is issued when mixing 32 and 64 bit processes.
+ """
+
+#==============================================================================
+
+# TODO
+# * Add memory read and write operations, similar to those in the Process
+# class, but hiding the presence of the code breakpoints.
+# * Add a method to get the memory map of a process, but hiding the presence
+# of the page breakpoints.
+# * Maybe the previous two features should be implemented at the Process class
+# instead, but how to communicate with the Debug object without creating
+# circular references? Perhaps the "overrides" could be set using private
+# members (so users won't see them), but then there's the problem of the
+# users being able to access the snapshot (i.e. clear it), which is why it's
+# not such a great idea to use the snapshot to store data that really belongs
+# to the Debug class.
+
+class Debug (EventDispatcher, _BreakpointContainer):
+ """
+ The main debugger class.
+
+ @group Debugging:
+ interactive, attach, detach, detach_from_all, execv, execl,
+ kill, kill_all,
+ get_debugee_count, get_debugee_pids,
+ is_debugee, is_debugee_attached, is_debugee_started,
+ in_hostile_mode,
+ add_existing_session
+
+ @group Debugging loop:
+ loop, stop, next, wait, dispatch, cont
+
+ @undocumented: force_garbage_collection
+
+ @type system: L{System}
+ @ivar system: A System snapshot that is automatically updated for
+ processes being debugged. Processes not being debugged in this snapshot
+ may be outdated.
+ """
+
+ # Automatically set to True the first time a Debug object is instanced.
+ _debug_static_init = False
+
+ def __init__(self, eventHandler = None, bKillOnExit = False,
+ bHostileCode = False):
+ """
+ Debugger object.
+
+ @type eventHandler: L{EventHandler}
+ @param eventHandler:
+ (Optional, recommended) Custom event handler object.
+
+ @type bKillOnExit: bool
+ @param bKillOnExit: (Optional) Kill on exit mode.
+ If C{True} debugged processes are killed when the debugger is
+ stopped. If C{False} when the debugger stops it detaches from all
+ debugged processes and leaves them running (default).
+
+ @type bHostileCode: bool
+ @param bHostileCode: (Optional) Hostile code mode.
+ Set to C{True} to take some basic precautions against anti-debug
+ tricks. Disabled by default.
+
+ @warn: When hostile mode is enabled, some things may not work as
+ expected! This is because the anti-anti debug tricks may disrupt
+ the behavior of the Win32 debugging APIs or WinAppDbg itself.
+
+ @note: The L{eventHandler} parameter may be any callable Python object
+ (for example a function, or an instance method).
+ However you'll probably find it more convenient to use an instance
+ of a subclass of L{EventHandler} here.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+ EventDispatcher.__init__(self, eventHandler)
+ _BreakpointContainer.__init__(self)
+
+ self.system = System()
+ self.lastEvent = None
+ self.__firstDebugee = True
+ self.__bKillOnExit = bKillOnExit
+ self.__bHostileCode = bHostileCode
+ self.__breakOnEP = set() # set of pids
+ self.__attachedDebugees = set() # set of pids
+ self.__startedDebugees = set() # set of pids
+
+ if not self._debug_static_init:
+ self._debug_static_init = True
+
+ # Request debug privileges for the current process.
+ # Only do this once, and only after instancing a Debug object,
+ # so passive debuggers don't get detected because of this.
+ self.system.request_debug_privileges(bIgnoreExceptions = False)
+
+ # Try to fix the symbol store path if it wasn't set.
+ # But don't enable symbol downloading by default, since it may
+ # degrade performance severely.
+ self.system.fix_symbol_store_path(remote = False, force = False)
+
+## # It's hard not to create circular references,
+## # and if we have a destructor, we can end up leaking everything.
+## # It's best to code the debugging loop properly to always
+## # stop the debugger before going out of scope.
+## def __del__(self):
+## self.stop()
+
+ def __enter__(self):
+ """
+ Compatibility with the "C{with}" Python statement.
+ """
+ return self
+
+ def __exit__(self, type, value, traceback):
+ """
+ Compatibility with the "C{with}" Python statement.
+ """
+ self.stop()
+
+ def __len__(self):
+ """
+ @rtype: int
+ @return: Number of processes being debugged.
+ """
+ return self.get_debugee_count()
+
+ # TODO: maybe custom __bool__ to break out of loop() ?
+ # it already does work (because of __len__) but it'd be
+ # useful to do it from the event handler anyway
+
+#------------------------------------------------------------------------------
+
+ def __setSystemKillOnExitMode(self):
+ # Make sure the default system behavior on detaching from processes
+ # versus killing them matches our preferences. This only affects the
+ # scenario where the Python VM dies unexpectedly without running all
+ # the finally clauses, or the user failed to either instance the Debug
+ # object inside a with block or call the stop() method before quitting.
+ if self.__firstDebugee:
+ try:
+ System.set_kill_on_exit_mode(self.__bKillOnExit)
+ self.__firstDebugee = False
+ except Exception:
+ pass
+
+ def attach(self, dwProcessId):
+ """
+ Attaches to an existing process for debugging.
+
+ @see: L{detach}, L{execv}, L{execl}
+
+ @type dwProcessId: int
+ @param dwProcessId: Global ID of a process to attach to.
+
+ @rtype: L{Process}
+ @return: A new Process object. Normally you don't need to use it now,
+ it's best to interact with the process from the event handler.
+
+ @raise WindowsError: Raises an exception on error.
+ Depending on the circumstances, the debugger may or may not have
+ attached to the target process.
+ """
+
+ # Get the Process object from the snapshot,
+ # if missing create a new one.
+ try:
+ aProcess = self.system.get_process(dwProcessId)
+ except KeyError:
+ aProcess = Process(dwProcessId)
+
+ # Warn when mixing 32 and 64 bits.
+ # This also allows the user to stop attaching altogether,
+ # depending on how the warnings are configured.
+ if System.bits != aProcess.get_bits():
+ msg = "Mixture of 32 and 64 bits is considered experimental." \
+ " Use at your own risk!"
+ warnings.warn(msg, MixedBitsWarning)
+
+ # Attach to the process.
+ win32.DebugActiveProcess(dwProcessId)
+
+ # Add the new PID to the set of debugees.
+ self.__attachedDebugees.add(dwProcessId)
+
+ # Match the system kill-on-exit flag to our own.
+ self.__setSystemKillOnExitMode()
+
+ # If the Process object was not in the snapshot, add it now.
+ if not self.system.has_process(dwProcessId):
+ self.system._add_process(aProcess)
+
+ # Scan the process threads and loaded modules.
+ # This is prefered because the thread and library events do not
+ # properly give some information, like the filename for each module.
+ aProcess.scan_threads()
+ aProcess.scan_modules()
+
+ # Return the Process object, like the execv() and execl() methods.
+ return aProcess
+
+ def execv(self, argv, **kwargs):
+ """
+ Starts a new process for debugging.
+
+ This method uses a list of arguments. To use a command line string
+ instead, use L{execl}.
+
+ @see: L{attach}, L{detach}
+
+ @type argv: list( str... )
+ @param argv: List of command line arguments to pass to the debugee.
+ The first element must be the debugee executable filename.
+
+ @type bBreakOnEntryPoint: bool
+ @keyword bBreakOnEntryPoint: C{True} to automatically set a breakpoint
+ at the program entry point.
+
+ @type bConsole: bool
+ @keyword bConsole: True to inherit the console of the debugger.
+ Defaults to C{False}.
+
+ @type bFollow: bool
+ @keyword bFollow: C{True} to automatically attach to child processes.
+ Defaults to C{False}.
+
+ @type bInheritHandles: bool
+ @keyword bInheritHandles: C{True} if the new process should inherit
+ it's parent process' handles. Defaults to C{False}.
+
+ @type bSuspended: bool
+ @keyword bSuspended: C{True} to suspend the main thread before any code
+ is executed in the debugee. Defaults to C{False}.
+
+ @keyword dwParentProcessId: C{None} or C{0} if the debugger process
+ should be the parent process (default), or a process ID to
+ forcefully set as the debugee's parent (only available for Windows
+ Vista and above).
+
+ In hostile mode, the default is not the debugger process but the
+ process ID for "explorer.exe".
+
+ @type iTrustLevel: int or None
+ @keyword iTrustLevel: Trust level.
+ Must be one of the following values:
+ - 0: B{No trust}. May not access certain resources, such as
+ cryptographic keys and credentials. Only available since
+ Windows XP and 2003, desktop editions. This is the default
+ in hostile mode.
+ - 1: B{Normal trust}. Run with the same privileges as a normal
+ user, that is, one that doesn't have the I{Administrator} or
+ I{Power User} user rights. Only available since Windows XP
+ and 2003, desktop editions.
+ - 2: B{Full trust}. Run with the exact same privileges as the
+ current user. This is the default in normal mode.
+
+ @type bAllowElevation: bool
+ @keyword bAllowElevation: C{True} to allow the child process to keep
+ UAC elevation, if the debugger itself is running elevated. C{False}
+ to ensure the child process doesn't run with elevation. Defaults to
+ C{True}.
+
+ This flag is only meaningful on Windows Vista and above, and if the
+ debugger itself is running with elevation. It can be used to make
+ sure the child processes don't run elevated as well.
+
+ This flag DOES NOT force an elevation prompt when the debugger is
+ not running with elevation.
+
+ Note that running the debugger with elevation (or the Python
+ interpreter at all for that matter) is not normally required.
+ You should only need to if the target program requires elevation
+ to work properly (for example if you try to debug an installer).
+
+ @rtype: L{Process}
+ @return: A new Process object. Normally you don't need to use it now,
+ it's best to interact with the process from the event handler.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+ if type(argv) in (str, compat.unicode):
+ raise TypeError("Debug.execv expects a list, not a string")
+ lpCmdLine = self.system.argv_to_cmdline(argv)
+ return self.execl(lpCmdLine, **kwargs)
+
+ def execl(self, lpCmdLine, **kwargs):
+ """
+ Starts a new process for debugging.
+
+ This method uses a command line string. To use a list of arguments
+ instead, use L{execv}.
+
+ @see: L{attach}, L{detach}
+
+ @type lpCmdLine: str
+ @param lpCmdLine: Command line string to execute.
+ The first token must be the debugee executable filename.
+ Tokens with spaces must be enclosed in double quotes.
+ Tokens including double quote characters must be escaped with a
+ backslash.
+
+ @type bBreakOnEntryPoint: bool
+ @keyword bBreakOnEntryPoint: C{True} to automatically set a breakpoint
+ at the program entry point. Defaults to C{False}.
+
+ @type bConsole: bool
+ @keyword bConsole: True to inherit the console of the debugger.
+ Defaults to C{False}.
+
+ @type bFollow: bool
+ @keyword bFollow: C{True} to automatically attach to child processes.
+ Defaults to C{False}.
+
+ @type bInheritHandles: bool
+ @keyword bInheritHandles: C{True} if the new process should inherit
+ it's parent process' handles. Defaults to C{False}.
+
+ @type bSuspended: bool
+ @keyword bSuspended: C{True} to suspend the main thread before any code
+ is executed in the debugee. Defaults to C{False}.
+
+ @type dwParentProcessId: int or None
+ @keyword dwParentProcessId: C{None} or C{0} if the debugger process
+ should be the parent process (default), or a process ID to
+ forcefully set as the debugee's parent (only available for Windows
+ Vista and above).
+
+ In hostile mode, the default is not the debugger process but the
+ process ID for "explorer.exe".
+
+ @type iTrustLevel: int
+ @keyword iTrustLevel: Trust level.
+ Must be one of the following values:
+ - 0: B{No trust}. May not access certain resources, such as
+ cryptographic keys and credentials. Only available since
+ Windows XP and 2003, desktop editions. This is the default
+ in hostile mode.
+ - 1: B{Normal trust}. Run with the same privileges as a normal
+ user, that is, one that doesn't have the I{Administrator} or
+ I{Power User} user rights. Only available since Windows XP
+ and 2003, desktop editions.
+ - 2: B{Full trust}. Run with the exact same privileges as the
+ current user. This is the default in normal mode.
+
+ @type bAllowElevation: bool
+ @keyword bAllowElevation: C{True} to allow the child process to keep
+ UAC elevation, if the debugger itself is running elevated. C{False}
+ to ensure the child process doesn't run with elevation. Defaults to
+ C{True} in normal mode and C{False} in hostile mode.
+
+ This flag is only meaningful on Windows Vista and above, and if the
+ debugger itself is running with elevation. It can be used to make
+ sure the child processes don't run elevated as well.
+
+ This flag DOES NOT force an elevation prompt when the debugger is
+ not running with elevation.
+
+ Note that running the debugger with elevation (or the Python
+ interpreter at all for that matter) is not normally required.
+ You should only need to if the target program requires elevation
+ to work properly (for example if you try to debug an installer).
+
+ @rtype: L{Process}
+ @return: A new Process object. Normally you don't need to use it now,
+ it's best to interact with the process from the event handler.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+ if type(lpCmdLine) not in (str, compat.unicode):
+ warnings.warn("Debug.execl expects a string")
+
+ # Set the "debug" flag to True.
+ kwargs['bDebug'] = True
+
+ # Pop the "break on entry point" flag.
+ bBreakOnEntryPoint = kwargs.pop('bBreakOnEntryPoint', False)
+
+ # Set the default trust level if requested.
+ if 'iTrustLevel' not in kwargs:
+ if self.__bHostileCode:
+ kwargs['iTrustLevel'] = 0
+ else:
+ kwargs['iTrustLevel'] = 2
+
+ # Set the default UAC elevation flag if requested.
+ if 'bAllowElevation' not in kwargs:
+ kwargs['bAllowElevation'] = not self.__bHostileCode
+
+ # In hostile mode the default parent process is explorer.exe.
+ # Only supported for Windows Vista and above.
+ if self.__bHostileCode and not kwargs.get('dwParentProcessId', None):
+ try:
+ vista_and_above = self.__vista_and_above
+ except AttributeError:
+ osi = win32.OSVERSIONINFOEXW()
+ osi.dwMajorVersion = 6
+ osi.dwMinorVersion = 0
+ osi.dwPlatformId = win32.VER_PLATFORM_WIN32_NT
+ mask = 0
+ mask = win32.VerSetConditionMask(mask,
+ win32.VER_MAJORVERSION,
+ win32.VER_GREATER_EQUAL)
+ mask = win32.VerSetConditionMask(mask,
+ win32.VER_MAJORVERSION,
+ win32.VER_GREATER_EQUAL)
+ mask = win32.VerSetConditionMask(mask,
+ win32.VER_PLATFORMID,
+ win32.VER_EQUAL)
+ vista_and_above = win32.VerifyVersionInfoW(osi,
+ win32.VER_MAJORVERSION | \
+ win32.VER_MINORVERSION | \
+ win32.VER_PLATFORMID,
+ mask)
+ self.__vista_and_above = vista_and_above
+ if vista_and_above:
+ dwParentProcessId = self.system.get_explorer_pid()
+ if dwParentProcessId:
+ kwargs['dwParentProcessId'] = dwParentProcessId
+ else:
+ msg = ("Failed to find \"explorer.exe\"!"
+ " Using the debugger as parent process.")
+ warnings.warn(msg, RuntimeWarning)
+
+ # Start the new process.
+ aProcess = None
+ try:
+ aProcess = self.system.start_process(lpCmdLine, **kwargs)
+ dwProcessId = aProcess.get_pid()
+
+ # Match the system kill-on-exit flag to our own.
+ self.__setSystemKillOnExitMode()
+
+ # Warn when mixing 32 and 64 bits.
+ # This also allows the user to stop attaching altogether,
+ # depending on how the warnings are configured.
+ if System.bits != aProcess.get_bits():
+ msg = "Mixture of 32 and 64 bits is considered experimental." \
+ " Use at your own risk!"
+ warnings.warn(msg, MixedBitsWarning)
+
+ # Add the new PID to the set of debugees.
+ self.__startedDebugees.add(dwProcessId)
+
+ # Add the new PID to the set of "break on EP" debugees if needed.
+ if bBreakOnEntryPoint:
+ self.__breakOnEP.add(dwProcessId)
+
+ # Return the Process object.
+ return aProcess
+
+ # On error kill the new process and raise an exception.
+ except:
+ if aProcess is not None:
+ try:
+ try:
+ self.__startedDebugees.remove(aProcess.get_pid())
+ except KeyError:
+ pass
+ finally:
+ try:
+ try:
+ self.__breakOnEP.remove(aProcess.get_pid())
+ except KeyError:
+ pass
+ finally:
+ try:
+ aProcess.kill()
+ except Exception:
+ pass
+ raise
+
+ def add_existing_session(self, dwProcessId, bStarted = False):
+ """
+ Use this method only when for some reason the debugger's been attached
+ to the target outside of WinAppDbg (for example when integrating with
+ other tools).
+
+ You don't normally need to call this method. Most users should call
+ L{attach}, L{execv} or L{execl} instead.
+
+ @type dwProcessId: int
+ @param dwProcessId: Global process ID.
+
+ @type bStarted: bool
+ @param bStarted: C{True} if the process was started by the debugger,
+ or C{False} if the process was attached to instead.
+
+ @raise WindowsError: The target process does not exist, is not attached
+ to the debugger anymore.
+ """
+
+ # Register the process object with the snapshot.
+ if not self.system.has_process(dwProcessId):
+ aProcess = Process(dwProcessId)
+ self.system._add_process(aProcess)
+ else:
+ aProcess = self.system.get_process(dwProcessId)
+
+ # Test for debug privileges on the target process.
+ # Raises WindowsException on error.
+ aProcess.get_handle()
+
+ # Register the process ID with the debugger.
+ if bStarted:
+ self.__attachedDebugees.add(dwProcessId)
+ else:
+ self.__startedDebugees.add(dwProcessId)
+
+ # Match the system kill-on-exit flag to our own.
+ self.__setSystemKillOnExitMode()
+
+ # Scan the process threads and loaded modules.
+ # This is prefered because the thread and library events do not
+ # properly give some information, like the filename for each module.
+ aProcess.scan_threads()
+ aProcess.scan_modules()
+
+ def __cleanup_process(self, dwProcessId, bIgnoreExceptions = False):
+ """
+ Perform the necessary cleanup of a process about to be killed or
+ detached from.
+
+ This private method is called by L{kill} and L{detach}.
+
+ @type dwProcessId: int
+ @param dwProcessId: Global ID of a process to kill.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when killing the process.
+
+ @raise WindowsError: Raises an exception on error, unless
+ C{bIgnoreExceptions} is C{True}.
+ """
+ # If the process is being debugged...
+ if self.is_debugee(dwProcessId):
+
+ # Make sure a Process object exists or the following calls fail.
+ if not self.system.has_process(dwProcessId):
+ aProcess = Process(dwProcessId)
+ try:
+ aProcess.get_handle()
+ except WindowsError:
+ pass # fails later on with more specific reason
+ self.system._add_process(aProcess)
+
+ # Erase all breakpoints in the process.
+ try:
+ self.erase_process_breakpoints(dwProcessId)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Stop tracing all threads in the process.
+ try:
+ self.stop_tracing_process(dwProcessId)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # The process is no longer a debugee.
+ try:
+ if dwProcessId in self.__attachedDebugees:
+ self.__attachedDebugees.remove(dwProcessId)
+ if dwProcessId in self.__startedDebugees:
+ self.__startedDebugees.remove(dwProcessId)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Clear and remove the process from the snapshot.
+ # If the user wants to do something with it after detaching
+ # a new Process instance should be created.
+ try:
+ if self.system.has_process(dwProcessId):
+ try:
+ self.system.get_process(dwProcessId).clear()
+ finally:
+ self.system._del_process(dwProcessId)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # If the last debugging event is related to this process, forget it.
+ try:
+ if self.lastEvent and self.lastEvent.get_pid() == dwProcessId:
+ self.lastEvent = None
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ def kill(self, dwProcessId, bIgnoreExceptions = False):
+ """
+ Kills a process currently being debugged.
+
+ @see: L{detach}
+
+ @type dwProcessId: int
+ @param dwProcessId: Global ID of a process to kill.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when killing the process.
+
+ @raise WindowsError: Raises an exception on error, unless
+ C{bIgnoreExceptions} is C{True}.
+ """
+
+ # Keep a reference to the process. We'll need it later.
+ try:
+ aProcess = self.system.get_process(dwProcessId)
+ except KeyError:
+ aProcess = Process(dwProcessId)
+
+ # Cleanup all data referring to the process.
+ self.__cleanup_process(dwProcessId,
+ bIgnoreExceptions = bIgnoreExceptions)
+
+ # Kill the process.
+ try:
+ try:
+ if self.is_debugee(dwProcessId):
+ try:
+ if aProcess.is_alive():
+ aProcess.suspend()
+ finally:
+ self.detach(dwProcessId,
+ bIgnoreExceptions = bIgnoreExceptions)
+ finally:
+ aProcess.kill()
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Cleanup what remains of the process data.
+ try:
+ aProcess.clear()
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ def kill_all(self, bIgnoreExceptions = False):
+ """
+ Kills from all processes currently being debugged.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when killing each process. C{False} to stop and raise an
+ exception when encountering an error.
+
+ @raise WindowsError: Raises an exception on error, unless
+ C{bIgnoreExceptions} is C{True}.
+ """
+ for pid in self.get_debugee_pids():
+ self.kill(pid, bIgnoreExceptions = bIgnoreExceptions)
+
+ def detach(self, dwProcessId, bIgnoreExceptions = False):
+ """
+ Detaches from a process currently being debugged.
+
+ @note: On Windows 2000 and below the process is killed.
+
+ @see: L{attach}, L{detach_from_all}
+
+ @type dwProcessId: int
+ @param dwProcessId: Global ID of a process to detach from.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when detaching. C{False} to stop and raise an exception when
+ encountering an error.
+
+ @raise WindowsError: Raises an exception on error, unless
+ C{bIgnoreExceptions} is C{True}.
+ """
+
+ # Keep a reference to the process. We'll need it later.
+ try:
+ aProcess = self.system.get_process(dwProcessId)
+ except KeyError:
+ aProcess = Process(dwProcessId)
+
+ # Determine if there is support for detaching.
+ # This check should only fail on Windows 2000 and older.
+ try:
+ win32.DebugActiveProcessStop
+ can_detach = True
+ except AttributeError:
+ can_detach = False
+
+ # Continue the last event before detaching.
+ # XXX not sure about this...
+ try:
+ if can_detach and self.lastEvent and \
+ self.lastEvent.get_pid() == dwProcessId:
+ self.cont(self.lastEvent)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Cleanup all data referring to the process.
+ self.__cleanup_process(dwProcessId,
+ bIgnoreExceptions = bIgnoreExceptions)
+
+ try:
+ # Detach from the process.
+ # On Windows 2000 and before, kill the process.
+ if can_detach:
+ try:
+ win32.DebugActiveProcessStop(dwProcessId)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+ else:
+ try:
+ aProcess.kill()
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ finally:
+
+ # Cleanup what remains of the process data.
+ aProcess.clear()
+
+ def detach_from_all(self, bIgnoreExceptions = False):
+ """
+ Detaches from all processes currently being debugged.
+
+ @note: To better handle last debugging event, call L{stop} instead.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when detaching.
+
+ @raise WindowsError: Raises an exception on error, unless
+ C{bIgnoreExceptions} is C{True}.
+ """
+ for pid in self.get_debugee_pids():
+ self.detach(pid, bIgnoreExceptions = bIgnoreExceptions)
+
+#------------------------------------------------------------------------------
+
+ def wait(self, dwMilliseconds = None):
+ """
+ Waits for the next debug event.
+
+ @see: L{cont}, L{dispatch}, L{loop}
+
+ @type dwMilliseconds: int
+ @param dwMilliseconds: (Optional) Timeout in milliseconds.
+ Use C{INFINITE} or C{None} for no timeout.
+
+ @rtype: L{Event}
+ @return: An event that occured in one of the debugees.
+
+ @raise WindowsError: Raises an exception on error.
+ If no target processes are left to debug,
+ the error code is L{win32.ERROR_INVALID_HANDLE}.
+ """
+
+ # Wait for the next debug event.
+ raw = win32.WaitForDebugEvent(dwMilliseconds)
+ event = EventFactory.get(self, raw)
+
+ # Remember it.
+ self.lastEvent = event
+
+ # Return it.
+ return event
+
+ def dispatch(self, event = None):
+ """
+ Calls the debug event notify callbacks.
+
+ @see: L{cont}, L{loop}, L{wait}
+
+ @type event: L{Event}
+ @param event: (Optional) Event object returned by L{wait}.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+
+ # If no event object was given, use the last event.
+ if event is None:
+ event = self.lastEvent
+
+ # Ignore dummy events.
+ if not event:
+ return
+
+ # Determine the default behaviour for this event.
+ # XXX HACK
+ # Some undocumented flags are used, but as far as I know in those
+ # versions of Windows that don't support them they should behave
+ # like DGB_CONTINUE.
+
+ code = event.get_event_code()
+ if code == win32.EXCEPTION_DEBUG_EVENT:
+
+ # At this point, by default some exception types are swallowed by
+ # the debugger, because we don't know yet if it was caused by the
+ # debugger itself or the debugged process.
+ #
+ # Later on (see breakpoint.py) if we determined the exception was
+ # not caused directly by the debugger itself, we set the default
+ # back to passing the exception to the debugee.
+ #
+ # The "invalid handle" exception is also swallowed by the debugger
+ # because it's not normally generated by the debugee. But in
+ # hostile mode we want to pass it to the debugee, as it may be the
+ # result of an anti-debug trick. In that case it's best to disable
+ # bad handles detection with Microsoft's gflags.exe utility. See:
+ # http://msdn.microsoft.com/en-us/library/windows/hardware/ff549557(v=vs.85).aspx
+
+ exc_code = event.get_exception_code()
+ if exc_code in (
+ win32.EXCEPTION_BREAKPOINT,
+ win32.EXCEPTION_WX86_BREAKPOINT,
+ win32.EXCEPTION_SINGLE_STEP,
+ win32.EXCEPTION_GUARD_PAGE,
+ ):
+ event.continueStatus = win32.DBG_CONTINUE
+ elif exc_code == win32.EXCEPTION_INVALID_HANDLE:
+ if self.__bHostileCode:
+ event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+ else:
+ event.continueStatus = win32.DBG_CONTINUE
+ else:
+ event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+
+ elif code == win32.RIP_EVENT and \
+ event.get_rip_type() == win32.SLE_ERROR:
+
+ # RIP events that signal fatal events should kill the process.
+ event.continueStatus = win32.DBG_TERMINATE_PROCESS
+
+ else:
+
+ # Other events need this continue code.
+ # Sometimes other codes can be used and are ignored, sometimes not.
+ # For example, when using the DBG_EXCEPTION_NOT_HANDLED code,
+ # debug strings are sent twice (!)
+ event.continueStatus = win32.DBG_CONTINUE
+
+ # Dispatch the debug event.
+ return EventDispatcher.dispatch(self, event)
+
+ def cont(self, event = None):
+ """
+ Resumes execution after processing a debug event.
+
+ @see: dispatch(), loop(), wait()
+
+ @type event: L{Event}
+ @param event: (Optional) Event object returned by L{wait}.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+
+ # If no event object was given, use the last event.
+ if event is None:
+ event = self.lastEvent
+
+ # Ignore dummy events.
+ if not event:
+ return
+
+ # Get the event continue status information.
+ dwProcessId = event.get_pid()
+ dwThreadId = event.get_tid()
+ dwContinueStatus = event.continueStatus
+
+ # Check if the process is still being debugged.
+ if self.is_debugee(dwProcessId):
+
+ # Try to flush the instruction cache.
+ try:
+ if self.system.has_process(dwProcessId):
+ aProcess = self.system.get_process(dwProcessId)
+ else:
+ aProcess = Process(dwProcessId)
+ aProcess.flush_instruction_cache()
+ except WindowsError:
+ pass
+
+ # XXX TODO
+ #
+ # Try to execute the UnhandledExceptionFilter for second chance
+ # exceptions, at least when in hostile mode (in normal mode it
+ # would be breaking compatibility, as users may actually expect
+ # second chance exceptions to be raised again).
+ #
+ # Reportedly in Windows 7 (maybe in Vista too) this seems to be
+ # happening already. In XP and below the UnhandledExceptionFilter
+ # was never called for processes being debugged.
+
+ # Continue execution of the debugee.
+ win32.ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus)
+
+ # If the event is the last event, forget it.
+ if event == self.lastEvent:
+ self.lastEvent = None
+
+ def stop(self, bIgnoreExceptions = True):
+ """
+ Stops debugging all processes.
+
+ If the kill on exit mode is on, debugged processes are killed when the
+ debugger is stopped. Otherwise when the debugger stops it detaches from
+ all debugged processes and leaves them running (default). For more
+ details see: L{__init__}
+
+ @note: This method is better than L{detach_from_all} because it can
+ gracefully handle the last debugging event before detaching.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when detaching.
+ """
+
+ # Determine if we have a last debug event that we need to continue.
+ try:
+ event = self.lastEvent
+ has_event = bool(event)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+ has_event = False
+
+ # If we do...
+ if has_event:
+
+ # Disable all breakpoints in the process before resuming execution.
+ try:
+ pid = event.get_pid()
+ self.disable_process_breakpoints(pid)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Disable all breakpoints in the thread before resuming execution.
+ try:
+ tid = event.get_tid()
+ self.disable_thread_breakpoints(tid)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Resume execution.
+ try:
+ event.continueDebugEvent = win32.DBG_CONTINUE
+ self.cont(event)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Detach from or kill all debuggees.
+ try:
+ if self.__bKillOnExit:
+ self.kill_all(bIgnoreExceptions)
+ else:
+ self.detach_from_all(bIgnoreExceptions)
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Cleanup the process snapshots.
+ try:
+ self.system.clear()
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+ # Close all Win32 handles the Python garbage collector failed to close.
+ self.force_garbage_collection(bIgnoreExceptions)
+
+ def next(self):
+ """
+ Handles the next debug event.
+
+ @see: L{cont}, L{dispatch}, L{wait}, L{stop}
+
+ @raise WindowsError: Raises an exception on error.
+
+ If the wait operation causes an error, debugging is stopped
+ (meaning all debugees are either killed or detached from).
+
+ If the event dispatching causes an error, the event is still
+ continued before returning. This may happen, for example, if the
+ event handler raises an exception nobody catches.
+ """
+ try:
+ event = self.wait()
+ except Exception:
+ self.stop()
+ raise
+ try:
+ self.dispatch()
+ finally:
+ self.cont()
+
+ def loop(self):
+ """
+ Simple debugging loop.
+
+ This debugging loop is meant to be useful for most simple scripts.
+ It iterates as long as there is at least one debugee, or an exception
+ is raised. Multiple calls are allowed.
+
+ This is a trivial example script::
+ import sys
+ debug = Debug()
+ try:
+ debug.execv( sys.argv [ 1 : ] )
+ debug.loop()
+ finally:
+ debug.stop()
+
+ @see: L{next}, L{stop}
+
+ U{http://msdn.microsoft.com/en-us/library/ms681675(VS.85).aspx}
+
+ @raise WindowsError: Raises an exception on error.
+
+ If the wait operation causes an error, debugging is stopped
+ (meaning all debugees are either killed or detached from).
+
+ If the event dispatching causes an error, the event is still
+ continued before returning. This may happen, for example, if the
+ event handler raises an exception nobody catches.
+ """
+ while self:
+ self.next()
+
+ def get_debugee_count(self):
+ """
+ @rtype: int
+ @return: Number of processes being debugged.
+ """
+ return len(self.__attachedDebugees) + len(self.__startedDebugees)
+
+ def get_debugee_pids(self):
+ """
+ @rtype: list( int... )
+ @return: Global IDs of processes being debugged.
+ """
+ return list(self.__attachedDebugees) + list(self.__startedDebugees)
+
+ def is_debugee(self, dwProcessId):
+ """
+ Determine if the debugger is debugging the given process.
+
+ @see: L{is_debugee_attached}, L{is_debugee_started}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: bool
+ @return: C{True} if the given process is being debugged
+ by this L{Debug} instance.
+ """
+ return self.is_debugee_attached(dwProcessId) or \
+ self.is_debugee_started(dwProcessId)
+
+ def is_debugee_started(self, dwProcessId):
+ """
+ Determine if the given process was started by the debugger.
+
+ @see: L{is_debugee}, L{is_debugee_attached}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: bool
+ @return: C{True} if the given process was started for debugging by this
+ L{Debug} instance.
+ """
+ return dwProcessId in self.__startedDebugees
+
+ def is_debugee_attached(self, dwProcessId):
+ """
+ Determine if the debugger is attached to the given process.
+
+ @see: L{is_debugee}, L{is_debugee_started}
+
+ @type dwProcessId: int
+ @param dwProcessId: Process global ID.
+
+ @rtype: bool
+ @return: C{True} if the given process is attached to this
+ L{Debug} instance.
+ """
+ return dwProcessId in self.__attachedDebugees
+
+ def in_hostile_mode(self):
+ """
+ Determine if we're in hostile mode (anti-anti-debug).
+
+ @rtype: bool
+ @return: C{True} if this C{Debug} instance was started in hostile mode,
+ C{False} otherwise.
+ """
+ return self.__bHostileCode
+
+#------------------------------------------------------------------------------
+
+ def interactive(self, bConfirmQuit = True, bShowBanner = True):
+ """
+ Start an interactive debugging session.
+
+ @type bConfirmQuit: bool
+ @param bConfirmQuit: Set to C{True} to ask the user for confirmation
+ before closing the session, C{False} otherwise.
+
+ @type bShowBanner: bool
+ @param bShowBanner: Set to C{True} to show a banner before entering
+ the session and after leaving it, C{False} otherwise.
+
+ @warn: This will temporarily disable the user-defined event handler!
+
+ This method returns when the user closes the session.
+ """
+ print('')
+ print("-" * 79)
+ print("Interactive debugging session started.")
+ print("Use the \"help\" command to list all available commands.")
+ print("Use the \"quit\" command to close this session.")
+ print("-" * 79)
+ if self.lastEvent is None:
+ print('')
+ console = ConsoleDebugger()
+ console.confirm_quit = bConfirmQuit
+ console.load_history()
+ try:
+ console.start_using_debugger(self)
+ console.loop()
+ finally:
+ console.stop_using_debugger()
+ console.save_history()
+ print('')
+ print("-" * 79)
+ print("Interactive debugging session closed.")
+ print("-" * 79)
+ print('')
+
+#------------------------------------------------------------------------------
+
+ @staticmethod
+ def force_garbage_collection(bIgnoreExceptions = True):
+ """
+ Close all Win32 handles the Python garbage collector failed to close.
+
+ @type bIgnoreExceptions: bool
+ @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
+ raised when detaching.
+ """
+ try:
+ import gc
+ gc.collect()
+ bRecollect = False
+ for obj in list(gc.garbage):
+ try:
+ if isinstance(obj, win32.Handle):
+ obj.close()
+ elif isinstance(obj, Event):
+ obj.debug = None
+ elif isinstance(obj, Process):
+ obj.clear()
+ elif isinstance(obj, Thread):
+ obj.set_process(None)
+ obj.clear()
+ elif isinstance(obj, Module):
+ obj.set_process(None)
+ elif isinstance(obj, Window):
+ obj.set_process(None)
+ else:
+ continue
+ gc.garbage.remove(obj)
+ del obj
+ bRecollect = True
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+ if bRecollect:
+ gc.collect()
+ except Exception:
+ if not bIgnoreExceptions:
+ raise
+ e = sys.exc_info()[1]
+ warnings.warn(str(e), RuntimeWarning)
+
+#------------------------------------------------------------------------------
+
+ def _notify_create_process(self, event):
+ """
+ Notify the creation of a new process.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{CreateProcessEvent}
+ @param event: Create process event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ dwProcessId = event.get_pid()
+ if dwProcessId not in self.__attachedDebugees:
+ if dwProcessId not in self.__startedDebugees:
+ self.__startedDebugees.add(dwProcessId)
+
+ retval = self.system._notify_create_process(event)
+
+ # Set a breakpoint on the program's entry point if requested.
+ # Try not to use the Event object's entry point value, as in some cases
+ # it may be wrong. See: http://pferrie.host22.com/misc/lowlevel3.htm
+ if dwProcessId in self.__breakOnEP:
+ try:
+ lpEntryPoint = event.get_process().get_entry_point()
+ except Exception:
+ lpEntryPoint = event.get_start_address()
+
+ # It'd be best to use a hardware breakpoint instead, at least in
+ # hostile mode. But since the main thread's context gets smashed
+ # by the loader, I haven't found a way to make it work yet.
+ self.break_at(dwProcessId, lpEntryPoint)
+
+ # Defeat isDebuggerPresent by patching PEB->BeingDebugged.
+ # When we do this, some debugging APIs cease to work as expected.
+ # For example, the system breakpoint isn't hit when we attach.
+ # For that reason we need to define a code breakpoint at the
+ # code location where a new thread is spawned by the debugging
+ # APIs, ntdll!DbgUiRemoteBreakin.
+ if self.__bHostileCode:
+ aProcess = event.get_process()
+ try:
+ hProcess = aProcess.get_handle(win32.PROCESS_QUERY_INFORMATION)
+ pbi = win32.NtQueryInformationProcess(
+ hProcess, win32.ProcessBasicInformation)
+ ptr = pbi.PebBaseAddress + 2
+ if aProcess.peek(ptr, 1) == '\x01':
+ aProcess.poke(ptr, '\x00')
+ except WindowsError:
+ e = sys.exc_info()[1]
+ warnings.warn(
+ "Cannot patch PEB->BeingDebugged, reason: %s" % e.strerror)
+
+ return retval
+
+ def _notify_create_thread(self, event):
+ """
+ Notify the creation of a new thread.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{CreateThreadEvent}
+ @param event: Create thread event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ return event.get_process()._notify_create_thread(event)
+
+ def _notify_load_dll(self, event):
+ """
+ Notify the load of a new module.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{LoadDLLEvent}
+ @param event: Load DLL event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+
+ # Pass the event to the breakpoint container.
+ bCallHandler = _BreakpointContainer._notify_load_dll(self, event)
+
+ # Get the process where the DLL was loaded.
+ aProcess = event.get_process()
+
+ # Pass the event to the process.
+ bCallHandler = aProcess._notify_load_dll(event) and bCallHandler
+
+ # Anti-anti-debugging tricks on ntdll.dll.
+ if self.__bHostileCode:
+ aModule = event.get_module()
+ if aModule.match_name('ntdll.dll'):
+
+ # Since we've overwritten the PEB to hide
+ # ourselves, we no longer have the system
+ # breakpoint when attaching to the process.
+ # Set a breakpoint at ntdll!DbgUiRemoteBreakin
+ # instead (that's where the debug API spawns
+ # it's auxiliary threads). This also defeats
+ # a simple anti-debugging trick: the hostile
+ # process could have overwritten the int3
+ # instruction at the system breakpoint.
+ self.break_at(aProcess.get_pid(),
+ aProcess.resolve_label('ntdll!DbgUiRemoteBreakin'))
+
+ return bCallHandler
+
+ def _notify_exit_process(self, event):
+ """
+ Notify the termination of a process.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{ExitProcessEvent}
+ @param event: Exit process event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ bCallHandler1 = _BreakpointContainer._notify_exit_process(self, event)
+ bCallHandler2 = self.system._notify_exit_process(event)
+
+ try:
+ self.detach( event.get_pid() )
+ except WindowsError:
+ e = sys.exc_info()[1]
+ if e.winerror != win32.ERROR_INVALID_PARAMETER:
+ warnings.warn(
+ "Failed to detach from dead process, reason: %s" % str(e),
+ RuntimeWarning)
+ except Exception:
+ e = sys.exc_info()[1]
+ warnings.warn(
+ "Failed to detach from dead process, reason: %s" % str(e),
+ RuntimeWarning)
+
+ return bCallHandler1 and bCallHandler2
+
+ def _notify_exit_thread(self, event):
+ """
+ Notify the termination of a thread.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{ExitThreadEvent}
+ @param event: Exit thread event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ bCallHandler1 = _BreakpointContainer._notify_exit_thread(self, event)
+ bCallHandler2 = event.get_process()._notify_exit_thread(event)
+ return bCallHandler1 and bCallHandler2
+
+ def _notify_unload_dll(self, event):
+ """
+ Notify the unload of a module.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{UnloadDLLEvent}
+ @param event: Unload DLL event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ bCallHandler1 = _BreakpointContainer._notify_unload_dll(self, event)
+ bCallHandler2 = event.get_process()._notify_unload_dll(event)
+ return bCallHandler1 and bCallHandler2
+
+ def _notify_rip(self, event):
+ """
+ Notify of a RIP event.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @type event: L{RIPEvent}
+ @param event: RIP event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ event.debug.detach( event.get_pid() )
+ return True
+
+ def _notify_debug_control_c(self, event):
+ """
+ Notify of a Debug Ctrl-C exception.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @note: This exception is only raised when a debugger is attached, and
+ applications are not supposed to handle it, so we need to handle it
+ ourselves or the application may crash.
+
+ @see: U{http://msdn.microsoft.com/en-us/library/aa363082(VS.85).aspx}
+
+ @type event: L{ExceptionEvent}
+ @param event: Debug Ctrl-C exception event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ if event.is_first_chance():
+ event.continueStatus = win32.DBG_EXCEPTION_HANDLED
+ return True
+
+ def _notify_ms_vc_exception(self, event):
+ """
+ Notify of a Microsoft Visual C exception.
+
+ @warning: This method is meant to be used internally by the debugger.
+
+ @note: This allows the debugger to understand the
+ Microsoft Visual C thread naming convention.
+
+ @see: U{http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx}
+
+ @type event: L{ExceptionEvent}
+ @param event: Microsoft Visual C exception event.
+
+ @rtype: bool
+ @return: C{True} to call the user-defined handle, C{False} otherwise.
+ """
+ dwType = event.get_exception_information(0)
+ if dwType == 0x1000:
+ pszName = event.get_exception_information(1)
+ dwThreadId = event.get_exception_information(2)
+ dwFlags = event.get_exception_information(3)
+
+ aProcess = event.get_process()
+ szName = aProcess.peek_string(pszName, fUnicode = False)
+ if szName:
+
+ if dwThreadId == -1:
+ dwThreadId = event.get_tid()
+
+ if aProcess.has_thread(dwThreadId):
+ aThread = aProcess.get_thread(dwThreadId)
+ else:
+ aThread = Thread(dwThreadId)
+ aProcess._add_thread(aThread)
+
+## if aThread.get_name() is None:
+## aThread.set_name(szName)
+ aThread.set_name(szName)
+
+ return True
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/disasm.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/disasm.py
new file mode 100644
index 00000000..230e3314
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/disasm.py
@@ -0,0 +1,722 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Binary code disassembly.
+
+@group Disassembler loader:
+ Disassembler, Engine
+
+@group Disassembler engines:
+ BeaEngine, CapstoneEngine, DistormEngine,
+ LibdisassembleEngine, PyDasmEngine
+"""
+
+from __future__ import with_statement
+
+__revision__ = "$Id$"
+
+__all__ = [
+ 'Disassembler',
+ 'Engine',
+ 'BeaEngine',
+ 'CapstoneEngine',
+ 'DistormEngine',
+ 'LibdisassembleEngine',
+ 'PyDasmEngine',
+]
+
+from winappdbg.textio import HexDump
+from winappdbg import win32
+
+import ctypes
+import warnings
+
+# lazy imports
+BeaEnginePython = None
+distorm3 = None
+pydasm = None
+libdisassemble = None
+capstone = None
+
+#==============================================================================
+
+class Engine (object):
+ """
+ Base class for disassembly engine adaptors.
+
+ @type name: str
+ @cvar name: Engine name to use with the L{Disassembler} class.
+
+ @type desc: str
+ @cvar desc: User friendly name of the disassembler engine.
+
+ @type url: str
+ @cvar url: Download URL.
+
+ @type supported: set(str)
+ @cvar supported: Set of supported processor architectures.
+ For more details see L{win32.version._get_arch}.
+
+ @type arch: str
+ @ivar arch: Name of the processor architecture.
+ """
+
+ name = ""
+ desc = ""
+ url = ""
+ supported = set()
+
+ def __init__(self, arch = None):
+ """
+ @type arch: str
+ @param arch: Name of the processor architecture.
+ If not provided the current processor architecture is assumed.
+ For more details see L{win32.version._get_arch}.
+
+ @raise NotImplementedError: This disassembler doesn't support the
+ requested processor architecture.
+ """
+ self.arch = self._validate_arch(arch)
+ try:
+ self._import_dependencies()
+ except ImportError:
+ msg = "%s is not installed or can't be found. Download it from: %s"
+ msg = msg % (self.name, self.url)
+ raise NotImplementedError(msg)
+
+ def _validate_arch(self, arch = None):
+ """
+ @type arch: str
+ @param arch: Name of the processor architecture.
+ If not provided the current processor architecture is assumed.
+ For more details see L{win32.version._get_arch}.
+
+ @rtype: str
+ @return: Name of the processor architecture.
+ If not provided the current processor architecture is assumed.
+ For more details see L{win32.version._get_arch}.
+
+ @raise NotImplementedError: This disassembler doesn't support the
+ requested processor architecture.
+ """
+
+ # Use the default architecture if none specified.
+ if not arch:
+ arch = win32.arch
+
+ # Validate the architecture.
+ if arch not in self.supported:
+ msg = "The %s engine cannot decode %s code."
+ msg = msg % (self.name, arch)
+ raise NotImplementedError(msg)
+
+ # Return the architecture.
+ return arch
+
+ def _import_dependencies(self):
+ """
+ Loads the dependencies for this disassembler.
+
+ @raise ImportError: This disassembler cannot find or load the
+ necessary dependencies to make it work.
+ """
+ raise SyntaxError("Subclasses MUST implement this method!")
+
+ def decode(self, address, code):
+ """
+ @type address: int
+ @param address: Memory address where the code was read from.
+
+ @type code: str
+ @param code: Machine code to disassemble.
+
+ @rtype: list of tuple( long, int, str, str )
+ @return: List of tuples. Each tuple represents an assembly instruction
+ and contains:
+ - Memory address of instruction.
+ - Size of instruction in bytes.
+ - Disassembly line of instruction.
+ - Hexadecimal dump of instruction.
+
+ @raise NotImplementedError: This disassembler could not be loaded.
+ This may be due to missing dependencies.
+ """
+ raise NotImplementedError()
+
+#==============================================================================
+
+class BeaEngine (Engine):
+ """
+ Integration with the BeaEngine disassembler by Beatrix.
+
+ @see: U{https://sourceforge.net/projects/winappdbg/files/additional%20packages/BeaEngine/}
+ """
+
+ name = "BeaEngine"
+ desc = "BeaEngine disassembler by Beatrix"
+ url = "https://sourceforge.net/projects/winappdbg/files/additional%20packages/BeaEngine/"
+
+ supported = set((
+ win32.ARCH_I386,
+ win32.ARCH_AMD64,
+ ))
+
+ def _import_dependencies(self):
+
+ # Load the BeaEngine ctypes wrapper.
+ global BeaEnginePython
+ if BeaEnginePython is None:
+ import BeaEnginePython
+
+ def decode(self, address, code):
+ addressof = ctypes.addressof
+
+ # Instance the code buffer.
+ buffer = ctypes.create_string_buffer(code)
+ buffer_ptr = addressof(buffer)
+
+ # Instance the disassembler structure.
+ Instruction = BeaEnginePython.DISASM()
+ Instruction.VirtualAddr = address
+ Instruction.EIP = buffer_ptr
+ Instruction.SecurityBlock = buffer_ptr + len(code)
+ if self.arch == win32.ARCH_I386:
+ Instruction.Archi = 0
+ else:
+ Instruction.Archi = 0x40
+ Instruction.Options = ( BeaEnginePython.Tabulation +
+ BeaEnginePython.NasmSyntax +
+ BeaEnginePython.SuffixedNumeral +
+ BeaEnginePython.ShowSegmentRegs )
+
+ # Prepare for looping over each instruction.
+ result = []
+ Disasm = BeaEnginePython.Disasm
+ InstructionPtr = addressof(Instruction)
+ hexdump = HexDump.hexadecimal
+ append = result.append
+ OUT_OF_BLOCK = BeaEnginePython.OUT_OF_BLOCK
+ UNKNOWN_OPCODE = BeaEnginePython.UNKNOWN_OPCODE
+
+ # For each decoded instruction...
+ while True:
+
+ # Calculate the current offset into the buffer.
+ offset = Instruction.EIP - buffer_ptr
+
+ # If we've gone past the buffer, break the loop.
+ if offset >= len(code):
+ break
+
+ # Decode the current instruction.
+ InstrLength = Disasm(InstructionPtr)
+
+ # If BeaEngine detects we've gone past the buffer, break the loop.
+ if InstrLength == OUT_OF_BLOCK:
+ break
+
+ # The instruction could not be decoded.
+ if InstrLength == UNKNOWN_OPCODE:
+
+ # Output a single byte as a "db" instruction.
+ char = "%.2X" % ord(buffer[offset])
+ result.append((
+ Instruction.VirtualAddr,
+ 1,
+ "db %sh" % char,
+ char,
+ ))
+ Instruction.VirtualAddr += 1
+ Instruction.EIP += 1
+
+ # The instruction was decoded but reading past the buffer's end.
+ # This can happen when the last instruction is a prefix without an
+ # opcode. For example: decode(0, '\x66')
+ elif offset + InstrLength > len(code):
+
+ # Output each byte as a "db" instruction.
+ for char in buffer[ offset : offset + len(code) ]:
+ char = "%.2X" % ord(char)
+ result.append((
+ Instruction.VirtualAddr,
+ 1,
+ "db %sh" % char,
+ char,
+ ))
+ Instruction.VirtualAddr += 1
+ Instruction.EIP += 1
+
+ # The instruction was decoded correctly.
+ else:
+
+ # Output the decoded instruction.
+ append((
+ Instruction.VirtualAddr,
+ InstrLength,
+ Instruction.CompleteInstr.strip(),
+ hexdump(buffer.raw[offset:offset+InstrLength]),
+ ))
+ Instruction.VirtualAddr += InstrLength
+ Instruction.EIP += InstrLength
+
+ # Return the list of decoded instructions.
+ return result
+
+#==============================================================================
+
+class DistormEngine (Engine):
+ """
+ Integration with the diStorm disassembler by Gil Dabah.
+
+ @see: U{https://code.google.com/p/distorm3}
+ """
+
+ name = "diStorm"
+ desc = "diStorm disassembler by Gil Dabah"
+ url = "https://code.google.com/p/distorm3"
+
+ supported = set((
+ win32.ARCH_I386,
+ win32.ARCH_AMD64,
+ ))
+
+ def _import_dependencies(self):
+
+ # Load the distorm bindings.
+ global distorm3
+ if distorm3 is None:
+ try:
+ import distorm3
+ except ImportError:
+ import distorm as distorm3
+
+ # Load the decoder function.
+ self.__decode = distorm3.Decode
+
+ # Load the bits flag.
+ self.__flag = {
+ win32.ARCH_I386: distorm3.Decode32Bits,
+ win32.ARCH_AMD64: distorm3.Decode64Bits,
+ }[self.arch]
+
+ def decode(self, address, code):
+ return self.__decode(address, code, self.__flag)
+
+#==============================================================================
+
+class PyDasmEngine (Engine):
+ """
+ Integration with PyDasm: Python bindings to libdasm.
+
+ @see: U{https://code.google.com/p/libdasm/}
+ """
+
+ name = "PyDasm"
+ desc = "PyDasm: Python bindings to libdasm"
+ url = "https://code.google.com/p/libdasm/"
+
+ supported = set((
+ win32.ARCH_I386,
+ ))
+
+ def _import_dependencies(self):
+
+ # Load the libdasm bindings.
+ global pydasm
+ if pydasm is None:
+ import pydasm
+
+ def decode(self, address, code):
+
+ # Decode each instruction in the buffer.
+ result = []
+ offset = 0
+ while offset < len(code):
+
+ # Try to decode the current instruction.
+ instruction = pydasm.get_instruction(code[offset:offset+32],
+ pydasm.MODE_32)
+
+ # Get the memory address of the current instruction.
+ current = address + offset
+
+ # Illegal opcode or opcode longer than remaining buffer.
+ if not instruction or instruction.length + offset > len(code):
+ hexdump = '%.2X' % ord(code[offset])
+ disasm = 'db 0x%s' % hexdump
+ ilen = 1
+
+ # Correctly decoded instruction.
+ else:
+ disasm = pydasm.get_instruction_string(instruction,
+ pydasm.FORMAT_INTEL,
+ current)
+ ilen = instruction.length
+ hexdump = HexDump.hexadecimal(code[offset:offset+ilen])
+
+ # Add the decoded instruction to the list.
+ result.append((
+ current,
+ ilen,
+ disasm,
+ hexdump,
+ ))
+
+ # Move to the next instruction.
+ offset += ilen
+
+ # Return the list of decoded instructions.
+ return result
+
+#==============================================================================
+
+class LibdisassembleEngine (Engine):
+ """
+ Integration with Immunity libdisassemble.
+
+ @see: U{http://www.immunitysec.com/resources-freesoftware.shtml}
+ """
+
+ name = "Libdisassemble"
+ desc = "Immunity libdisassemble"
+ url = "http://www.immunitysec.com/resources-freesoftware.shtml"
+
+ supported = set((
+ win32.ARCH_I386,
+ ))
+
+ def _import_dependencies(self):
+
+ # Load the libdisassemble module.
+ # Since it doesn't come with an installer or an __init__.py file
+ # users can only install it manually however they feel like it,
+ # so we'll have to do a bit of guessing to find it.
+
+ global libdisassemble
+ if libdisassemble is None:
+ try:
+
+ # If installed properly with __init__.py
+ import libdisassemble.disassemble as libdisassemble
+
+ except ImportError:
+
+ # If installed by just copying and pasting the files
+ import disassemble as libdisassemble
+
+ def decode(self, address, code):
+
+ # Decode each instruction in the buffer.
+ result = []
+ offset = 0
+ while offset < len(code):
+
+ # Decode the current instruction.
+ opcode = libdisassemble.Opcode( code[offset:offset+32] )
+ length = opcode.getSize()
+ disasm = opcode.printOpcode('INTEL')
+ hexdump = HexDump.hexadecimal( code[offset:offset+length] )
+
+ # Add the decoded instruction to the list.
+ result.append((
+ address + offset,
+ length,
+ disasm,
+ hexdump,
+ ))
+
+ # Move to the next instruction.
+ offset += length
+
+ # Return the list of decoded instructions.
+ return result
+
+#==============================================================================
+
+class CapstoneEngine (Engine):
+ """
+ Integration with the Capstone disassembler by Nguyen Anh Quynh.
+
+ @see: U{http://www.capstone-engine.org/}
+ """
+
+ name = "Capstone"
+ desc = "Capstone disassembler by Nguyen Anh Quynh"
+ url = "http://www.capstone-engine.org/"
+
+ supported = set((
+ win32.ARCH_I386,
+ win32.ARCH_AMD64,
+ win32.ARCH_THUMB,
+ win32.ARCH_ARM,
+ win32.ARCH_ARM64,
+ ))
+
+ def _import_dependencies(self):
+
+ # Load the Capstone bindings.
+ global capstone
+ if capstone is None:
+ import capstone
+
+ # Load the constants for the requested architecture.
+ self.__constants = {
+ win32.ARCH_I386:
+ (capstone.CS_ARCH_X86, capstone.CS_MODE_32),
+ win32.ARCH_AMD64:
+ (capstone.CS_ARCH_X86, capstone.CS_MODE_64),
+ win32.ARCH_THUMB:
+ (capstone.CS_ARCH_ARM, capstone.CS_MODE_THUMB),
+ win32.ARCH_ARM:
+ (capstone.CS_ARCH_ARM, capstone.CS_MODE_ARM),
+ win32.ARCH_ARM64:
+ (capstone.CS_ARCH_ARM64, capstone.CS_MODE_ARM),
+ }
+
+ # Test for the bug in early versions of Capstone.
+ # If found, warn the user about it.
+ try:
+ self.__bug = not isinstance(
+ capstone.cs_disasm_quick(
+ capstone.CS_ARCH_X86, capstone.CS_MODE_32, "\x90", 1)[0],
+ capstone.capstone.CsInsn)
+ except AttributeError:
+ self.__bug = False
+ if self.__bug:
+ warnings.warn(
+ "This version of the Capstone bindings is unstable,"
+ " please upgrade to a newer one!",
+ RuntimeWarning, stacklevel=4)
+
+
+ def decode(self, address, code):
+
+ # Get the constants for the requested architecture.
+ arch, mode = self.__constants[self.arch]
+
+ # Get the decoder function outside the loop.
+ decoder = capstone.cs_disasm_quick
+
+ # If the buggy version of the bindings are being used, we need to catch
+ # all exceptions broadly. If not, we only need to catch CsError.
+ if self.__bug:
+ CsError = Exception
+ else:
+ CsError = capstone.CsError
+
+ # Create the variables for the instruction length, mnemonic and
+ # operands. That way they won't be created within the loop,
+ # minimizing the chances data might be overwritten.
+ # This only makes sense for the buggy vesion of the bindings, normally
+ # memory accesses are safe).
+ length = mnemonic = op_str = None
+
+ # For each instruction...
+ result = []
+ offset = 0
+ while offset < len(code):
+
+ # Disassemble a single instruction, because disassembling multiple
+ # instructions may cause excessive memory usage (Capstone allocates
+ # approximately 1K of metadata per each decoded instruction).
+ instr = None
+ try:
+ instr = decoder(
+ arch, mode, code[offset:offset+16], address+offset, 1)[0]
+ except IndexError:
+ pass # No instructions decoded.
+ except CsError:
+ pass # Any other error.
+
+ # On success add the decoded instruction.
+ if instr is not None:
+
+ # Get the instruction length, mnemonic and operands.
+ # Copy the values quickly before someone overwrites them,
+ # if using the buggy version of the bindings (otherwise it's
+ # irrelevant in which order we access the properties).
+ length = instr.size
+ mnemonic = instr.mnemonic
+ op_str = instr.op_str
+
+ # Concatenate the mnemonic and the operands.
+ if op_str:
+ disasm = "%s %s" % (mnemonic, op_str)
+ else:
+ disasm = mnemonic
+
+ # Get the instruction bytes as a hexadecimal dump.
+ hexdump = HexDump.hexadecimal( code[offset:offset+length] )
+
+ # On error add a "define constant" instruction.
+ # The exact instruction depends on the architecture.
+ else:
+
+ # The number of bytes to skip depends on the architecture.
+ # On Intel processors we'll skip one byte, since we can't
+ # really know the instruction length. On the rest of the
+ # architectures we always know the instruction length.
+ if self.arch in (win32.ARCH_I386, win32.ARCH_AMD64):
+ length = 1
+ else:
+ length = 4
+
+ # Get the skipped bytes as a hexadecimal dump.
+ skipped = code[offset:offset+length]
+ hexdump = HexDump.hexadecimal(skipped)
+
+ # Build the "define constant" instruction.
+ # On Intel processors it's "db".
+ # On ARM processors it's "dcb".
+ if self.arch in (win32.ARCH_I386, win32.ARCH_AMD64):
+ mnemonic = "db "
+ else:
+ mnemonic = "dcb "
+ bytes = []
+ for b in skipped:
+ if b.isalpha():
+ bytes.append("'%s'" % b)
+ else:
+ bytes.append("0x%x" % ord(b))
+ op_str = ", ".join(bytes)
+ disasm = mnemonic + op_str
+
+ # Add the decoded instruction to the list.
+ result.append((
+ address + offset,
+ length,
+ disasm,
+ hexdump,
+ ))
+
+ # Update the offset.
+ offset += length
+
+ # Return the list of decoded instructions.
+ return result
+
+#==============================================================================
+
+# TODO: use a lock to access __decoder
+# TODO: look in sys.modules for whichever disassembler is already loaded
+
+class Disassembler (object):
+ """
+ Generic disassembler. Uses a set of adapters to decide which library to
+ load for which supported platform.
+
+ @type engines: tuple( L{Engine} )
+ @cvar engines: Set of supported engines. If you implement your own adapter
+ you can add its class here to make it available to L{Disassembler}.
+ Supported disassemblers are:
+ """
+
+ engines = (
+ DistormEngine, # diStorm engine goes first for backwards compatibility
+ BeaEngine,
+ CapstoneEngine,
+ LibdisassembleEngine,
+ PyDasmEngine,
+ )
+
+ # Add the list of supported disassemblers to the docstring.
+ __doc__ += "\n"
+ for e in engines:
+ __doc__ += " - %s - %s (U{%s})\n" % (e.name, e.desc, e.url)
+ del e
+
+ # Cache of already loaded disassemblers.
+ __decoder = {}
+
+ def __new__(cls, arch = None, engine = None):
+ """
+ Factory class. You can't really instance a L{Disassembler} object,
+ instead one of the adapter L{Engine} subclasses is returned.
+
+ @type arch: str
+ @param arch: (Optional) Name of the processor architecture.
+ If not provided the current processor architecture is assumed.
+ For more details see L{win32.version._get_arch}.
+
+ @type engine: str
+ @param engine: (Optional) Name of the disassembler engine.
+ If not provided a compatible one is loaded automatically.
+ See: L{Engine.name}
+
+ @raise NotImplementedError: No compatible disassembler was found that
+ could decode machine code for the requested architecture. This may
+ be due to missing dependencies.
+
+ @raise ValueError: An unknown engine name was supplied.
+ """
+
+ # Use the default architecture if none specified.
+ if not arch:
+ arch = win32.arch
+
+ # Return a compatible engine if none specified.
+ if not engine:
+ found = False
+ for clazz in cls.engines:
+ try:
+ if arch in clazz.supported:
+ selected = (clazz.name, arch)
+ try:
+ decoder = cls.__decoder[selected]
+ except KeyError:
+ decoder = clazz(arch)
+ cls.__decoder[selected] = decoder
+ return decoder
+ except NotImplementedError:
+ pass
+ msg = "No disassembler engine available for %s code." % arch
+ raise NotImplementedError(msg)
+
+ # Return the specified engine.
+ selected = (engine, arch)
+ try:
+ decoder = cls.__decoder[selected]
+ except KeyError:
+ found = False
+ engineLower = engine.lower()
+ for clazz in cls.engines:
+ if clazz.name.lower() == engineLower:
+ found = True
+ break
+ if not found:
+ msg = "Unsupported disassembler engine: %s" % engine
+ raise ValueError(msg)
+ if arch not in clazz.supported:
+ msg = "The %s engine cannot decode %s code." % selected
+ raise NotImplementedError(msg)
+ decoder = clazz(arch)
+ cls.__decoder[selected] = decoder
+ return decoder
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/event.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/event.py
new file mode 100644
index 00000000..af64727b
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/event.py
@@ -0,0 +1,1869 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Event handling module.
+
+@see: U{http://apps.sourceforge.net/trac/winappdbg/wiki/Debugging}
+
+@group Debugging:
+ EventHandler, EventSift
+
+@group Debug events:
+ EventFactory,
+ EventDispatcher,
+ Event,
+ NoEvent,
+ CreateProcessEvent,
+ CreateThreadEvent,
+ ExitProcessEvent,
+ ExitThreadEvent,
+ LoadDLLEvent,
+ UnloadDLLEvent,
+ OutputDebugStringEvent,
+ RIPEvent,
+ ExceptionEvent
+
+@group Warnings:
+ EventCallbackWarning
+"""
+
+__revision__ = "$Id$"
+
+__all__ = [
+ # Factory of Event objects and all of it's subclasses.
+ # Users should not need to instance Event objects directly.
+ 'EventFactory',
+
+ # Event dispatcher used internally by the Debug class.
+ 'EventDispatcher',
+
+ # Base classes for user-defined event handlers.
+ 'EventHandler',
+ 'EventSift',
+
+ # Warning for uncaught exceptions on event callbacks.
+ 'EventCallbackWarning',
+
+ # Dummy event object that can be used as a placeholder.
+ # It's never returned by the EventFactory.
+ 'NoEvent',
+
+ # Base class for event objects.
+ 'Event',
+
+ # Event objects.
+ 'CreateProcessEvent',
+ 'CreateThreadEvent',
+ 'ExitProcessEvent',
+ 'ExitThreadEvent',
+ 'LoadDLLEvent',
+ 'UnloadDLLEvent',
+ 'OutputDebugStringEvent',
+ 'RIPEvent',
+ 'ExceptionEvent'
+ ]
+
+from winappdbg import win32
+from winappdbg import compat
+from winappdbg.win32 import FileHandle, ProcessHandle, ThreadHandle
+from winappdbg.breakpoint import ApiHook
+from winappdbg.module import Module
+from winappdbg.thread import Thread
+from winappdbg.process import Process
+from winappdbg.textio import HexDump
+from winappdbg.util import StaticClass, PathOperations
+
+import sys
+import ctypes
+import warnings
+import traceback
+
+#==============================================================================
+
+class EventCallbackWarning (RuntimeWarning):
+ """
+ This warning is issued when an uncaught exception was raised by a
+ user-defined event handler.
+ """
+
+#==============================================================================
+
+class Event (object):
+ """
+ Event object.
+
+ @type eventMethod: str
+ @cvar eventMethod:
+ Method name to call when using L{EventHandler} subclasses.
+ Used internally.
+
+ @type eventName: str
+ @cvar eventName:
+ User-friendly name of the event.
+
+ @type eventDescription: str
+ @cvar eventDescription:
+ User-friendly description of the event.
+
+ @type debug: L{Debug}
+ @ivar debug:
+ Debug object that received the event.
+
+ @type raw: L{DEBUG_EVENT}
+ @ivar raw:
+ Raw DEBUG_EVENT structure as used by the Win32 API.
+
+ @type continueStatus: int
+ @ivar continueStatus:
+ Continue status to pass to L{win32.ContinueDebugEvent}.
+ """
+
+ eventMethod = 'unknown_event'
+ eventName = 'Unknown event'
+ eventDescription = 'A debug event of an unknown type has occured.'
+
+ def __init__(self, debug, raw):
+ """
+ @type debug: L{Debug}
+ @param debug: Debug object that received the event.
+
+ @type raw: L{DEBUG_EVENT}
+ @param raw: Raw DEBUG_EVENT structure as used by the Win32 API.
+ """
+ self.debug = debug
+ self.raw = raw
+ self.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+
+## @property
+## def debug(self):
+## """
+## @rtype debug: L{Debug}
+## @return debug:
+## Debug object that received the event.
+## """
+## return self.__debug()
+
+ def get_event_name(self):
+ """
+ @rtype: str
+ @return: User-friendly name of the event.
+ """
+ return self.eventName
+
+ def get_event_description(self):
+ """
+ @rtype: str
+ @return: User-friendly description of the event.
+ """
+ return self.eventDescription
+
+ def get_event_code(self):
+ """
+ @rtype: int
+ @return: Debug event code as defined in the Win32 API.
+ """
+ return self.raw.dwDebugEventCode
+
+## # Compatibility with version 1.0
+## # XXX to be removed in version 1.4
+## def get_code(self):
+## """
+## Alias of L{get_event_code} for backwards compatibility
+## with WinAppDbg version 1.0.
+## Will be phased out in the next version.
+##
+## @rtype: int
+## @return: Debug event code as defined in the Win32 API.
+## """
+## return self.get_event_code()
+
+ def get_pid(self):
+ """
+ @see: L{get_process}
+
+ @rtype: int
+ @return: Process global ID where the event occured.
+ """
+ return self.raw.dwProcessId
+
+ def get_tid(self):
+ """
+ @see: L{get_thread}
+
+ @rtype: int
+ @return: Thread global ID where the event occured.
+ """
+ return self.raw.dwThreadId
+
+ def get_process(self):
+ """
+ @see: L{get_pid}
+
+ @rtype: L{Process}
+ @return: Process where the event occured.
+ """
+ pid = self.get_pid()
+ system = self.debug.system
+ if system.has_process(pid):
+ process = system.get_process(pid)
+ else:
+ # XXX HACK
+ # The process object was missing for some reason, so make a new one.
+ process = Process(pid)
+ system._add_process(process)
+## process.scan_threads() # not needed
+ process.scan_modules()
+ return process
+
+ def get_thread(self):
+ """
+ @see: L{get_tid}
+
+ @rtype: L{Thread}
+ @return: Thread where the event occured.
+ """
+ tid = self.get_tid()
+ process = self.get_process()
+ if process.has_thread(tid):
+ thread = process.get_thread(tid)
+ else:
+ # XXX HACK
+ # The thread object was missing for some reason, so make a new one.
+ thread = Thread(tid)
+ process._add_thread(thread)
+ return thread
+
+#==============================================================================
+
+class NoEvent (Event):
+ """
+ No event.
+
+ Dummy L{Event} object that can be used as a placeholder when no debug
+ event has occured yet. It's never returned by the L{EventFactory}.
+ """
+
+ eventMethod = 'no_event'
+ eventName = 'No event'
+ eventDescription = 'No debug event has occured.'
+
+ def __init__(self, debug, raw = None):
+ Event.__init__(self, debug, raw)
+
+ def __len__(self):
+ """
+ Always returns C{0}, so when evaluating the object as a boolean it's
+ always C{False}. This prevents L{Debug.cont} from trying to continue
+ a dummy event.
+ """
+ return 0
+
+ def get_event_code(self):
+ return -1
+
+ def get_pid(self):
+ return -1
+
+ def get_tid(self):
+ return -1
+
+ def get_process(self):
+ return Process(self.get_pid())
+
+ def get_thread(self):
+ return Thread(self.get_tid())
+
+#==============================================================================
+
+class ExceptionEvent (Event):
+ """
+ Exception event.
+
+ @type exceptionName: dict( int S{->} str )
+ @cvar exceptionName:
+ Mapping of exception constants to their names.
+
+ @type exceptionDescription: dict( int S{->} str )
+ @cvar exceptionDescription:
+ Mapping of exception constants to user-friendly strings.
+
+ @type breakpoint: L{Breakpoint}
+ @ivar breakpoint:
+ If the exception was caused by one of our breakpoints, this member
+ contains a reference to the breakpoint object. Otherwise it's not
+ defined. It should only be used from the condition or action callback
+ routines, instead of the event handler.
+
+ @type hook: L{Hook}
+ @ivar hook:
+ If the exception was caused by a function hook, this member contains a
+ reference to the hook object. Otherwise it's not defined. It should
+ only be used from the hook callback routines, instead of the event
+ handler.
+ """
+
+ eventName = 'Exception event'
+ eventDescription = 'An exception was raised by the debugee.'
+
+ __exceptionMethod = {
+ win32.EXCEPTION_ACCESS_VIOLATION : 'access_violation',
+ win32.EXCEPTION_ARRAY_BOUNDS_EXCEEDED : 'array_bounds_exceeded',
+ win32.EXCEPTION_BREAKPOINT : 'breakpoint',
+ win32.EXCEPTION_DATATYPE_MISALIGNMENT : 'datatype_misalignment',
+ win32.EXCEPTION_FLT_DENORMAL_OPERAND : 'float_denormal_operand',
+ win32.EXCEPTION_FLT_DIVIDE_BY_ZERO : 'float_divide_by_zero',
+ win32.EXCEPTION_FLT_INEXACT_RESULT : 'float_inexact_result',
+ win32.EXCEPTION_FLT_INVALID_OPERATION : 'float_invalid_operation',
+ win32.EXCEPTION_FLT_OVERFLOW : 'float_overflow',
+ win32.EXCEPTION_FLT_STACK_CHECK : 'float_stack_check',
+ win32.EXCEPTION_FLT_UNDERFLOW : 'float_underflow',
+ win32.EXCEPTION_ILLEGAL_INSTRUCTION : 'illegal_instruction',
+ win32.EXCEPTION_IN_PAGE_ERROR : 'in_page_error',
+ win32.EXCEPTION_INT_DIVIDE_BY_ZERO : 'integer_divide_by_zero',
+ win32.EXCEPTION_INT_OVERFLOW : 'integer_overflow',
+ win32.EXCEPTION_INVALID_DISPOSITION : 'invalid_disposition',
+ win32.EXCEPTION_NONCONTINUABLE_EXCEPTION : 'noncontinuable_exception',
+ win32.EXCEPTION_PRIV_INSTRUCTION : 'privileged_instruction',
+ win32.EXCEPTION_SINGLE_STEP : 'single_step',
+ win32.EXCEPTION_STACK_OVERFLOW : 'stack_overflow',
+ win32.EXCEPTION_GUARD_PAGE : 'guard_page',
+ win32.EXCEPTION_INVALID_HANDLE : 'invalid_handle',
+ win32.EXCEPTION_POSSIBLE_DEADLOCK : 'possible_deadlock',
+ win32.EXCEPTION_WX86_BREAKPOINT : 'wow64_breakpoint',
+ win32.CONTROL_C_EXIT : 'control_c_exit',
+ win32.DBG_CONTROL_C : 'debug_control_c',
+ win32.MS_VC_EXCEPTION : 'ms_vc_exception',
+ }
+
+ __exceptionName = {
+ win32.EXCEPTION_ACCESS_VIOLATION : 'EXCEPTION_ACCESS_VIOLATION',
+ win32.EXCEPTION_ARRAY_BOUNDS_EXCEEDED : 'EXCEPTION_ARRAY_BOUNDS_EXCEEDED',
+ win32.EXCEPTION_BREAKPOINT : 'EXCEPTION_BREAKPOINT',
+ win32.EXCEPTION_DATATYPE_MISALIGNMENT : 'EXCEPTION_DATATYPE_MISALIGNMENT',
+ win32.EXCEPTION_FLT_DENORMAL_OPERAND : 'EXCEPTION_FLT_DENORMAL_OPERAND',
+ win32.EXCEPTION_FLT_DIVIDE_BY_ZERO : 'EXCEPTION_FLT_DIVIDE_BY_ZERO',
+ win32.EXCEPTION_FLT_INEXACT_RESULT : 'EXCEPTION_FLT_INEXACT_RESULT',
+ win32.EXCEPTION_FLT_INVALID_OPERATION : 'EXCEPTION_FLT_INVALID_OPERATION',
+ win32.EXCEPTION_FLT_OVERFLOW : 'EXCEPTION_FLT_OVERFLOW',
+ win32.EXCEPTION_FLT_STACK_CHECK : 'EXCEPTION_FLT_STACK_CHECK',
+ win32.EXCEPTION_FLT_UNDERFLOW : 'EXCEPTION_FLT_UNDERFLOW',
+ win32.EXCEPTION_ILLEGAL_INSTRUCTION : 'EXCEPTION_ILLEGAL_INSTRUCTION',
+ win32.EXCEPTION_IN_PAGE_ERROR : 'EXCEPTION_IN_PAGE_ERROR',
+ win32.EXCEPTION_INT_DIVIDE_BY_ZERO : 'EXCEPTION_INT_DIVIDE_BY_ZERO',
+ win32.EXCEPTION_INT_OVERFLOW : 'EXCEPTION_INT_OVERFLOW',
+ win32.EXCEPTION_INVALID_DISPOSITION : 'EXCEPTION_INVALID_DISPOSITION',
+ win32.EXCEPTION_NONCONTINUABLE_EXCEPTION : 'EXCEPTION_NONCONTINUABLE_EXCEPTION',
+ win32.EXCEPTION_PRIV_INSTRUCTION : 'EXCEPTION_PRIV_INSTRUCTION',
+ win32.EXCEPTION_SINGLE_STEP : 'EXCEPTION_SINGLE_STEP',
+ win32.EXCEPTION_STACK_OVERFLOW : 'EXCEPTION_STACK_OVERFLOW',
+ win32.EXCEPTION_GUARD_PAGE : 'EXCEPTION_GUARD_PAGE',
+ win32.EXCEPTION_INVALID_HANDLE : 'EXCEPTION_INVALID_HANDLE',
+ win32.EXCEPTION_POSSIBLE_DEADLOCK : 'EXCEPTION_POSSIBLE_DEADLOCK',
+ win32.EXCEPTION_WX86_BREAKPOINT : 'EXCEPTION_WX86_BREAKPOINT',
+ win32.CONTROL_C_EXIT : 'CONTROL_C_EXIT',
+ win32.DBG_CONTROL_C : 'DBG_CONTROL_C',
+ win32.MS_VC_EXCEPTION : 'MS_VC_EXCEPTION',
+ }
+
+ __exceptionDescription = {
+ win32.EXCEPTION_ACCESS_VIOLATION : 'Access violation',
+ win32.EXCEPTION_ARRAY_BOUNDS_EXCEEDED : 'Array bounds exceeded',
+ win32.EXCEPTION_BREAKPOINT : 'Breakpoint',
+ win32.EXCEPTION_DATATYPE_MISALIGNMENT : 'Datatype misalignment',
+ win32.EXCEPTION_FLT_DENORMAL_OPERAND : 'Float denormal operand',
+ win32.EXCEPTION_FLT_DIVIDE_BY_ZERO : 'Float divide by zero',
+ win32.EXCEPTION_FLT_INEXACT_RESULT : 'Float inexact result',
+ win32.EXCEPTION_FLT_INVALID_OPERATION : 'Float invalid operation',
+ win32.EXCEPTION_FLT_OVERFLOW : 'Float overflow',
+ win32.EXCEPTION_FLT_STACK_CHECK : 'Float stack check',
+ win32.EXCEPTION_FLT_UNDERFLOW : 'Float underflow',
+ win32.EXCEPTION_ILLEGAL_INSTRUCTION : 'Illegal instruction',
+ win32.EXCEPTION_IN_PAGE_ERROR : 'In-page error',
+ win32.EXCEPTION_INT_DIVIDE_BY_ZERO : 'Integer divide by zero',
+ win32.EXCEPTION_INT_OVERFLOW : 'Integer overflow',
+ win32.EXCEPTION_INVALID_DISPOSITION : 'Invalid disposition',
+ win32.EXCEPTION_NONCONTINUABLE_EXCEPTION : 'Noncontinuable exception',
+ win32.EXCEPTION_PRIV_INSTRUCTION : 'Privileged instruction',
+ win32.EXCEPTION_SINGLE_STEP : 'Single step event',
+ win32.EXCEPTION_STACK_OVERFLOW : 'Stack limits overflow',
+ win32.EXCEPTION_GUARD_PAGE : 'Guard page hit',
+ win32.EXCEPTION_INVALID_HANDLE : 'Invalid handle',
+ win32.EXCEPTION_POSSIBLE_DEADLOCK : 'Possible deadlock',
+ win32.EXCEPTION_WX86_BREAKPOINT : 'WOW64 breakpoint',
+ win32.CONTROL_C_EXIT : 'Control-C exit',
+ win32.DBG_CONTROL_C : 'Debug Control-C',
+ win32.MS_VC_EXCEPTION : 'Microsoft Visual C++ exception',
+ }
+
+ @property
+ def eventMethod(self):
+ return self.__exceptionMethod.get(
+ self.get_exception_code(), 'unknown_exception')
+
+ def get_exception_name(self):
+ """
+ @rtype: str
+ @return: Name of the exception as defined by the Win32 API.
+ """
+ code = self.get_exception_code()
+ unk = HexDump.integer(code)
+ return self.__exceptionName.get(code, unk)
+
+ def get_exception_description(self):
+ """
+ @rtype: str
+ @return: User-friendly name of the exception.
+ """
+ code = self.get_exception_code()
+ description = self.__exceptionDescription.get(code, None)
+ if description is None:
+ try:
+ description = 'Exception code %s (%s)'
+ description = description % (HexDump.integer(code),
+ ctypes.FormatError(code))
+ except OverflowError:
+ description = 'Exception code %s' % HexDump.integer(code)
+ return description
+
+ def is_first_chance(self):
+ """
+ @rtype: bool
+ @return: C{True} for first chance exceptions, C{False} for last chance.
+ """
+ return self.raw.u.Exception.dwFirstChance != 0
+
+ def is_last_chance(self):
+ """
+ @rtype: bool
+ @return: The opposite of L{is_first_chance}.
+ """
+ return not self.is_first_chance()
+
+ def is_noncontinuable(self):
+ """
+ @see: U{http://msdn.microsoft.com/en-us/library/aa363082(VS.85).aspx}
+
+ @rtype: bool
+ @return: C{True} if the exception is noncontinuable,
+ C{False} otherwise.
+
+ Attempting to continue a noncontinuable exception results in an
+ EXCEPTION_NONCONTINUABLE_EXCEPTION exception to be raised.
+ """
+ return bool( self.raw.u.Exception.ExceptionRecord.ExceptionFlags & \
+ win32.EXCEPTION_NONCONTINUABLE )
+
+ def is_continuable(self):
+ """
+ @rtype: bool
+ @return: The opposite of L{is_noncontinuable}.
+ """
+ return not self.is_noncontinuable()
+
+ def is_user_defined_exception(self):
+ """
+ Determines if this is an user-defined exception. User-defined
+ exceptions may contain any exception code that is not system reserved.
+
+ Often the exception code is also a valid Win32 error code, but that's
+ up to the debugged application.
+
+ @rtype: bool
+ @return: C{True} if the exception is user-defined, C{False} otherwise.
+ """
+ return self.get_exception_code() & 0x10000000 == 0
+
+ def is_system_defined_exception(self):
+ """
+ @rtype: bool
+ @return: The opposite of L{is_user_defined_exception}.
+ """
+ return not self.is_user_defined_exception()
+
+ def get_exception_code(self):
+ """
+ @rtype: int
+ @return: Exception code as defined by the Win32 API.
+ """
+ return self.raw.u.Exception.ExceptionRecord.ExceptionCode
+
+ def get_exception_address(self):
+ """
+ @rtype: int
+ @return: Memory address where the exception occured.
+ """
+ address = self.raw.u.Exception.ExceptionRecord.ExceptionAddress
+ if address is None:
+ address = 0
+ return address
+
+ def get_exception_information(self, index):
+ """
+ @type index: int
+ @param index: Index into the exception information block.
+
+ @rtype: int
+ @return: Exception information DWORD.
+ """
+ if index < 0 or index > win32.EXCEPTION_MAXIMUM_PARAMETERS:
+ raise IndexError("Array index out of range: %s" % repr(index))
+ info = self.raw.u.Exception.ExceptionRecord.ExceptionInformation
+ value = info[index]
+ if value is None:
+ value = 0
+ return value
+
+ def get_exception_information_as_list(self):
+ """
+ @rtype: list( int )
+ @return: Exception information block.
+ """
+ info = self.raw.u.Exception.ExceptionRecord.ExceptionInformation
+ data = list()
+ for index in compat.xrange(0, win32.EXCEPTION_MAXIMUM_PARAMETERS):
+ value = info[index]
+ if value is None:
+ value = 0
+ data.append(value)
+ return data
+
+ def get_fault_type(self):
+ """
+ @rtype: int
+ @return: Access violation type.
+ Should be one of the following constants:
+
+ - L{win32.EXCEPTION_READ_FAULT}
+ - L{win32.EXCEPTION_WRITE_FAULT}
+ - L{win32.EXCEPTION_EXECUTE_FAULT}
+
+ @note: This method is only meaningful for access violation exceptions,
+ in-page memory error exceptions and guard page exceptions.
+
+ @raise NotImplementedError: Wrong kind of exception.
+ """
+ if self.get_exception_code() not in (win32.EXCEPTION_ACCESS_VIOLATION,
+ win32.EXCEPTION_IN_PAGE_ERROR, win32.EXCEPTION_GUARD_PAGE):
+ msg = "This method is not meaningful for %s."
+ raise NotImplementedError(msg % self.get_exception_name())
+ return self.get_exception_information(0)
+
+ def get_fault_address(self):
+ """
+ @rtype: int
+ @return: Access violation memory address.
+
+ @note: This method is only meaningful for access violation exceptions,
+ in-page memory error exceptions and guard page exceptions.
+
+ @raise NotImplementedError: Wrong kind of exception.
+ """
+ if self.get_exception_code() not in (win32.EXCEPTION_ACCESS_VIOLATION,
+ win32.EXCEPTION_IN_PAGE_ERROR, win32.EXCEPTION_GUARD_PAGE):
+ msg = "This method is not meaningful for %s."
+ raise NotImplementedError(msg % self.get_exception_name())
+ return self.get_exception_information(1)
+
+ def get_ntstatus_code(self):
+ """
+ @rtype: int
+ @return: NTSTATUS status code that caused the exception.
+
+ @note: This method is only meaningful for in-page memory error
+ exceptions.
+
+ @raise NotImplementedError: Not an in-page memory error.
+ """
+ if self.get_exception_code() != win32.EXCEPTION_IN_PAGE_ERROR:
+ msg = "This method is only meaningful "\
+ "for in-page memory error exceptions."
+ raise NotImplementedError(msg)
+ return self.get_exception_information(2)
+
+ def is_nested(self):
+ """
+ @rtype: bool
+ @return: Returns C{True} if there are additional exception records
+ associated with this exception. This would mean the exception
+ is nested, that is, it was triggered while trying to handle
+ at least one previous exception.
+ """
+ return bool(self.raw.u.Exception.ExceptionRecord.ExceptionRecord)
+
+ def get_raw_exception_record_list(self):
+ """
+ Traverses the exception record linked list and builds a Python list.
+
+ Nested exception records are received for nested exceptions. This
+ happens when an exception is raised in the debugee while trying to
+ handle a previous exception.
+
+ @rtype: list( L{win32.EXCEPTION_RECORD} )
+ @return:
+ List of raw exception record structures as used by the Win32 API.
+
+ There is always at least one exception record, so the list is
+ never empty. All other methods of this class read from the first
+ exception record only, that is, the most recent exception.
+ """
+ # The first EXCEPTION_RECORD is contained in EXCEPTION_DEBUG_INFO.
+ # The remaining EXCEPTION_RECORD structures are linked by pointers.
+ nested = list()
+ record = self.raw.u.Exception
+ while True:
+ record = record.ExceptionRecord
+ if not record:
+ break
+ nested.append(record)
+ return nested
+
+ def get_nested_exceptions(self):
+ """
+ Traverses the exception record linked list and builds a Python list.
+
+ Nested exception records are received for nested exceptions. This
+ happens when an exception is raised in the debugee while trying to
+ handle a previous exception.
+
+ @rtype: list( L{ExceptionEvent} )
+ @return:
+ List of ExceptionEvent objects representing each exception record
+ found in this event.
+
+ There is always at least one exception record, so the list is
+ never empty. All other methods of this class read from the first
+ exception record only, that is, the most recent exception.
+ """
+ # The list always begins with ourselves.
+ # Just put a reference to "self" as the first element,
+ # and start looping from the second exception record.
+ nested = [ self ]
+ raw = self.raw
+ dwDebugEventCode = raw.dwDebugEventCode
+ dwProcessId = raw.dwProcessId
+ dwThreadId = raw.dwThreadId
+ dwFirstChance = raw.u.Exception.dwFirstChance
+ record = raw.u.Exception.ExceptionRecord
+ while True:
+ record = record.ExceptionRecord
+ if not record:
+ break
+ raw = win32.DEBUG_EVENT()
+ raw.dwDebugEventCode = dwDebugEventCode
+ raw.dwProcessId = dwProcessId
+ raw.dwThreadId = dwThreadId
+ raw.u.Exception.ExceptionRecord = record
+ raw.u.Exception.dwFirstChance = dwFirstChance
+ event = EventFactory.get(self.debug, raw)
+ nested.append(event)
+ return nested
+
+#==============================================================================
+
+class CreateThreadEvent (Event):
+ """
+ Thread creation event.
+ """
+
+ eventMethod = 'create_thread'
+ eventName = 'Thread creation event'
+ eventDescription = 'A new thread has started.'
+
+ def get_thread_handle(self):
+ """
+ @rtype: L{ThreadHandle}
+ @return: Thread handle received from the system.
+ Returns C{None} if the handle is not available.
+ """
+ # The handle doesn't need to be closed.
+ # See http://msdn.microsoft.com/en-us/library/ms681423(VS.85).aspx
+ hThread = self.raw.u.CreateThread.hThread
+ if hThread in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hThread = None
+ else:
+ hThread = ThreadHandle(hThread, False, win32.THREAD_ALL_ACCESS)
+ return hThread
+
+ def get_teb(self):
+ """
+ @rtype: int
+ @return: Pointer to the TEB.
+ """
+ return self.raw.u.CreateThread.lpThreadLocalBase
+
+ def get_start_address(self):
+ """
+ @rtype: int
+ @return: Pointer to the first instruction to execute in this thread.
+
+ Returns C{NULL} when the debugger attached to a process
+ and the thread already existed.
+
+ See U{http://msdn.microsoft.com/en-us/library/ms679295(VS.85).aspx}
+ """
+ return self.raw.u.CreateThread.lpStartAddress
+
+#==============================================================================
+
+class CreateProcessEvent (Event):
+ """
+ Process creation event.
+ """
+
+ eventMethod = 'create_process'
+ eventName = 'Process creation event'
+ eventDescription = 'A new process has started.'
+
+ def get_file_handle(self):
+ """
+ @rtype: L{FileHandle} or None
+ @return: File handle to the main module, received from the system.
+ Returns C{None} if the handle is not available.
+ """
+ # This handle DOES need to be closed.
+ # Therefore we must cache it so it doesn't
+ # get closed after the first call.
+ try:
+ hFile = self.__hFile
+ except AttributeError:
+ hFile = self.raw.u.CreateProcessInfo.hFile
+ if hFile in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hFile = None
+ else:
+ hFile = FileHandle(hFile, True)
+ self.__hFile = hFile
+ return hFile
+
+ def get_process_handle(self):
+ """
+ @rtype: L{ProcessHandle}
+ @return: Process handle received from the system.
+ Returns C{None} if the handle is not available.
+ """
+ # The handle doesn't need to be closed.
+ # See http://msdn.microsoft.com/en-us/library/ms681423(VS.85).aspx
+ hProcess = self.raw.u.CreateProcessInfo.hProcess
+ if hProcess in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hProcess = None
+ else:
+ hProcess = ProcessHandle(hProcess, False, win32.PROCESS_ALL_ACCESS)
+ return hProcess
+
+ def get_thread_handle(self):
+ """
+ @rtype: L{ThreadHandle}
+ @return: Thread handle received from the system.
+ Returns C{None} if the handle is not available.
+ """
+ # The handle doesn't need to be closed.
+ # See http://msdn.microsoft.com/en-us/library/ms681423(VS.85).aspx
+ hThread = self.raw.u.CreateProcessInfo.hThread
+ if hThread in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hThread = None
+ else:
+ hThread = ThreadHandle(hThread, False, win32.THREAD_ALL_ACCESS)
+ return hThread
+
+ def get_start_address(self):
+ """
+ @rtype: int
+ @return: Pointer to the first instruction to execute in this process.
+
+ Returns C{NULL} when the debugger attaches to a process.
+
+ See U{http://msdn.microsoft.com/en-us/library/ms679295(VS.85).aspx}
+ """
+ return self.raw.u.CreateProcessInfo.lpStartAddress
+
+ def get_image_base(self):
+ """
+ @rtype: int
+ @return: Base address of the main module.
+ @warn: This value is taken from the PE file
+ and may be incorrect because of ASLR!
+ """
+ # TODO try to calculate the real value when ASLR is active.
+ return self.raw.u.CreateProcessInfo.lpBaseOfImage
+
+ def get_teb(self):
+ """
+ @rtype: int
+ @return: Pointer to the TEB.
+ """
+ return self.raw.u.CreateProcessInfo.lpThreadLocalBase
+
+ def get_debug_info(self):
+ """
+ @rtype: str
+ @return: Debugging information.
+ """
+ raw = self.raw.u.CreateProcessInfo
+ ptr = raw.lpBaseOfImage + raw.dwDebugInfoFileOffset
+ size = raw.nDebugInfoSize
+ data = self.get_process().peek(ptr, size)
+ if len(data) == size:
+ return data
+ return None
+
+ def get_filename(self):
+ """
+ @rtype: str, None
+ @return: This method does it's best to retrieve the filename to
+ the main module of the process. However, sometimes that's not
+ possible, and C{None} is returned instead.
+ """
+
+ # Try to get the filename from the file handle.
+ szFilename = None
+ hFile = self.get_file_handle()
+ if hFile:
+ szFilename = hFile.get_filename()
+ if not szFilename:
+
+ # Try to get it from CREATE_PROCESS_DEBUG_INFO.lpImageName
+ # It's NULL or *NULL most of the times, see MSDN:
+ # http://msdn.microsoft.com/en-us/library/ms679286(VS.85).aspx
+ aProcess = self.get_process()
+ lpRemoteFilenamePtr = self.raw.u.CreateProcessInfo.lpImageName
+ if lpRemoteFilenamePtr:
+ lpFilename = aProcess.peek_uint(lpRemoteFilenamePtr)
+ fUnicode = bool( self.raw.u.CreateProcessInfo.fUnicode )
+ szFilename = aProcess.peek_string(lpFilename, fUnicode)
+
+ # XXX TODO
+ # Sometimes the filename is relative (ntdll.dll, kernel32.dll).
+ # It could be converted to an absolute pathname (SearchPath).
+
+ # Try to get it from Process.get_image_name().
+ if not szFilename:
+ szFilename = aProcess.get_image_name()
+
+ # Return the filename, or None on error.
+ return szFilename
+
+ def get_module_base(self):
+ """
+ @rtype: int
+ @return: Base address of the main module.
+ """
+ return self.get_image_base()
+
+ def get_module(self):
+ """
+ @rtype: L{Module}
+ @return: Main module of the process.
+ """
+ return self.get_process().get_module( self.get_module_base() )
+
+#==============================================================================
+
+class ExitThreadEvent (Event):
+ """
+ Thread termination event.
+ """
+
+ eventMethod = 'exit_thread'
+ eventName = 'Thread termination event'
+ eventDescription = 'A thread has finished executing.'
+
+ def get_exit_code(self):
+ """
+ @rtype: int
+ @return: Exit code of the thread.
+ """
+ return self.raw.u.ExitThread.dwExitCode
+
+#==============================================================================
+
+class ExitProcessEvent (Event):
+ """
+ Process termination event.
+ """
+
+ eventMethod = 'exit_process'
+ eventName = 'Process termination event'
+ eventDescription = 'A process has finished executing.'
+
+ def get_exit_code(self):
+ """
+ @rtype: int
+ @return: Exit code of the process.
+ """
+ return self.raw.u.ExitProcess.dwExitCode
+
+ def get_filename(self):
+ """
+ @rtype: None or str
+ @return: Filename of the main module.
+ C{None} if the filename is unknown.
+ """
+ return self.get_module().get_filename()
+
+ def get_image_base(self):
+ """
+ @rtype: int
+ @return: Base address of the main module.
+ """
+ return self.get_module_base()
+
+ def get_module_base(self):
+ """
+ @rtype: int
+ @return: Base address of the main module.
+ """
+ return self.get_module().get_base()
+
+ def get_module(self):
+ """
+ @rtype: L{Module}
+ @return: Main module of the process.
+ """
+ return self.get_process().get_main_module()
+
+#==============================================================================
+
+class LoadDLLEvent (Event):
+ """
+ Module load event.
+ """
+
+ eventMethod = 'load_dll'
+ eventName = 'Module load event'
+ eventDescription = 'A new DLL library was loaded by the debugee.'
+
+ def get_module_base(self):
+ """
+ @rtype: int
+ @return: Base address for the newly loaded DLL.
+ """
+ return self.raw.u.LoadDll.lpBaseOfDll
+
+ def get_module(self):
+ """
+ @rtype: L{Module}
+ @return: Module object for the newly loaded DLL.
+ """
+ lpBaseOfDll = self.get_module_base()
+ aProcess = self.get_process()
+ if aProcess.has_module(lpBaseOfDll):
+ aModule = aProcess.get_module(lpBaseOfDll)
+ else:
+ # XXX HACK
+ # For some reason the module object is missing, so make a new one.
+ aModule = Module(lpBaseOfDll,
+ hFile = self.get_file_handle(),
+ fileName = self.get_filename(),
+ process = aProcess)
+ aProcess._add_module(aModule)
+ return aModule
+
+ def get_file_handle(self):
+ """
+ @rtype: L{FileHandle} or None
+ @return: File handle to the newly loaded DLL received from the system.
+ Returns C{None} if the handle is not available.
+ """
+ # This handle DOES need to be closed.
+ # Therefore we must cache it so it doesn't
+ # get closed after the first call.
+ try:
+ hFile = self.__hFile
+ except AttributeError:
+ hFile = self.raw.u.LoadDll.hFile
+ if hFile in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hFile = None
+ else:
+ hFile = FileHandle(hFile, True)
+ self.__hFile = hFile
+ return hFile
+
+ def get_filename(self):
+ """
+ @rtype: str, None
+ @return: This method does it's best to retrieve the filename to
+ the newly loaded module. However, sometimes that's not
+ possible, and C{None} is returned instead.
+ """
+ szFilename = None
+
+ # Try to get it from LOAD_DLL_DEBUG_INFO.lpImageName
+ # It's NULL or *NULL most of the times, see MSDN:
+ # http://msdn.microsoft.com/en-us/library/ms679286(VS.85).aspx
+ aProcess = self.get_process()
+ lpRemoteFilenamePtr = self.raw.u.LoadDll.lpImageName
+ if lpRemoteFilenamePtr:
+ lpFilename = aProcess.peek_uint(lpRemoteFilenamePtr)
+ fUnicode = bool( self.raw.u.LoadDll.fUnicode )
+ szFilename = aProcess.peek_string(lpFilename, fUnicode)
+ if not szFilename:
+ szFilename = None
+
+ # Try to get the filename from the file handle.
+ if not szFilename:
+ hFile = self.get_file_handle()
+ if hFile:
+ szFilename = hFile.get_filename()
+
+ # Return the filename, or None on error.
+ return szFilename
+
+#==============================================================================
+
+class UnloadDLLEvent (Event):
+ """
+ Module unload event.
+ """
+
+ eventMethod = 'unload_dll'
+ eventName = 'Module unload event'
+ eventDescription = 'A DLL library was unloaded by the debugee.'
+
+ def get_module_base(self):
+ """
+ @rtype: int
+ @return: Base address for the recently unloaded DLL.
+ """
+ return self.raw.u.UnloadDll.lpBaseOfDll
+
+ def get_module(self):
+ """
+ @rtype: L{Module}
+ @return: Module object for the recently unloaded DLL.
+ """
+ lpBaseOfDll = self.get_module_base()
+ aProcess = self.get_process()
+ if aProcess.has_module(lpBaseOfDll):
+ aModule = aProcess.get_module(lpBaseOfDll)
+ else:
+ aModule = Module(lpBaseOfDll, process = aProcess)
+ aProcess._add_module(aModule)
+ return aModule
+
+ def get_file_handle(self):
+ """
+ @rtype: None or L{FileHandle}
+ @return: File handle to the recently unloaded DLL.
+ Returns C{None} if the handle is not available.
+ """
+ hFile = self.get_module().hFile
+ if hFile in (0, win32.NULL, win32.INVALID_HANDLE_VALUE):
+ hFile = None
+ return hFile
+
+ def get_filename(self):
+ """
+ @rtype: None or str
+ @return: Filename of the recently unloaded DLL.
+ C{None} if the filename is unknown.
+ """
+ return self.get_module().get_filename()
+
+#==============================================================================
+
+class OutputDebugStringEvent (Event):
+ """
+ Debug string output event.
+ """
+
+ eventMethod = 'output_string'
+ eventName = 'Debug string output event'
+ eventDescription = 'The debugee sent a message to the debugger.'
+
+ def get_debug_string(self):
+ """
+ @rtype: str, compat.unicode
+ @return: String sent by the debugee.
+ It may be ANSI or Unicode and may end with a null character.
+ """
+ return self.get_process().peek_string(
+ self.raw.u.DebugString.lpDebugStringData,
+ bool( self.raw.u.DebugString.fUnicode ),
+ self.raw.u.DebugString.nDebugStringLength)
+
+#==============================================================================
+
+class RIPEvent (Event):
+ """
+ RIP event.
+ """
+
+ eventMethod = 'rip'
+ eventName = 'RIP event'
+ eventDescription = 'An error has occured and the process ' \
+ 'can no longer be debugged.'
+
+ def get_rip_error(self):
+ """
+ @rtype: int
+ @return: RIP error code as defined by the Win32 API.
+ """
+ return self.raw.u.RipInfo.dwError
+
+ def get_rip_type(self):
+ """
+ @rtype: int
+ @return: RIP type code as defined by the Win32 API.
+ May be C{0} or one of the following:
+ - L{win32.SLE_ERROR}
+ - L{win32.SLE_MINORERROR}
+ - L{win32.SLE_WARNING}
+ """
+ return self.raw.u.RipInfo.dwType
+
+#==============================================================================
+
+class EventFactory (StaticClass):
+ """
+ Factory of L{Event} objects.
+
+ @type baseEvent: L{Event}
+ @cvar baseEvent:
+ Base class for Event objects.
+ It's used for unknown event codes.
+
+ @type eventClasses: dict( int S{->} L{Event} )
+ @cvar eventClasses:
+ Dictionary that maps event codes to L{Event} subclasses.
+ """
+
+ baseEvent = Event
+ eventClasses = {
+ win32.EXCEPTION_DEBUG_EVENT : ExceptionEvent, # 1
+ win32.CREATE_THREAD_DEBUG_EVENT : CreateThreadEvent, # 2
+ win32.CREATE_PROCESS_DEBUG_EVENT : CreateProcessEvent, # 3
+ win32.EXIT_THREAD_DEBUG_EVENT : ExitThreadEvent, # 4
+ win32.EXIT_PROCESS_DEBUG_EVENT : ExitProcessEvent, # 5
+ win32.LOAD_DLL_DEBUG_EVENT : LoadDLLEvent, # 6
+ win32.UNLOAD_DLL_DEBUG_EVENT : UnloadDLLEvent, # 7
+ win32.OUTPUT_DEBUG_STRING_EVENT : OutputDebugStringEvent, # 8
+ win32.RIP_EVENT : RIPEvent, # 9
+ }
+
+ @classmethod
+ def get(cls, debug, raw):
+ """
+ @type debug: L{Debug}
+ @param debug: Debug object that received the event.
+
+ @type raw: L{DEBUG_EVENT}
+ @param raw: Raw DEBUG_EVENT structure as used by the Win32 API.
+
+ @rtype: L{Event}
+ @returns: An Event object or one of it's subclasses,
+ depending on the event type.
+ """
+ eventClass = cls.eventClasses.get(raw.dwDebugEventCode, cls.baseEvent)
+ return eventClass(debug, raw)
+
+#==============================================================================
+
+class EventHandler (object):
+ """
+ Base class for debug event handlers.
+
+ Your program should subclass it to implement it's own event handling.
+
+ The constructor can be overriden as long as you call the superclass
+ constructor. The special method L{__call__} B{MUST NOT} be overriden.
+
+ The signature for event handlers is the following::
+
+ def event_handler(self, event):
+
+ Where B{event} is an L{Event} object.
+
+ Each event handler is named after the event they handle.
+ This is the list of all valid event handler names:
+
+ - I{event}
+
+ Receives an L{Event} object or an object of any of it's subclasses,
+ and handles any event for which no handler was defined.
+
+ - I{unknown_event}
+
+ Receives an L{Event} object or an object of any of it's subclasses,
+ and handles any event unknown to the debugging engine. (This is not
+ likely to happen unless the Win32 debugging API is changed in future
+ versions of Windows).
+
+ - I{exception}
+
+ Receives an L{ExceptionEvent} object and handles any exception for
+ which no handler was defined. See above for exception handlers.
+
+ - I{unknown_exception}
+
+ Receives an L{ExceptionEvent} object and handles any exception unknown
+ to the debugging engine. This usually happens for C++ exceptions, which
+ are not standardized and may change from one compiler to the next.
+
+ Currently we have partial support for C++ exceptions thrown by Microsoft
+ compilers.
+
+ Also see: U{RaiseException()
+ }
+
+ - I{create_thread}
+
+ Receives a L{CreateThreadEvent} object.
+
+ - I{create_process}
+
+ Receives a L{CreateProcessEvent} object.
+
+ - I{exit_thread}
+
+ Receives a L{ExitThreadEvent} object.
+
+ - I{exit_process}
+
+ Receives a L{ExitProcessEvent} object.
+
+ - I{load_dll}
+
+ Receives a L{LoadDLLEvent} object.
+
+ - I{unload_dll}
+
+ Receives an L{UnloadDLLEvent} object.
+
+ - I{output_string}
+
+ Receives an L{OutputDebugStringEvent} object.
+
+ - I{rip}
+
+ Receives a L{RIPEvent} object.
+
+ This is the list of all valid exception handler names
+ (they all receive an L{ExceptionEvent} object):
+
+ - I{access_violation}
+ - I{array_bounds_exceeded}
+ - I{breakpoint}
+ - I{control_c_exit}
+ - I{datatype_misalignment}
+ - I{debug_control_c}
+ - I{float_denormal_operand}
+ - I{float_divide_by_zero}
+ - I{float_inexact_result}
+ - I{float_invalid_operation}
+ - I{float_overflow}
+ - I{float_stack_check}
+ - I{float_underflow}
+ - I{guard_page}
+ - I{illegal_instruction}
+ - I{in_page_error}
+ - I{integer_divide_by_zero}
+ - I{integer_overflow}
+ - I{invalid_disposition}
+ - I{invalid_handle}
+ - I{ms_vc_exception}
+ - I{noncontinuable_exception}
+ - I{possible_deadlock}
+ - I{privileged_instruction}
+ - I{single_step}
+ - I{stack_overflow}
+ - I{wow64_breakpoint}
+
+
+
+ @type apiHooks: dict( str S{->} list( tuple( str, int ) ) )
+ @cvar apiHooks:
+ Dictionary that maps module names to lists of
+ tuples of ( procedure name, parameter count ).
+
+ All procedures listed here will be hooked for calls from the debugee.
+ When this happens, the corresponding event handler can be notified both
+ when the procedure is entered and when it's left by the debugee.
+
+ For example, let's hook the LoadLibraryEx() API call.
+ This would be the declaration of apiHooks::
+
+ from winappdbg import EventHandler
+ from winappdbg.win32 import *
+
+ # (...)
+
+ class MyEventHandler (EventHandler):
+
+ apiHook = {
+
+ "kernel32.dll" : (
+
+ # Procedure name Signature
+ ( "LoadLibraryEx", (PVOID, HANDLE, DWORD) ),
+
+ # (more procedures can go here...)
+ ),
+
+ # (more libraries can go here...)
+ }
+
+ # (your method definitions go here...)
+
+ Note that all pointer types are treated like void pointers, so your
+ callback won't get the string or structure pointed to by it, but the
+ remote memory address instead. This is so to prevent the ctypes library
+ from being "too helpful" and trying to dereference the pointer. To get
+ the actual data being pointed to, use one of the L{Process.read}
+ methods.
+
+ Now, to intercept calls to LoadLibraryEx define a method like this in
+ your event handler class::
+
+ def pre_LoadLibraryEx(self, event, ra, lpFilename, hFile, dwFlags):
+ szFilename = event.get_process().peek_string(lpFilename)
+
+ # (...)
+
+ Note that the first parameter is always the L{Event} object, and the
+ second parameter is the return address. The third parameter and above
+ are the values passed to the hooked function.
+
+ Finally, to intercept returns from calls to LoadLibraryEx define a
+ method like this::
+
+ def post_LoadLibraryEx(self, event, retval):
+ # (...)
+
+ The first parameter is the L{Event} object and the second is the
+ return value from the hooked function.
+ """
+
+#------------------------------------------------------------------------------
+
+ # Default (empty) API hooks dictionary.
+ apiHooks = {}
+
+ def __init__(self):
+ """
+ Class constructor. Don't forget to call it when subclassing!
+
+ Forgetting to call the superclass constructor is a common mistake when
+ you're new to Python. :)
+
+ Example::
+ class MyEventHandler (EventHandler):
+
+ # Override the constructor to use an extra argument.
+ def __init__(self, myArgument):
+
+ # Do something with the argument, like keeping it
+ # as an instance variable.
+ self.myVariable = myArgument
+
+ # Call the superclass constructor.
+ super(MyEventHandler, self).__init__()
+
+ # The rest of your code below...
+ """
+
+ # TODO
+ # All this does is set up the hooks.
+ # This code should be moved to the EventDispatcher class.
+ # Then the hooks can be set up at set_event_handler() instead, making
+ # this class even simpler. The downside here is deciding where to store
+ # the ApiHook objects.
+
+ # Convert the tuples into instances of the ApiHook class.
+ # A new dictionary must be instanced, otherwise we could also be
+ # affecting all other instances of the EventHandler.
+ apiHooks = dict()
+ for lib, hooks in compat.iteritems(self.apiHooks):
+ hook_objs = []
+ for proc, args in hooks:
+ if type(args) in (int, long):
+ h = ApiHook(self, lib, proc, paramCount = args)
+ else:
+ h = ApiHook(self, lib, proc, signature = args)
+ hook_objs.append(h)
+ apiHooks[lib] = hook_objs
+ self.__apiHooks = apiHooks
+
+ def __get_hooks_for_dll(self, event):
+ """
+ Get the requested API hooks for the current DLL.
+
+ Used by L{__hook_dll} and L{__unhook_dll}.
+ """
+ result = []
+ if self.__apiHooks:
+ path = event.get_module().get_filename()
+ if path:
+ lib_name = PathOperations.pathname_to_filename(path).lower()
+ for hook_lib, hook_api_list in compat.iteritems(self.__apiHooks):
+ if hook_lib == lib_name:
+ result.extend(hook_api_list)
+ return result
+
+ def __hook_dll(self, event):
+ """
+ Hook the requested API calls (in self.apiHooks).
+
+ This method is called automatically whenever a DLL is loaded.
+ """
+ debug = event.debug
+ pid = event.get_pid()
+ for hook_api_stub in self.__get_hooks_for_dll(event):
+ hook_api_stub.hook(debug, pid)
+
+ def __unhook_dll(self, event):
+ """
+ Unhook the requested API calls (in self.apiHooks).
+
+ This method is called automatically whenever a DLL is unloaded.
+ """
+ debug = event.debug
+ pid = event.get_pid()
+ for hook_api_stub in self.__get_hooks_for_dll(event):
+ hook_api_stub.unhook(debug, pid)
+
+ def __call__(self, event):
+ """
+ Dispatch debug events.
+
+ @warn: B{Don't override this method!}
+
+ @type event: L{Event}
+ @param event: Event object.
+ """
+ try:
+ code = event.get_event_code()
+ if code == win32.LOAD_DLL_DEBUG_EVENT:
+ self.__hook_dll(event)
+ elif code == win32.UNLOAD_DLL_DEBUG_EVENT:
+ self.__unhook_dll(event)
+ finally:
+ method = EventDispatcher.get_handler_method(self, event)
+ if method is not None:
+ return method(event)
+
+#==============================================================================
+
+# TODO
+# * Make it more generic by adding a few more callbacks.
+# That way it will be possible to make a thread sifter too.
+# * This interface feels too much like an antipattern.
+# When apiHooks is deprecated this will have to be reviewed.
+
+class EventSift(EventHandler):
+ """
+ Event handler that allows you to use customized event handlers for each
+ process you're attached to.
+
+ This makes coding the event handlers much easier, because each instance
+ will only "know" about one process. So you can code your event handler as
+ if only one process was being debugged, but your debugger can attach to
+ multiple processes.
+
+ Example::
+ from winappdbg import Debug, EventHandler, EventSift
+
+ # This class was written assuming only one process is attached.
+ # If you used it directly it would break when attaching to another
+ # process, or when a child process is spawned.
+ class MyEventHandler (EventHandler):
+
+ def create_process(self, event):
+ self.first = True
+ self.name = event.get_process().get_filename()
+ print "Attached to %s" % self.name
+
+ def breakpoint(self, event):
+ if self.first:
+ self.first = False
+ print "First breakpoint reached at %s" % self.name
+
+ def exit_process(self, event):
+ print "Detached from %s" % self.name
+
+ # Now when debugging we use the EventSift to be able to work with
+ # multiple processes while keeping our code simple. :)
+ if __name__ == "__main__":
+ handler = EventSift(MyEventHandler)
+ #handler = MyEventHandler() # try uncommenting this line...
+ with Debug(handler) as debug:
+ debug.execl("calc.exe")
+ debug.execl("notepad.exe")
+ debug.execl("charmap.exe")
+ debug.loop()
+
+ Subclasses of C{EventSift} can prevent specific event types from
+ being forwarded by simply defining a method for it. That means your
+ subclass can handle some event types globally while letting other types
+ be handled on per-process basis. To forward events manually you can
+ call C{self.event(event)}.
+
+ Example::
+ class MySift (EventSift):
+
+ # Don't forward this event.
+ def debug_control_c(self, event):
+ pass
+
+ # Handle this event globally without forwarding it.
+ def output_string(self, event):
+ print "Debug string: %s" % event.get_debug_string()
+
+ # Handle this event globally and then forward it.
+ def create_process(self, event):
+ print "New process created, PID: %d" % event.get_pid()
+ return self.event(event)
+
+ # All other events will be forwarded.
+
+ Note that overriding the C{event} method would cause no events to be
+ forwarded at all. To prevent this, call the superclass implementation.
+
+ Example::
+
+ def we_want_to_forward_this_event(event):
+ "Use whatever logic you want here..."
+ # (...return True or False...)
+
+ class MySift (EventSift):
+
+ def event(self, event):
+
+ # If the event matches some custom criteria...
+ if we_want_to_forward_this_event(event):
+
+ # Forward it.
+ return super(MySift, self).event(event)
+
+ # Otherwise, don't.
+
+ @type cls: class
+ @ivar cls:
+ Event handler class. There will be one instance of this class
+ per debugged process in the L{forward} dictionary.
+
+ @type argv: list
+ @ivar argv:
+ Positional arguments to pass to the constructor of L{cls}.
+
+ @type argd: list
+ @ivar argd:
+ Keyword arguments to pass to the constructor of L{cls}.
+
+ @type forward: dict
+ @ivar forward:
+ Dictionary that maps each debugged process ID to an instance of L{cls}.
+ """
+
+ def __init__(self, cls, *argv, **argd):
+ """
+ Maintains an instance of your event handler for each process being
+ debugged, and forwards the events of each process to each corresponding
+ instance.
+
+ @warn: If you subclass L{EventSift} and reimplement this method,
+ don't forget to call the superclass constructor!
+
+ @see: L{event}
+
+ @type cls: class
+ @param cls: Event handler class. This must be the class itself, not an
+ instance! All additional arguments passed to the constructor of
+ the event forwarder will be passed on to the constructor of this
+ class as well.
+ """
+ self.cls = cls
+ self.argv = argv
+ self.argd = argd
+ self.forward = dict()
+ super(EventSift, self).__init__()
+
+ # XXX HORRIBLE HACK
+ # This makes apiHooks work in the inner handlers.
+ def __call__(self, event):
+ try:
+ eventCode = event.get_event_code()
+ if eventCode in (win32.LOAD_DLL_DEBUG_EVENT,
+ win32.LOAD_DLL_DEBUG_EVENT):
+ pid = event.get_pid()
+ handler = self.forward.get(pid, None)
+ if handler is None:
+ handler = self.cls(*self.argv, **self.argd)
+ self.forward[pid] = handler
+ if isinstance(handler, EventHandler):
+ if eventCode == win32.LOAD_DLL_DEBUG_EVENT:
+ handler.__EventHandler_hook_dll(event)
+ else:
+ handler.__EventHandler_unhook_dll(event)
+ finally:
+ return super(EventSift, self).__call__(event)
+
+ def event(self, event):
+ """
+ Forwards events to the corresponding instance of your event handler
+ for this process.
+
+ If you subclass L{EventSift} and reimplement this method, no event
+ will be forwarded at all unless you call the superclass implementation.
+
+ If your filtering is based on the event type, there's a much easier way
+ to do it: just implement a handler for it.
+ """
+ eventCode = event.get_event_code()
+ pid = event.get_pid()
+ handler = self.forward.get(pid, None)
+ if handler is None:
+ handler = self.cls(*self.argv, **self.argd)
+ if eventCode != win32.EXIT_PROCESS_DEBUG_EVENT:
+ self.forward[pid] = handler
+ elif eventCode == win32.EXIT_PROCESS_DEBUG_EVENT:
+ del self.forward[pid]
+ return handler(event)
+
+#==============================================================================
+
+class EventDispatcher (object):
+ """
+ Implements debug event dispatching capabilities.
+
+ @group Debugging events:
+ get_event_handler, set_event_handler, get_handler_method
+ """
+
+ # Maps event code constants to the names of the pre-notify routines.
+ # These routines are called BEFORE the user-defined handlers.
+ # Unknown codes are ignored.
+ __preEventNotifyCallbackName = {
+ win32.CREATE_THREAD_DEBUG_EVENT : '_notify_create_thread',
+ win32.CREATE_PROCESS_DEBUG_EVENT : '_notify_create_process',
+ win32.LOAD_DLL_DEBUG_EVENT : '_notify_load_dll',
+ }
+
+ # Maps event code constants to the names of the post-notify routines.
+ # These routines are called AFTER the user-defined handlers.
+ # Unknown codes are ignored.
+ __postEventNotifyCallbackName = {
+ win32.EXIT_THREAD_DEBUG_EVENT : '_notify_exit_thread',
+ win32.EXIT_PROCESS_DEBUG_EVENT : '_notify_exit_process',
+ win32.UNLOAD_DLL_DEBUG_EVENT : '_notify_unload_dll',
+ win32.RIP_EVENT : '_notify_rip',
+ }
+
+ # Maps exception code constants to the names of the pre-notify routines.
+ # These routines are called BEFORE the user-defined handlers.
+ # Unknown codes are ignored.
+ __preExceptionNotifyCallbackName = {
+ win32.EXCEPTION_BREAKPOINT : '_notify_breakpoint',
+ win32.EXCEPTION_WX86_BREAKPOINT : '_notify_breakpoint',
+ win32.EXCEPTION_SINGLE_STEP : '_notify_single_step',
+ win32.EXCEPTION_GUARD_PAGE : '_notify_guard_page',
+ win32.DBG_CONTROL_C : '_notify_debug_control_c',
+ win32.MS_VC_EXCEPTION : '_notify_ms_vc_exception',
+ }
+
+ # Maps exception code constants to the names of the post-notify routines.
+ # These routines are called AFTER the user-defined handlers.
+ # Unknown codes are ignored.
+ __postExceptionNotifyCallbackName = {
+ }
+
+ def __init__(self, eventHandler = None):
+ """
+ Event dispatcher.
+
+ @type eventHandler: L{EventHandler}
+ @param eventHandler: (Optional) User-defined event handler.
+
+ @raise TypeError: The event handler is of an incorrect type.
+
+ @note: The L{eventHandler} parameter may be any callable Python object
+ (for example a function, or an instance method).
+ However you'll probably find it more convenient to use an instance
+ of a subclass of L{EventHandler} here.
+ """
+ self.set_event_handler(eventHandler)
+
+ def get_event_handler(self):
+ """
+ Get the event handler.
+
+ @see: L{set_event_handler}
+
+ @rtype: L{EventHandler}
+ @return: Current event handler object, or C{None}.
+ """
+ return self.__eventHandler
+
+ def set_event_handler(self, eventHandler):
+ """
+ Set the event handler.
+
+ @warn: This is normally not needed. Use with care!
+
+ @type eventHandler: L{EventHandler}
+ @param eventHandler: New event handler object, or C{None}.
+
+ @rtype: L{EventHandler}
+ @return: Previous event handler object, or C{None}.
+
+ @raise TypeError: The event handler is of an incorrect type.
+
+ @note: The L{eventHandler} parameter may be any callable Python object
+ (for example a function, or an instance method).
+ However you'll probably find it more convenient to use an instance
+ of a subclass of L{EventHandler} here.
+ """
+ if eventHandler is not None and not callable(eventHandler):
+ raise TypeError("Event handler must be a callable object")
+ try:
+ wrong_type = issubclass(eventHandler, EventHandler)
+ except TypeError:
+ wrong_type = False
+ if wrong_type:
+ classname = str(eventHandler)
+ msg = "Event handler must be an instance of class %s"
+ msg += "rather than the %s class itself. (Missing parens?)"
+ msg = msg % (classname, classname)
+ raise TypeError(msg)
+ try:
+ previous = self.__eventHandler
+ except AttributeError:
+ previous = None
+ self.__eventHandler = eventHandler
+ return previous
+
+ @staticmethod
+ def get_handler_method(eventHandler, event, fallback=None):
+ """
+ Retrieves the appropriate callback method from an L{EventHandler}
+ instance for the given L{Event} object.
+
+ @type eventHandler: L{EventHandler}
+ @param eventHandler:
+ Event handler object whose methods we are examining.
+
+ @type event: L{Event}
+ @param event: Debugging event to be handled.
+
+ @type fallback: callable
+ @param fallback: (Optional) If no suitable method is found in the
+ L{EventHandler} instance, return this value.
+
+ @rtype: callable
+ @return: Bound method that will handle the debugging event.
+ Returns C{None} if no such method is defined.
+ """
+ eventCode = event.get_event_code()
+ method = getattr(eventHandler, 'event', fallback)
+ if eventCode == win32.EXCEPTION_DEBUG_EVENT:
+ method = getattr(eventHandler, 'exception', method)
+ method = getattr(eventHandler, event.eventMethod, method)
+ return method
+
+ def dispatch(self, event):
+ """
+ Sends event notifications to the L{Debug} object and
+ the L{EventHandler} object provided by the user.
+
+ The L{Debug} object will forward the notifications to it's contained
+ snapshot objects (L{System}, L{Process}, L{Thread} and L{Module}) when
+ appropriate.
+
+ @warning: This method is called automatically from L{Debug.dispatch}.
+
+ @see: L{Debug.cont}, L{Debug.loop}, L{Debug.wait}
+
+ @type event: L{Event}
+ @param event: Event object passed to L{Debug.dispatch}.
+
+ @raise WindowsError: Raises an exception on error.
+ """
+ returnValue = None
+ bCallHandler = True
+ pre_handler = None
+ post_handler = None
+ eventCode = event.get_event_code()
+
+ # Get the pre and post notification methods for exceptions.
+ # If not found, the following steps take care of that.
+ if eventCode == win32.EXCEPTION_DEBUG_EVENT:
+ exceptionCode = event.get_exception_code()
+ pre_name = self.__preExceptionNotifyCallbackName.get(
+ exceptionCode, None)
+ post_name = self.__postExceptionNotifyCallbackName.get(
+ exceptionCode, None)
+ if pre_name is not None:
+ pre_handler = getattr(self, pre_name, None)
+ if post_name is not None:
+ post_handler = getattr(self, post_name, None)
+
+ # Get the pre notification method for all other events.
+ # This includes the exception event if no notify method was found
+ # for this exception code.
+ if pre_handler is None:
+ pre_name = self.__preEventNotifyCallbackName.get(eventCode, None)
+ if pre_name is not None:
+ pre_handler = getattr(self, pre_name, pre_handler)
+
+ # Get the post notification method for all other events.
+ # This includes the exception event if no notify method was found
+ # for this exception code.
+ if post_handler is None:
+ post_name = self.__postEventNotifyCallbackName.get(eventCode, None)
+ if post_name is not None:
+ post_handler = getattr(self, post_name, post_handler)
+
+ # Call the pre-notify method only if it was defined.
+ # If an exception is raised don't call the other methods.
+ if pre_handler is not None:
+ bCallHandler = pre_handler(event)
+
+ # Call the user-defined event handler only if the pre-notify
+ # method was not defined, or was and it returned True.
+ try:
+ if bCallHandler and self.__eventHandler is not None:
+ try:
+ returnValue = self.__eventHandler(event)
+ except Exception:
+ e = sys.exc_info()[1]
+ msg = ("Event handler pre-callback %r"
+ " raised an exception: %s")
+ msg = msg % (self.__eventHandler, traceback.format_exc(e))
+ warnings.warn(msg, EventCallbackWarning)
+ returnValue = None
+
+ # Call the post-notify method if defined, even if an exception is
+ # raised by the user-defined event handler.
+ finally:
+ if post_handler is not None:
+ post_handler(event)
+
+ # Return the value from the call to the user-defined event handler.
+ # If not defined return None.
+ return returnValue
diff --git a/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/interactive.py b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/interactive.py
new file mode 100644
index 00000000..f14883a2
--- /dev/null
+++ b/ptvsd/pydevd/pydevd_attach_to_process/winappdbg/interactive.py
@@ -0,0 +1,2281 @@
+#!~/.wine/drive_c/Python25/python.exe
+# -*- coding: utf-8 -*-
+
+# Acknowledgements:
+# Nicolas Economou, for his command line debugger on which this is inspired.
+# http://tinyurl.com/nicolaseconomou
+
+# Copyright (c) 2009-2014, Mario Vilas
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice,this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Interactive debugging console.
+
+@group Debugging:
+ ConsoleDebugger
+
+@group Exceptions:
+ CmdError
+"""
+
+from __future__ import with_statement
+
+__revision__ = "$Id$"
+
+__all__ = [ 'ConsoleDebugger', 'CmdError' ]
+
+# TODO document this module with docstrings.
+# TODO command to set a last error breakpoint.
+# TODO command to show available plugins.
+
+from winappdbg import win32
+from winappdbg import compat
+from winappdbg.system import System
+from winappdbg.util import PathOperations
+from winappdbg.event import EventHandler, NoEvent
+from winappdbg.textio import HexInput, HexOutput, HexDump, CrashDump, DebugLog
+
+import os
+import sys
+import code
+import time
+import warnings
+import traceback
+
+# too many variables named "cmd" to have a module by the same name :P
+from cmd import Cmd
+
+# lazy imports
+readline = None
+
+#==============================================================================
+
+class DummyEvent (NoEvent):
+ "Dummy event object used internally by L{ConsoleDebugger}."
+
+ def get_pid(self):
+ return self._pid
+
+ def get_tid(self):
+ return self._tid
+
+ def get_process(self):
+ return self._process
+
+ def get_thread(self):
+ return self._thread
+
+#==============================================================================
+
+class CmdError (Exception):
+ """
+ Exception raised when a command parsing error occurs.
+ Used internally by L{ConsoleDebugger}.
+ """
+
+#==============================================================================
+
+class ConsoleDebugger (Cmd, EventHandler):
+ """
+ Interactive console debugger.
+
+ @see: L{Debug.interactive}
+ """
+
+#------------------------------------------------------------------------------
+# Class variables
+
+ # Exception to raise when an error occurs executing a command.
+ command_error_exception = CmdError
+
+ # Milliseconds to wait for debug events in the main loop.
+ dwMilliseconds = 100
+
+ # History file name.
+ history_file = '.winappdbg_history'
+
+ # Confirm before quitting?
+ confirm_quit = True
+
+ # Valid plugin name characters.
+ valid_plugin_name_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXY' \
+ 'abcdefghijklmnopqrstuvwxy' \
+ '012345678' \
+ '_'
+
+ # Names of the registers.
+ segment_names = ( 'cs', 'ds', 'es', 'fs', 'gs' )
+
+ register_alias_64_to_32 = {
+ 'eax':'Rax', 'ebx':'Rbx', 'ecx':'Rcx', 'edx':'Rdx',
+ 'eip':'Rip', 'ebp':'Rbp', 'esp':'Rsp', 'esi':'Rsi', 'edi':'Rdi'
+ }
+ register_alias_64_to_16 = { 'ax':'Rax', 'bx':'Rbx', 'cx':'Rcx', 'dx':'Rdx' }
+ register_alias_64_to_8_low = { 'al':'Rax', 'bl':'Rbx', 'cl':'Rcx', 'dl':'Rdx' }
+ register_alias_64_to_8_high = { 'ah':'Rax', 'bh':'Rbx', 'ch':'Rcx', 'dh':'Rdx' }
+ register_alias_32_to_16 = { 'ax':'Eax', 'bx':'Ebx', 'cx':'Ecx', 'dx':'Edx' }
+ register_alias_32_to_8_low = { 'al':'Eax', 'bl':'Ebx', 'cl':'Ecx', 'dl':'Edx' }
+ register_alias_32_to_8_high = { 'ah':'Eax', 'bh':'Ebx', 'ch':'Ecx', 'dh':'Edx' }
+
+ register_aliases_full_32 = list(segment_names)
+ register_aliases_full_32.extend(compat.iterkeys(register_alias_32_to_16))
+ register_aliases_full_32.extend(compat.iterkeys(register_alias_32_to_8_low))
+ register_aliases_full_32.extend(compat.iterkeys(register_alias_32_to_8_high))
+ register_aliases_full_32 = tuple(register_aliases_full_32)
+
+ register_aliases_full_64 = list(segment_names)
+ register_aliases_full_64.extend(compat.iterkeys(register_alias_64_to_32))
+ register_aliases_full_64.extend(compat.iterkeys(register_alias_64_to_16))
+ register_aliases_full_64.extend(compat.iterkeys(register_alias_64_to_8_low))
+ register_aliases_full_64.extend(compat.iterkeys(register_alias_64_to_8_high))
+ register_aliases_full_64 = tuple(register_aliases_full_64)
+
+ # Names of the control flow instructions.
+ jump_instructions = (
+ 'jmp', 'jecxz', 'jcxz',
+ 'ja', 'jnbe', 'jae', 'jnb', 'jb', 'jnae', 'jbe', 'jna', 'jc', 'je',
+ 'jz', 'jnc', 'jne', 'jnz', 'jnp', 'jpo', 'jp', 'jpe', 'jg', 'jnle',
+ 'jge', 'jnl', 'jl', 'jnge', 'jle', 'jng', 'jno', 'jns', 'jo', 'js'
+ )
+ call_instructions = ( 'call', 'ret', 'retn' )
+ loop_instructions = ( 'loop', 'loopz', 'loopnz', 'loope', 'loopne' )
+ control_flow_instructions = call_instructions + loop_instructions + \
+ jump_instructions
+
+#------------------------------------------------------------------------------
+# Instance variables
+
+ def __init__(self):
+ """
+ Interactive console debugger.
+
+ @see: L{Debug.interactive}
+ """
+ Cmd.__init__(self)
+ EventHandler.__init__(self)
+
+ # Quit the debugger when True.
+ self.debuggerExit = False
+
+ # Full path to the history file.
+ self.history_file_full_path = None
+
+ # Last executed command.
+ self.__lastcmd = ""
+
+#------------------------------------------------------------------------------
+# Debugger
+
+ # Use this Debug object.
+ def start_using_debugger(self, debug):
+
+ # Clear the previous Debug object.
+ self.stop_using_debugger()
+
+ # Keep the Debug object.
+ self.debug = debug
+
+ # Set ourselves as the event handler for the debugger.
+ self.prevHandler = debug.set_event_handler(self)
+
+ # Stop using the Debug object given by start_using_debugger().
+ # Circular references must be removed, or the destructors never get called.
+ def stop_using_debugger(self):
+ if hasattr(self, 'debug'):
+ debug = self.debug
+ debug.set_event_handler(self.prevHandler)
+ del self.prevHandler
+ del self.debug
+ return debug
+ return None
+
+ # Destroy the Debug object.
+ def destroy_debugger(self, autodetach = True):
+ debug = self.stop_using_debugger()
+ if debug is not None:
+ if not autodetach:
+ debug.kill_all(bIgnoreExceptions=True)
+ debug.lastEvent = None
+ debug.stop()
+ del debug
+
+ @property
+ def lastEvent(self):
+ return self.debug.lastEvent
+
+ def set_fake_last_event(self, process):
+ if self.lastEvent is None:
+ self.debug.lastEvent = DummyEvent(self.debug)
+ self.debug.lastEvent._process = process
+ self.debug.lastEvent._thread = process.get_thread(
+ process.get_thread_ids()[0])
+ self.debug.lastEvent._pid = process.get_pid()
+ self.debug.lastEvent._tid = self.lastEvent._thread.get_tid()
+
+#------------------------------------------------------------------------------
+# Input
+
+# TODO
+# * try to guess breakpoints when insufficient data is given
+# * child Cmd instances will have to be used for other prompts, for example
+# when assembling or editing memory - it may also be a good idea to think
+# if it's possible to make the main Cmd instance also a child, instead of
+# the debugger itself - probably the same goes for the EventHandler, maybe
+# it can be used as a contained object rather than a parent class.
+
+ # Join a token list into an argument string.
+ def join_tokens(self, token_list):
+ return self.debug.system.argv_to_cmdline(token_list)
+
+ # Split an argument string into a token list.
+ def split_tokens(self, arg, min_count = 0, max_count = None):
+ token_list = self.debug.system.cmdline_to_argv(arg)
+ if len(token_list) < min_count:
+ raise CmdError("missing parameters.")
+ if max_count and len(token_list) > max_count:
+ raise CmdError("too many parameters.")
+ return token_list
+
+ # Token is a thread ID or name.
+ def input_thread(self, token):
+ targets = self.input_thread_list( [token] )
+ if len(targets) == 0:
+ raise CmdError("missing thread name or ID")
+ if len(targets) > 1:
+ msg = "more than one thread with that name:\n"
+ for tid in targets:
+ msg += "\t%d\n" % tid
+ msg = msg[:-len("\n")]
+ raise CmdError(msg)
+ return targets[0]
+
+ # Token list is a list of thread IDs or names.
+ def input_thread_list(self, token_list):
+ targets = set()
+ system = self.debug.system
+ for token in token_list:
+ try:
+ tid = self.input_integer(token)
+ if not system.has_thread(tid):
+ raise CmdError("thread not found (%d)" % tid)
+ targets.add(tid)
+ except ValueError:
+ found = set()
+ for process in system.iter_processes():
+ found.update( system.find_threads_by_name(token) )
+ if not found:
+ raise CmdError("thread not found (%s)" % token)
+ for thread in found:
+ targets.add( thread.get_tid() )
+ targets = list(targets)
+ targets.sort()
+ return targets
+
+ # Token is a process ID or name.
+ def input_process(self, token):
+ targets = self.input_process_list( [token] )
+ if len(targets) == 0:
+ raise CmdError("missing process name or ID")
+ if len(targets) > 1:
+ msg = "more than one process with that name:\n"
+ for pid in targets:
+ msg += "\t%d\n" % pid
+ msg = msg[:-len("\n")]
+ raise CmdError(msg)
+ return targets[0]
+
+ # Token list is a list of process IDs or names.
+ def input_process_list(self, token_list):
+ targets = set()
+ system = self.debug.system
+ for token in token_list:
+ try:
+ pid = self.input_integer(token)
+ if not system.has_process(pid):
+ raise CmdError("process not found (%d)" % pid)
+ targets.add(pid)
+ except ValueError:
+ found = system.find_processes_by_filename(token)
+ if not found:
+ raise CmdError("process not found (%s)" % token)
+ for (process, _) in found:
+ targets.add( process.get_pid() )
+ targets = list(targets)
+ targets.sort()
+ return targets
+
+ # Token is a command line to execute.
+ def input_command_line(self, command_line):
+ argv = self.debug.system.cmdline_to_argv(command_line)
+ if not argv:
+ raise CmdError("missing command line to execute")
+ fname = argv[0]
+ if not os.path.exists(fname):
+ try:
+ fname, _ = win32.SearchPath(None, fname, '.exe')
+ except WindowsError:
+ raise CmdError("file not found: %s" % fname)
+ argv[0] = fname
+ command_line = self.debug.system.argv_to_cmdline(argv)
+ return command_line
+
+ # Token is an integer.
+ # Only hexadecimal format is supported.
+ def input_hexadecimal_integer(self, token):
+ return int(token, 0x10)
+
+ # Token is an integer.
+ # It can be in any supported format.
+ def input_integer(self, token):
+ return HexInput.integer(token)
+## input_integer = input_hexadecimal_integer
+
+ # Token is an address.
+ # The address can be a integer, a label or a register.
+ def input_address(self, token, pid = None, tid = None):
+ address = None
+ if self.is_register(token):
+ if tid is None:
+ if self.lastEvent is None or pid != self.lastEvent.get_pid():
+ msg = "can't resolve register (%s) for unknown thread"
+ raise CmdError(msg % token)
+ tid = self.lastEvent.get_tid()
+ address = self.input_register(token, tid)
+ if address is None:
+ try:
+ address = self.input_hexadecimal_integer(token)
+ except ValueError:
+ if pid is None:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ process = self.lastEvent.get_process()
+ elif self.lastEvent is not None and pid == self.lastEvent.get_pid():
+ process = self.lastEvent.get_process()
+ else:
+ try:
+ process = self.debug.system.get_process(pid)
+ except KeyError:
+ raise CmdError("process not found (%d)" % pid)
+ try:
+ address = process.resolve_label(token)
+ except Exception:
+ raise CmdError("unknown address (%s)" % token)
+ return address
+
+ # Token is an address range, or a single address.
+ # The addresses can be integers, labels or registers.
+ def input_address_range(self, token_list, pid = None, tid = None):
+ if len(token_list) == 2:
+ token_1, token_2 = token_list
+ address = self.input_address(token_1, pid, tid)
+ try:
+ size = self.input_integer(token_2)
+ except ValueError:
+ raise CmdError("bad address range: %s %s" % (token_1, token_2))
+ elif len(token_list) == 1:
+ token = token_list[0]
+ if '-' in token:
+ try:
+ token_1, token_2 = token.split('-')
+ except Exception:
+ raise CmdError("bad address range: %s" % token)
+ address = self.input_address(token_1, pid, tid)
+ size = self.input_address(token_2, pid, tid) - address
+ else:
+ address = self.input_address(token, pid, tid)
+ size = None
+ return address, size
+
+ # XXX TODO
+ # Support non-integer registers here.
+ def is_register(self, token):
+ if win32.arch == 'i386':
+ if token in self.register_aliases_full_32:
+ return True
+ token = token.title()
+ for (name, typ) in win32.CONTEXT._fields_:
+ if name == token:
+ return win32.sizeof(typ) == win32.sizeof(win32.DWORD)
+ elif win32.arch == 'amd64':
+ if token in self.register_aliases_full_64:
+ return True
+ token = token.title()
+ for (name, typ) in win32.CONTEXT._fields_:
+ if name == token:
+ return win32.sizeof(typ) == win32.sizeof(win32.DWORD64)
+ return False
+
+ # The token is a register name.
+ # Returns None if no register name is matched.
+ def input_register(self, token, tid = None):
+ if tid is None:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ thread = self.lastEvent.get_thread()
+ else:
+ thread = self.debug.system.get_thread(tid)
+ ctx = thread.get_context()
+
+ token = token.lower()
+ title = token.title()
+
+ if title in ctx:
+ return ctx.get(title) # eax -> Eax
+
+ if ctx.arch == 'i386':
+
+ if token in self.segment_names:
+ return ctx.get( 'Seg%s' % title ) # cs -> SegCs
+
+ if token in self.register_alias_32_to_16:
+ return ctx.get( self.register_alias_32_to_16[token] ) & 0xFFFF
+
+ if token in self.register_alias_32_to_8_low:
+ return ctx.get( self.register_alias_32_to_8_low[token] ) & 0xFF
+
+ if token in self.register_alias_32_to_8_high:
+ return (ctx.get( self.register_alias_32_to_8_high[token] ) & 0xFF00) >> 8
+
+ elif ctx.arch == 'amd64':
+
+ if token in self.segment_names:
+ return ctx.get( 'Seg%s' % title ) # cs -> SegCs
+
+ if token in self.register_alias_64_to_32:
+ return ctx.get( self.register_alias_64_to_32[token] ) & 0xFFFFFFFF
+
+ if token in self.register_alias_64_to_16:
+ return ctx.get( self.register_alias_64_to_16[token] ) & 0xFFFF
+
+ if token in self.register_alias_64_to_8_low:
+ return ctx.get( self.register_alias_64_to_8_low[token] ) & 0xFF
+
+ if token in self.register_alias_64_to_8_high:
+ return (ctx.get( self.register_alias_64_to_8_high[token] ) & 0xFF00) >> 8
+
+ return None
+
+ # Token list contains an address or address range.
+ # The prefix is also parsed looking for process and thread IDs.
+ def input_full_address_range(self, token_list):
+ pid, tid = self.get_process_and_thread_ids_from_prefix()
+ address, size = self.input_address_range(token_list, pid, tid)
+ return pid, tid, address, size
+
+ # Token list contains a breakpoint.
+ def input_breakpoint(self, token_list):
+ pid, tid, address, size = self.input_full_address_range(token_list)
+ if not self.debug.is_debugee(pid):
+ raise CmdError("target process is not being debugged")
+ return pid, tid, address, size
+
+ # Token list contains a memory address, and optional size and process.
+ # Sets the results as the default for the next display command.
+ def input_display(self, token_list, default_size = 64):
+ pid, tid, address, size = self.input_full_address_range(token_list)
+ if not size:
+ size = default_size
+ next_address = HexOutput.integer(address + size)
+ self.default_display_target = next_address
+ return pid, tid, address, size
+
+#------------------------------------------------------------------------------
+# Output
+
+ # Tell the user a module was loaded.
+ def print_module_load(self, event):
+ mod = event.get_module()
+ base = mod.get_base()
+ name = mod.get_filename()
+ if not name:
+ name = ''
+ msg = "Loaded module (%s) %s"
+ msg = msg % (HexDump.address(base), name)
+ print(msg)
+
+ # Tell the user a module was unloaded.
+ def print_module_unload(self, event):
+ mod = event.get_module()
+ base = mod.get_base()
+ name = mod.get_filename()
+ if not name:
+ name = ''
+ msg = "Unloaded module (%s) %s"
+ msg = msg % (HexDump.address(base), name)
+ print(msg)
+
+ # Tell the user a process was started.
+ def print_process_start(self, event):
+ pid = event.get_pid()
+ start = event.get_start_address()
+ if start:
+ start = HexOutput.address(start)
+ print("Started process %d at %s" % (pid, start))
+ else:
+ print("Attached to process %d" % pid)
+
+ # Tell the user a thread was started.
+ def print_thread_start(self, event):
+ tid = event.get_tid()
+ start = event.get_start_address()
+ if start:
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ start = event.get_process().get_label_at_address(start)
+ print("Started thread %d at %s" % (tid, start))
+ else:
+ print("Attached to thread %d" % tid)
+
+ # Tell the user a process has finished.
+ def print_process_end(self, event):
+ pid = event.get_pid()
+ code = event.get_exit_code()
+ print("Process %d terminated, exit code %d" % (pid, code))
+
+ # Tell the user a thread has finished.
+ def print_thread_end(self, event):
+ tid = event.get_tid()
+ code = event.get_exit_code()
+ print("Thread %d terminated, exit code %d" % (tid, code))
+
+ # Print(debug strings.
+ def print_debug_string(self, event):
+ tid = event.get_tid()
+ string = event.get_debug_string()
+ print("Thread %d says: %r" % (tid, string))
+
+ # Inform the user of any other debugging event.
+ def print_event(self, event):
+ code = HexDump.integer( event.get_event_code() )
+ name = event.get_event_name()
+ desc = event.get_event_description()
+ if code in desc:
+ print('')
+ print("%s: %s" % (name, desc))
+ else:
+ print('')
+ print("%s (%s): %s" % (name, code, desc))
+ self.print_event_location(event)
+
+ # Stop on exceptions and prompt for commands.
+ def print_exception(self, event):
+ address = HexDump.address( event.get_exception_address() )
+ code = HexDump.integer( event.get_exception_code() )
+ desc = event.get_exception_description()
+ if event.is_first_chance():
+ chance = 'first'
+ else:
+ chance = 'second'
+ if code in desc:
+ msg = "%s at address %s (%s chance)" % (desc, address, chance)
+ else:
+ msg = "%s (%s) at address %s (%s chance)" % (desc, code, address, chance)
+ print('')
+ print(msg)
+ self.print_event_location(event)
+
+ # Show the current location in the code.
+ def print_event_location(self, event):
+ process = event.get_process()
+ thread = event.get_thread()
+ self.print_current_location(process, thread)
+
+ # Show the current location in the code.
+ def print_breakpoint_location(self, event):
+ process = event.get_process()
+ thread = event.get_thread()
+ pc = event.get_exception_address()
+ self.print_current_location(process, thread, pc)
+
+ # Show the current location in any process and thread.
+ def print_current_location(self, process = None, thread = None, pc = None):
+ if not process:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ process = self.lastEvent.get_process()
+ if not thread:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ thread = self.lastEvent.get_thread()
+ thread.suspend()
+ try:
+ if pc is None:
+ pc = thread.get_pc()
+ ctx = thread.get_context()
+ finally:
+ thread.resume()
+ label = process.get_label_at_address(pc)
+ try:
+ disasm = process.disassemble(pc, 15)
+ except WindowsError:
+ disasm = None
+ except NotImplementedError:
+ disasm = None
+ print('')
+ print(CrashDump.dump_registers(ctx),)
+ print("%s:" % label)
+ if disasm:
+ print(CrashDump.dump_code_line(disasm[0], pc, bShowDump = True))
+ else:
+ try:
+ data = process.peek(pc, 15)
+ except Exception:
+ data = None
+ if data:
+ print('%s: %s' % (HexDump.address(pc), HexDump.hexblock_byte(data)))
+ else:
+ print('%s: ???' % HexDump.address(pc))
+
+ # Display memory contents using a given method.
+ def print_memory_display(self, arg, method):
+ if not arg:
+ arg = self.default_display_target
+ token_list = self.split_tokens(arg, 1, 2)
+ pid, tid, address, size = self.input_display(token_list)
+ label = self.get_process(pid).get_label_at_address(address)
+ data = self.read_memory(address, size, pid)
+ if data:
+ print("%s:" % label)
+ print(method(data, address),)
+
+#------------------------------------------------------------------------------
+# Debugging
+
+ # Get the process ID from the prefix or the last event.
+ def get_process_id_from_prefix(self):
+ if self.cmdprefix:
+ pid = self.input_process(self.cmdprefix)
+ else:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ pid = self.lastEvent.get_pid()
+ return pid
+
+ # Get the thread ID from the prefix or the last event.
+ def get_thread_id_from_prefix(self):
+ if self.cmdprefix:
+ tid = self.input_thread(self.cmdprefix)
+ else:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ tid = self.lastEvent.get_tid()
+ return tid
+
+ # Get the process from the prefix or the last event.
+ def get_process_from_prefix(self):
+ pid = self.get_process_id_from_prefix()
+ return self.get_process(pid)
+
+ # Get the thread from the prefix or the last event.
+ def get_thread_from_prefix(self):
+ tid = self.get_thread_id_from_prefix()
+ return self.get_thread(tid)
+
+ # Get the process and thread IDs from the prefix or the last event.
+ def get_process_and_thread_ids_from_prefix(self):
+ if self.cmdprefix:
+ try:
+ pid = self.input_process(self.cmdprefix)
+ tid = None
+ except CmdError:
+ try:
+ tid = self.input_thread(self.cmdprefix)
+ pid = self.debug.system.get_thread(tid).get_pid()
+ except CmdError:
+ msg = "unknown process or thread (%s)" % self.cmdprefix
+ raise CmdError(msg)
+ else:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ pid = self.lastEvent.get_pid()
+ tid = self.lastEvent.get_tid()
+ return pid, tid
+
+ # Get the process and thread from the prefix or the last event.
+ def get_process_and_thread_from_prefix(self):
+ pid, tid = self.get_process_and_thread_ids_from_prefix()
+ process = self.get_process(pid)
+ thread = self.get_thread(tid)
+ return process, thread
+
+ # Get the process object.
+ def get_process(self, pid = None):
+ if pid is None:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ process = self.lastEvent.get_process()
+ elif self.lastEvent is not None and pid == self.lastEvent.get_pid():
+ process = self.lastEvent.get_process()
+ else:
+ try:
+ process = self.debug.system.get_process(pid)
+ except KeyError:
+ raise CmdError("process not found (%d)" % pid)
+ return process
+
+ # Get the thread object.
+ def get_thread(self, tid = None):
+ if tid is None:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ thread = self.lastEvent.get_thread()
+ elif self.lastEvent is not None and tid == self.lastEvent.get_tid():
+ thread = self.lastEvent.get_thread()
+ else:
+ try:
+ thread = self.debug.system.get_thread(tid)
+ except KeyError:
+ raise CmdError("thread not found (%d)" % tid)
+ return thread
+
+ # Read the process memory.
+ def read_memory(self, address, size, pid = None):
+ process = self.get_process(pid)
+ try:
+ data = process.peek(address, size)
+ except WindowsError:
+ orig_address = HexOutput.integer(address)
+ next_address = HexOutput.integer(address + size)
+ msg = "error reading process %d, from %s to %s (%d bytes)"
+ msg = msg % (pid, orig_address, next_address, size)
+ raise CmdError(msg)
+ return data
+
+ # Write the process memory.
+ def write_memory(self, address, data, pid = None):
+ process = self.get_process(pid)
+ try:
+ process.write(address, data)
+ except WindowsError:
+ size = len(data)
+ orig_address = HexOutput.integer(address)
+ next_address = HexOutput.integer(address + size)
+ msg = "error reading process %d, from %s to %s (%d bytes)"
+ msg = msg % (pid, orig_address, next_address, size)
+ raise CmdError(msg)
+
+ # Change a register value.
+ def change_register(self, register, value, tid = None):
+
+ # Get the thread.
+ if tid is None:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ thread = self.lastEvent.get_thread()
+ else:
+ try:
+ thread = self.debug.system.get_thread(tid)
+ except KeyError:
+ raise CmdError("thread not found (%d)" % tid)
+
+ # Convert the value to integer type.
+ try:
+ value = self.input_integer(value)
+ except ValueError:
+ pid = thread.get_pid()
+ value = self.input_address(value, pid, tid)
+
+ # Suspend the thread.
+ # The finally clause ensures the thread is resumed before returning.
+ thread.suspend()
+ try:
+
+ # Get the current context.
+ ctx = thread.get_context()
+
+ # Register name matching is case insensitive.
+ register = register.lower()
+
+ # Integer 32 bits registers.
+ if register in self.register_names:
+ register = register.title() # eax -> Eax
+
+ # Segment (16 bit) registers.
+ if register in self.segment_names:
+ register = 'Seg%s' % register.title() # cs -> SegCs
+ value = value & 0x0000FFFF
+
+ # Integer 16 bits registers.
+ if register in self.register_alias_16:
+ register = self.register_alias_16[register]
+ previous = ctx.get(register) & 0xFFFF0000
+ value = (value & 0x0000FFFF) | previous
+
+ # Integer 8 bits registers (low part).
+ if register in self.register_alias_8_low:
+ register = self.register_alias_8_low[register]
+ previous = ctx.get(register) % 0xFFFFFF00
+ value = (value & 0x000000FF) | previous
+
+ # Integer 8 bits registers (high part).
+ if register in self.register_alias_8_high:
+ register = self.register_alias_8_high[register]
+ previous = ctx.get(register) % 0xFFFF00FF
+ value = ((value & 0x000000FF) << 8) | previous
+
+ # Set the new context.
+ ctx.__setitem__(register, value)
+ thread.set_context(ctx)
+
+ # Resume the thread.
+ finally:
+ thread.resume()
+
+ # Very crude way to find data within the process memory.
+ # TODO: Perhaps pfind.py can be integrated here instead.
+ def find_in_memory(self, query, process):
+ for mbi in process.get_memory_map():
+ if mbi.State != win32.MEM_COMMIT or mbi.Protect & win32.PAGE_GUARD:
+ continue
+ address = mbi.BaseAddress
+ size = mbi.RegionSize
+ try:
+ data = process.read(address, size)
+ except WindowsError:
+ msg = "*** Warning: read error at address %s"
+ msg = msg % HexDump.address(address)
+ print(msg)
+ width = min(len(query), 16)
+ p = data.find(query)
+ while p >= 0:
+ q = p + len(query)
+ d = data[ p : min(q, p + width) ]
+ h = HexDump.hexline(d, width = width)
+ a = HexDump.address(address + p)
+ print("%s: %s" % (a, h))
+ p = data.find(query, q)
+
+ # Kill a process.
+ def kill_process(self, pid):
+ process = self.debug.system.get_process(pid)
+ try:
+ process.kill()
+ if self.debug.is_debugee(pid):
+ self.debug.detach(pid)
+ print("Killed process (%d)" % pid)
+ except Exception:
+ print("Error trying to kill process (%d)" % pid)
+
+ # Kill a thread.
+ def kill_thread(self, tid):
+ thread = self.debug.system.get_thread(tid)
+ try:
+ thread.kill()
+ process = thread.get_process()
+ pid = process.get_pid()
+ if self.debug.is_debugee(pid) and not process.is_alive():
+ self.debug.detach(pid)
+ print("Killed thread (%d)" % tid)
+ except Exception:
+ print("Error trying to kill thread (%d)" % tid)
+
+#------------------------------------------------------------------------------
+# Command prompt input
+
+ # Prompt the user for commands.
+ def prompt_user(self):
+ while not self.debuggerExit:
+ try:
+ self.cmdloop()
+ break
+ except CmdError:
+ e = sys.exc_info()[1]
+ print("*** Error: %s" % str(e))
+ except Exception:
+ traceback.print_exc()
+## self.debuggerExit = True
+
+ # Prompt the user for a YES/NO kind of question.
+ def ask_user(self, msg, prompt = "Are you sure? (y/N): "):
+ print(msg)
+ answer = raw_input(prompt)
+ answer = answer.strip()[:1].lower()
+ return answer == 'y'
+
+ # Autocomplete the given command when not ambiguous.
+ # Convert it to lowercase (so commands are seen as case insensitive).
+ def autocomplete(self, cmd):
+ cmd = cmd.lower()
+ completed = self.completenames(cmd)
+ if len(completed) == 1:
+ cmd = completed[0]
+ return cmd
+
+ # Get the help text for the given list of command methods.
+ # Note it's NOT a list of commands, but a list of actual method names.
+ # Each line of text is stripped and all lines are sorted.
+ # Repeated text lines are removed.
+ # Returns a single, possibly multiline, string.
+ def get_help(self, commands):
+ msg = set()
+ for name in commands:
+ if name != 'do_help':
+ try:
+ doc = getattr(self, name).__doc__.split('\n')
+ except Exception:
+ return ( "No help available when Python"
+ " is run with the -OO switch." )
+ for x in doc:
+ x = x.strip()
+ if x:
+ msg.add(' %s' % x)
+ msg = list(msg)
+ msg.sort()
+ msg = '\n'.join(msg)
+ return msg
+
+ # Parse the prefix and remove it from the command line.
+ def split_prefix(self, line):
+ prefix = None
+ if line.startswith('~'):
+ pos = line.find(' ')
+ if pos == 1:
+ pos = line.find(' ', pos + 1)
+ if not pos < 0:
+ prefix = line[ 1 : pos ].strip()
+ line = line[ pos : ].strip()
+ return prefix, line
+
+#------------------------------------------------------------------------------
+# Cmd() hacks
+
+ # Header for help page.
+ doc_header = 'Available commands (type help * or help )'
+
+## # Read and write directly to stdin and stdout.
+## # This prevents the use of raw_input and print.
+## use_rawinput = False
+
+ @property
+ def prompt(self):
+ if self.lastEvent:
+ pid = self.lastEvent.get_pid()
+ tid = self.lastEvent.get_tid()
+ if self.debug.is_debugee(pid):
+## return '~%d(%d)> ' % (tid, pid)
+ return '%d:%d> ' % (pid, tid)
+ return '> '
+
+ # Return a sorted list of method names.
+ # Only returns the methods that implement commands.
+ def get_names(self):
+ names = Cmd.get_names(self)
+ names = [ x for x in set(names) if x.startswith('do_') ]
+ names.sort()
+ return names
+
+ # Automatically autocomplete commands, even if Tab wasn't pressed.
+ # The prefix is removed from the line and stored in self.cmdprefix.
+ # Also implement the commands that consist of a symbol character.
+ def parseline(self, line):
+ self.cmdprefix, line = self.split_prefix(line)
+ line = line.strip()
+ if line:
+ if line[0] == '.':
+ line = 'plugin ' + line[1:]
+ elif line[0] == '#':
+ line = 'python ' + line[1:]
+ cmd, arg, line = Cmd.parseline(self, line)
+ if cmd:
+ cmd = self.autocomplete(cmd)
+ return cmd, arg, line
+
+## # Don't repeat the last executed command.
+## def emptyline(self):
+## pass
+
+ # Reset the defaults for some commands.
+ def preloop(self):
+ self.default_disasm_target = 'eip'
+ self.default_display_target = 'eip'
+ self.last_display_command = self.do_db
+
+ # Put the prefix back in the command line.
+ def get_lastcmd(self):
+ return self.__lastcmd
+ def set_lastcmd(self, lastcmd):
+ if self.cmdprefix:
+ lastcmd = '~%s %s' % (self.cmdprefix, lastcmd)
+ self.__lastcmd = lastcmd
+ lastcmd = property(get_lastcmd, set_lastcmd)
+
+ # Quit the command prompt if the debuggerExit flag is on.
+ def postcmd(self, stop, line):
+ return stop or self.debuggerExit
+
+#------------------------------------------------------------------------------
+# Commands
+
+ # Each command contains a docstring with it's help text.
+ # The help text consist of independent text lines,
+ # where each line shows a command and it's parameters.
+ # Each command method has the help message for itself and all it's aliases.
+ # Only the docstring for the "help" command is shown as-is.
+
+ # NOTE: Command methods MUST be all lowercase!
+
+ # Extended help command.
+ def do_help(self, arg):
+ """
+ ? - show the list of available commands
+ ? * - show help for all commands
+ ? [command...] - show help for the given command(s)
+ help - show the list of available commands
+ help * - show help for all commands
+ help [command...] - show help for the given command(s)
+ """
+ if not arg:
+ Cmd.do_help(self, arg)
+ elif arg in ('?', 'help'):
+ # An easter egg :)
+ print(" Help! I need somebody...")
+ print(" Help! Not just anybody...")
+ print(" Help! You know, I need someone...")
+ print(" Heeelp!")
+ else:
+ if arg == '*':
+ commands = self.get_names()
+ commands = [ x for x in commands if x.startswith('do_') ]
+ else:
+ commands = set()
+ for x in arg.split(' '):
+ x = x.strip()
+ if x:
+ for n in self.completenames(x):
+ commands.add( 'do_%s' % n )
+ commands = list(commands)
+ commands.sort()
+ print(self.get_help(commands))
+
+ def do_shell(self, arg):
+ """
+ ! - spawn a system shell
+ shell - spawn a system shell
+ ! [arguments...] - execute a single shell command
+ shell [arguments...] - execute a single shell command
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+
+ # Try to use the environment to locate cmd.exe.
+ # If not found, it's usually OK to just use the filename,
+ # since cmd.exe is one of those "magic" programs that
+ # can be automatically found by CreateProcess.
+ shell = os.getenv('ComSpec', 'cmd.exe')
+
+ # When given a command, run it and return.
+ # When no command is given, spawn a shell.
+ if arg:
+ arg = '%s /c %s' % (shell, arg)
+ else:
+ arg = shell
+ process = self.debug.system.start_process(arg, bConsole = True)
+ process.wait()
+
+ # This hack fixes a bug in Python, the interpreter console is closing the
+ # stdin pipe when calling the exit() function (Ctrl+Z seems to work fine).
+ class _PythonExit(object):
+ def __repr__(self):
+ return "Use exit() or Ctrl-Z plus Return to exit"
+ def __call__(self):
+ raise SystemExit()
+ _python_exit = _PythonExit()
+
+ # Spawns a Python shell with some handy local variables and the winappdbg
+ # module already imported. Also the console banner is improved.
+ def _spawn_python_shell(self, arg):
+ import winappdbg
+ banner = ('Python %s on %s\nType "help", "copyright", '
+ '"credits" or "license" for more information.\n')
+ platform = winappdbg.version.lower()
+ platform = 'WinAppDbg %s' % platform
+ banner = banner % (sys.version, platform)
+ local = {}
+ local.update(__builtins__)
+ local.update({
+ '__name__' : '__console__',
+ '__doc__' : None,
+ 'exit' : self._python_exit,
+ 'self' : self,
+ 'arg' : arg,
+ 'winappdbg' : winappdbg,
+ })
+ try:
+ code.interact(banner=banner, local=local)
+ except SystemExit:
+ # We need to catch it so it doesn't kill our program.
+ pass
+
+ def do_python(self, arg):
+ """
+ # - spawn a python interpreter
+ python - spawn a python interpreter
+ # - execute a single python statement
+ python - execute a single python statement
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+
+ # When given a Python statement, execute it directly.
+ if arg:
+ try:
+ compat.exec_(arg, globals(), locals())
+ except Exception:
+ traceback.print_exc()
+
+ # When no statement is given, spawn a Python interpreter.
+ else:
+ try:
+ self._spawn_python_shell(arg)
+ except Exception:
+ e = sys.exc_info()[1]
+ raise CmdError(
+ "unhandled exception when running Python console: %s" % e)
+
+ # The plugins interface is quite simple.
+ #
+ # Just place a .py file with the plugin name in the "plugins" folder,
+ # for example "do_example.py" would implement the "example" command.
+ #
+ # The plugin must have a function named "do", which implements the
+ # command functionality exactly like the do_* methods of Cmd instances.
+ #
+ # The docstring for the "do" function will be parsed exactly like
+ # one of the debugger's commands - that is, each line is treated
+ # independently.
+ #
+ def do_plugin(self, arg):
+ """
+ [~prefix] . [arguments] - run a plugin command
+ [~prefix] plugin [arguments] - run a plugin command
+ """
+ pos = arg.find(' ')
+ if pos < 0:
+ name = arg
+ arg = ''
+ else:
+ name = arg[:pos]
+ arg = arg[pos:].strip()
+ if not name:
+ raise CmdError("missing plugin name")
+ for c in name:
+ if c not in self.valid_plugin_name_chars:
+ raise CmdError("invalid plugin name: %r" % name)
+ name = 'winappdbg.plugins.do_%s' % name
+ try:
+ plugin = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ plugin = getattr(plugin, comp)
+ reload(plugin)
+ except ImportError:
+ raise CmdError("plugin not found: %s" % name)
+ try:
+ return plugin.do(self, arg)
+ except CmdError:
+ raise
+ except Exception:
+ e = sys.exc_info()[1]
+## traceback.print_exc(e) # XXX DEBUG
+ raise CmdError("unhandled exception in plugin: %s" % e)
+
+ def do_quit(self, arg):
+ """
+ quit - close the debugging session
+ q - close the debugging session
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if arg:
+ raise CmdError("too many arguments")
+ if self.confirm_quit:
+ count = self.debug.get_debugee_count()
+ if count > 0:
+ if count == 1:
+ msg = "There's a program still running."
+ else:
+ msg = "There are %s programs still running." % count
+ if not self.ask_user(msg):
+ return False
+ self.debuggerExit = True
+ return True
+
+ do_q = do_quit
+
+ def do_attach(self, arg):
+ """
+ attach [target...] - attach to the given process(es)
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ targets = self.input_process_list( self.split_tokens(arg, 1) )
+ if not targets:
+ print("Error: missing parameters")
+ else:
+ debug = self.debug
+ for pid in targets:
+ try:
+ debug.attach(pid)
+ print("Attached to process (%d)" % pid)
+ except Exception:
+ print("Error: can't attach to process (%d)" % pid)
+
+ def do_detach(self, arg):
+ """
+ [~process] detach - detach from the current process
+ detach - detach from the current process
+ detach [target...] - detach from the given process(es)
+ """
+ debug = self.debug
+ token_list = self.split_tokens(arg)
+ if self.cmdprefix:
+ token_list.insert(0, self.cmdprefix)
+ targets = self.input_process_list(token_list)
+ if not targets:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ targets = [ self.lastEvent.get_pid() ]
+ for pid in targets:
+ try:
+ debug.detach(pid)
+ print("Detached from process (%d)" % pid)
+ except Exception:
+ print("Error: can't detach from process (%d)" % pid)
+
+ def do_windowed(self, arg):
+ """
+ windowed [arguments...] - run a windowed program for debugging
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ cmdline = self.input_command_line(arg)
+ try:
+ process = self.debug.execl(arg,
+ bConsole = False,
+ bFollow = self.options.follow)
+ print("Spawned process (%d)" % process.get_pid())
+ except Exception:
+ raise CmdError("can't execute")
+ self.set_fake_last_event(process)
+
+ def do_console(self, arg):
+ """
+ console [arguments...] - run a console program for debugging
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ cmdline = self.input_command_line(arg)
+ try:
+ process = self.debug.execl(arg,
+ bConsole = True,
+ bFollow = self.options.follow)
+ print("Spawned process (%d)" % process.get_pid())
+ except Exception:
+ raise CmdError("can't execute")
+ self.set_fake_last_event(process)
+
+ def do_continue(self, arg):
+ """
+ continue - continue execution
+ g - continue execution
+ go - continue execution
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if arg:
+ raise CmdError("too many arguments")
+ if self.debug.get_debugee_count() > 0:
+ return True
+
+ do_g = do_continue
+ do_go = do_continue
+
+ def do_gh(self, arg):
+ """
+ gh - go with exception handled
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if arg:
+ raise CmdError("too many arguments")
+ if self.lastEvent:
+ self.lastEvent.continueStatus = win32.DBG_EXCEPTION_HANDLED
+ return self.do_go(arg)
+
+ def do_gn(self, arg):
+ """
+ gn - go with exception not handled
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if arg:
+ raise CmdError("too many arguments")
+ if self.lastEvent:
+ self.lastEvent.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED
+ return self.do_go(arg)
+
+ def do_refresh(self, arg):
+ """
+ refresh - refresh the list of running processes and threads
+ [~process] refresh - refresh the list of running threads
+ """
+ if arg:
+ raise CmdError("too many arguments")
+ if self.cmdprefix:
+ process = self.get_process_from_prefix()
+ process.scan()
+ else:
+ self.debug.system.scan()
+
+ def do_processlist(self, arg):
+ """
+ pl - show the processes being debugged
+ processlist - show the processes being debugged
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if arg:
+ raise CmdError("too many arguments")
+ system = self.debug.system
+ pid_list = self.debug.get_debugee_pids()
+ if pid_list:
+ print("Process ID File name")
+ for pid in pid_list:
+ if pid == 0:
+ filename = "System Idle Process"
+ elif pid == 4:
+ filename = "System"
+ else:
+ filename = system.get_process(pid).get_filename()
+ filename = PathOperations.pathname_to_filename(filename)
+ print("%-12d %s" % (pid, filename))
+
+ do_pl = do_processlist
+
+ def do_threadlist(self, arg):
+ """
+ tl - show the threads being debugged
+ threadlist - show the threads being debugged
+ """
+ if arg:
+ raise CmdError("too many arguments")
+ if self.cmdprefix:
+ process = self.get_process_from_prefix()
+ for thread in process.iter_threads():
+ tid = thread.get_tid()
+ name = thread.get_name()
+ print("%-12d %s" % (tid, name))
+ else:
+ system = self.debug.system
+ pid_list = self.debug.get_debugee_pids()
+ if pid_list:
+ print("Thread ID Thread name")
+ for pid in pid_list:
+ process = system.get_process(pid)
+ for thread in process.iter_threads():
+ tid = thread.get_tid()
+ name = thread.get_name()
+ print("%-12d %s" % (tid, name))
+
+ do_tl = do_threadlist
+
+ def do_kill(self, arg):
+ """
+ [~process] kill - kill a process
+ [~thread] kill - kill a thread
+ kill - kill the current process
+ kill * - kill all debugged processes
+ kill - kill the given processes and threads
+ """
+ if arg:
+ if arg == '*':
+ target_pids = self.debug.get_debugee_pids()
+ target_tids = list()
+ else:
+ target_pids = set()
+ target_tids = set()
+ if self.cmdprefix:
+ pid, tid = self.get_process_and_thread_ids_from_prefix()
+ if tid is None:
+ target_tids.add(tid)
+ else:
+ target_pids.add(pid)
+ for token in self.split_tokens(arg):
+ try:
+ pid = self.input_process(token)
+ target_pids.add(pid)
+ except CmdError:
+ try:
+ tid = self.input_process(token)
+ target_pids.add(pid)
+ except CmdError:
+ msg = "unknown process or thread (%s)" % token
+ raise CmdError(msg)
+ target_pids = list(target_pids)
+ target_tids = list(target_tids)
+ target_pids.sort()
+ target_tids.sort()
+ msg = "You are about to kill %d processes and %d threads."
+ msg = msg % ( len(target_pids), len(target_tids) )
+ if self.ask_user(msg):
+ for pid in target_pids:
+ self.kill_process(pid)
+ for tid in target_tids:
+ self.kill_thread(tid)
+ else:
+ if self.cmdprefix:
+ pid, tid = self.get_process_and_thread_ids_from_prefix()
+ if tid is None:
+ if self.lastEvent is not None and pid == self.lastEvent.get_pid():
+ msg = "You are about to kill the current process."
+ else:
+ msg = "You are about to kill process %d." % pid
+ if self.ask_user(msg):
+ self.kill_process(pid)
+ else:
+ if self.lastEvent is not None and tid == self.lastEvent.get_tid():
+ msg = "You are about to kill the current thread."
+ else:
+ msg = "You are about to kill thread %d." % tid
+ if self.ask_user(msg):
+ self.kill_thread(tid)
+ else:
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ pid = self.lastEvent.get_pid()
+ if self.ask_user("You are about to kill the current process."):
+ self.kill_process(pid)
+
+ # TODO: create hidden threads using undocumented API calls.
+ def do_modload(self, arg):
+ """
+ [~process] modload - load a DLL module
+ """
+ filename = self.split_tokens(arg, 1, 1)[0]
+ process = self.get_process_from_prefix()
+ try:
+ process.inject_dll(filename, bWait=False)
+ except RuntimeError:
+ print("Can't inject module: %r" % filename)
+
+ # TODO: modunload
+
+ def do_stack(self, arg):
+ """
+ [~thread] k - show the stack trace
+ [~thread] stack - show the stack trace
+ """
+ if arg: # XXX TODO add depth parameter
+ raise CmdError("too many arguments")
+ pid, tid = self.get_process_and_thread_ids_from_prefix()
+ process = self.get_process(pid)
+ thread = process.get_thread(tid)
+ try:
+ stack_trace = thread.get_stack_trace_with_labels()
+ if stack_trace:
+ print(CrashDump.dump_stack_trace_with_labels(stack_trace),)
+ else:
+ print("No stack trace available for thread (%d)" % tid)
+ except WindowsError:
+ print("Can't get stack trace for thread (%d)" % tid)
+
+ do_k = do_stack
+
+ def do_break(self, arg):
+ """
+ break - force a debug break in all debugees
+ break [process...] - force a debug break
+ """
+ debug = self.debug
+ system = debug.system
+ targets = self.input_process_list( self.split_tokens(arg) )
+ if not targets:
+ targets = debug.get_debugee_pids()
+ targets.sort()
+ if self.lastEvent:
+ current = self.lastEvent.get_pid()
+ else:
+ current = None
+ for pid in targets:
+ if pid != current and debug.is_debugee(pid):
+ process = system.get_process(pid)
+ try:
+ process.debug_break()
+ except WindowsError:
+ print("Can't force a debug break on process (%d)")
+
+ def do_step(self, arg):
+ """
+ p - step on the current assembly instruction
+ next - step on the current assembly instruction
+ step - step on the current assembly instruction
+ """
+ if self.cmdprefix:
+ raise CmdError("prefix not allowed")
+ if self.lastEvent is None:
+ raise CmdError("no current process set")
+ if arg: # XXX this check is to be removed
+ raise CmdError("too many arguments")
+ pid = self.lastEvent.get_pid()
+ thread = self.lastEvent.get_thread()
+ pc = thread.get_pc()
+ code = thread.disassemble(pc, 16)[0]
+ size = code[1]
+ opcode = code[2].lower()
+ if ' ' in opcode:
+ opcode = opcode[ : opcode.find(' ') ]
+ if opcode in self.jump_instructions or opcode in ('int', 'ret', 'retn'):
+ return self.do_trace(arg)
+ address = pc + size
+## print(hex(pc), hex(address), size # XXX DEBUG
+ self.debug.stalk_at(pid, address)
+ return True
+
+ do_p = do_step
+ do_next = do_step
+
+ def do_trace(self, arg):
+ """
+ t - trace at the current assembly instruction
+ trace - trace at the current assembly instruction
+ """
+ if arg: # XXX this check is to be removed
+ raise CmdError("too many arguments")
+ if self.lastEvent is None:
+ raise CmdError("no current thread set")
+ self.lastEvent.get_thread().set_tf()
+ return True
+
+ do_t = do_trace
+
+ def do_bp(self, arg):
+ """
+ [~process] bp - set a code breakpoint
+ """
+ pid = self.get_process_id_from_prefix()
+ if not self.debug.is_debugee(pid):
+ raise CmdError("target process is not being debugged")
+ process = self.get_process(pid)
+ token_list = self.split_tokens(arg, 1, 1)
+ try:
+ address = self.input_address(token_list[0], pid)
+ deferred = False
+ except Exception:
+ address = token_list[0]
+ deferred = True
+ if not address:
+ address = token_list[0]
+ deferred = True
+ self.debug.break_at(pid, address)
+ if deferred:
+ print("Deferred breakpoint set at %s" % address)
+ else:
+ print("Breakpoint set at %s" % address)
+
+ def do_ba(self, arg):
+ """
+ [~thread] ba <1|2|4|8> - set hardware breakpoint
+ """
+ debug = self.debug
+ thread = self.get_thread_from_prefix()
+ pid = thread.get_pid()
+ tid = thread.get_tid()
+ if not debug.is_debugee(pid):
+ raise CmdError("target thread is not being debugged")
+ token_list = self.split_tokens(arg, 3, 3)
+ access = token_list[0].lower()
+ size = token_list[1]
+ address = token_list[2]
+ if access == 'a':
+ access = debug.BP_BREAK_ON_ACCESS
+ elif access == 'w':
+ access = debug.BP_BREAK_ON_WRITE
+ elif access == 'e':
+ access = debug.BP_BREAK_ON_EXECUTION
+ else:
+ raise CmdError("bad access type: %s" % token_list[0])
+ if size == '1':
+ size = debug.BP_WATCH_BYTE
+ elif size == '2':
+ size = debug.BP_WATCH_WORD
+ elif size == '4':
+ size = debug.BP_WATCH_DWORD
+ elif size == '8':
+ size = debug.BP_WATCH_QWORD
+ else:
+ raise CmdError("bad breakpoint size: %s" % size)
+ thread = self.get_thread_from_prefix()
+ tid = thread.get_tid()
+ pid = thread.get_pid()
+ if not debug.is_debugee(pid):
+ raise CmdError("target process is not being debugged")
+ address = self.input_address(address, pid)
+ if debug.has_hardware_breakpoint(tid, address):
+ debug.erase_hardware_breakpoint(tid, address)
+ debug.define_hardware_breakpoint(tid, address, access, size)
+ debug.enable_hardware_breakpoint(tid, address)
+
+ def do_bm(self, arg):
+ """
+ [~process] bm - set memory breakpoint
+ """
+ pid = self.get_process_id_from_prefix()
+ if not self.debug.is_debugee(pid):
+ raise CmdError("target process is not being debugged")
+ process = self.get_process(pid)
+ token_list = self.split_tokens(arg, 1, 2)
+ address, size = self.input_address_range(token_list[0], pid)
+ self.debug.watch_buffer(pid, address, size)
+
+ def do_bl(self, arg):
+ """
+ bl - list the breakpoints for the current process
+ bl * - list the breakpoints for all processes
+ [~process] bl - list the breakpoints for the given process
+ bl [process...] - list the breakpoints for each given process
+ """
+ debug = self.debug
+ if arg == '*':
+ if self.cmdprefix:
+ raise CmdError("prefix not supported")
+ breakpoints = debug.get_debugee_pids()
+ else:
+ targets = self.input_process_list( self.split_tokens(arg) )
+ if self.cmdprefix:
+ targets.insert(0, self.input_process(self.cmdprefix))
+ if not targets:
+ if self.lastEvent is None:
+ raise CmdError("no current process is set")
+ targets = [ self.lastEvent.get_pid() ]
+ for pid in targets:
+ bplist = debug.get_process_code_breakpoints(pid)
+ printed_process_banner = False
+ if bplist:
+ if not printed_process_banner:
+ print("Process %d:" % pid)
+ printed_process_banner = True
+ for bp in bplist:
+ address = repr(bp)[1:-1].replace('remote address ','')
+ print(" %s" % address)
+ dbplist = debug.get_process_deferred_code_breakpoints(pid)
+ if dbplist:
+ if not printed_process_banner:
+ print("Process %d:" % pid)
+ printed_process_banner = True
+ for (label, action, oneshot) in dbplist:
+ if oneshot:
+ address = " Deferred unconditional one-shot" \
+ " code breakpoint at %s"
+ else:
+ address = " Deferred unconditional" \
+ " code breakpoint at %s"
+ address = address % label
+ print(" %s" % address)
+ bplist = debug.get_process_page_breakpoints(pid)
+ if bplist:
+ if not printed_process_banner:
+ print("Process %d:" % pid)
+ printed_process_banner = True
+ for bp in bplist:
+ address = repr(bp)[1:-1].replace('remote address ','')
+ print(" %s" % address)
+ for tid in debug.system.get_process(pid).iter_thread_ids():
+ bplist = debug.get_thread_hardware_breakpoints(tid)
+ if bplist:
+ print("Thread %d:" % tid)
+ for bp in bplist:
+ address = repr(bp)[1:-1].replace('remote address ','')
+ print(" %s" % address)
+
+ def do_bo(self, arg):
+ """
+ [~process] bo