As part of some work I have been doing on improving debugging of optimized code, I have created a GCC patch that tags variables it believes are uninitialized with a new Dwarf op (an extension), DW_OP_GNU_uninit. I have submitted that patch to the GCC patches list and am waiting for approval to commit it. I have also created the following gdb patch to recognize the new op and inform the user when a variable the user requests to see is uninitialized. I have tested this patch on some small testcases and I have run the gdb dejagnu testsuite with no regressions. I am new to submitting things to this list, so if there is anything else I ought to have done, please let me know (kindly!). Is this patch okay to commit to gdb? -- Caroline Tice ctice@apple.com 2007-05-01 Caroline Tice * c-valprint.c (c_value_print): If the var_status field of the value struct is 0, print out "[uninitialized]" before the value. * dwarf2expr.c (add_piece): Make function non-static. (unsigned_address_type): Likewise. (signed_address_type): Likewise. (execute_stack_op): Initialize ctx->var_status field; allow DW_OP_GNU_uninit as legal op following a DW_OP_reg op or a DW_OP_regx op; add case for DW_OP_GNU_uninit and update ctx->var_status appropriately. * dwarf2expr.h (struct dwarf_expr_context): New field, var_status. (unsigned_address_type): Add extern declaration. (signed_address_type): Likewise. (add_piece): Likewise. * dwarf2loc.c (dwarf2_evaluate_loc_desc): Add call to set_var_status. * dwarf2read.c (dwarf_stack_op_name): Add case for DW_OP_GNU_uninit. (decode_locdesc): Add case for DW_OP_GNU_uninit. * value.c (struct value): New field, var_status. (allocate_value): Initialize new field. (set_var_status): New function. (value_var_status): New function. * value.h (value_var_status): New extern declaration. (set_var_status): Likewise. * include/elf/dwarf2.h: (enum dwarf_location_atom): Add new DW_OP, DW_OP_GNU_uninit.