From: Doug Evans <xdje42@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Hui Zhu <hui_zhu@mentor.com>,
gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Eliminate UNSUPPORTED_ERROR.
Date: Wed, 11 Dec 2013 16:33:00 -0000 [thread overview]
Message-ID: <CAP9bCMRyMQESGWQFSsB-+OJ=eSgtcnNcC6J4hDxq5n6kSY=c6Q@mail.gmail.com> (raw)
In-Reply-To: <52A75A05.60006@redhat.com>
On Tue, Dec 10, 2013 at 10:14 AM, Pedro Alves <palves@redhat.com> wrote:
> On 12/10/2013 05:34 PM, Pedro Alves wrote:
>> On 12/09/2013 09:07 PM, Doug Evans wrote:
>
>>>>> --- a/gdb/cli/cli-cmds.c
>>>>> +++ b/gdb/cli/cli-cmds.c
>>>>> @@ -527,24 +527,16 @@ source_script_from_stream (FILE *stream, const char *file)
>>>>> {
>>>>> volatile struct gdb_exception e;
>>>>>
>>>>> - TRY_CATCH (e, RETURN_MASK_ERROR)
>>>>> - {
>>>>> - source_python_script (stream, file);
>>>>> - }
>>>>> - if (e.reason < 0)
>>>>> + if (!source_python_script (stream, file))
>>> If we must change things, I would prefer having a predicate
>>> and call that first.
>>
>> I can try that.
>
> OK?
A few nits, but yep.
>
> gdb/
> 2013-12-10 Pedro Alves <palves@redhat.com>
>
> * cli/cli-cmds.c (source_script_from_stream) Use have_python
> instead of catching UNSUPPORTED_ERROR.
> * exceptions.h (UNSUPPORTED_ERROR): Delete.
> * python/python.c (source_python_script) [!HAVE_PYTHON]: Internal
> error if called.
> * python/python.h (have_python): New static inline function.
> ---
> gdb/cli/cli-cmds.c | 27 ++++++++-------------------
> gdb/exceptions.h | 3 ---
> gdb/python/python.c | 5 +++--
> gdb/python/python.h | 13 +++++++++++++
> 4 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index 52a6bc9..a0586ff 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -525,27 +525,16 @@ source_script_from_stream (FILE *stream, const char *file)
> if (script_ext_mode != script_ext_off
> && strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py"))
> {
> - volatile struct gdb_exception e;
> -
> - TRY_CATCH (e, RETURN_MASK_ERROR)
> + if (have_python ())
> + source_python_script (stream, file);
> + else if (script_ext_mode == script_ext_soft)
> {
> - source_python_script (stream, file);
> - }
> - if (e.reason < 0)
> - {
> - /* Should we fallback to ye olde GDB script mode? */
> - if (script_ext_mode == script_ext_soft
> - && e.reason == RETURN_ERROR && e.error == UNSUPPORTED_ERROR)
> - {
> - fseek (stream, 0, SEEK_SET);
> - script_from_file (stream, (char*) file);
> - }
> - else
> - {
> - /* Nope, just punt. */
> - throw_exception (e);
> - }
> + /* Fallback to GDB script mode. */
> + fseek (stream, 0, SEEK_SET);
> + script_from_file (stream, (char*) file);
Remove the fseek and cast.
[that'll probably require removing the { } too, sigh]
next prev parent reply other threads:[~2013-12-11 16:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 10:30 [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Hui Zhu
2013-10-21 15:37 ` Pedro Alves
2013-11-28 10:56 ` Hui Zhu
2013-11-28 17:38 ` Maciej W. Rozycki
2013-11-29 9:41 ` Hui Zhu
2013-11-29 15:27 ` [pushed] Plug target side conditions and commands leaks (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-11-29 16:05 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2013-12-02 12:45 ` Hui Zhu
2013-12-02 14:38 ` Pedro Alves
2013-12-03 4:50 ` Hui Zhu
2013-12-03 4:54 ` Hui Zhu
2013-12-06 19:29 ` Pedro Alves
2013-12-08 5:19 ` Hui Zhu
2013-12-08 8:34 ` Doug Evans
2013-12-08 14:18 ` Hui Zhu
2013-12-09 19:48 ` Pedro Alves
2013-12-09 21:07 ` Doug Evans
2013-12-10 17:34 ` Pedro Alves
2013-12-10 18:14 ` [PATCH] Eliminate UNSUPPORTED_ERROR Pedro Alves
2013-12-11 16:33 ` Doug Evans [this message]
2013-12-11 19:17 ` Pedro Alves
2013-12-12 4:23 ` Doug Evans
2013-12-12 10:23 ` Pedro Alves
2013-12-11 16:40 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Doug Evans
2013-12-12 10:55 ` breakpoint.c:insert_bp_location: Constify local. (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-12-12 12:55 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2014-01-09 18:36 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP9bCMRyMQESGWQFSsB-+OJ=eSgtcnNcC6J4hDxq5n6kSY=c6Q@mail.gmail.com' \
--to=xdje42@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=hui_zhu@mentor.com \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).