Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Fix a memory corruption in mdebugread.c
Date: Fri, 03 Jan 2003 14:05:00 -0000	[thread overview]
Message-ID: <20030103140448.GH693@gnat.com> (raw)
In-Reply-To: <20030101174132.GA15485@nevyn.them.org>

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

> OK.  Assuming that the name of the class's stEnd is not mangled like a
> constructor, my worry is unfounded.  If you add a comment to that effect
> then this patch is OK.

Class names appear not to be mangled, so indeed there should be no
name "clash". I checked the following change in (I expanded the comment
to explain that a method can not have the same name as the class name):

2003-01-03  J. Brobecker  <brobecker@gnat.com>

        * mdebugread.c (parse_symbol): Count until the stEnd matching
        the structure name.

-- 
Joel

[-- Attachment #2: mdebugread.c.diff --]
[-- Type: text/plain, Size: 1891 bytes --]

Index: mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 mdebugread.c
*** mdebugread.c	17 Dec 2002 00:39:07 -0000	1.32
--- mdebugread.c	3 Jan 2003 13:59:00 -0000
*************** parse_symbol (SYMR *sh, union aux_ext *a
*** 865,871 ****
  	    switch (tsym.st)
  	      {
  	      case stEnd:
! 		goto end_of_fields;
  
  	      case stMember:
  		if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
--- 865,888 ----
  	    switch (tsym.st)
  	      {
  	      case stEnd:
!                 /* 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)

      reply	other threads:[~2003-01-03 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31  7:12 Joel Brobecker
2002-12-31  7:49 ` Daniel Jacobowitz
2003-01-01 13:35   ` Joel Brobecker
2003-01-01 17:41     ` Daniel Jacobowitz
2003-01-03 14:05       ` Joel Brobecker [this message]

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=20030103140448.GH693@gnat.com \
    --to=brobecker@gnat.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