-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathmake_gdb_refs.py
More file actions
71 lines (54 loc) · 2.26 KB
/
make_gdb_refs.py
File metadata and controls
71 lines (54 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python3
# This creates a mock objects.inv file to reference external documentation
from sphinx.util.inventory import InventoryFile
class config(object):
def __init__(self, project, version):
self.project = project
self.version = version
# type: () -> Iterator[Tuple[unicode, unicode, unicode, unicode, unicode, int]]
# modules:
# modname, modname, 'module', "info[0]", 'module-' + modname, 0
# objects:
# refname, refname, type, docname, refname, 1
class MockDomain(object):
def __init__(self, name):
self.name = name
self.objects = dict()
def add_class_ref(self, name, doc):
self.objects[name] = doc
def get_objects(self):
for name, doc in self.objects.items():
yield (name, name, 'class', doc, name, 1)
class MockEnvironment(object):
def __init__(self):
self.domains = dict()
self.config = config('gdb', '8.3')
def add_domain(self, domain):
self.domains[domain.name] = domain
class MockBuilder(object):
def get_target_uri(self, docname):
return docname
def make_gdb_refs(root):
print("*** Generating gdb inventory file")
env = MockEnvironment()
builder = MockBuilder()
classes = MockDomain('py')
classes.add_class_ref('gdb.Type', 'Types-In-Python.html')
classes.add_class_ref('gdb.Symbol', 'Symbols-In-Python.html')
classes.add_class_ref('gdb.Command', 'Commands-In-Python.html')
classes.add_class_ref('gdb.Inferior', 'Inferiors-In-Python.html')
classes.add_class_ref('gdb.Objfile', 'Objfiles-In-Python.html')
classes.add_class_ref('gdb.Value', 'Values-From-Inferior.html')
classes.add_class_ref('gdb.InferiorThread', 'Threads-In-Python.html')
classes.add_class_ref('gdb.Frame', 'Frames-In-Python.html')
classes.add_class_ref('gdb.NotAvailableErorr', 'Exception-Handling.html')
classes.add_class_ref('gdb.MemoryError', 'Exception-Handling.html')
classes.add_class_ref('gdb.error', 'Exception-Handling.html')
classes.add_class_ref('gdb.GdbError', 'Exception-Handling.html')
env.add_domain(classes)
print(f"Writing {root}/gdb.inv")
InventoryFile.dump(f"{root}/gdb.inv", env, builder)
if __name__ == '__main__':
import os
import sys
make_gdb_refs(os.path.dirname(sys.argv[0]))