• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bison disables breakpoints?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison disables breakpoints?


  • Subject: Re: Bison disables breakpoints?
  • From: Thomas Wetmore <email@hidden>
  • Date: Thu, 17 Apr 2014 19:46:14 -0400

I would suggest removing all #line lines from xxxxx.tab.c and see what happens. Commenting them out would be better so they can be turned back on.

Yacc and Bison (and lex and flex) use the #line directive to redirect error messages to the .y (and .l) files when possible, but #line directives have been known to mess up operations in certain contexts. Maybe this is one of them.

Tom Wetmore


On Apr 17, 2014, at 5:05 PM, email@hidden wrote:

> What breakpoint gets set?  i.e. what does:
>
> (lldb) break list
>
> from the lldb console say?
>
> Jim
>
> On Apr 17, 2014, at 1:24 PM, McLaughlin, Michael P. <email@hidden> wrote:
>
>> I am not running lldb manually; I am setting the breakpoint(s) in Xcode
>> (blue arrow, etc.) while viewing the corresponding source file.
>>
>> For instance, I put one on the second
>>
>> puts(łHere˛);
>>
>> line in main() below.
>>
>> --
>> Michael P. McLaughlin
>>
>>
>>
>>
>> On 4/17/14, 3:04 PM, "email@hidden" <email@hidden> wrote:
>>
>>> How are you setting breakpoints, in rpcalc.y or in rpcalc.tab.c?
>>>
>>> For any of the code that is directly generated from the .y file, bison
>>> puts in #line directives which route the debug line table back to the .y
>>> file.  So some parts of the rpcalc.tab.c will claim to be from rpcalc.y,
>>> and others from fpcalc.tab.c.
>>>
>>> Setting breakpoints worked for me, provided you know which file to
>>> specify for the breakpoint:
>>>
>>>> lldb rpcalc
>>> Current executable set to 'rpcalc' (x86_64).
>>> (lldb) b s -f rpcalc.y -l 72
>>> Breakpoint 1: where = rpcalc`main + 22 at rpcalc.y:72, address =
>>> 0x0000000100001c96
>>> (lldb) run
>>> Process 62453 launched: '/private/tmp/rpcalc' (x86_64)
>>> Process 62453 stopped
>>> * thread #1: tid = 0x2781f, function: main , stop reason = breakpoint 1.1
>>>  frame #0: 0x0000000100001c96 rpcalc`main at rpcalc.y:72
>>> 69  	int
>>> 70  	main (void)
>>> 71  	{
>>> -> 72  	  puts("Here");
>>> 73  	  puts("Here");
>>> 74
>>> 75  	  return yyparse ();
>>>
>>> Note there is an old bug in lldb that "source list" doesn't redirect
>>> through the #line directive:
>>>
>>> (lldb) source list -f rpcalc.y -l 72
>>> error: Could not find source file "rpcalc.y".
>>>
>>> but that doesn't keep the breakpoints from working.
>>>
>>> You can also invoke bison with the -l (--no-lines) option, which will
>>> cause it not to generate these #line directives, and then you can set
>>> breakpoints in the rpcalc.tab.c w/o having to worry about whether those
>>> lines are redirected or not.
>>>
>>> Jim
>>>
>>> On Apr 17, 2014, at 10:20 AM, McLaughlin, Michael P. <email@hidden>
>>> wrote:
>>>
>>>> Uncertain whether this is OT or not.
>>>>
>>>> When I run Appleąs supplied Bison (2.3) on the simple rpcalc.y file
>>>> (very slightly modified, appended below) and compile the result with cc,
>>>> everything works as expected.
>>>>
>>>> When I compile Bisonąs output (rpcalc.tab.c) in Xcode 5.1.1 (as a C
>>>> tool), again the program runs perfectly.
>>>>
>>>> However, if I put a breakpoint anywhere, it does not trigger.  This is
>>>> all with the standard (unmodified) Xcode C-tool template‹Debug
>>>> configuration, etc.
>>>>
>>>> Is Bison known to disable LLDB breakpoints?
>>>>
>>>> *** rpcalc.y ***
>>>>
>>>> /* Reverse polish notation calculator. */
>>>> %{
>>>> #include <stdio.h>
>>>> #include <math.h>
>>>>
>>>> #define YYSTYPE double
>>>>
>>>> int yylex (void);
>>>> void yyerror (char const *);
>>>> %}
>>>>
>>>> %token NUM
>>>>
>>>> %% /* Grammar rules and actions follow. */
>>>>
>>>> input:
>>>>  /* empty */
>>>> | input line
>>>> ;
>>>> line:
>>>> '\n'
>>>> | expr '\n' { printf ("%.10g\n", $1); }
>>>> ;
>>>> expr:
>>>> NUM { $$ = $1; }
>>>> | expr expr '+' { $$ = $1 + $2; }
>>>> | expr expr '-' { $$ = $1 - $2; }
>>>> | expr expr '*' { $$ = $1 * $2; }
>>>> | expr expr '/' { $$ = $1 / $2; }
>>>> | expr expr '^' { $$ = pow ($1, $2); } /* exponentiation */
>>>> | expr 'n' { $$ = -$1; } /* Unary minus */
>>>> ;
>>>> %%
>>>>
>>>> /* The lexical analyzer returns a double floating point
>>>> number on the stack and the token NUM, or the numeric code
>>>> of the character read if not a number. It skips all blanks
>>>> and tabs, and returns 0 for end-of-input. */
>>>> #include <ctype.h>
>>>> int
>>>> yylex (void)
>>>> {
>>>> int c;
>>>> /* Skip white space. */
>>>> while ((c = getchar ()) == ' ' || c == '\t')
>>>> continue;
>>>> /* Process numbers. */
>>>> if (c == '.' || isdigit (c))
>>>> {
>>>> ungetc (c, stdin);
>>>> scanf ("%lf", &yylval);
>>>> return NUM;
>>>> }
>>>> /* Return end-of-input. */
>>>> if (c == EOF)
>>>> return 0;
>>>> /* Return a single char. */
>>>> return c;
>>>> }
>>>>
>>>> #include <stdio.h>
>>>> /* Called by yyparse on error. */
>>>> void
>>>> yyerror (char const *s)
>>>> {
>>>>  fprintf (stderr, "%s\n", s);
>>>> }
>>>>
>>>> int
>>>> main (void)
>>>> {
>>>>  puts("Here");
>>>>  puts("Here");
>>>>
>>>>  return yyparse ();
>>>> }
>>>>
>>>> --
>>>> Michael P. McLaughlin
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Xcode-users mailing list      (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Quartz Composer deprecated in Xcode 5.1.1??
      • From: Wayne <email@hidden>
References: 
 >Bison disables breakpoints? (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: Bison disables breakpoints? (From: email@hidden)
 >Re: Bison disables breakpoints? (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: Bison disables breakpoints? (From: email@hidden)

  • Prev by Date: Re: Bison disables breakpoints?
  • Next by Date: Re: Storyboard XIB linking.
  • Previous by thread: Re: Bison disables breakpoints?
  • Next by thread: Quartz Composer deprecated in Xcode 5.1.1??
  • Index(es):
    • Date
    • Thread