Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Elizabeth Chastain <mec@shout.net>
To: gdb@sources.redhat.com, jimb@redhat.com
Subject: Replace TYPE_FLAG_PROTOTYPED with two flags
Date: Sat, 04 Jan 2003 17:13:00 -0000	[thread overview]
Message-ID: <200301041712.h04HCrw01931@duracef.shout.net> (raw)

I've got these FAILs with gcc -gdwarf-2, both v2 and v3:

  FAIL: gdb.base/callfuncs.exp: p t_float_values(3.14159,-2.3765)
  FAIL: gdb.base/callfuncs.exp: p t_float_values(float_val1,float_val2)
  FAIL: gdb.base/callfuncs.exp: p t_float_values(3.14159,float_val2)
  FAIL: gdb.base/callfuncs.exp: p t_float_values(float_val1,-2.3765)

This happens because t_float_values has no prototype.  The dwarf2 reader
leaves TYPE_FLAG_PROTOTYPED clear, but later on, value_arg_coerce refuses
to trust the flag and guesses.

Indeed, Jim Blandy has been down this path recently:

  http://sources.redhat.com/ml/gdb-patches/2001-11/threads.html#00529

I am writing a new patch ("six weeks in the laboratory can often save
fifteen minutes in the library").  Instead of TYPE_FLAG_PROTOTYPED and
TYPE_FLAG_MAYBE_PROTOTYPED, I use a more solid model:

  TYPE_FLAG_PROTO_KNOWN     gdb knows whether there is a prototype 

  TYPE_FLAG_PROTO_YES       if proto_known is true, says whether there is 
			    a prototype

The dwarf and dwarf-2 readers always set TYPE_FLAG_PROTO_KNOWN,
and may set TYPE_FLAG_PROTO_YES.

The stabs reader sets TYPE_FLAG_PROTO_KNOWN when it finds an actual
prototype (an argument list in the stabs).  This does not happen with
gcc, but the comments say that it can happen with sun cc.

My big question here is: is it safe to assume that dwarf and dwarf-2
have accurate prototype information?  That is, if there is no prototype
in the debug information, can gdb really be sure that the function has
no prototype and then rely on that information?

My testing says that it can, for dwarf-2.  I haven't tested dwarf yet.
(dwarf might hit the OBSOLETE list some day but it's not OBSOLETE yet).
The stabs+ case still works because TYPE_FLAG_PROTO_KNOWN==0 behaves
like the existing code.

If it's safe to make this assumption, then I would like to proceed with
my patch, because this fixes a real bug with dwarf-2.  My goal here is
to fix bugs where dwarf-2 behaves worse than stabs+.

Michael C


             reply	other threads:[~2003-01-04 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-04 17:13 Michael Elizabeth Chastain [this message]
2003-01-04 17:33 ` Daniel Jacobowitz
2003-01-04 18:02 Michael Elizabeth Chastain

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=200301041712.h04HCrw01931@duracef.shout.net \
    --to=mec@shout.net \
    --cc=gdb@sources.redhat.com \
    --cc=jimb@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