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: [rfa] Fix breakpoint error messages


I fixed up the error mesages the user gets when gdb can't insert
breakpoints.
The text changes are up to JimB or MichaelS.

Having GDB print ``Cannot access memory ...'' for a hardware breakpoint error doesn't make much sense though :-)

One thing I noticed,

target_terminal_ours_for_output ();
- warning ("Cannot insert breakpoint %d:", b->number);
+ if (b->type == bp_hardware_breakpoint)
+ {
+ warning ("Cannot insert hardware breakpoint %d:", b->number);
+ }
+ else + {
+ warning ("Cannot insert breakpoint %d:", b->number);
+ }
#ifdef ONE_PROCESS_WRITETEXT
warning ("The same program may be running in another process.");
#endif
- memory_error (val, b->address); /* which bombs us out */
memory_error() eventually calls error() which ``bombs us out'' (long jump's back to main ...). The above changes the behavour in a number of ways.

--

Hmm, since you're looking at this code ... :-)

The above leads to the sequence of calls:

warning (...msg 1..)
warning (...msg 2..)
error (...msg 3...)

The more GUI/MI friendly way of doing this is to accumulate the entire message text in a ui_file object and then send it out using a single error_stream() call. See memory_error() for an example.

If this isn't done, the message ends up being split. Possibly a number of pop-up windows, or even lost.

Can I suggest changing the above to accumulate the message and then call error_stream(). You'll likely need to split memory_error() in two. One half print the message to a ui_file and then call that.

enjoy,
Andrew




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