Add conditional breakpoint, fix typo in settings file
This commit is contained in:
@@ -19,6 +19,10 @@
|
|||||||
"caption": "RemedyBG: Set breakpoint",
|
"caption": "RemedyBG: Set breakpoint",
|
||||||
"command": "remedy_set_breakpoint",
|
"command": "remedy_set_breakpoint",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"caption": "RemedyBG: Set conditional breakpoint",
|
||||||
|
"command": "remedy_set_conditional_breakpoint",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"caption": "RemedyBG: Run to cursor, launch and stop at cursor",
|
"caption": "RemedyBG: Run to cursor, launch and stop at cursor",
|
||||||
"command": "remedy_run_to_cursor",
|
"command": "remedy_run_to_cursor",
|
||||||
@@ -29,11 +33,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"caption": "RemedyBG: Add selection or word under cursor to watch window",
|
"caption": "RemedyBG: Add selection or word under cursor to watch window",
|
||||||
"command": "remedy_restart_debugging",
|
"command": "remedy_add_to_watch",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"caption": "RemedyBG: All in one, this is for the convienient mouse + keyboard usage",
|
"caption": "RemedyBG: All in one, this is for the convienient mouse + keyboard usage",
|
||||||
"command": "remedy_restart_debugging",
|
"command": "remedy_all_in_one",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"caption": "RemedyBG: Build and run to cursor, requires a project",
|
"caption": "RemedyBG: Build and run to cursor, requires a project",
|
||||||
|
|||||||
49
remedy.py
49
remedy.py
@@ -46,12 +46,17 @@ class RemedyInstance:
|
|||||||
sublime.message_dialog('RemedyBG: ' + str(cmd) + ' failed')
|
sublime.message_dialog('RemedyBG: ' + str(cmd) + ' failed')
|
||||||
return out_buffer, result_code
|
return out_buffer, result_code
|
||||||
|
|
||||||
def add_breakpoint_at_filename_line(self, view, filename, line, region):
|
def add_breakpoint_at_filename_line(self, view, filename, line, region, expr = None):
|
||||||
buff = self.begin_command(COMMAND_ADD_BREAKPOINT_AT_FILENAME_LINE)
|
buff = self.begin_command(COMMAND_ADD_BREAKPOINT_AT_FILENAME_LINE)
|
||||||
buff.write(ctypes.c_uint16(len(filename)))
|
buff.write(ctypes.c_uint16(len(filename)))
|
||||||
buff.write(bytes(filename, 'utf-8'))
|
buff.write(bytes(filename, 'utf-8'))
|
||||||
buff.write(ctypes.c_uint32(line))
|
buff.write(ctypes.c_uint32(line))
|
||||||
|
if expr:
|
||||||
|
buff.write(ctypes.c_uint16(len(expr)))
|
||||||
|
buff.write(bytes(expr, 'utf-8'))
|
||||||
|
else:
|
||||||
buff.write(ctypes.c_uint16(0))
|
buff.write(ctypes.c_uint16(0))
|
||||||
|
|
||||||
buff, result_code = self.end_command(buff)
|
buff, result_code = self.end_command(buff)
|
||||||
if result_code == 1:
|
if result_code == 1:
|
||||||
bp_id = int.from_bytes(buff.read(4), 'little')
|
bp_id = int.from_bytes(buff.read(4), 'little')
|
||||||
@@ -317,27 +322,26 @@ class RemedyInstance:
|
|||||||
except OSError as os_error:
|
except OSError as os_error:
|
||||||
sublime.error_message("RemedyBG: " + str(os_error))
|
sublime.error_message("RemedyBG: " + str(os_error))
|
||||||
|
|
||||||
def run_to_cursor(self):
|
def filename_and_line():
|
||||||
window = sublime.active_window()
|
|
||||||
view = window.active_view()
|
|
||||||
line = view.rowcol(view.sel()[0].b)[0] + 1
|
|
||||||
filename = view.file_name()
|
|
||||||
self.run_to_file_at_line(filename, line)
|
|
||||||
|
|
||||||
def goto_cursor(self):
|
|
||||||
window = sublime.active_window()
|
|
||||||
view = window.active_view()
|
|
||||||
line = view.rowcol(view.sel()[0].b)[0] + 1
|
|
||||||
filename = view.file_name()
|
|
||||||
self.goto_file_at_line(filename, line)
|
|
||||||
|
|
||||||
def breakpoint_on_cursor(self):
|
|
||||||
window = sublime.active_window()
|
window = sublime.active_window()
|
||||||
view = window.active_view()
|
view = window.active_view()
|
||||||
sel = view.sel()[0].b
|
sel = view.sel()[0].b
|
||||||
line = view.rowcol(sel)[0] + 1
|
line = view.rowcol(sel)[0] + 1
|
||||||
filename = view.file_name()
|
filename = view.file_name()
|
||||||
self.toggle_breakpoint(view, filename, line, sublime.Region(sel))
|
return filename, line, sel
|
||||||
|
|
||||||
|
def run_to_cursor(self):
|
||||||
|
filename, line, cursor = RemedyInstance.filename_and_line()
|
||||||
|
self.run_to_file_at_line(filename, line)
|
||||||
|
|
||||||
|
def goto_cursor(self):
|
||||||
|
filename, line, cursor = RemedyInstance.filename_and_line()
|
||||||
|
self.goto_file_at_line(filename, line)
|
||||||
|
|
||||||
|
def breakpoint_on_cursor(self, expr = None):
|
||||||
|
filename, line, cursor = RemedyInstance.filename_and_line()
|
||||||
|
self.toggle_breakpoint(view, filename, line, sublime.Region(cursor))
|
||||||
|
|
||||||
|
|
||||||
remedy_instance = RemedyInstance()
|
remedy_instance = RemedyInstance()
|
||||||
|
|
||||||
@@ -484,6 +488,17 @@ class RemedySetBreakpointCommand(sublime_plugin.TextCommand):
|
|||||||
if remedy_instance.try_launching(): return
|
if remedy_instance.try_launching(): return
|
||||||
remedy_instance.breakpoint_on_cursor()
|
remedy_instance.breakpoint_on_cursor()
|
||||||
|
|
||||||
|
class RemedySetConditionalBreakpointCommand(sublime_plugin.TextCommand):
|
||||||
|
def run(self, edit):
|
||||||
|
if remedy_instance.try_launching(): return
|
||||||
|
window = self.view.window()
|
||||||
|
|
||||||
|
def on_done(expr):
|
||||||
|
filename, line, cursor = RemedyInstance.filename_and_line()
|
||||||
|
remedy_instance.add_breakpoint_at_filename_line(self.view, filename, line, sublime.Region(cursor), expr)
|
||||||
|
|
||||||
|
window.show_input_panel("Enter conditional breakpoint expression:", "", on_done, None, None)
|
||||||
|
|
||||||
class RemedyAddToWatchCommand(sublime_plugin.TextCommand):
|
class RemedyAddToWatchCommand(sublime_plugin.TextCommand):
|
||||||
def run(self, edit):
|
def run(self, edit):
|
||||||
if remedy_instance.try_launching(): return
|
if remedy_instance.try_launching(): return
|
||||||
|
|||||||
Reference in New Issue
Block a user