Patch to preserve programmer specified labels in flow.c

Jeffrey A Law law@cygnus.com
Wed Mar 31 18:59:00 GMT 1999


  In message < 199903211915.LAA24929@elmo.cygnus.com >you write:
  > Because the label was created by the programmer, so they expect to be
  > able to put a breakpoint on it.  For example, in the source fragment I
  > mentioned before: 
  > 
  >       switch (c)
  > 	{
  > 	case '%':
  > 	literal:
  >           lptr = fmt - nbytes;
  > 
  > 
  > GCC eliminates the label 'literal' because it is also represented by
  > the case '%' in the switch table.  An earlier "goto literal" is
  > replaced with "goto case '%'" (effectively!), but if we eliminate the
  > information about label 'literal' from the debug output then it will
  > be impossible for the user to put a break on the destination of the
  > goto instruction.
This sounds like typical problems debugging optimized code.

One can not expect to debug optimized code and have it work 100% like
debuggin unoptimized code.  However, it looks like we can do something for
this case (at the expense of making the debug symbols larger).

Looking at the code a little more closely, I think you need to make a
similar change in dwarfout.c in output_label_die.

So I think you should update dwarfout.c too and install your patch.

Thanks,
jeff



More information about the Gcc-patches mailing list