From: Daniel Berlin <dberlin@redhat.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: Jim Wilson <wilson@cygnus.com>,
Elena Zannoni <ezannoni@redhat.com>, Pete Wyckoff <pw@osc.edu>,
gdb@sources.redhat.com, linux-ia64@linuxia64.org
Subject: Re: [Linux-ia64] Re: gdb null ptr
Date: Fri, 03 Nov 2000 19:21:00 -0000 [thread overview]
Message-ID: <m3em0sqv74.fsf@dan2.cygnus.com> (raw)
In-Reply-To: <1001103230254.ZM14396@ocotillo.lan>
Kevin Buettner <kevinb@cygnus.com> writes:
>
> Nice analysis.
>
> The patch below effectively implements Jim's suggestion #2 above.
> This patch was made with respect to sourceware and might not apply
> cleanly to sources from which the current linux/ia64 gdb is being
> built. (I can provide such patches if desired however.)
>
> I've tested it against the program provided by Pete Wyckoff and
> it does fix the segfault.
>
> I will leave it to the dwarf2 maintainers to decide whether this
> patch is acceptable or if it would be better to implement one of
> Jim's other suggestions.
>
Unfortuantely , this is actually still wrong for languages other than
C++, because we don't have the same guarantees about uniqueness in the name.
I was actually in the process of readying patches that add the same
type of name based caching (based on mangled name) to partial and
normal symbol reading, which gives us an amazing win for C++.
These patches also moved all of the name caching into "if (cu_language
== language_cplus)" blocks, doing what we used to do in the old case
(IE no caching).
Rather than let this stay broken until i finish cleaning up those
patches, here is a patch that moves the type caching so it only
happens for C++ CU's.
Unless other languages make the same guarantees, we can't do the same
optimization.
Diff is making it into more than it is, because moving it into the
cu_language == language_cplus block, changes the indentation of all
the code under it.
I have added the same type of code kevin has to the patches i am
readying.
--Dan
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 dwarf2read.c
*** dwarf2read.c 2000/11/03 22:38:38 1.17
--- dwarf2read.c 2000/11/04 03:05:24
*************** tag_type_to_type (struct die_info *die,
*** 4532,4547 ****
attr = dwarf_attr (die, DW_AT_name);
if (attr && DW_STRING (attr))
{
! char *attrname=DW_STRING (attr);
! unsigned long hashval=hash(attrname, strlen(attrname)) % TYPE_HASH_SIZE;
!
! if (dwarf2_cached_types[hashval] != NULL)
{
! const char *nameoftype;
! nameoftype = TYPE_NAME(dwarf2_cached_types[hashval]) == NULL ? TYPE_TAG_NAME(dwarf2_cached_types[hashval]) : TYPE_NAME(dwarf2_cached_types[hashval]);
! if (strcmp(attrname, nameoftype) == 0)
{
! die->type=dwarf2_cached_types[hashval];
}
else
{
--- 4532,4554 ----
attr = dwarf_attr (die, DW_AT_name);
if (attr && DW_STRING (attr))
{
! if (cu_language == language_cplus)
{
! char *attrname=DW_STRING (attr);
! unsigned long hashval=hash(attrname, strlen(attrname)) % TYPE_HASH_SIZE;
! if (dwarf2_cached_types[hashval] != NULL)
{
! const char *nameoftype;
! nameoftype = TYPE_NAME(dwarf2_cached_types[hashval]) == NULL ? TYPE_TAG_NAME(dwarf2_cached_types[hashval]) : TYPE_NAME(dwarf2_cached_types[hashval]);
! if (strcmp(attrname, nameoftype) == 0)
! {
! die->type=dwarf2_cached_types[hashval];
! }
! else
! {
! read_type_die (die, objfile, cu_header);
! dwarf2_cached_types[hashval] = die->type;
! }
}
else
{
*************** tag_type_to_type (struct die_info *die,
*** 4552,4558 ****
else
{
read_type_die (die, objfile, cu_header);
- dwarf2_cached_types[hashval] = die->type;
}
}
else
--- 4559,4564 ----
next parent reply other threads:[~2000-11-03 19:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200011032142.NAA27103@wilson.cygnus.com>
[not found] ` <1001103230254.ZM14396@ocotillo.lan>
2000-11-03 19:21 ` Daniel Berlin [this message]
2000-11-06 17:08 ` Kevin Buettner
2000-11-06 21:13 ` Daniel Berlin
[not found] <npofzr8lj2.fsf@zwingli.cygnus.com>
2000-11-07 15:40 ` Jim Wilson
2000-11-09 14:03 David B Anderson
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=m3em0sqv74.fsf@dan2.cygnus.com \
--to=dberlin@redhat.com \
--cc=ezannoni@redhat.com \
--cc=gdb@sources.redhat.com \
--cc=kevinb@cygnus.com \
--cc=linux-ia64@linuxia64.org \
--cc=pw@osc.edu \
--cc=wilson@cygnus.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