This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 4/4] Add a TRY_CATCH to get_prev_frame to better handle errors during unwind.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <aburgess at broadcom dot com>, gdb-patches at sourceware dot org
- Date: Wed, 28 May 2014 19:31:29 +0100
- Subject: Re: [PATCH v3 4/4] Add a TRY_CATCH to get_prev_frame to better handle errors during unwind.
- Authentication-results: sourceware.org; auth=none
- References: <533EC5B7 dot 6080600 at broadcom dot com> <1398855344-25278-1-git-send-email-aburgess at broadcom dot com> <1398855344-25278-5-git-send-email-aburgess at broadcom dot com>
On 04/30/2014 11:55 AM, Andrew Burgess wrote:
> Here a new TRY_CATCH is added to the core of get_prev_frame, all uncaught
> errors are turned into UNWIND_MISC_ERROR, and where possible the error
> message associated with the error is stored as a frame specific stop reason
> string. The reason string is held of the frame OBSTACK so it lives as long
> as the frame does.
>
> There's a new function for getting the frame_stop_reason_string, this
> replaces the now (thanks to patch #3) old frame_stop_reason_string
> function, I know that reusing the name could confuse, but this function was
> not widely used, so I hope that'll not be an issue.
Sounds like we'll want to expose this to Python too. If you're not
planning on doing that, could you file a PR once this goes in?
>
> Finally, I update the expected results from the tests in patch #1 now that
> everything should pass.
>
> I don't know if you'll all be happy with me catching _all_ errors in
> get_prev_frame.
Yeah, that makes me somewhat nervous. E.g., this catches and
swallows TARGET_CLOSE_ERROR.
> Given that the issues I'm seeing "in the wild" and which
> I've put into the tests are for accessing invalid memory through a bad
> stack pointer, I could reduce the catching to only catch MEMORY_ERRORs,
> then UNWIND_MISC_ERROR would become UNWIND_MEMORY_ERROR.
I think I'd prefer that. This swallows TARGET_CLOSE_ERROR, for example.
Could you please include both MI and CLI before/after examples
in the description/commit log, please? You had something
close to that in the cover letter, but that doesn't make it to
the repository.
> I could even add
> the memory error detection on top of the new MISC_ERROR case if preferred,
> though I'd need to think of a new test...
I didn't understand this.
>
> Feedback welcome, or is this OK?
> * unwind_stop_reason.def: Add UNWIND_MISC_ERROR.
Values added here are exposed to Python/scheme automatically.
But, we need to document them manually in the manual. E.g.
for python, in gdb/python.texi in the table beneath the
description of Frame.unwind_stop_reason ().
--
Pedro Alves