From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: "Jose E. Marchesi" <jose.marchesi@oracle.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH V4 5/9] New probe type: DTrace USDT probes.
Date: Thu, 26 Mar 2015 18:53:00 -0000 [thread overview]
Message-ID: <87zj6zy4hr.fsf@redhat.com> (raw)
In-Reply-To: <20150326184350.GB13867@adacore.com> (Joel Brobecker's message of "Thu, 26 Mar 2015 11:43:50 -0700")
On Thursday, March 26 2015, Joel Brobecker wrote:
> [Sergio - a change in dtrace-probe.c needs your approval, I think.
> Also, if you have a chance to double-check the rest of the patch,
> that'd be a much appreciated second pair of eyes!]
Thanks, Joel. I saw the messages yesterday but did not get a chance to
review until today.
>> > Well, the TRY..CATCH in your prototype would catch any error that may be
>> > thrown in parse_expression, and the `set_language' must take care of
>> > changing the language, so I would say that is enough...
>>
>> OK - I will send an updated patch that makes things a little cleaner.
>> I didn't know whether it was OK to default to type long makes much
>> sense when the probe says the parameter should be using type "mutex_t".
I remember we had the same problem (i.e., not parsing using language_c)
on SystemTap SDT probes as well. Coincidentally or not, you triggered
the problem twice!
> Here it is.
>
> gdb/ChangeLog:
>
> * dtrace-probe.c (dtrace_process_dof_probe): Contain any
> exception raised while parsing the probe arguments.
> Force parsing to be done using the C language parser.
> * expression.h (parse_expression_with_language): Declare.
> * parse.c (parse_expression_with_language): New function.
>
> Tested on sparc-solaris.
>
> --
> Joel
>
> From ba8991270e994cd96f92316932f65f96e47bf329 Mon Sep 17 00:00:00 2001
> From: Joel Brobecker <brobecker@adacore.com>
> Date: Thu, 26 Mar 2015 19:14:03 +0100
> Subject: [PATCH] dtrace-probe: Handle error while parsing probe argument.
>
> The debugger on Solaris has been broken since the introduction of
> DTrace probe support:
>
> (gdb) start
> Temporary breakpoint 1 at 0x80593bc: file simple_main.adb, line 4.
> Starting program: /[...]/simple_main
> [Thread debugging using libthread_db enabled]
> No definition of "mutex_t" in current context.
>
> The problem occurs while trying to parse a probe's arguument,
"argument"
> and the exception propagates all the way to the top. This patch
> fixes the issue by containing the exception and falling back on
> using the "long" builtin type if the argument's type could not
> be determined.
>
> Also, the parsing should be done using the C language parser.
>
> gdb/ChangeLog:
>
> * dtrace-probe.c (dtrace_process_dof_probe): Contain any
> exception raised while parsing the probe arguments.
> Force parsing to be done using the C language parser.
> * expression.h (parse_expression_with_language): Declare.
> * parse.c (parse_expression_with_language): New function.
> ---
> gdb/dtrace-probe.c | 14 ++++++++++++--
> gdb/expression.h | 3 +++
> gdb/parse.c | 22 ++++++++++++++++++++++
> 3 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
> index 491d853..ff7ce7d 100644
> --- a/gdb/dtrace-probe.c
> +++ b/gdb/dtrace-probe.c
> @@ -427,8 +427,18 @@ dtrace_process_dof_probe (struct objfile *objfile,
> this does not work then we set the type to `long
> int'. */
> arg.type = builtin_type (gdbarch)->builtin_long;
> - expr = parse_expression (arg.type_str);
> - if (expr->elts[0].opcode == OP_TYPE)
> +
> + TRY
> + {
> + expr = parse_expression_with_language (arg.type_str, language_c);
> + }
> + CATCH (ex, RETURN_MASK_ERROR)
> + {
> + expr = NULL;
> + }
> + END_CATCH
> +
> + if (expr != NULL && expr->elts[0].opcode == OP_TYPE)
> arg.type = expr->elts[1].type;
>
> VEC_safe_push (dtrace_probe_arg_s, ret->args, &arg);
This part looks OK.
> diff --git a/gdb/expression.h b/gdb/expression.h
> index f5cd0e5..d08ce05 100644
> --- a/gdb/expression.h
> +++ b/gdb/expression.h
> @@ -97,6 +97,9 @@ struct expression
>
> extern struct expression *parse_expression (const char *);
>
> +extern struct expression *parse_expression_with_language (const char *string,
> + enum language lang);
> +
> extern struct expression *parse_expression_in_context (const char *, int);
>
> extern struct type *parse_field_expression (char *, char **);
> diff --git a/gdb/parse.c b/gdb/parse.c
> index 2ffe52e..bc95cf1 100644
> --- a/gdb/parse.c
> +++ b/gdb/parse.c
> @@ -1268,6 +1268,28 @@ parse_expression (const char *string)
> return exp;
> }
>
> +/* Same as parse_expression, but using the given language (LANG)
> + to parse the expression. */
> +
> +struct expression *
> +parse_expression_with_language (const char *string, enum language lang)
> +{
> + struct cleanup *old_chain = NULL;
> + struct expression *expr;
> +
> + if (current_language->la_language != language_c)
> + {
> + old_chain = make_cleanup_restore_current_language ();
> + set_language (language_c);
> + }
Here I think you meant to use "lang" instead of "language_c", right?
> +
> + expr = parse_expression (string);
> +
> + if (old_chain != NULL)
> + do_cleanups (old_chain);
> + return expr;
> +}
> +
> /* As for parse_expression, except that if VOID_CONTEXT_P, then
> no value is expected from the expression. */
>
> --
> 1.7.10.4
>
OK with the fix above.
Thanks,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
next prev parent reply other threads:[~2015-03-26 18:53 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 10:57 [PATCH V4 0/9] Add support for DTrace USDT probes to gdb Jose E. Marchesi
2015-02-02 10:57 ` [PATCH V4 1/9] Adapt `info probes' to support printing probes of different types Jose E. Marchesi
2015-02-17 1:12 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 9/9] Announce the DTrace USDT probes support in NEWS Jose E. Marchesi
2015-02-02 16:03 ` Eli Zaretskii
2015-02-02 10:57 ` [PATCH V4 7/9] Simple testsuite for DTrace USDT probes Jose E. Marchesi
2015-02-02 11:18 ` Jose E. Marchesi
2015-02-17 1:53 ` Sergio Durigan Junior
2015-02-17 1:58 ` Sergio Durigan Junior
2015-02-17 11:32 ` Pedro Alves
2015-02-02 10:57 ` [PATCH V4 3/9] New commands `enable probe' and `disable probe' Jose E. Marchesi
2015-02-02 16:01 ` Eli Zaretskii
2015-02-17 1:54 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 4/9] New gdbarch functions: dtrace_parse_probe_argument, dtrace_probe_is_enabled, dtrace_enable_probe, dtrace_disable_probe Jose E. Marchesi
2015-02-17 1:14 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 6/9] Support for DTrace USDT probes in x86_64 targets Jose E. Marchesi
2015-02-17 1:37 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 8/9] Documentation for DTrace USDT probes Jose E. Marchesi
2015-02-02 16:03 ` Eli Zaretskii
2015-02-02 19:47 ` Jose E. Marchesi
2015-02-02 10:57 ` [PATCH V4 2/9] Move `compute_probe_arg' and `compile_probe_arg' to probe.c Jose E. Marchesi
2015-02-17 1:13 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 5/9] New probe type: DTrace USDT probes Jose E. Marchesi
2015-02-17 1:35 ` Sergio Durigan Junior
2015-03-25 19:14 ` Joel Brobecker
2015-03-26 16:15 ` Jose E. Marchesi
2015-03-26 17:50 ` Joel Brobecker
2015-03-26 18:43 ` Joel Brobecker
2015-03-26 18:53 ` Sergio Durigan Junior [this message]
2015-03-26 21:00 ` Joel Brobecker
2015-03-27 9:47 ` gdb fails to compile with GCC 4.4.7 (was: [PATCH V4 5/9] New probe type: DTrace USDT probes.) Tobias Burnus
2015-03-27 13:42 ` Joel Brobecker
2015-03-27 15:18 ` Tobias Burnus
2015-03-27 15:27 ` [pushed] " Joel Brobecker
2015-03-27 16:58 ` H.J. Lu
2015-03-26 23:39 ` [PATCH V4 5/9] New probe type: DTrace USDT probes Jose E. Marchesi
2015-03-31 17:29 ` Jose E. Marchesi
2015-03-31 18:47 ` Joel Brobecker
2015-03-31 19:54 ` Jose E. Marchesi
2015-08-06 21:31 ` Joel Brobecker
2015-08-07 2:03 ` Sergio Durigan Junior
2015-08-07 15:20 ` Joel Brobecker
2015-08-07 13:05 ` Jose E. Marchesi
2015-08-07 13:14 ` Jose E. Marchesi
2015-08-07 14:11 ` Jose E. Marchesi
2015-08-07 15:12 ` Joel Brobecker
2015-08-10 3:21 ` Sergio Durigan Junior
2015-08-10 14:31 ` Jose E. Marchesi
2015-02-16 13:20 ` [PATCH V4 0/9] Add support for DTrace USDT probes to gdb Jose E. Marchesi
2015-02-17 1:57 ` Sergio Durigan Junior
2015-02-17 11:56 ` Jose E. Marchesi
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=87zj6zy4hr.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jose.marchesi@oracle.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