X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcompile%2Fcompile-c-support.c;h=41fead9ad19d4c5a15d516b966f58bb00e78bc35;hb=b7dc48b4a8006abb552c5e7d22f9841c86f2537d;hp=006d3f811ca1b9d36b2a3865c22f24f1f659033e;hpb=e2882c85786571175a0b0bfc3bcd2f14620b1ea3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index 006d3f811c..41fead9ad1 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -19,6 +19,7 @@ #include "defs.h" #include "compile-internal.h" +#include "compile-c.h" #include "compile.h" #include "gdb-dlfcn.h" #include "c-lang.h" @@ -157,7 +158,7 @@ static void write_macro_definitions (const struct block *block, CORE_ADDR pc, struct ui_file *file) { - struct macro_scope *scope; + gdb::unique_xmalloc_ptr scope; if (block != NULL) scope = sal_macro_scope (find_pc_line (pc, 0)); @@ -351,17 +352,15 @@ c_compute_program (struct compile_instance *inst, and the user's code may only refer to globals. */ if (inst->scope != COMPILE_I_RAW_SCOPE) { - unsigned char *registers_used; int i; /* Generate the code to compute variable locations, but do it before generating the function header, so we can define the register struct before the function body. This requires a temporary stream. */ - registers_used = generate_c_for_variable_locations (context, - var_stream, gdbarch, - expr_block, expr_pc); - make_cleanup (xfree, registers_used); + gdb::unique_xmalloc_ptr registers_used + = generate_c_for_variable_locations (context, var_stream, gdbarch, + expr_block, expr_pc); buf.puts ("typedef unsigned int" " __attribute__ ((__mode__(__pointer__)))" @@ -382,7 +381,7 @@ c_compute_program (struct compile_instance *inst, mode, mode); } - generate_register_struct (&buf, gdbarch, registers_used); + generate_register_struct (&buf, gdbarch, registers_used.get ()); } add_code_header (inst->scope, &buf);