public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] Arm dwarf line debug info
@ 2006-03-19 20:12 Paul Brook
  2006-03-19 20:32 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Brook @ 2006-03-19 20:12 UTC (permalink / raw)
  To: binutils

Gas sometimes generates incorrect dwarf line debug info for Thumb-2 
instructions. The problem occurs when a Thumb-2 instruction subject to 
relaxation ends up as the 16-bit version. The patch below fixes this by 
calling dwarf2_emit_insn before the insn is output, like other ports with 
variable-length insns do.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-03-19  Paul Brook  <paul@codesourcery.com>

	* config/tc-arm.c (output_relax_insn): Call dwarf2_emit_insn before
	outputting the insn.

Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.248
diff -u -p -r1.248 tc-arm.c
--- gas/config/tc-arm.c	17 Mar 2006 14:03:36 -0000	1.248
+++ gas/config/tc-arm.c	19 Mar 2006 19:11:12 -0000
@@ -7982,6 +8044,12 @@ output_relax_insn (void)
   symbolS *sym;
   int offset;
 
+#ifdef OBJ_ELF
+  /* The size of the instruction is unknown, so tie the debug info to the
+     start of the function.  */
+  dwarf2_emit_insn (0);
+#endif
+
   switch (inst.reloc.exp.X_op)
     {
     case O_symbol:
@@ -8000,10 +8068,6 @@ output_relax_insn (void)
   to = frag_var (rs_machine_dependent, INSN_SIZE, THUMB_SIZE,
 		 inst.relax, sym, offset, NULL/*offset, opcode*/);
   md_number_to_chars (to, inst.instruction, THUMB_SIZE);
-
-#ifdef OBJ_ELF
-  dwarf2_emit_insn (INSN_SIZE);
-#endif
 }
 
 /* Write a 32-bit thumb instruction to buf.  */

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

* Re: [patch] Arm dwarf line debug info
  2006-03-19 20:12 [patch] Arm dwarf line debug info Paul Brook
@ 2006-03-19 20:32 ` Daniel Jacobowitz
  2006-03-19 22:09   ` Paul Brook
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-03-19 20:32 UTC (permalink / raw)
  To: Paul Brook; +Cc: binutils

On Sun, Mar 19, 2006 at 07:29:05PM +0000, Paul Brook wrote:
> +#ifdef OBJ_ELF
> +  /* The size of the instruction is unknown, so tie the debug info to the
> +     start of the function.  */
> +  dwarf2_emit_insn (0);
> +#endif

s/function/instruction/?

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: [patch] Arm dwarf line debug info
  2006-03-19 20:32 ` Daniel Jacobowitz
@ 2006-03-19 22:09   ` Paul Brook
  2006-03-20 17:46     ` Richard Earnshaw
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Brook @ 2006-03-19 22:09 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: binutils

On Sunday 19 March 2006 20:27, Daniel Jacobowitz wrote:
> On Sun, Mar 19, 2006 at 07:29:05PM +0000, Paul Brook wrote:
> > +#ifdef OBJ_ELF
> > +  /* The size of the instruction is unknown, so tie the debug info to
> > the +     start of the function.  */
> > +  dwarf2_emit_insn (0);
> > +#endif
>
> s/function/instruction/?

Yes. Updated patch below

Paul

Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.248
diff -u -p -r1.248 tc-arm.c
--- gas/config/tc-arm.c	17 Mar 2006 14:03:36 -0000	1.248
+++ gas/config/tc-arm.c	19 Mar 2006 19:11:12 -0000
@@ -7982,6 +8044,12 @@ output_relax_insn (void)
   symbolS *sym;
   int offset;
 
+#ifdef OBJ_ELF
+  /* The size of the instruction is unknown, so tie the debug info to the
+     start of the instruction.  */
+  dwarf2_emit_insn (0);
+#endif
+
   switch (inst.reloc.exp.X_op)
     {
     case O_symbol:
@@ -8000,10 +8068,6 @@ output_relax_insn (void)
   to = frag_var (rs_machine_dependent, INSN_SIZE, THUMB_SIZE,
 		 inst.relax, sym, offset, NULL/*offset, opcode*/);
   md_number_to_chars (to, inst.instruction, THUMB_SIZE);
-
-#ifdef OBJ_ELF
-  dwarf2_emit_insn (INSN_SIZE);
-#endif
 }
 
 /* Write a 32-bit thumb instruction to buf.  */

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

* Re: [patch] Arm dwarf line debug info
  2006-03-19 22:09   ` Paul Brook
@ 2006-03-20 17:46     ` Richard Earnshaw
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Earnshaw @ 2006-03-20 17:46 UTC (permalink / raw)
  To: Paul Brook; +Cc: Daniel Jacobowitz, binutils

On Sun, 2006-03-19 at 20:31, Paul Brook wrote:
> On Sunday 19 March 2006 20:27, Daniel Jacobowitz wrote:
> > On Sun, Mar 19, 2006 at 07:29:05PM +0000, Paul Brook wrote:
> > > +#ifdef OBJ_ELF
> > > +  /* The size of the instruction is unknown, so tie the debug info to
> > > the +     start of the function.  */
> > > +  dwarf2_emit_insn (0);
> > > +#endif
> >
> > s/function/instruction/?
> 
> Yes. Updated patch below
> 
> Paul

OK.

R.

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

end of thread, other threads:[~2006-03-20 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-19 20:12 [patch] Arm dwarf line debug info Paul Brook
2006-03-19 20:32 ` Daniel Jacobowitz
2006-03-19 22:09   ` Paul Brook
2006-03-20 17:46     ` Richard Earnshaw

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).