Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2009-02-03 23:23:35 +0300
committerZoltan Varga <vargaz@gmail.com>2009-02-03 23:23:35 +0300
commit7f8c90da241e9668aef0170a74d6974c82b05343 (patch)
tree082e73bf0dccf230d50a2c0dbb59d2af6c4cf01e /data
parentdca5b708a1cd601f5fc6f3d101a6ba7813a3114b (diff)
2009-02-03 Zoltan Varga <vargaz@gmail.com>
* mono-gdb.py (stringify_class_name): Helper function to print base types using their short name. Also add a prototype implementation of registering the hooks from python code instead of needing the mono-gdbinit file. svn path=/trunk/mono/; revision=125594
Diffstat (limited to 'data')
-rw-r--r--data/gdb/mono-gdb.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/data/gdb/mono-gdb.py b/data/gdb/mono-gdb.py
index d8e8599d474..df5690e2986 100644
--- a/data/gdb/mono-gdb.py
+++ b/data/gdb/mono-gdb.py
@@ -39,6 +39,14 @@ class StringPrinter:
res.append ('"')
return ''.join (res)
+def stringify_class_name(ns, name):
+ if ns == "System":
+ if name == "Byte":
+ return "byte"
+ if name == "String":
+ return "string"
+ return "%s.%s" % (ns, name)
+
class ArrayPrinter:
"Print a C# array"
@@ -50,7 +58,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.Type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
- return "%s.%s [%d]" % (self.class_ns, self.class_name [0:len(self.class_name) - 2], int(length))
+ return "%s [%d]" % (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
class ObjectPrinter:
"Print a C# object"
@@ -147,10 +155,21 @@ class MonoSupport(object):
gdb.execute ("add-symbol-file %s 0" % sofile)
self.s_size = new_size
+class RunHook (gdb.Command):
+ def __init__ (self):
+ super (RunHook, self).__init__ ("hook-run", gdb.COMMAND_NONE,
+ gdb.COMPLETE_COMMAND, pre_hook_of="run")
+
+ def invoke(self, arg, from_tty):
+ mono_support.run_hook ()
+
print "Mono support loaded."
mono_support = MonoSupport ()
+# This depends on the changes in gdb-python.diff to work
+#RunHook ()
+
# Register our hooks
# This currently cannot be done from python code
@@ -160,4 +179,3 @@ if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
exec_file = os.readlink (exec_file)
exec_dir = os.path.dirname (exec_file)
gdb.execute ("source %s/%s-gdbinit" % (exec_dir, os.path.basename (exec_file)))
-