public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Do not generate discriminator directive in strict mode
@ 2011-04-19 14:10 Eric Botcazou
  2011-04-20 18:22 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Botcazou @ 2011-04-19 14:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

Hi,

it appears that the (standard DWARF as of version 4) discriminator directive 
can confuse non-GDB DWARF 2/3 debuggers, so this patch changes the compiler 
to stop emitting it in strict mode.

Tested on i586-suse-linux, OK for the mainline?


2011-04-19  Eric Botcazou  <ebotcazou@adacore.com>

	* dwarf2out.c (dwarf2out_source_line): Emit "discriminator" directive
	only for version 4 or above, or else in non-strict mode.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 645 bytes --]

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 172693)
+++ dwarf2out.c	(working copy)
@@ -22232,7 +22240,9 @@ dwarf2out_source_line (unsigned int line
       fprintf (asm_out_file, "\t.loc %d %d 0", file_num, line);
       if (is_stmt != table->is_stmt)
 	fprintf (asm_out_file, " is_stmt %d", is_stmt ? 1 : 0);
-      if (SUPPORTS_DISCRIMINATOR && discriminator != 0)
+      if (SUPPORTS_DISCRIMINATOR
+	  && discriminator != 0
+	  && (dwarf_version >= 4 || !dwarf_strict))
 	fprintf (asm_out_file, " discriminator %d", discriminator);
       fputc ('\n', asm_out_file);
     }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Do not generate discriminator directive in strict mode
  2011-04-19 14:10 [patch] Do not generate discriminator directive in strict mode Eric Botcazou
@ 2011-04-20 18:22 ` Richard Henderson
  2011-04-20 19:26   ` Eric Botcazou
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2011-04-20 18:22 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On 04/19/2011 06:40 AM, Eric Botcazou wrote:
> -      if (SUPPORTS_DISCRIMINATOR && discriminator != 0)
> +      if (SUPPORTS_DISCRIMINATOR
> +	  && discriminator != 0
> +	  && (dwarf_version >= 4 || !dwarf_strict))
>  	fprintf (asm_out_file, " discriminator %d", discriminator);

How is this not redundant with the existing

  /* The discriminator column was added in dwarf4.  Simplify the below
     by simply removing it if we're not supposed to output it.  */
  if (dwarf_version < 4 && dwarf_strict)
    discriminator = 0;

check near the top of the function?


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Do not generate discriminator directive in strict mode
  2011-04-20 18:22 ` Richard Henderson
@ 2011-04-20 19:26   ` Eric Botcazou
  2011-04-20 21:10     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Botcazou @ 2011-04-20 19:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc-patches

> How is this not redundant with the existing
>
>   /* The discriminator column was added in dwarf4.  Simplify the below
>      by simply removing it if we're not supposed to output it.  */
>   if (dwarf_version < 4 && dwarf_strict)
>     discriminator = 0;
>
> check near the top of the function?

Obviously I missed this recent change, sorry.  So the question is: would the 
change be appropriate for the release branches, where we emit the directive 
unconditionally, i.e 4.5 and 4.6 branches, or would mine be safer for them?  
This directive apparently confuses (some versions of) the Wind River debugger.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Do not generate discriminator directive in strict mode
  2011-04-20 19:26   ` Eric Botcazou
@ 2011-04-20 21:10     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2011-04-20 21:10 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On 04/20/2011 12:09 PM, Eric Botcazou wrote:
>> How is this not redundant with the existing
>>
>>   /* The discriminator column was added in dwarf4.  Simplify the below
>>      by simply removing it if we're not supposed to output it.  */
>>   if (dwarf_version < 4 && dwarf_strict)
>>     discriminator = 0;
>>
>> check near the top of the function?
> 
> Obviously I missed this recent change, sorry.  So the question is: would the 
> change be appropriate for the release branches, where we emit the directive 
> unconditionally, i.e 4.5 and 4.6 branches, or would mine be safer for them?

Let's try to keep the branches more similar than not.  It's just as safe, since
prior to mainline we ignore the discriminator when not emitting via gas directive.


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-20 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 14:10 [patch] Do not generate discriminator directive in strict mode Eric Botcazou
2011-04-20 18:22 ` Richard Henderson
2011-04-20 19:26   ` Eric Botcazou
2011-04-20 21:10     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).