Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Kei Sakamoto" <sakamoto.kei@renesas.com>
To: <gdb-patches@sources.redhat.com>
Subject: [patch/testcase] fix gdb.base/relocate.c
Date: Tue, 08 Jul 2003 02:53:00 -0000	[thread overview]
Message-ID: <014401c344fc$7b0972d0$5169910a@KEI> (raw)

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

The attached patch fixes gdb.base/relocate.c.

"relocate.exp: get address of function_bar" fails with m32r-elf-gdb
as the following:

print &function_bar
$6 = (int (*)(void)) 0xc <global_bar>
(gdb) FAIL: gdb.base/relocate.exp: get address of function_bar (unknown output)

Both function_bar and global_bar have the same address, 0xc.
Though they belong to different sections, gdb considers they
are the same and prints global_bar's data instead of
function_bar's.

The same error happens with i386 if line 4 and 5 of relocate.c
are modified as the following:

short global_foo = 3;
short global_bar = 4;

I guess this is not gdb's bug but a feature and the testcase
should be modified. So I made a patch file.

The attached patch inserts a definition of a dummy array so that
global_bar and function_bar should not have the same address.

Kei

2003-07-08    Kei Sakamoto  <sakamoto.kei@renesas.com>

 * gdb.base/relocate.c : Add a dummy array to make global_bar
        and function_bar have different addresses.

[-- Attachment #2: relocate.c.patch --]
[-- Type: application/octet-stream, Size: 351 bytes --]

--- insight-20030703.orig/src/gdb/testsuite/gdb.base/relocate.c	Fri Apr  5 11:45:48 2002
+++ insight-20030703/src/gdb/testsuite/gdb.base/relocate.c	Mon Jul  7 16:56:47 2003
@@ -1,6 +1,8 @@
 static int static_foo = 1;
 static int static_bar = 2;
 
+int dummy[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
 int global_foo = 3;
 int global_bar = 4;
 

             reply	other threads:[~2003-07-08  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-08  2:53 Kei Sakamoto [this message]
2003-07-08  2:58 ` Daniel Jacobowitz
2003-07-24 18:47   ` Daniel Jacobowitz

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='014401c344fc$7b0972d0$5169910a@KEI' \
    --to=sakamoto.kei@renesas.com \
    --cc=gdb-patches@sources.redhat.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