This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, "ptype $pc" doesn't work anymore. With any program, try the following: (gdb) ptype $pc ../../src-public/gdb/regcache.c:164: internal-error: register_type: Assertion `regnum >= 0 && regnum < descr->nr_cooked_registers' failed. [...] The problem is inside evaluate_subexp_standard, case OP_REGISTER: regno = frame_map_name_to_regnum (deprecated_safe_get_selected_frame (), name, strlen (name)); [...] if (noside == EVAL_AVOID_SIDE_EFFECTS) val = value_zero (register_type (current_gdbarch, regno), not_lval); else val = value_of_register (regno, get_selected_frame (NULL)); In our case, the regno points to a "user" register, and as a result calling "register_type" with that register number triggers the failed assertion. The type of a user register doesn't seem to be conveniently accessible like with the other registers. So my approach was to return a value_zero only when the register was not a user register. For user registers, I get the actual register value, regardless of EVAL_AVOID_SIDE_EFFECTS. I hope the performance will not be noticeably affected. Otherwise, a grander way of fixing this would be to extend the user-regs interface to provide access to these register types. Either through a new callback function, or by updating the "add_reg" function with an extra parameter being the type. I don't remember seeing this need elsewhere, so I think the simple approach is sufficient for now. 2008-01-04 Joel Brobecker <brobecker@adacore.com> * eval.c (evaluate_subexp_standard): Add handling of user registers when in EVAL_AVOID_SIDE_EFFECTS mode. I also added a new test in gdb.base/ptype.exp: 2008-01-04 Joel Brobecker <brobecker@adacore.com> * gdb.base/ptype.exp: Add testing of "ptype $pc". All tested on x86-linux. No regression. OK to apply? Thanks, -- Joel
Attachment:
ptype_pc.diff
Description: Text document
Attachment:
ptype_pc-tc.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |