public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Does DW_OP_deref work?
@ 2003-07-30 21:54 H. J. Lu
  2003-07-30 21:56 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: H. J. Lu @ 2003-07-30 21:54 UTC (permalink / raw)
  To: GDB

Does DW_OP_deref work correctly with gdb?


H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does DW_OP_deref work?
  2003-07-30 21:54 Does DW_OP_deref work? H. J. Lu
@ 2003-07-30 21:56 ` Daniel Jacobowitz
  2003-07-31  0:23   ` H. J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-07-30 21:56 UTC (permalink / raw)
  To: GDB

On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> Does DW_OP_deref work correctly with gdb?

That depends on the context.  Things that use decode_locdesc, probably
not.  As we find time, things are being converted to the full
expression evaluator.  Location descriptions and frame bases should
work.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does DW_OP_deref work?
  2003-07-30 21:56 ` Daniel Jacobowitz
@ 2003-07-31  0:23   ` H. J. Lu
  2003-07-31  0:27     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: H. J. Lu @ 2003-07-31  0:23 UTC (permalink / raw)
  To: GDB

On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > Does DW_OP_deref work correctly with gdb?
> 
> That depends on the context.  Things that use decode_locdesc, probably
> not.  As we find time, things are being converted to the full
> expression evaluator.  Location descriptions and frame bases should
> work.

I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
I got

(gdb) b wkinit
During symbol reading, unsupported tag: 'DW_TAG_entry_point'.
Breakpoint 1 at 0x8049211: file test.f, line 13.
(gdb) r
Starting program: a.out
 
Breakpoint 1, wkinit (wksize=Cannot access memory at address 0xc8078578
) at test.f:13
13
Current language:  auto; currently fortran
(gdb)


H.J.
----
The section .debug_info contains:

  Compilation Unit @ 0:
   Length:        304
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_comp_dir    : /home/cmplr/usr2/mtokugaw	
     DW_AT_language    : 8	(Fortran 90)
     DW_AT_name        : test.f	
     DW_AT_producer    : EPC Fortran-95 Version F95 Intel:200200:131124	
     DW_AT_stmt_list   : 0	
 <1><61>: Abbrev Number: 2 (DW_TAG_base_type)
     DW_AT_byte_size   : 0	
     DW_AT_encoding    : 5	(signed)
     DW_AT_name        : void	
 <1><69>: Abbrev Number: 3 (DW_TAG_subprogram)
     DW_AT_decl_line   : 1	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_sibling     : <8e>	
     DW_AT_accessibility: 1	(public)
     DW_AT_calling_convention: 2	(program)
     DW_AT_name        : main.program	
     DW_AT_type        : <61>	
     DW_AT_prototyped  : 0	
     DW_AT_high_pc     : 0x8049206 134517254	
     DW_AT_low_pc      : 0x8049198 134517144	
     DW_AT_external    : 1	
 <1><8e>: Abbrev Number: 4 (DW_TAG_subprogram)
     DW_AT_decl_line   : 6	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_sibling     : <125>	
     DW_AT_accessibility: 1	(public)
     DW_AT_name        : wkinit	
     DW_AT_type        : <61>	
     DW_AT_prototyped  : 0	
     DW_AT_high_pc     : 0x8049456 134517846	
     DW_AT_low_pc      : 0x8049206 134517254	
     DW_AT_external    : 1	
 <2><ac>: Abbrev Number: 5 (DW_TAG_formal_parameter)
     DW_AT_decl_line   : 31	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_type        : <125>	
     DW_AT_variable_parameter: 1	
     DW_AT_name        : wksize	
     DW_AT_location    : 6 byte block: 3 8 a0 7 8 6 	(DW_OP_addr: 807a008; DW_OP_deref)
 <2><c3>: Abbrev Number: 6 (DW_TAG_entry_point)
     DW_AT_decl_line   : 20	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_sibling     : <f2>	
     DW_AT_name        : wkprnt	
     DW_AT_type        : <61>	
     DW_AT_low_pc      : 0x80492ac 134517420	
 <3><da>: Abbrev Number: 5 (DW_TAG_formal_parameter)
     DW_AT_decl_line   : 31	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_type        : <125>	
     DW_AT_variable_parameter: 1	
     DW_AT_name        : jprint	
     DW_AT_location    : 6 byte block: 3 14 a0 7 8 6 	(DW_OP_addr: 807a014; DW_OP_deref)
 <2><f2>: Abbrev Number: 7 (DW_TAG_variable)
     DW_AT_decl_line   : 31	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_accessibility: 1	(public)
     DW_AT_name        : jpr	
     DW_AT_type        : <125>	
     DW_AT_location    : 5 byte block: 3 c a0 7 8 	(DW_OP_addr: 807a00c)
     DW_AT_external    : 0	
     DW_AT_start_scope : 0x8049454 134517844	
 <2><10a>: Abbrev Number: 7 (DW_TAG_variable)
     DW_AT_decl_line   : 31	
     DW_AT_decl_column : 0	
     DW_AT_decl_file   : 1	
     DW_AT_accessibility: 1	(public)
     DW_AT_name        : nsize	
     DW_AT_type        : <125>	
     DW_AT_location    : 5 byte block: 3 10 a0 7 8 	(DW_OP_addr: 807a010)
     DW_AT_external    : 0	
     DW_AT_start_scope : 0x8049454 134517844	
 <1><125>: Abbrev Number: 2 (DW_TAG_base_type)
     DW_AT_byte_size   : 4	
     DW_AT_encoding    : 5	(signed)
     DW_AT_name        : integer	

Contents of the .debug_abbrev section:

  Number TAG
   1      DW_TAG_compile_unit    [has children]
    DW_AT_comp_dir     DW_FORM_string
    DW_AT_language     DW_FORM_data1
    DW_AT_name         DW_FORM_string
    DW_AT_producer     DW_FORM_string
    DW_AT_stmt_list    DW_FORM_data4
   2      DW_TAG_base_type    [no children]
    DW_AT_byte_size    DW_FORM_data1
    DW_AT_encoding     DW_FORM_data1
    DW_AT_name         DW_FORM_string
   3      DW_TAG_subprogram    [no children]
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_decl_column  DW_FORM_data1
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_sibling      DW_FORM_ref4
    DW_AT_accessibility DW_FORM_data1
    DW_AT_calling_convention DW_FORM_data1
    DW_AT_name         DW_FORM_string
    DW_AT_type         DW_FORM_ref4
    DW_AT_prototyped   DW_FORM_flag
    DW_AT_high_pc      DW_FORM_addr
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_external     DW_FORM_flag
   4      DW_TAG_subprogram    [has children]
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_decl_column  DW_FORM_data1
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_sibling      DW_FORM_ref4
    DW_AT_accessibility DW_FORM_data1
    DW_AT_name         DW_FORM_string
    DW_AT_type         DW_FORM_ref4
    DW_AT_prototyped   DW_FORM_flag
    DW_AT_high_pc      DW_FORM_addr
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_external     DW_FORM_flag
   5      DW_TAG_formal_parameter    [no children]
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_decl_column  DW_FORM_data1
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_type         DW_FORM_ref4
    DW_AT_variable_parameter DW_FORM_flag
    DW_AT_name         DW_FORM_string
    DW_AT_location     DW_FORM_block1
   6      DW_TAG_entry_point    [has children]
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_decl_column  DW_FORM_data1
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_sibling      DW_FORM_ref4
    DW_AT_name         DW_FORM_string
    DW_AT_type         DW_FORM_ref4
    DW_AT_low_pc       DW_FORM_addr
   7      DW_TAG_variable    [no children]
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_decl_column  DW_FORM_data1
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_accessibility DW_FORM_data1
    DW_AT_name         DW_FORM_string
    DW_AT_type         DW_FORM_ref4
    DW_AT_location     DW_FORM_block1
    DW_AT_external     DW_FORM_flag
    DW_AT_start_scope  DW_FORM_addr


Dump of debug contents of section .debug_line:

  Length:                      94
  DWARF Version:               2
  Prologue Length:             31
  Minimum Instruction Length:  1
  Initial value of 'is_stmt':  0
  Line Base:                   -1
  Line Range:                  4
  Opcode Base:                 10

 Opcodes:
  Opcode 1 has 0 args
  Opcode 2 has 1 args
  Opcode 3 has 1 args
  Opcode 4 has 1 args
  Opcode 5 has 1 args
  Opcode 6 has 0 args
  Opcode 7 has 0 args
  Opcode 8 has 0 args
  Opcode 9 has 1 args

 The Directory Table is empty.

 The File Name Table:
  Entry	Dir	Time	Size	Name
  1	0	1059586658	583	test.f

 Line Number Statements:
  Extended opcode 2: set Address to 0x8049198
  Copy
  Special opcode 158: advance Address by 39 to 0x80491bf and Line by 1 to 2
  Special opcode 82: advance Address by 20 to 0x80491d3 and Line by 1 to 3
  Special opcode 82: advance Address by 20 to 0x80491e7 and Line by 1 to 4
  Special opcode 127: advance Address by 31 to 0x8049206 and Line by 2 to 6
  Advance PC by 11 to 8049211
  Advance Line by 7 to 13
  Copy
  Special opcode 51: advance Address by 12 to 0x804921d and Line by 2 to 15
  Advance PC by 126 to 804929b
  Advance Line by 2 to 17
  Copy
  Advance PC by 17 to 80492ac
  Advance Line by 3 to 20
  Copy
  Special opcode 46: advance Address by 11 to 0x80492b7 and Line by 1 to 21
  Advance PC by 124 to 8049333
  Advance Line by 1 to 22
  Copy
  Advance PC by 126 to 80493b1
  Advance Line by 1 to 23
  Copy
  Special opcode 50: advance Address by 12 to 0x80493bd and Line by 1 to 24
  Special opcode 63: advance Address by 15 to 0x80493cc and Line by 2 to 26
  Special opcode 51: advance Address by 12 to 0x80493d8 and Line by 2 to 28
  Advance PC by 124 to 8049454
  Advance Line by 3 to 31
  Copy
  Extended opcode 2: set Address to 0x8049456
  Extended opcode 1: End of Sequence


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does DW_OP_deref work?
  2003-07-31  0:23   ` H. J. Lu
@ 2003-07-31  0:27     ` Daniel Jacobowitz
  2003-07-31 15:44       ` H. J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-07-31  0:27 UTC (permalink / raw)
  To: H. J. Lu; +Cc: GDB

On Wed, Jul 30, 2003 at 05:23:06PM -0700, H. J. Lu wrote:
> On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> > On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > > Does DW_OP_deref work correctly with gdb?
> > 
> > That depends on the context.  Things that use decode_locdesc, probably
> > not.  As we find time, things are being converted to the full
> > expression evaluator.  Location descriptions and frame bases should
> > work.
> 
> I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
> I got

Location descriptions for parameters may not work fully.  Feel free to
fix it, or to investigate the reasons why more thoroughly - search for
LOC_COMPUTED_ARG, but I don't even think we generate those yet.

> 
> (gdb) b wkinit
> During symbol reading, unsupported tag: 'DW_TAG_entry_point'.
> Breakpoint 1 at 0x8049211: file test.f, line 13.
> (gdb) r
> Starting program: a.out
>  
> Breakpoint 1, wkinit (wksize=Cannot access memory at address 0xc8078578
> ) at test.f:13
> 13
> Current language:  auto; currently fortran
> (gdb)
> 
> 
> H.J.
> ----
> The section .debug_info contains:
> 
>   Compilation Unit @ 0:
>    Length:        304
>    Version:       2
>    Abbrev Offset: 0
>    Pointer Size:  4
>  <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
>      DW_AT_comp_dir    : /home/cmplr/usr2/mtokugaw	
>      DW_AT_language    : 8	(Fortran 90)
>      DW_AT_name        : test.f	
>      DW_AT_producer    : EPC Fortran-95 Version F95 Intel:200200:131124	
>      DW_AT_stmt_list   : 0	
>  <1><61>: Abbrev Number: 2 (DW_TAG_base_type)
>      DW_AT_byte_size   : 0	
>      DW_AT_encoding    : 5	(signed)
>      DW_AT_name        : void	
>  <1><69>: Abbrev Number: 3 (DW_TAG_subprogram)
>      DW_AT_decl_line   : 1	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_sibling     : <8e>	
>      DW_AT_accessibility: 1	(public)
>      DW_AT_calling_convention: 2	(program)
>      DW_AT_name        : main.program	
>      DW_AT_type        : <61>	
>      DW_AT_prototyped  : 0	
>      DW_AT_high_pc     : 0x8049206 134517254	
>      DW_AT_low_pc      : 0x8049198 134517144	
>      DW_AT_external    : 1	
>  <1><8e>: Abbrev Number: 4 (DW_TAG_subprogram)
>      DW_AT_decl_line   : 6	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_sibling     : <125>	
>      DW_AT_accessibility: 1	(public)
>      DW_AT_name        : wkinit	
>      DW_AT_type        : <61>	
>      DW_AT_prototyped  : 0	
>      DW_AT_high_pc     : 0x8049456 134517846	
>      DW_AT_low_pc      : 0x8049206 134517254	
>      DW_AT_external    : 1	
>  <2><ac>: Abbrev Number: 5 (DW_TAG_formal_parameter)
>      DW_AT_decl_line   : 31	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_type        : <125>	
>      DW_AT_variable_parameter: 1	
>      DW_AT_name        : wksize	
>      DW_AT_location    : 6 byte block: 3 8 a0 7 8 6 	(DW_OP_addr: 807a008; DW_OP_deref)
>  <2><c3>: Abbrev Number: 6 (DW_TAG_entry_point)
>      DW_AT_decl_line   : 20	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_sibling     : <f2>	
>      DW_AT_name        : wkprnt	
>      DW_AT_type        : <61>	
>      DW_AT_low_pc      : 0x80492ac 134517420	
>  <3><da>: Abbrev Number: 5 (DW_TAG_formal_parameter)
>      DW_AT_decl_line   : 31	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_type        : <125>	
>      DW_AT_variable_parameter: 1	
>      DW_AT_name        : jprint	
>      DW_AT_location    : 6 byte block: 3 14 a0 7 8 6 	(DW_OP_addr: 807a014; DW_OP_deref)
>  <2><f2>: Abbrev Number: 7 (DW_TAG_variable)
>      DW_AT_decl_line   : 31	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_accessibility: 1	(public)
>      DW_AT_name        : jpr	
>      DW_AT_type        : <125>	
>      DW_AT_location    : 5 byte block: 3 c a0 7 8 	(DW_OP_addr: 807a00c)
>      DW_AT_external    : 0	
>      DW_AT_start_scope : 0x8049454 134517844	
>  <2><10a>: Abbrev Number: 7 (DW_TAG_variable)
>      DW_AT_decl_line   : 31	
>      DW_AT_decl_column : 0	
>      DW_AT_decl_file   : 1	
>      DW_AT_accessibility: 1	(public)
>      DW_AT_name        : nsize	
>      DW_AT_type        : <125>	
>      DW_AT_location    : 5 byte block: 3 10 a0 7 8 	(DW_OP_addr: 807a010)
>      DW_AT_external    : 0	
>      DW_AT_start_scope : 0x8049454 134517844	
>  <1><125>: Abbrev Number: 2 (DW_TAG_base_type)
>      DW_AT_byte_size   : 4	
>      DW_AT_encoding    : 5	(signed)
>      DW_AT_name        : integer	
> 
> Contents of the .debug_abbrev section:
> 
>   Number TAG
>    1      DW_TAG_compile_unit    [has children]
>     DW_AT_comp_dir     DW_FORM_string
>     DW_AT_language     DW_FORM_data1
>     DW_AT_name         DW_FORM_string
>     DW_AT_producer     DW_FORM_string
>     DW_AT_stmt_list    DW_FORM_data4
>    2      DW_TAG_base_type    [no children]
>     DW_AT_byte_size    DW_FORM_data1
>     DW_AT_encoding     DW_FORM_data1
>     DW_AT_name         DW_FORM_string
>    3      DW_TAG_subprogram    [no children]
>     DW_AT_decl_line    DW_FORM_data1
>     DW_AT_decl_column  DW_FORM_data1
>     DW_AT_decl_file    DW_FORM_data1
>     DW_AT_sibling      DW_FORM_ref4
>     DW_AT_accessibility DW_FORM_data1
>     DW_AT_calling_convention DW_FORM_data1
>     DW_AT_name         DW_FORM_string
>     DW_AT_type         DW_FORM_ref4
>     DW_AT_prototyped   DW_FORM_flag
>     DW_AT_high_pc      DW_FORM_addr
>     DW_AT_low_pc       DW_FORM_addr
>     DW_AT_external     DW_FORM_flag
>    4      DW_TAG_subprogram    [has children]
>     DW_AT_decl_line    DW_FORM_data1
>     DW_AT_decl_column  DW_FORM_data1
>     DW_AT_decl_file    DW_FORM_data1
>     DW_AT_sibling      DW_FORM_ref4
>     DW_AT_accessibility DW_FORM_data1
>     DW_AT_name         DW_FORM_string
>     DW_AT_type         DW_FORM_ref4
>     DW_AT_prototyped   DW_FORM_flag
>     DW_AT_high_pc      DW_FORM_addr
>     DW_AT_low_pc       DW_FORM_addr
>     DW_AT_external     DW_FORM_flag
>    5      DW_TAG_formal_parameter    [no children]
>     DW_AT_decl_line    DW_FORM_data1
>     DW_AT_decl_column  DW_FORM_data1
>     DW_AT_decl_file    DW_FORM_data1
>     DW_AT_type         DW_FORM_ref4
>     DW_AT_variable_parameter DW_FORM_flag
>     DW_AT_name         DW_FORM_string
>     DW_AT_location     DW_FORM_block1
>    6      DW_TAG_entry_point    [has children]
>     DW_AT_decl_line    DW_FORM_data1
>     DW_AT_decl_column  DW_FORM_data1
>     DW_AT_decl_file    DW_FORM_data1
>     DW_AT_sibling      DW_FORM_ref4
>     DW_AT_name         DW_FORM_string
>     DW_AT_type         DW_FORM_ref4
>     DW_AT_low_pc       DW_FORM_addr
>    7      DW_TAG_variable    [no children]
>     DW_AT_decl_line    DW_FORM_data1
>     DW_AT_decl_column  DW_FORM_data1
>     DW_AT_decl_file    DW_FORM_data1
>     DW_AT_accessibility DW_FORM_data1
>     DW_AT_name         DW_FORM_string
>     DW_AT_type         DW_FORM_ref4
>     DW_AT_location     DW_FORM_block1
>     DW_AT_external     DW_FORM_flag
>     DW_AT_start_scope  DW_FORM_addr
> 
> 
> Dump of debug contents of section .debug_line:
> 
>   Length:                      94
>   DWARF Version:               2
>   Prologue Length:             31
>   Minimum Instruction Length:  1
>   Initial value of 'is_stmt':  0
>   Line Base:                   -1
>   Line Range:                  4
>   Opcode Base:                 10
> 
>  Opcodes:
>   Opcode 1 has 0 args
>   Opcode 2 has 1 args
>   Opcode 3 has 1 args
>   Opcode 4 has 1 args
>   Opcode 5 has 1 args
>   Opcode 6 has 0 args
>   Opcode 7 has 0 args
>   Opcode 8 has 0 args
>   Opcode 9 has 1 args
> 
>  The Directory Table is empty.
> 
>  The File Name Table:
>   Entry	Dir	Time	Size	Name
>   1	0	1059586658	583	test.f
> 
>  Line Number Statements:
>   Extended opcode 2: set Address to 0x8049198
>   Copy
>   Special opcode 158: advance Address by 39 to 0x80491bf and Line by 1 to 2
>   Special opcode 82: advance Address by 20 to 0x80491d3 and Line by 1 to 3
>   Special opcode 82: advance Address by 20 to 0x80491e7 and Line by 1 to 4
>   Special opcode 127: advance Address by 31 to 0x8049206 and Line by 2 to 6
>   Advance PC by 11 to 8049211
>   Advance Line by 7 to 13
>   Copy
>   Special opcode 51: advance Address by 12 to 0x804921d and Line by 2 to 15
>   Advance PC by 126 to 804929b
>   Advance Line by 2 to 17
>   Copy
>   Advance PC by 17 to 80492ac
>   Advance Line by 3 to 20
>   Copy
>   Special opcode 46: advance Address by 11 to 0x80492b7 and Line by 1 to 21
>   Advance PC by 124 to 8049333
>   Advance Line by 1 to 22
>   Copy
>   Advance PC by 126 to 80493b1
>   Advance Line by 1 to 23
>   Copy
>   Special opcode 50: advance Address by 12 to 0x80493bd and Line by 1 to 24
>   Special opcode 63: advance Address by 15 to 0x80493cc and Line by 2 to 26
>   Special opcode 51: advance Address by 12 to 0x80493d8 and Line by 2 to 28
>   Advance PC by 124 to 8049454
>   Advance Line by 3 to 31
>   Copy
>   Extended opcode 2: set Address to 0x8049456
>   Extended opcode 1: End of Sequence
> 
> 
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does DW_OP_deref work?
  2003-07-31  0:27     ` Daniel Jacobowitz
@ 2003-07-31 15:44       ` H. J. Lu
  2003-07-31 15:48         ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: H. J. Lu @ 2003-07-31 15:44 UTC (permalink / raw)
  To: GDB

On Wed, Jul 30, 2003 at 08:27:53PM -0400, Daniel Jacobowitz wrote:
> On Wed, Jul 30, 2003 at 05:23:06PM -0700, H. J. Lu wrote:
> > On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> > > On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > > > Does DW_OP_deref work correctly with gdb?
> > > 
> > > That depends on the context.  Things that use decode_locdesc, probably
> > > not.  As we find time, things are being converted to the full
> > > expression evaluator.  Location descriptions and frame bases should
> > > work.
> > 
> > I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
> > I got
> 
> Location descriptions for parameters may not work fully.  Feel free to
> fix it, or to investigate the reasons why more thoroughly - search for
> LOC_COMPUTED_ARG, but I don't even think we generate those yet.
> 

The problem is gdb has a different idea about DW_OP_deref than Intel
compiler. From what I can tell in DWARF 3 draft, DW_OP_deref specifies
an address. But dwarf2read.c and gdb doesn't support it at all. There
is LOC_REF_ARG, which is an offset from the frame base register.
new_symbol in dwarf2read.c has

              else if (offreg)
                {
                  if (isderef)
                    {
                      if (basereg != frame_base_reg)
                        dwarf2_complex_location_expr_complaint ();
                      SYMBOL_CLASS (sym) = LOC_REF_ARG;
                    }
                  else
                    {
                      SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
                      SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
                    }
                }
              else
                {
                  SYMBOL_CLASS (sym) = LOC_ARG;
                }
 
Since DW_OP_deref doesn't use basereg nor frame_base_reg, SYMBOL_CLASS
is set to LOC_ARG. DW_OP_deref needs something like LOC_DEREF_ARG,
which works on address instead of offset from a base register.


H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does DW_OP_deref work?
  2003-07-31 15:44       ` H. J. Lu
@ 2003-07-31 15:48         ` Daniel Jacobowitz
  2003-07-31 16:13           ` PATCH: Fix DW_OP_deref for DW_TAG_formal_parameter H. J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-07-31 15:48 UTC (permalink / raw)
  To: H. J. Lu; +Cc: GDB

On Thu, Jul 31, 2003 at 08:44:05AM -0700, H. J. Lu wrote:
> On Wed, Jul 30, 2003 at 08:27:53PM -0400, Daniel Jacobowitz wrote:
> > On Wed, Jul 30, 2003 at 05:23:06PM -0700, H. J. Lu wrote:
> > > On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> > > > On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > > > > Does DW_OP_deref work correctly with gdb?
> > > > 
> > > > That depends on the context.  Things that use decode_locdesc, probably
> > > > not.  As we find time, things are being converted to the full
> > > > expression evaluator.  Location descriptions and frame bases should
> > > > work.
> > > 
> > > I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
> > > I got
> > 
> > Location descriptions for parameters may not work fully.  Feel free to
> > fix it, or to investigate the reasons why more thoroughly - search for
> > LOC_COMPUTED_ARG, but I don't even think we generate those yet.
> > 
> 
> The problem is gdb has a different idea about DW_OP_deref than Intel
> compiler. From what I can tell in DWARF 3 draft, DW_OP_deref specifies
> an address. But dwarf2read.c and gdb doesn't support it at all. There
> is LOC_REF_ARG, which is an offset from the frame base register.
> new_symbol in dwarf2read.c has
> 
>               else if (offreg)
>                 {
>                   if (isderef)
>                     {
>                       if (basereg != frame_base_reg)
>                         dwarf2_complex_location_expr_complaint ();
>                       SYMBOL_CLASS (sym) = LOC_REF_ARG;
>                     }
>                   else
>                     {
>                       SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
>                       SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
>                     }
>                 }
>               else
>                 {
>                   SYMBOL_CLASS (sym) = LOC_ARG;
>                 }
>  
> Since DW_OP_deref doesn't use basereg nor frame_base_reg, SYMBOL_CLASS
> is set to LOC_ARG. DW_OP_deref needs something like LOC_DEREF_ARG,
> which works on address instead of offset from a base register.

Please look more closely at what I suggested, and at how DW_OP_deref
works for DW_TAG_variable (as opposed to DW_TAG_formal_parameter).  All
of the above should be turned into LOC_COMPUTED_ARG.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* PATCH: Fix DW_OP_deref for DW_TAG_formal_parameter
  2003-07-31 15:48         ` Daniel Jacobowitz
@ 2003-07-31 16:13           ` H. J. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: H. J. Lu @ 2003-07-31 16:13 UTC (permalink / raw)
  To: GDB; +Cc: GDB

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

On Thu, Jul 31, 2003 at 11:48:21AM -0400, Daniel Jacobowitz wrote:
> On Thu, Jul 31, 2003 at 08:44:05AM -0700, H. J. Lu wrote:
> > On Wed, Jul 30, 2003 at 08:27:53PM -0400, Daniel Jacobowitz wrote:
> > > On Wed, Jul 30, 2003 at 05:23:06PM -0700, H. J. Lu wrote:
> > > > On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> > > > > On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > > > > > Does DW_OP_deref work correctly with gdb?
> > > > > 
> > > > > That depends on the context.  Things that use decode_locdesc, probably
> > > > > not.  As we find time, things are being converted to the full
> > > > > expression evaluator.  Location descriptions and frame bases should
> > > > > work.
> > > > 
> > > > I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
> > > > I got
> > > 
> > > Location descriptions for parameters may not work fully.  Feel free to
> > > fix it, or to investigate the reasons why more thoroughly - search for
> > > LOC_COMPUTED_ARG, but I don't even think we generate those yet.
> > > 
> > 

> Please look more closely at what I suggested, and at how DW_OP_deref
> works for DW_TAG_variable (as opposed to DW_TAG_formal_parameter).  All
> of the above should be turned into LOC_COMPUTED_ARG.
> 

Thanks. This patch works for me.


H.J.

[-- Attachment #2: gdb-arg.patch --]
[-- Type: text/plain, Size: 1133 bytes --]

2003-07-31  H.J. Lu  <hongjiu.lu@intel.com>

	* dwarf2read.c (new_symbol): Mark DW_TAG_formal_parameter with
	DW_OP_deref with LOC_COMPUTED_ARG.

--- gdb/dwarf2read.c.arg	2003-07-30 21:38:25.000000000 -0700
+++ gdb/dwarf2read.c	2003-07-31 09:06:53.000000000 -0700
@@ -5231,9 +5231,9 @@ new_symbol (struct die_info *die, struct
 		  SYMBOL_VALUE (sym) = 
 		    DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
 		}
-	      else if (offreg)
+	      else if (isderef)
 		{
-		  if (isderef)
+		  if (offreg)
 		    {
 		      if (basereg != frame_base_reg)
 			dwarf2_complex_location_expr_complaint ();
@@ -5241,10 +5241,16 @@ new_symbol (struct die_info *die, struct
 		    }
 		  else
 		    {
-		      SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
-		      SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
+		      dwarf2_symbol_mark_computed (attr, sym,
+						   cu_header, objfile);
+		      SYMBOL_CLASS (sym) = LOC_COMPUTED_ARG;
 		    }
 		}
+	      else if (offreg)
+		{
+		  SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
+		  SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
+		}
 	      else
 		{
 		  SYMBOL_CLASS (sym) = LOC_ARG;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-07-31 16:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-30 21:54 Does DW_OP_deref work? H. J. Lu
2003-07-30 21:56 ` Daniel Jacobowitz
2003-07-31  0:23   ` H. J. Lu
2003-07-31  0:27     ` Daniel Jacobowitz
2003-07-31 15:44       ` H. J. Lu
2003-07-31 15:48         ` Daniel Jacobowitz
2003-07-31 16:13           ` PATCH: Fix DW_OP_deref for DW_TAG_formal_parameter H. J. Lu

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).