This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/935: GDB is not able to show parameters of catch block


>Number:         935
>Category:       c++
>Synopsis:       GDB is not able to show parameters of catch block
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 16 00:48:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     miwako.tokugawa@intel.com
>Release:        unknown-1.0
>Organization:
>Environment:
32-bit && 64-bit Linux
>Description:
GDB is not able to show parameters of catch block.
Debug information looks like correct.
IDB shows these parameters correctly for the same executable files.

Example of debug session with GDB:

This GDB was configured as "i386-redhat-linux"...
(gdb) b 16
Breakpoint 1 at 0x8049ee5: file eh_02.cpp, line 16.
(gdb) r
Starting program: /home1/sana/trackers/tr29011/tests/gdbCpp/opt_none_debug/eh_02.exe 

Breakpoint 1, main () at eh_02.cpp:16
16              cout << "Exception raised: " << str << '\n';
(gdb) p str
$1 = str
(gdb) 

Example of debug session with IDB:

Linux Application Debugger for 32-bit applications, Version 7.0 Beta, Build 20020715
------------------ 
object file name: a.out 
Reading symbolic information ...done
(idb) stop 16
[#1: stop at "eh_02.cpp":16 ]
(idb) r
[1] stopped at [
In file a.out:
IGNORING unsupported DWARF2 debugging information entries with TAG code 47 (DW_TAG_template_type_param)
int main(void):16 0x8049ef1]
     16         cout << "Exception raised: " << str << '\n';
(idb) p str
0x8083fc4="Test Memory allocation failure!"
(idb) 


Debug information for catch block (it is generated by Intel compiler):
<2><517e>: Abbrev Number: 58 (DW_TAG_catch_block)
     DW_AT_decl_line   : 14     
     DW_AT_decl_column : 5      
     DW_AT_decl_file   : 13     
     DW_AT_sibling     : <51a0> 
     DW_AT_low_pc      : 0x8049ecd 134520525    
     DW_AT_high_pc     : 0x8049f59 134520665    
<3><518e>: Abbrev Number: 56 (DW_TAG_variable)
     DW_AT_decl_line   : 14     
     DW_AT_decl_column : 25     
     DW_AT_decl_file   : 13     
     DW_AT_accessibility: 1     (public)
     DW_AT_name        : str    
     DW_AT_type        : <2bf5> 
     DW_AT_location    : 2 byte block: 75 6c    (DW_OP_breg5: -20)
     DW_AT_external    : 0    
>How-To-Repeat:
Regression test is 
#include <iostream.h>

int main()
{
    char *buf;
    try
    {
        buf = new char[512];
        if( buf == 0 )
            throw "Memory allocation failure!";
        if( buf != 0 )
            throw "Test Memory allocation failure!";
    }
    catch( const char * str )
    {
        cout << "Exception raised: " << str << '\n';
    }
    // ...
    return 0;
}
  
Intel compiler should be used for reproducing of this problem because G++ generates debug information for try and catch blocks as for lexical blocks simple:
 
<1><65>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_sibling     : <cb>   
     DW_AT_external    : 1      
     DW_AT_name        : main   
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 4      
     DW_AT_type        : <cb>   
     DW_AT_low_pc      : 0x8048840 134514752    
     DW_AT_high_pc     : 0x8048942 134515010    
     DW_AT_frame_base  : 1 byte block: 55       (DW_OP_reg5)
 <2><80>: Abbrev Number: 3 (DW_TAG_variable)
     DW_AT_name        : buf    
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 5      
     DW_AT_type        : <d2>   
     DW_AT_location    : 2 byte block: 91 7c    (DW_OP_fbreg: -4)
 <2><8e>: Abbrev Number: 4 (DW_TAG_lexical_block)
     DW_AT_low_pc      : 0x80488e4 134514916    
     DW_AT_high_pc     : 0x804893b 134515003    
 <3><97>: Abbrev Number: 5 (DW_TAG_variable)
     DW_AT_name        : __exception_info       
     DW_AT_type        : <1e7>  
     DW_AT_artificial  : 1      
    DW_AT_location    : 2 byte block: 91 78    (DW_OP_fbreg: -8)
 <3><b1>: Abbrev Number: 4 (DW_TAG_lexical_block)
     DW_AT_low_pc      : 0x80488ee 134514926    
     DW_AT_high_pc     : 0x804892d 134514989    
 <4><ba>: Abbrev Number: 3 (DW_TAG_variable)
     DW_AT_name        : str    
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 14     
     DW_AT_type        : <1f9>  
     DW_AT_location    : 2 byte block: 91 74    (DW_OP_fbreg: -12)

Command line for reproducing is "icc -g test.cpp"
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]