public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* debug crt0.s
@ 2005-12-06 15:06 Efim Monjak
  2005-12-07  0:38 ` Jim Blandy
  0 siblings, 1 reply; 8+ messages in thread
From: Efim Monjak @ 2005-12-06 15:06 UTC (permalink / raw)
  To: gdb

Hi all,

if GDB steps throw crt0.s modul no debug information (assembler 
instructions) can be seen.
Command "show language" will be responsed "auto; currently c", but in 
assembler moduls
which are called from main() the response is "auto; currently asm" and I 
can see the
assembler instructions.
Is it possible to enable these information in the crt0.s module 
automatically, similar to
other assembler modules?

Thanks


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

* Re: debug crt0.s
  2005-12-06 15:06 debug crt0.s Efim Monjak
@ 2005-12-07  0:38 ` Jim Blandy
  2005-12-07  9:10   ` Efim Monyak
  0 siblings, 1 reply; 8+ messages in thread
From: Jim Blandy @ 2005-12-07  0:38 UTC (permalink / raw)
  To: Efim Monjak; +Cc: gdb

Does your crt0.o have debug information?  If it does, then this should
work, I think.

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

* Re: debug crt0.s
  2005-12-07  0:38 ` Jim Blandy
@ 2005-12-07  9:10   ` Efim Monyak
  2005-12-07 17:29     ` Jim Blandy
  0 siblings, 1 reply; 8+ messages in thread
From: Efim Monyak @ 2005-12-07  9:10 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb

I don't use the precompiled crt0 modul. They are in my Software two 
assembler modules.
One of them is crt0.s. They both are compiled together with C modules.
I use the Option -g3 for assembler modules. The difference between 
assembler modules is:
the srt0.s is not a .text section it use its own section.

Do I have a possibility to check does crt0.o file have debug informations?
In the list file generate from .elf by objcopy utilite with -G Option 
both assembler modules
shows similar.

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

* Re: debug crt0.s
  2005-12-07  9:10   ` Efim Monyak
@ 2005-12-07 17:29     ` Jim Blandy
  2005-12-07 17:55       ` Efim Monyak
  0 siblings, 1 reply; 8+ messages in thread
From: Jim Blandy @ 2005-12-07 17:29 UTC (permalink / raw)
  To: Efim Monyak; +Cc: gdb

On 12/7/05, Efim Monyak <efim@lipowsky.de> wrote:
> Do I have a possibility to check does crt0.o file have debug informations?
> In the list file generate from .elf by objcopy utilite with -G Option
> both assembler modules

Try running 'readelf -S crt0.o'.  If you see a section named
.debug_info, or a section named .stab (I think), then you have debug
info.

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

* Re: debug crt0.s
  2005-12-07 17:29     ` Jim Blandy
@ 2005-12-07 17:55       ` Efim Monyak
  2005-12-07 18:57         ` Jim Blandy
  0 siblings, 1 reply; 8+ messages in thread
From: Efim Monyak @ 2005-12-07 17:55 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb

Jim Blandy schrieb:

>On 12/7/05, Efim Monyak <efim@lipowsky.de> wrote:
>  
>
>>Do I have a possibility to check does crt0.o file have debug informations?
>>In the list file generate from .elf by objcopy utilite with -G Option
>>both assembler modules
>>    
>>
>
>Try running 'readelf -S crt0.o'.  If you see a section named
>.debug_info, or a section named .stab (I think), then you have debug
>info.
>
>  
>
I can see section .debug_info and the Size of this section is NOT Zero.
If I open the crt0.o with an editor I can see the relative path to 
crt0.s (to source modul) into it.



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

* Re: debug crt0.s
  2005-12-07 17:55       ` Efim Monyak
@ 2005-12-07 18:57         ` Jim Blandy
  2005-12-08  8:40           ` Efim Monyak
  0 siblings, 1 reply; 8+ messages in thread
From: Jim Blandy @ 2005-12-07 18:57 UTC (permalink / raw)
  To: Efim Monyak; +Cc: gdb

On 12/7/05, Efim Monyak <efim@lipowsky.de> wrote:
> I can see section .debug_info and the Size of this section is NOT Zero.
> If I open the crt0.o with an editor I can see the relative path to
> crt0.s (to source modul) into it.

Check out 'man readelf'.  'readelf -wi' will display the contents of
the .debug_info section legibly.

Could you post the output from 'readelf -wil' applied to a small
executable linked against your crt0.s?

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

* Re: debug crt0.s
  2005-12-07 18:57         ` Jim Blandy
@ 2005-12-08  8:40           ` Efim Monyak
  2005-12-08 18:48             ` Jim Blandy
  0 siblings, 1 reply; 8+ messages in thread
From: Efim Monyak @ 2005-12-08  8:40 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb

Hier is an output for small executable:

C:\WINNT\system32>C:\Programme\ARM-Eclipse\GNUARM\bin\arm-elf-readelf.exe 
-wil C:\embedded\arm\workspace\functest\Debug\functest

Dump of debug contents of section .debug_line:

  Length:                      66
  DWARF Version:               2
  Prologue Length:             38
  Minimum Instruction Length:  2
  Initial value of 'is_stmt':  1
  Line Base:                   -5
  Line Range:                  14
  Opcode Base:                 10
  (Pointer size:               4)

 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:
  ../src

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       comm_chan.s

 Line Number Statements:
  Extended opcode 2: set Address to 0x40000114
  Advance Line by 9 to 10
  Copy
  Special opcode 34: advance Address by 4 to 0x40000118 and Line by 1 to 11
  Special opcode 34: advance Address by 4 to 0x4000011c and Line by 1 to 12
  Special opcode 35: advance Address by 4 to 0x40000120 and Line by 2 to 14
  Special opcode 34: advance Address by 4 to 0x40000124 and Line by 1 to 15
  Special opcode 34: advance Address by 4 to 0x40000128 and Line by 1 to 16
  Special opcode 36: advance Address by 4 to 0x4000012c and Line by 3 to 19
  Special opcode 36: advance Address by 4 to 0x40000130 and Line by 3 to 22
  Advance PC by 4 to 40000134
  Extended opcode 1: End of Sequence


  Length:                      125
  DWARF Version:               2
  Prologue Length:             33
  Minimum Instruction Length:  2
  Initial value of 'is_stmt':  1
  Line Base:                   -5
  Line Range:                  14
  Opcode Base:                 10
  (Pointer size:               4)

 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:
  ../src

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       crt0.s

 Line Number Statements:
  Extended opcode 2: set Address to 0x40000000
  Advance Line by 185 to 186
  Copy
  Special opcode 34: advance Address by 4 to 0x40000004 and Line by 1 to 187
  Special opcode 34: advance Address by 4 to 0x40000008 and Line by 1 to 188
  Special opcode 34: advance Address by 4 to 0x4000000c and Line by 1 to 189
  Special opcode 34: advance Address by 4 to 0x40000010 and Line by 1 to 190
  Special opcode 34: advance Address by 4 to 0x40000014 and Line by 1 to 191
  Special opcode 35: advance Address by 4 to 0x40000018 and Line by 2 to 193
  Special opcode 34: advance Address by 4 to 0x4000001c and Line by 1 to 194
  Advance PC by 4 to 40000020
  Extended opcode 1: End of Sequence

  Extended opcode 2: set Address to 0x40000020
  Advance Line by 73 to 74
  Copy
  Special opcode 34: advance Address by 4 to 0x40000024 and Line by 1 to 75
  Special opcode 35: advance Address by 4 to 0x40000028 and Line by 2 to 77
  Special opcode 38: advance Address by 4 to 0x4000002c and Line by 5 to 82
  Special opcode 34: advance Address by 4 to 0x40000030 and Line by 1 to 83
  Special opcode 34: advance Address by 4 to 0x40000034 and Line by 1 to 84
  Special opcode 34: advance Address by 4 to 0x40000038 and Line by 1 to 85
  Special opcode 34: advance Address by 4 to 0x4000003c and Line by 1 to 86
  Special opcode 34: advance Address by 4 to 0x40000040 and Line by 1 to 87
  Special opcode 34: advance Address by 4 to 0x40000044 and Line by 1 to 88
  Special opcode 34: advance Address by 4 to 0x40000048 and Line by 1 to 89
  Special opcode 34: advance Address by 4 to 0x4000004c and Line by 1 to 90
  Special opcode 34: advance Address by 4 to 0x40000050 and Line by 1 to 91
  Special opcode 34: advance Address by 4 to 0x40000054 and Line by 1 to 92
  Special opcode 34: advance Address by 4 to 0x40000058 and Line by 1 to 93
  Special opcode 34: advance Address by 4 to 0x4000005c and Line by 1 to 94
  Special opcode 34: advance Address by 4 to 0x40000060 and Line by 1 to 95
  Special opcode 34: advance Address by 4 to 0x40000064 and Line by 1 to 96
  Special opcode 34: advance Address by 4 to 0x40000068 and Line by 1 to 97
  Special opcode 34: advance Address by 4 to 0x4000006c and Line by 1 to 98
  Special opcode 34: advance Address by 4 to 0x40000070 and Line by 1 to 99
  Special opcode 35: advance Address by 4 to 0x40000074 and Line by 2 to 101
  Special opcode 35: advance Address by 4 to 0x40000078 and Line by 2 to 103
  Special opcode 34: advance Address by 4 to 0x4000007c and Line by 1 to 104
  Special opcode 34: advance Address by 4 to 0x40000080 and Line by 1 to 105
  Special opcode 35: advance Address by 4 to 0x40000084 and Line by 2 to 107
  Special opcode 36: advance Address by 4 to 0x40000088 and Line by 3 to 110
  Special opcode 35: advance Address by 4 to 0x4000008c and Line by 2 to 112
  Special opcode 35: advance Address by 4 to 0x40000090 and Line by 2 to 114
  Special opcode 35: advance Address by 4 to 0x40000094 and Line by 2 to 116
  Special opcode 36: advance Address by 4 to 0x40000098 and Line by 3 to 119
  Special opcode 34: advance Address by 4 to 0x4000009c and Line by 1 to 120
  Special opcode 34: advance Address by 4 to 0x400000a0 and Line by 1 to 121
  Special opcode 37: advance Address by 4 to 0x400000a4 and Line by 4 to 125
  Special opcode 35: advance Address by 4 to 0x400000a8 and Line by 2 to 127
  Special opcode 37: advance Address by 4 to 0x400000ac and Line by 4 to 131
  Special opcode 35: advance Address by 4 to 0x400000b0 and Line by 2 to 133
  Special opcode 35: advance Address by 4 to 0x400000b4 and Line by 2 to 135
  Special opcode 36: advance Address by 4 to 0x400000b8 and Line by 3 to 138
  Special opcode 34: advance Address by 4 to 0x400000bc and Line by 1 to 139
  Special opcode 34: advance Address by 4 to 0x400000c0 and Line by 1 to 140
  Special opcode 34: advance Address by 4 to 0x400000c4 and Line by 1 to 141
  Special opcode 39: advance Address by 4 to 0x400000c8 and Line by 6 to 147
  Special opcode 34: advance Address by 4 to 0x400000cc and Line by 1 to 148
  Special opcode 35: advance Address by 4 to 0x400000d0 and Line by 2 to 150
  Special opcode 34: advance Address by 4 to 0x400000d4 and Line by 1 to 151
  Special opcode 34: advance Address by 4 to 0x400000d8 and Line by 1 to 152
  Special opcode 38: advance Address by 4 to 0x400000dc and Line by 5 to 157
  Advance PC by 56 to 40000114
  Extended opcode 1: End of Sequence


  Length:                      594
  DWARF Version:               2
  Prologue Length:             565
  Minimum Instruction Length:  2
  Initial value of 'is_stmt':  1
  Line Base:                   -5
  Line Range:                  14
  Opcode Base:                 10
  (Pointer size:               4)

 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:
  ../src
  C:/Programme/ARM-Eclipse/GNUARM/arm-elf/include
  C:/Programme/ARM-Eclipse/GNUARM/arm-elf/include/sys
  C:/Programme/ARM-Eclipse/GNUARM/arm-elf/include/machine
  C:/Programme/ARM-Eclipse/GNUARM/lib/gcc/arm-elf/4.0.1/include
  C:/embedded/arm/workspace/functest/inc

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       main.c
  2     2       0       0       stdio.h
  3     2       0       0       _ansi.h
  4     2       0       0       newlib.h
  5     3       0       0       config.h
  6     4       0       0       ieeefp.h
  7     5       0       0       stddef.h
  8     5       0       0       stdarg.h
  9     3       0       0       reent.h
  10    3       0       0       _types.h
  11    3       0       0       lock.h
  12    3       0       0       types.h
  13    4       0       0       types.h
  14    3       0       0       stdio.h
  15    2       0       0       errno.h
  16    3       0       0       errno.h
  17    2       0       0       string.h
  18    6       0       0       utypes.h
  19    6       0       0       serialio.h
  20    6       0       0       LPC2xsys.h
  21    6       0       0       lpc2292.h
  22    1       0       0       comm_chan.h
  23    1       0       0       commio.h
  24    1       0       0       PCPUcfg.h

 Line Number Statements:
  Extended opcode 2: set Address to 0x40000134
  Advance Line by 143 to 144
  Copy
  Special opcode 124: advance Address by 16 to 0x40000144 and Line by 7 
to 151
  Special opcode 119: advance Address by 16 to 0x40000154 and Line by 2 
to 153
  Advance Line by 178 to 331
  Special opcode 61: advance Address by 8 to 0x4000015c and Line by 0 to 331
  Special opcode 34: advance Address by 4 to 0x40000160 and Line by 1 to 332
  Advance PC by 8 to 40000168
  Extended opcode 1: End of Sequence


The section .debug_info contains:

  Compilation Unit @ 0:
   Length:        105
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0
     DW_AT_low_pc      : 0x40000114
     DW_AT_high_pc     : 0x40000134
     DW_AT_name        : ../src/comm_chan.s
     DW_AT_comp_dir    : /cygdrive/c/embedded/arm/workspace/functest/Debug
     DW_AT_producer    : GNU AS 2.16.1
     DW_AT_language    : 32769  (MIPS assembler)
  Compilation Unit @ 6d:
   Length:        92
   Version:       2
   Abbrev Offset: 20
   Pointer Size:  4
 <0><78>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0x46
     DW_AT_name        : ../src/crt0.s
     DW_AT_comp_dir    : /cygdrive/c/embedded/arm/workspace/functest/Debug
     DW_AT_producer    : GNU AS 2.16.1
     DW_AT_language    : 32769  (MIPS assembler)
  Compilation Unit @ cd:
   Length:        315
   Version:       2
   Abbrev Offset: 36
   Pointer Size:  4
 <0><d8>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_macro_info  : 0
     DW_AT_stmt_list   : 0xc7
     DW_AT_high_pc     : 0x40000168
     DW_AT_low_pc      : 0x40000134
     DW_AT_producer    : GNU C 4.0.1
     DW_AT_language    : 1      (ANSI C)
     DW_AT_name        : ../src/main.c
     DW_AT_comp_dir    : /cygdrive/c/embedded/arm/workspace/functest/Debug
 <1><136>: Abbrev Number: 2 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x0): long unsigned int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 7      (unsigned)
 <1><13d>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 5      (signed)
 <1><144>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : long int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 5      (signed)
 <1><150>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : long long int
     DW_AT_byte_size   : 8
     DW_AT_encoding    : 5      (signed)
 <1><161>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : unsigned int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 7      (unsigned)
 <1><171>: Abbrev Number: 2 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x0): long unsigned int
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 7      (unsigned)
 <1><178>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : unsigned char
     DW_AT_byte_size   : 1
     DW_AT_encoding    : 8      (unsigned char)
 <1><189>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : short int
     DW_AT_byte_size   : 2
     DW_AT_encoding    : 5      (signed)
 <1><196>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : char
     DW_AT_byte_size   : 1
     DW_AT_encoding    : 8      (unsigned char)
 <1><19e>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : short unsigned int
     DW_AT_byte_size   : 2
     DW_AT_encoding    : 7      (unsigned)
 <1><1b4>: Abbrev Number: 3 (DW_TAG_base_type)
     DW_AT_name        : long long unsigned int
     DW_AT_byte_size   : 8
     DW_AT_encoding    : 7      (unsigned)
 <1><1ce>: Abbrev Number: 4 (DW_TAG_typedef)
     DW_AT_name        : DWORD
     DW_AT_decl_file   : 18
     DW_AT_decl_line   : 16
     DW_AT_type        : <136>
 <1><1db>: Abbrev Number: 5 (DW_TAG_subprogram)
     DW_AT_sibling     : <206>
     DW_AT_external    : 1
     DW_AT_name        : main
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 144
     DW_AT_prototyped  : 1
     DW_AT_type        : <13d>
     DW_AT_low_pc      : 0x40000134
     DW_AT_high_pc     : 0x40000168
     DW_AT_frame_base  : 1 byte block: 5b       (DW_OP_reg11)
 <2><1f7>: Abbrev Number: 6 (DW_TAG_variable)
     DW_AT_name        : mem
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 147
     DW_AT_type        : <206>
     DW_AT_location    : 2 byte block: 7b 70    (DW_OP_breg11: -16)
 <1><206>: Abbrev Number: 7 (DW_TAG_volatile_type)
     DW_AT_type        : <1ce>


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

* Re: debug crt0.s
  2005-12-08  8:40           ` Efim Monyak
@ 2005-12-08 18:48             ` Jim Blandy
  0 siblings, 0 replies; 8+ messages in thread
From: Jim Blandy @ 2005-12-08 18:48 UTC (permalink / raw)
  To: Efim Monyak; +Cc: gdb

On 12/8/05, Efim Monyak <efim@lipowsky.de> wrote:
>   Compilation Unit @ 6d:
>    Length:        92
>    Version:       2
>    Abbrev Offset: 20
>    Pointer Size:  4
>  <0><78>: Abbrev Number: 1 (DW_TAG_compile_unit)
>      DW_AT_stmt_list   : 0x46
>      DW_AT_name        : ../src/crt0.s
>      DW_AT_comp_dir    : /cygdrive/c/embedded/arm/workspace/functest/Debug
>      DW_AT_producer    : GNU AS 2.16.1
>      DW_AT_language    : 32769  (MIPS assembler)
>   Compilation Unit @ cd: ...

This is interesting.  This is the debugging information for crt0.s. 
It points to the right place in the .debug_line section, but it
doesn't have DW_AT_low_pc and DW_AT_high_pc attributes like the other
compilation units.

What do you get when you run 'readelf -wil' on crt0.o itself?  The
addresses will be meaningless because they haven't been relocated, but
we should be able to see the rest of the information.

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

end of thread, other threads:[~2005-12-08 18:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-06 15:06 debug crt0.s Efim Monjak
2005-12-07  0:38 ` Jim Blandy
2005-12-07  9:10   ` Efim Monyak
2005-12-07 17:29     ` Jim Blandy
2005-12-07 17:55       ` Efim Monyak
2005-12-07 18:57         ` Jim Blandy
2005-12-08  8:40           ` Efim Monyak
2005-12-08 18:48             ` Jim Blandy

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