public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>,
	       Jan Kratochvil <jan.kratochvil@redhat.com>,
	gdb-patches@sourceware.org,
	       Ulrich Weigand <uweigand@de.ibm.com>,
	       Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Subject: Re: [PATCH] Fix possible alignment issue with dw2-dir-file-name test case
Date: Fri, 17 Jan 2014 17:58:00 -0000	[thread overview]
Message-ID: <874n5232yj.fsf@br87z6lw.de.ibm.com> (raw)
In-Reply-To: <52D7EEA9.4030006@redhat.com> (Pedro Alves's message of "Thu, 16	Jan 2014 14:37:29 +0000")

On Thu, Jan 16 2014, Pedro Alves wrote:

> On 01/15/2014 09:33 PM, Edjunior Barbosa Machado wrote:
>> 
>
>>> testsuite/
>>> 2014-01-10  Andreas Arnez  <arnez@linux.vnet.ibm.com>
>>> 	    Pedro Alves <palves@redhat.com>
>>>
>>> 	* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Remove "*_start" symbol.
>>> 	Make "name" extern.
>>> 	* gdb.dwarf2/dw2-dir-file-name.exp (out_cu, out_line): Replace
>>> 	references to ${name}_start by references to ${name}.
>> 
>> For some reason, the testcase is no longer successful on ppc64 (although it
>> still passes on ppc32): it hits the breakpoints, but no longer shows the
>> filename in none of the tests.
>> 
>> From gdb.log:
>> ...
>> (gdb) break compdir_missing__ldir_missing__file_basename
>> Breakpoint 2 at 0x100006c4
>> (gdb) continue
>> Continuing.
>> 
>> Breakpoint 2, 0x00000000100006c4 in .compdir_missing.ldir_missing.file_basename ()
>
> Bah, looks like the function's low_pc ends up pointing to the function
> descriptor (because that's what the "name" symbol resolves to in the
> debug info in the .S file)?  Looks like we'll need some other solution.

OK, how about this?

----
Subject: [PATCH] Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.

On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

      https://sourceware.org/ml/gdb-patches/2014-01/msg00275.html

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

testsuite/
2014-01-17  Andreas Arnez  <arnez@linux.vnet.ibm.com>

	* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
	define "*_start" label.  Make "name" static.

	* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
	${name} by references to ${name}_start.
---
 gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c   |   10 +++++++++-
 gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp |    6 +++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
index 2b9cc6a..517df90 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
@@ -63,8 +63,16 @@ FUNC (compdir_absolute_ldir_absolute_file_relative_different)	\
 FUNC (compdir_absolute_ldir_absolute_file_absolute_same)	\
 FUNC (compdir_absolute_ldir_absolute_file_absolute_different)
 
+/* Notes: (1) The '*_start' label below is needed because 'name' may
+   point to a function descriptor instead of to the actual code.  (2)
+   The '.balign' should specify the highest possible function
+   alignment across all supported architectures, such that the label
+   never points into the alignment gap.  */
+
 #define FUNC(name)					\
-  void							\
+  asm (".balign 8");					\
+  asm (#name "_start: .globl " #name "_start\n");	\
+  static void						\
   name (void)						\
   {							\
     v++;						\
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
index e523e89..7f29581 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -54,7 +54,7 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
 	.ascii	\"GNU C\\0\"			/* DW_AT_producer */
 	.byte	2				/* DW_AT_language (DW_LANG_C) */
 	.4byte	.Lline_${name}_begin		/* DW_AT_stmt_list */
-	.4byte	${name}			/* DW_AT_low_pc */
+	.4byte	${name}_start			/* DW_AT_low_pc */
 	.4byte	${name}_end			/* DW_AT_high_pc */
 "
     if { $cu_dir != "" } {
@@ -65,7 +65,7 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
 
 	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
 	.asciz		\"${name}\"		/* DW_AT_name */
-	.4byte		${name}		/* DW_AT_low_pc */
+	.4byte		${name}_start		/* DW_AT_low_pc */
 	.4byte		${name}_end		/* DW_AT_high_pc */
 
 	.byte		0			/* End of children of CU */
@@ -122,7 +122,7 @@ proc out_line { name cu_dir cu_name line_dir line_name } {
 	.byte		0	/* DW_LNE_set_address */
 	.uleb128	5
 	.byte		2
-	.4byte		${name}
+	.4byte		${name}_start
 	.byte		1	/* DW_LNS_copy */
 	.byte		3	/* DW_LNS_advance_line */
 	.sleb128	1	/* ... to 1000 */
-- 
1.7.1

  reply	other threads:[~2014-01-17 17:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 18:00 Andreas Arnez
2014-01-10 11:29 ` Pedro Alves
2014-01-10 14:30   ` Andreas Arnez
2014-01-10 14:53     ` Jan Kratochvil
2014-01-10 16:39       ` Pedro Alves
2014-01-15 21:33         ` Edjunior Barbosa Machado
2014-01-16 14:37           ` Pedro Alves
2014-01-17 17:58             ` Andreas Arnez [this message]
2014-01-17 18:09               ` Pedro Alves
2014-01-17 18:20                 ` Pedro Alves
2014-01-20 19:47                   ` Andreas Arnez
2014-01-22 13:15                     ` Pedro Alves
2014-01-17 18:21               ` Edjunior Barbosa Machado
2014-01-22 16:13               ` Andreas Krebbel
2014-01-10 15:32     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874n5232yj.fsf@br87z6lw.de.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=emachado@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=krebbel@linux.vnet.ibm.com \
    --cc=palves@redhat.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).