[RFA]: error_silent for use in pending breakpoint support

J. Johnston jjohnstn@redhat.com
Thu Jan 15 23:42:00 GMT 2004


Andrew Cagney wrote:
>> To properly support pending breakpoints, gdb needs to be able to 
>> suppress the "not found" messages at will, but it also needs to 
>> sometimes issue these messages and determine the cause of the error 
>> was a "not found" event.
>>
>> To handle the problem, I propose two new useful functions in utils.c.  
>> The first is error_silent() which works just like error(), only it 
>> does not issue the error message.  Like error(), it stores the error 
>> message in gdb_lasterr.  This leads to the other new function: 
>> error_last_output() which is used to output the last error message.
>>
>> This allows the pending breakpoint support to issue the error message 
>> when the user is doing the initial break command and to suppress it 
>> when shared libraries are being loaded or a pending breakpoint is 
>> reenabled.
> 
> 
> (I noticed this mentioned linespec so left it, it's really more of a 
> change to utils though).
> 
> What does the stack look like at the point where error_silent is being 
> called?
> 
> I'm thinking that something more like:
> 
>     catch_exception_error (....., &error_mesg);
> with
>     throw_error (message, ...) // silent
> 
> or
>     catch_exception_silently (..., &error_mesg);
> with
>     error (message, ...)
> 
> would be better.  With that it should be possible to avoid the stateful 
> error_last_output interface.   I think this would also be better long 
> term as it should lend itself to the recursive case (where an error is 
> being propogated up the stack).
> 
> 
> Andrew
> 

Ok, patch revised.

I chose to add a new version of catch_exceptions() called 
catch_exceptions_with_msg() which saves a copy of the error message (if an error 
occurs) for the caller to manually output if desired.  The copy needs to be 
freed by the caller once the message is no longer needed.

I removed error_last_output() and created a new function error_output_message() 
which takes pre_print text plus a message and outputs to gdb_stderr.

Any other problems or ok to commit?

-- Jeff J.

2004-01-15  Jeff Johnston  <jjohnstn@redhat.com>

         * linespec.c (decode_variable, symtab_from_filename):  Call
         error_silent with error message instead of throwing an exception
         directly.
         * defs.h (error_silent, error_output_message): Add prototypes.
         (catch_exceptions_with_msg): Ditto.
         * utils.c (error_silent, error_output_message): New functions.
         * top.c (catch_exceptions_with_msg): New function.



> 
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: error_silent.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040115/da5a3fd5/attachment.ksh>


More information about the Gdb-patches mailing list