public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Michal Ludvig <mludvig@suse.cz>
To: gdb <gdb@sources.redhat.com>
Subject: [testsuite & dwarf2] How to handle store.exp failure on AMD64?
Date: Thu, 07 Aug 2003 08:49:00 -0000	[thread overview]
Message-ID: <3F3212B7.8060003@suse.cz> (raw)

Hi all,
on AMD64 I'm getting these failures:

Running /ttt/64/gdb-head/gdb/testsuite/gdb.base/store.exp ...
FAIL: gdb.base/store.exp: up print old r - charest
FAIL: gdb.base/store.exp: up print old r - short
FAIL: gdb.base/store.exp: up print old r - int
FAIL: gdb.base/store.exp: up print old r - long
FAIL: gdb.base/store.exp: up print old r - longest
FAIL: gdb.base/store.exp: up print old r - float
FAIL: gdb.base/store.exp: up print old r - double

Maybe these failures should be turned into "expected failures" or 
something alike [see below for other solutions]. Why?

This is an extracted testcase:
=============
int add_int (register int u, register int v)
{
   return u + v;
}

int wack_int (register int u, register int v)
{
   register int l = u, r = v;
   l = add_int (l, r);
   return l + r;
}

int main (void)
{
   return wack_int (-1, -2);
}
=============

Compile it and do the steps that store.exp does:
$ ./gdb store
GNU gdb 5.3.90_2003-08-07-cvs
[...]
This GDB was configured as "x86_64-unknown-linux-gnu"...
(gdb) break add_int
Breakpoint 1 at 0x40040c: file store.c, line 6.
(gdb) run
Starting program: /ttt/64/tst/store
Breakpoint 1, add_int (u=-1, v=-2) at store.c:6
6         return u + v;
(gdb) up
#1  0x0000000000400429 in wack_int (u=-1, v=-2) at store.c:13
13        l = add_int (l, r);
(gdb) print r
$1 = <value optimized out>
(gdb)

The testsuite expects that 'r' will have a value '-2' which is not the 
case here. The problem is, that 'r' lives in the register (%rbx) but 
.debug_frame doesn't contain information how to unwind it's previous 
value. When I manually added the appropriate rule 
(DW_CFA_same_value[rbx]) to the generated asm file store.s it worked, 
but GCC obviously doesn't put it there.
The testsuite also works if I undefine the 'register' keyword. Then the 
variables live in the memory and everything is fine.

What's the purpose of having the 'register' keyword in this testcase? 
When the code isn't optimized it doesn't matter where the value lives 
and if you optimize it then GCC itself decides if it should go to the 
register or not.

So I see these possible solutions for inhibiting AMD64 testcase failures:
1) undefine 'register' keyword when running the testsuite on AMD64, or
2) make these failures expected on AMD64, or
3) convince GCC to put 'DW_CFA_same_value' for all non-destroyed 
registers, or
4) let GDB pretend that all registers have the same value unless said 
otherwise later in the .debug_frame and convince GCC to put a note when 
their value is overwritten.

Opinions?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz

             reply	other threads:[~2003-08-07  8:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-07  8:49 Michal Ludvig [this message]
2003-08-07 13:50 ` Daniel Jacobowitz
2003-08-07 14:58   ` Andrew Cagney
2003-08-07 15:02     ` Daniel Jacobowitz
2003-08-07 15:53       ` Andrew Cagney
2003-08-07 21:40         ` Michal Ludvig
2003-08-13  3:54           ` Andrew Cagney
2003-08-13  4:54             ` Richard Henderson
2003-08-13 14:39               ` Andrew Cagney
2003-08-13 16:50                 ` Richard Henderson
2003-08-13 18:23                   ` Andrew Cagney
2003-08-13 23:35                     ` Richard Henderson

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=3F3212B7.8060003@suse.cz \
    --to=mludvig@suse.cz \
    --cc=gdb@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).