patches/binutils/2.16.1a/120-skip-comments.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 13 23:32:39 2011 +0100 (2011-12-13)
branch1.13
changeset 2847 c0bf2319af08
parent 745 e445c00d134d
permissions -rw-r--r--
scripts: fix dumping execution backtrace

Dumping the backtrace has been broken since changeset #652e56d6d35a:
scripts: execute each steps in a subshell

We can spawn sub-sub-shells in some cases.

The way the fault handler works is to dump the backtrace, but to avoid
printing it once for every sub-shell (which could get quite confusing),
it simply exits when it detects that it is being run in a sub-shell,
leaving to the top-level shell the work to dump the backtrace.

Because each step is executed in its own sub-shell, the variable arrays
that contain the step name, the source file and line number, are lost
when exiting the per-step sub-shell.

Hence, the backtrace is currently limited to printing only the top-level
main procedure of the shell.

Fix this thus:
- when dumping the bckatraces for the steps & the functions, remember
it was dumped, and only dump it if it was not already dumped
- at the top-level shell, print the hints

Also, rename the top-level step label.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 4193d6e6a17430a177fa88c287879c2c35e319f3)
     1 [removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank]
     2 
     3 Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
     4 Fixes
     5 localealias.s:544: Error: junk at end of line, first unrecognized character is `,' 
     6 when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
     7 
     8 Paths adjusted to match crosstool's patcher.
     9 
    10 Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
    11 From: Andreas Schwab <schwab at suse dot de>
    12 To: Nathan Sidwell <nathan at codesourcery dot com>
    13 Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
    14 Date: Fri, 23 Apr 2004 22:27:19 +0200
    15 Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
    16 
    17 Nathan Sidwell <nathan@codesourcery.com> writes:
    18 
    19 > Index: read.c
    20 > ===================================================================
    21 > RCS file: /cvs/src/src/gas/read.c,v
    22 > retrieving revision 1.76
    23 > diff -c -3 -p -r1.76 read.c
    24 > *** read.c	12 Mar 2004 17:48:12 -0000	1.76
    25 > --- read.c	18 Mar 2004 09:56:05 -0000
    26 > *************** read_a_source_file (char *name)
    27 > *** 1053,1059 ****
    28 >   #endif
    29 >   	  input_line_pointer--;
    30 >   	  /* Report unknown char as ignored.  */
    31 > ! 	  ignore_rest_of_line ();
    32 >   	}
    33 >   
    34 >   #ifdef md_after_pass_hook
    35 > --- 1053,1059 ----
    36 >   #endif
    37 >   	  input_line_pointer--;
    38 >   	  /* Report unknown char as ignored.  */
    39 > ! 	  demand_empty_rest_of_line ();
    40 >   	}
    41 >   
    42 >   #ifdef md_after_pass_hook
    43 
    44 This means that the unknown character is no longer ignored, despite the
    45 comment.  As a side effect a line starting with a line comment character
    46 not followed by APP in NO_APP mode now triggers an error instead of just a
    47 warning, breaking builds of glibc on m68k-linux.  Earlier in
    48 read_a_source_file where #APP is handled there is another comment that
    49 claims that unknown comments are ignored, when in fact they aren't (only
    50 the initial line comment character is skipped).
    51 
    52 Note that the presence of #APP will mess up the line counters, but
    53 that appears to be difficult to fix.
    54 
    55 Andreas.
    56 
    57 2004-04-23  Andreas Schwab  <schwab@suse.de>
    58 
    59 	* read.c (read_a_source_file): Ignore unknown text after line
    60 	comment character.  Fix misleading comment.
    61 
    62 --- binutils/gas/read.c.~1.78.~	2004-04-23 08:58:23.000000000 +0200
    63 +++ binutils/gas/read.c	2004-04-23 21:49:01.000000000 +0200
    64 @@ -950,10 +950,14 @@ read_a_source_file (char *name)
    65  	      unsigned int new_length;
    66  	      char *tmp_buf = 0;
    67  
    68 -	      bump_line_counters ();
    69  	      s = input_line_pointer;
    70  	      if (strncmp (s, "APP\n", 4))
    71 -		continue;	/* We ignore it */
    72 +		{
    73 +		  /* We ignore it */
    74 +		  ignore_rest_of_line ();
    75 +		  continue;
    76 +		}
    77 +	      bump_line_counters ();
    78  	      s += 4;
    79  
    80  	      sb_new (&sbuf);
    81 @@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
    82  	    continue;
    83  #endif
    84  	  input_line_pointer--;
    85 -	  /* Report unknown char as ignored.  */
    86 +	  /* Report unknown char as error.  */
    87  	  demand_empty_rest_of_line ();
    88  	}
    89  
    90 
    91 -- 
    92 Andreas Schwab, SuSE Labs, schwab@suse.de
    93 SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
    94 Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
    95 "And now for something completely different."