This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: Don't error out when variable not available


Andreas Schwab wrote:
With the introduction of DWARF location lists it became impossible to get
the full list of local variables of a function when any of them is not
available.  This is especially annoying when the first local or function
parameter is missing.  Here is an attempt at correcting this.  It is
suboptimal because it still prints the error message including the newline
which badly messes up the output.  Any idea how to fix that properly?

The code to catch these errors and print the message as part of the output has long been on my (and I suspect others) wish list. It should, in addition to solving your problem, mean that gdb handles the general case printing for instance:


  (gdb) print struct_s
  $1 = { a = <memory error>, b = "hi" }
  (gdb)

instead of

  $1 = { a = memory error
  (gdb)

Have a look at catch_exceptions_with_msg. It was added to handle the problem of needing to catch the error message (you might need to wiggle the interface though).

Adding more special case code, as was done with your other patch, isn't the way to go.

Andrew

2005-01-02 Andreas Schwab <schwab@suse.de>

	* findvar.c (read_var_value_no_error, read_var_value_no_error_1)
	(struct read_var_value_args): New.
	* value.h (read_var_value_no_error): Declare it.
	* printcmd.c (print_variable_value): Use read_var_value_no_error.
	* stack.c (print_frame_args): Likewise.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]