add gdb commands: koch, nim, nimble (#10741)

* add gdb commands: koch, nim, nimble
* make commands path independent
This commit is contained in:
Arne Döring
2019-02-26 15:47:35 +01:00
committed by Andreas Rumpf
parent 287206f993
commit ba38c05eb6

View File

@@ -168,6 +168,60 @@ class DollarPrintCmd (gdb.Command):
DollarPrintCmd()
################################################################################
##### GDB Commands to invoke common nim tools.
################################################################################
import subprocess, os
class KochCmd (gdb.Command):
"""Command that invokes ``koch'', the build tool for the compiler."""
def __init__ (self):
super (KochCmd, self).__init__ ("koch",
gdb.COMMAND_USER, gdb.COMPLETE_FILENAME)
self.binary = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "koch")
def invoke(self, argument, from_tty):
import os
subprocess.run([self.binary] + gdb.string_to_argv(argument))
KochCmd()
class NimCmd (gdb.Command):
"""Command that invokes ``nim'', the nim compiler."""
def __init__ (self):
super (NimCmd, self).__init__ ("nim",
gdb.COMMAND_USER, gdb.COMPLETE_FILENAME)
self.binary = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "bin/nim")
def invoke(self, argument, from_tty):
subprocess.run([self.binary] + gdb.string_to_argv(argument))
NimCmd()
class NimbleCmd (gdb.Command):
"""Command that invokes ``nimble'', the nim package manager and build tool."""
def __init__ (self):
super (NimbleCmd, self).__init__ ("nimble",
gdb.COMMAND_USER, gdb.COMPLETE_FILENAME)
self.binary = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "bin/nimble")
def invoke(self, argument, from_tty):
subprocess.run([self.binary] + gdb.string_to_argv(argument))
NimbleCmd()
################################################################################
##### Value pretty printers
################################################################################