aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2003-01-03 14:01:47 +0000
committerJoel Brobecker <brobecker@gnat.com>2003-01-03 14:01:47 +0000
commitf0394be6484dacc42dad15586b3bbe5de0f0149b (patch)
tree540043db2d7200759d241a93b0ddf10878023245 /gdb/mdebugread.c
parent1efcd1fdb6ef1f769ce7e8028afcf03eb1a1d620 (diff)
downloadgdb-f0394be6484dacc42dad15586b3bbe5de0f0149b.zip
gdb-f0394be6484dacc42dad15586b3bbe5de0f0149b.tar.gz
gdb-f0394be6484dacc42dad15586b3bbe5de0f0149b.tar.bz2
* mdebugread.c (parse_symbol): Count until the stEnd matching
the structure name.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index f6ec396..b5a15c3 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -865,7 +865,24 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
switch (tsym.st)
{
case stEnd:
- goto end_of_fields;
+ /* C++ encodes class types as structures where there the
+ methods are encoded as stProc. The scope of stProc
+ symbols also ends with stEnd, thus creating a risk of
+ taking the wrong stEnd symbol record as the end of
+ the current struct, which would cause GDB to undercount
+ the real number of fields in this struct. To make sure
+ we really reached the right stEnd symbol record, we
+ check the associated name, and match it against the
+ struct name. Since method names are mangled while
+ the class name is not, there is no risk of having a
+ method whose name is identical to the class name
+ (in particular constructor method names are different
+ from the class name). There is therefore no risk that
+ this check stops the count on the StEnd of a method. */
+ if (strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss,
+ name) == 0)
+ goto end_of_fields;
+ break;
case stMember:
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)