public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 1/4] parser: fix parser debugging yet again
Date: Thu, 2 Oct 2025 20:00:24 -0400	[thread overview]
Message-ID: <aN8SGC3RC8BOM8gV@oracle.com> (raw)
In-Reply-To: <20250918180338.197827-1-nick.alcock@oracle.com>

On Thu, Sep 18, 2025 at 07:03:35PM +0100, Nick Alcock wrote:
> The interaction between YYDEBUG and the yydebug extern variable has
> changed repeatedly in the various iterations of flex and bison.  The one
> thing that is consistent is that yydebug is not used if YYDEBUG is unset
> or set to 0; if it's set to 1, the parser skeleton defines it for you.
> 
> So (now that -fno-common is on by default) dl_lex.l should not be
> defining yydebug itself, and dt_impl.h should only be declaring it
> extern if YYDEBUG is 1.
> 
> With this in place, we link and run with the parser debugger set to the
> expected state when compiling with YYDEBUG 1, YYDEBUG 0, and YYDEBUG
> unset.
> 
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>

> ---
>  libdtrace/dt_impl.h | 2 ++
>  libdtrace/dt_lex.l  | 4 +---
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
> index 7d8e4432a24ad..9c4651a46baa6 100644
> --- a/libdtrace/dt_impl.h
> +++ b/libdtrace/dt_impl.h
> @@ -808,7 +808,9 @@ extern char yyintsuffix[4];	/* int token suffix ([uUlL]*) */
>  extern int yyintdecimal;	/* int token is decimal (1) or octal/hex (0) */
>  extern char *yytext;		/* lex input buffer */
>  extern int yylineno;		/* lex line number */
> +#if defined(YYDEBUG) && YYDEBUG == 1
>  extern int yydebug;		/* lex debugging */
> +#endif
>  extern dt_node_t *yypragma;	/* lex token list for control lines */
>  
>  extern const dtrace_attribute_t _dtrace_maxattr; /* maximum attributes */
> diff --git a/libdtrace/dt_lex.l b/libdtrace/dt_lex.l
> index e8f3bc8c25bb0..9f12f5c7ca289 100644
> --- a/libdtrace/dt_lex.l
> +++ b/libdtrace/dt_lex.l
> @@ -21,8 +21,6 @@
>  static int id_or_type(const char *);
>  static size_t dt_input(char *buf, size_t max_size);
>  
> -int yydebug;
> -
>  #define YY_INPUT(buf,result,max_size)                                   \
>          result = dt_input(buf,max_size);
>  
> @@ -663,7 +661,7 @@ if (yypcb->pcb_token != 0) {
>  void
>  yybegin(yystate_t state)
>  {
> -#ifdef	YYDEBUG
> +#if defined(YYDEBUG) && YYDEBUG == 1
>  	yydebug = _dtrace_debug;
>  #endif
>  	if (yypcb->pcb_yystate == state)
> -- 
> 2.48.1.283.g18c60a128c
> 

      parent reply	other threads:[~2025-10-03  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 18:03 [PATCH 1/4] parser: fix parser debugging yet again Nick Alcock
2025-09-18 18:03 ` [PATCH 2/4] lexer: the things inside an enum { ... } declaration are identifiers Nick Alcock
2025-10-03  0:00   ` [DTrace-devel] " Kris Van Hees
2025-09-18 18:03 ` [PATCH 3/4] test: enum tests Nick Alcock
2025-10-03  0:00   ` Kris Van Hees
2025-09-18 18:03 ` [PATCH 4/4] test: fix test failure when no /usr/sbin/dtrace exists Nick Alcock
2025-09-18 19:18   ` Eugene Loh
2025-09-23 15:15     ` Nick Alcock
2025-09-23 15:31     ` [PATCH v2 " Nick Alcock
2025-10-03  0:01   ` [DTrace-devel] [PATCH " Kris Van Hees
2025-10-03  0:00 ` Kris Van Hees [this message]

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=aN8SGC3RC8BOM8gV@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@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