public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "keiths at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/12328] Can't set breakpoint on method taking const, non-reference/pointer scalar parameter
Date: Thu, 16 Dec 2010 17:37:00 -0000	[thread overview]
Message-ID: <bug-12328-4717-jic4CQKU18@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12328-4717@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=12328

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Ignore "const" for          |Can't set breakpoint on
                   |non-reference/pointer       |method taking const,
                   |scalar                      |non-reference/pointer
                   |                            |scalar parameter

--- Comment #1 from Keith Seitz <keiths at redhat dot com> 2010-12-16 17:34:26 UTC ---
This happens because of the constant scalar parameter for "func". Gdb thinks it
is really "int" (not "const int"), and when it goes to lookup
"myclass::func(int)", it does not find anything.

The DIEs pertaining to "myclass" and "func":

 <1><31>: Abbrev Number: 2 (DW_TAG_class_type)
    <32>   DW_AT_name        : (indirect string, offset: 0x71): myclass 
    <36>   DW_AT_byte_size   : 1        
    <37>   DW_AT_decl_file   : 1        
    <38>   DW_AT_decl_line   : 2        
    <39>   DW_AT_sibling     : <0x51>   
 <2><3d>: Abbrev Number: 3 (DW_TAG_subprogram)
    <3e>   DW_AT_external    : 1        
    <3f>   DW_AT_name        : (indirect string, offset: 0x0): func     
    <43>   DW_AT_decl_file   : 1        
    <44>   DW_AT_decl_line   : 4        
    <45>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x59):
_ZN7myclass4funcEi 
    <49>   DW_AT_declaration : 1        
 <3><4a>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <4b>   DW_AT_type        : <0x51>   
 <1><51>: Abbrev Number: 5 (DW_TAG_base_type)
    <52>   DW_AT_byte_size   : 4        
    <53>   DW_AT_encoding    : 5        (signed)
    <54>   DW_AT_name        : int      
 <1><58>: Abbrev Number: 6 (DW_TAG_subprogram)
    <59>   DW_AT_specification: <0x3d>  
    <5d>   DW_AT_low_pc      : 0x400574 
    <65>   DW_AT_high_pc     : 0x40057d 
    <6d>   DW_AT_frame_base  : 1 byte block: 9c         (DW_OP_call_frame_cfa)
    <6f>   DW_AT_sibling     : <0x81>   
 <2><73>: Abbrev Number: 7 (DW_TAG_formal_parameter)
    <74>   DW_AT_name        : aa       
    <77>   DW_AT_decl_file   : 1        
    <78>   DW_AT_decl_line   : 4        
    <79>   DW_AT_type        : <0x81>   
    <7d>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)
 <1><81>: Abbrev Number: 8 (DW_TAG_const_type)
    <82>   DW_AT_type        : <0x51>   

As you can see, when reading the fieldlists for "myclass", we add an entry for
"func" with parameter "int" NOT "const int". Later when the function definition
is seen, we correctly get "const int".

IMO, this is a compiler bug. I see no reason why the class definition and the
function definition should conflict.

However, this might be relatively painless to add something to gdb to ignore

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  reply	other threads:[~2010-12-16 17:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 17:34 [Bug c++/12328] New: Ignore "const" for non-reference/pointer scalar keiths at redhat dot com
2010-12-16 17:37 ` keiths at redhat dot com [this message]
2010-12-16 17:47 ` [Bug c++/12328] Can't set breakpoint on method taking const, non-reference/pointer scalar parameter keiths at redhat dot com
2010-12-17 17:03 ` thahn01@t-online.de
2010-12-17 23:13 ` keiths at redhat dot com
2011-01-17  7:13 ` jan.kratochvil at redhat dot com
2011-02-06 18:17 ` jan.kratochvil at redhat dot com
2011-02-13  9:16 ` cvs-commit at gcc dot gnu.org
2011-02-13  9:24 ` jan.kratochvil at redhat dot com

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=bug-12328-4717-jic4CQKU18@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).