Re: How the gdb function throw_error works?

Yao Qi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 06/27/2013 11:19 AM, Terry Guo wrote:
> Hi there,
>
> Function value_of_dwarf_block_entry in file dwarf2loc.c has a call to
> function throw_error which seems will print out some error messages to
> gdb user. I am pretty sure that the throw_error will be called in the

Function 'error' prints error messages, but throw_error may not. 
NO_ENTRY_VALUE_ERROR is caught by the callers of 
value_of_dwarf_block_entry, IIUC.  For example, see stack.c:read_frame_arg:

       TRY_CATCH (except, RETURN_MASK_ERROR)
	{
	  const struct symbol_computed_ops *ops;

	  ops = SYMBOL_COMPUTED_OPS (sym);
	  entryval = ops->read_variable_at_entry (sym, frame);
	}
       if (!entryval)
	{
	  entryval_error = alloca (strlen (except.message) + 1);
	  strcpy (entryval_error, except.message);
	}

       if (except.error == NO_ENTRY_VALUE_ERROR
	  || (entryval && value_optimized_out (entryval)))
	{
	  entryval = NULL;
	  entryval_error = NULL;
	}

Function pointer 'read_variable_at_entry' calls value_of_dwarf_block_entry.

-- 
Yao (齐尧)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.