summaryrefslogtreecommitdiff
path: root/gdb/gdbarch.py
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbarch.py')
-rwxr-xr-xgdb/gdbarch.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index 4a0c522074..5a261ba572 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -257,29 +257,29 @@ with open("gdbarch.c", "w") as f:
print("struct gdbarch", file=f)
print("{", file=f)
print(" /* Has this architecture been fully initialized? */", file=f)
- print(" bool initialized_p;", file=f)
+ print(" bool initialized_p = false;", file=f)
print(file=f)
print(" /* An obstack bound to the lifetime of the architecture. */", file=f)
- print(" struct obstack *obstack;", file=f)
+ print(" auto_obstack obstack;", file=f)
print(file=f)
print(" /* basic architectural information. */", file=f)
for c in filter(info, components):
print(f" {c.type} {c.name};", file=f)
print(file=f)
print(" /* target specific vector. */", file=f)
- print(" struct gdbarch_tdep_base *tdep;", file=f)
- print(" gdbarch_dump_tdep_ftype *dump_tdep;", file=f)
+ print(" struct gdbarch_tdep_base *tdep = nullptr;", file=f)
+ print(" gdbarch_dump_tdep_ftype *dump_tdep = nullptr;", file=f)
print(file=f)
print(" /* per-architecture data-pointers. */", file=f)
- print(" unsigned nr_data;", file=f)
- print(" void **data;", file=f)
+ print(" unsigned nr_data = 0;", file=f)
+ print(" void **data = nullptr;", file=f)
print(file=f)
for c in filter(not_info, components):
if isinstance(c, Value):
- print(f" {c.type} {c.name};", file=f)
+ print(f" {c.type} {c.name} = 0;", file=f)
else:
assert isinstance(c, Function)
- print(f" gdbarch_{c.name}_ftype *{c.name};", file=f)
+ print(f" gdbarch_{c.name}_ftype *{c.name} = nullptr;", file=f)
print("};", file=f)
print(file=f)
#
@@ -294,15 +294,7 @@ with open("gdbarch.c", "w") as f:
print("{", file=f)
print(" struct gdbarch *gdbarch;", file=f)
print("", file=f)
- print(
- " /* Create an obstack for allocating all the per-architecture memory,", file=f
- )
- print(" then use that to allocate the architecture vector. */", file=f)
- print(" struct obstack *obstack = XNEW (struct obstack);", file=f)
- print(" obstack_init (obstack);", file=f)
- print(" gdbarch = XOBNEW (obstack, struct gdbarch);", file=f)
- print(" memset (gdbarch, 0, sizeof (*gdbarch));", file=f)
- print(" gdbarch->obstack = obstack;", file=f)
+ print(" gdbarch = new struct gdbarch;", file=f)
print(file=f)
print(" alloc_gdbarch_data (gdbarch);", file=f)
print(file=f)