Index: gdb/c-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-valprint.c,v retrieving revision 1.42 diff -c -3 -p -r1.42 c-valprint.c *** gdb/c-valprint.c 26 Jan 2007 20:54:16 -0000 1.42 --- gdb/c-valprint.c 1 May 2007 22:10:43 -0000 *************** c_value_print (struct value *val, struct *** 556,561 **** --- 556,564 ---- } } + if (value_var_status (val) == 0) + fprintf_filtered (stream, " [uninitialized] "); + if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object */ Index: gdb/dwarf2expr.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2expr.c,v retrieving revision 1.19 diff -c -3 -p -r1.19 dwarf2expr.c *** gdb/dwarf2expr.c 9 Jan 2007 17:58:50 -0000 1.19 --- gdb/dwarf2expr.c 1 May 2007 22:10:43 -0000 *************** dwarf_expr_fetch (struct dwarf_expr_cont *** 106,112 **** } /* Add a new piece to CTX's piece list. */ ! static void add_piece (struct dwarf_expr_context *ctx, int in_reg, CORE_ADDR value, ULONGEST size) { --- 106,112 ---- } /* Add a new piece to CTX's piece list. */ ! void add_piece (struct dwarf_expr_context *ctx, int in_reg, CORE_ADDR value, ULONGEST size) { *************** dwarf2_read_address (gdb_byte *buf, gdb_ *** 213,219 **** /* Return the type of an address, for unsigned arithmetic. */ ! static struct type * unsigned_address_type (void) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) --- 213,219 ---- /* Return the type of an address, for unsigned arithmetic. */ ! struct type * unsigned_address_type (void) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) *************** unsigned_address_type (void) *** 232,238 **** /* Return the type of an address, for signed arithmetic. */ ! static struct type * signed_address_type (void) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) --- 232,238 ---- /* Return the type of an address, for signed arithmetic. */ ! struct type * signed_address_type (void) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) *************** execute_stack_op (struct dwarf_expr_cont *** 257,262 **** --- 257,263 ---- gdb_byte *op_ptr, gdb_byte *op_end) { ctx->in_reg = 0; + ctx->var_status = 1; /* Default is initialized. */ while (op_ptr < op_end) { *************** execute_stack_op (struct dwarf_expr_cont *** 383,389 **** case DW_OP_reg29: case DW_OP_reg30: case DW_OP_reg31: ! if (op_ptr != op_end && *op_ptr != DW_OP_piece) error (_("DWARF-2 expression error: DW_OP_reg operations must be " "used either alone or in conjuction with DW_OP_piece.")); --- 384,392 ---- case DW_OP_reg29: case DW_OP_reg30: case DW_OP_reg31: ! if (op_ptr != op_end ! && *op_ptr != DW_OP_piece ! && *op_ptr != DW_OP_GNU_uninit) error (_("DWARF-2 expression error: DW_OP_reg operations must be " "used either alone or in conjuction with DW_OP_piece.")); *************** execute_stack_op (struct dwarf_expr_cont *** 394,400 **** case DW_OP_regx: op_ptr = read_uleb128 (op_ptr, op_end, ®); ! if (op_ptr != op_end && *op_ptr != DW_OP_piece) error (_("DWARF-2 expression error: DW_OP_reg operations must be " "used either alone or in conjuction with DW_OP_piece.")); --- 397,405 ---- case DW_OP_regx: op_ptr = read_uleb128 (op_ptr, op_end, ®); ! if (op_ptr != op_end ! && *op_ptr != DW_OP_piece ! && *op_ptr != DW_OP_GNU_uninit) error (_("DWARF-2 expression error: DW_OP_reg operations must be " "used either alone or in conjuction with DW_OP_piece.")); *************** execute_stack_op (struct dwarf_expr_cont *** 704,709 **** --- 709,718 ---- } goto no_push; + case DW_OP_GNU_uninit: + ctx->var_status = 0; + goto no_push; + default: error (_("Unhandled dwarf expression opcode 0x%x"), op); } Index: gdb/dwarf2expr.h =================================================================== RCS file: /cvs/src/src/gdb/dwarf2expr.h,v retrieving revision 1.9 diff -c -3 -p -r1.9 dwarf2expr.h *** gdb/dwarf2expr.h 9 Jan 2007 17:58:50 -0000 1.9 --- gdb/dwarf2expr.h 1 May 2007 22:10:43 -0000 *************** struct dwarf_expr_context *** 76,81 **** --- 76,84 ---- will be on the expression stack. */ int in_reg; + /* Initialization status of variable. */ + int var_status; + /* An array of pieces. PIECES points to its first element; NUM_PIECES is its length. *************** gdb_byte *read_sleb128 (gdb_byte *buf, g *** 135,138 **** --- 138,144 ---- CORE_ADDR dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read); + extern struct type *unsigned_address_type (void); + extern struct type *signed_address_type (void); + extern void add_piece (struct dwarf_expr_context *, int, CORE_ADDR, ULONGEST); #endif /* dwarf2expr.h */ Index: gdb/dwarf2loc.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2loc.c,v retrieving revision 1.39 diff -c -3 -p -r1.39 dwarf2loc.c *** gdb/dwarf2loc.c 24 Jan 2007 22:04:48 -0000 1.39 --- gdb/dwarf2loc.c 1 May 2007 22:10:43 -0000 *************** dwarf2_evaluate_loc_desc (struct symbol *** 256,261 **** --- 256,263 ---- VALUE_ADDRESS (retval) = address; } + set_var_status (retval, ctx->var_status); + free_dwarf_expr_context (ctx); return retval; Index: gdb/dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.218 diff -c -3 -p -r1.218 dwarf2read.c *** gdb/dwarf2read.c 18 Apr 2007 13:25:04 -0000 1.218 --- gdb/dwarf2read.c 1 May 2007 22:10:44 -0000 *************** dwarf_stack_op_name (unsigned op) *** 8629,8634 **** --- 8629,8636 ---- return "DW_OP_bit_piece"; case DW_OP_GNU_push_tls_address: return "DW_OP_GNU_push_tls_address"; + case DW_OP_GNU_uninit: + return "DW_OP_GNU_uninit"; /* HP extensions. */ case DW_OP_HP_is_value: return "DW_OP_HP_is_value"; *************** decode_locdesc (struct dwarf_block *blk, *** 9204,9209 **** --- 9206,9214 ---- dwarf2_complex_location_expr_complaint (); break; + case DW_OP_GNU_uninit: + break; + default: complaint (&symfile_complaints, _("unsupported stack op: '%s'"), dwarf_stack_op_name (op)); Index: gdb/value.c =================================================================== RCS file: /cvs/src/src/gdb/value.c,v retrieving revision 1.41 diff -c -3 -p -r1.41 value.c *** gdb/value.c 13 Apr 2007 14:17:46 -0000 1.41 --- gdb/value.c 1 May 2007 22:10:44 -0000 *************** struct value *** 157,162 **** --- 157,165 ---- actually exist in the program. */ char optimized_out; + /* If value is a variable, is it initialized or not. */ + int var_status; + /* Actual contents of the value. For use of this value; setting it uses the stuff above. Not valid if lazy is nonzero. Target byte-order. We force it to be aligned properly for any possible *************** allocate_value (struct type *type) *** 232,237 **** --- 235,241 ---- val->embedded_offset = 0; val->pointed_to_offset = 0; val->modifiable = 1; + val->var_status = 1; /* Default to initialized. */ return val; } *************** using_struct_return (struct type *value_ *** 1691,1696 **** --- 1695,1717 ---- != RETURN_VALUE_REGISTER_CONVENTION); } + /* Set the var_status field in a value struct. */ + + void + set_var_status (struct value *val, int status) + { + val->var_status = status; + } + + + /* Return the var_status field in a value struct. */ + + int + value_var_status (struct value *val) + { + return val->var_status; + } + void _initialize_values (void) { Index: gdb/value.h =================================================================== RCS file: /cvs/src/src/gdb/value.h,v retrieving revision 1.96 diff -c -3 -p -r1.96 value.h *** gdb/value.h 9 Jan 2007 17:58:59 -0000 1.96 --- gdb/value.h 1 May 2007 22:10:44 -0000 *************** extern int value_contents_equal (struct *** 193,198 **** --- 193,202 ---- extern int value_optimized_out (struct value *value); extern void set_value_optimized_out (struct value *value, int val); + /* */ + extern int value_var_status (struct value *); + extern void set_var_status (struct value *, int); + /* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a single value might have multiple LVALs), this hacked interface is limited to just the first PIECE. Expect further change. */ Index: include/elf/dwarf2.h =================================================================== RCS file: /cvs/src/src/include/elf/dwarf2.h,v retrieving revision 1.19 diff -c -3 -p -r1.19 dwarf2.h *** include/elf/dwarf2.h 2 Mar 2006 00:54:27 -0000 1.19 --- include/elf/dwarf2.h 1 May 2007 22:10:44 -0000 *************** enum dwarf_location_atom *** 540,545 **** --- 540,546 ---- DW_OP_bit_piece = 0x9d, /* GNU extensions. */ DW_OP_GNU_push_tls_address = 0xe0, + DW_OP_GNU_uninit = 0xf0, /* HP extensions. */ DW_OP_HP_unknown = 0xe0, /* Ouch, the same as GNU_push_tls_address. */ DW_OP_HP_is_value = 0xe1,