Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to avoid "but contains no code." in command "info line"?
@ 2007-03-23  7:22 qinwei
  2007-03-23 11:58 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: qinwei @ 2007-03-23  7:22 UTC (permalink / raw)
  To: gdb

Dears, problems are here:

In a assembly file 'a.s', we define two sections which have code both.
For example:

line1: .section mysection
line2: load r4, [r3]
line3: jump func
......

line6: .text
line7: store r4, [r3]
line8: jump func
......

"info line a.s:7" will print both the begin and end address of the line.
but "info line a.s:2" just print the begin address and "but contains no 
code."

I trace the behavior of gdb (6.6 release) and find if the code is not in 
.text, 
then it will not be put to the 'blockvector structure' and finally the 
branch in
gdb/source.c is taken. Does gdb have commands to let codes that in user 
defined
sections tobe added to the 'blockvector structure' and "info line" will 
print 
both the begin & end address? Thanks!

      if (start_pc == end_pc) 
        { 
          printf_filtered ("Line %d of \"%s\"",
                   sal.line, sal.symtab->filename);
          wrap_here ("  "); 
          printf_filtered (" is at address ");
          print_address (start_pc, gdb_stdout);
          wrap_here ("  "); 
          printf_filtered (" but contains no code.\n");
        } 

Best regards,
Qinwei
Mail  qinwei@sunnorth.com.cn
Phone +86-010-62981668-2708
Fax   +86-010-62985972


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

* Re: How to avoid "but contains no code." in command "info line"?
  2007-03-23  7:22 How to avoid "but contains no code." in command "info line"? qinwei
@ 2007-03-23 11:58 ` Daniel Jacobowitz
  2007-03-27  4:08   ` qinwei
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-03-23 11:58 UTC (permalink / raw)
  To: qinwei; +Cc: gdb

On Fri, Mar 23, 2007 at 03:21:29PM +0800, qinwei wrote:
> Dears, problems are here:
> 
> In a assembly file 'a.s', we define two sections which have code both.
> For example:
> 
> line1: .section mysection
> line2: load r4, [r3]
> line3: jump func
> ......
> 
> line6: .text
> line7: store r4, [r3]
> line8: jump func
> ......
> 
> "info line a.s:7" will print both the begin and end address of the line.
> but "info line a.s:2" just print the begin address and "but contains no 
> code."
> 
> I trace the behavior of gdb (6.6 release) and find if the code is not in 
> .text, 
> then it will not be put to the 'blockvector structure'

Are you sure?  It sounds to me like your assembler is not emitting the
right debug info.  GDB doesn't care what section lines are in.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: How to avoid "but contains no code." in command "info line"?
  2007-03-23 11:58 ` Daniel Jacobowitz
@ 2007-03-27  4:08   ` qinwei
  2007-03-27 11:16     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: qinwei @ 2007-03-27  4:08 UTC (permalink / raw)
  To: gdb

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

> > In a assembly file 'a.s', we define two sections which have code both.
> > For example:
> > 
> > line1: .section mysection
> > line2: load r4, [r3]
> > line3: jump func
> > ......
> > 
> > line6: .text
> > line7: store r4, [r3]
> > line8: jump func
> > ......
> > 
> > "info line a.s:7" will print both the begin and end address of the 
line.
> > but "info line a.s:2" just print the begin address and "but contains 
no 
> > code."
> > 
> > I trace the behavior of gdb (6.6 release) and find if the code is not 
in 
> > .text, 
> > then it will not be put to the 'blockvector structure'
> 
> Are you sure?  It sounds to me like your assembler is not emitting the
> right debug info.  GDB doesn't care what section lines are in.

Hi, I tested this on x86:

1, compile & dump:
gcc -o t -gstabs+ s2.s tp_bt1.c
objdump -dhs t &>log1
objdump -G t &>log2

2, debug:
(gdb) info line s2.s:2
Line 2 of "s2.s" is at address 0x8048490 but contains no code.

3, I trace gdb(6.6 release) behavior in 'find_pc_sect_symtab':
1934      ALL_SYMTABS (objfile, s)
(gdb) 
1936        bv = BLOCKVECTOR (s);
(gdb) 
1937        b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
(gdb) 
1939        if (BLOCK_START (b) <= pc
(gdb) p/x *b
$1 = {
  startaddr = 0x8048334, 
  endaddr = 0x8048340, 
  function = 0x0, 
  superblock = 0x0, 
  dict = 0x9931404, 
  language_specific = {
    cplus_specific = {
      namespace = 0x0
    }
  }, 
  gcc_compile_flag = 0x0
}
(gdb) 

because address 0x8048490 is not in [0x8048334, 0x8048340], so return 
NULL.

4, See the stabs info:

Contents of .stab section:
Symnum n_type n_othr n_desc n_value  n_strx String

-1     HdrSym 0      71     0000043c 1 
0      SO     0      0      08048334 1      s2.s 
1      SLINE  0      2      08048490 0 
2      SLINE  0      3      08048495 0 
3      SLINE  0      5      08048334 0 
4      SLINE  0      6      08048339 0 
5      SO     0      0      08048340 6 
/home/qinwei/GJ283/code/build_linux/debug-gdb/
6      SO     0      0      08048340 53     tp_bt1.c
7      OPT    0      0      00000000 62     gcc2_compiled.

5, My question:
1, Does gdb create a 'block' range from [0x08048334, 0x08048340] according 
to every
'SO' symbol here? And address 0x08048490 is not in the range(s2.s)?
2, How to solve the problem? (make 'line info' print both start & end 
address)
Let linker to link 'my_section' in the proper ranges? Or other solutions?



[-- Attachment #2: tp_bt1.c --]
[-- Type: application/octet-stream, Size: 305 bytes --]

int 
fun2 (int x, int y)
{
  int z;
  z = x * y;
  return z;
}

int 
fun1 (int k, int l)
{
  int m, n;
  int ret;
  m = k - l;
  n = k + l;
  ret = fun2 (m, n);
  return ret;
}

int
main (void)
{

   int i = 200;
   int j = 100;
   int ret;
   i = 300;
   j = 400;
   ret = fun1 (i, j);
   return ret;	
}

[-- Attachment #3: log1 --]
[-- Type: application/octet-stream, Size: 29875 bytes --]


t:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       00000013  08048114  08048114  00000114  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  08048128  08048128  00000128  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         00000028  08048148  08048148  00000148  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000050  08048170  08048170  00000170  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       00000059  080481c0  080481c0  000001c0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  0000000a  0804821a  0804821a  0000021a  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000020  08048224  08048224  00000224  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rel.dyn      00000008  08048244  08048244  00000244  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rel.plt      00000008  0804824c  0804824c  0000024c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         00000017  08048254  08048254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt          00000020  0804826c  0804826c  0000026c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .text         00000204  0804828c  0804828c  0000028c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .my_section   0000000a  08048490  08048490  00000490  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .fini         0000001a  0804849c  0804849c  0000049c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .rodata       00000008  080484b8  080484b8  000004b8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame     00000004  080484c0  080484c0  000004c0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .ctors        00000008  080494c4  080494c4  000004c4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .dtors        00000008  080494cc  080494cc  000004cc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .jcr          00000004  080494d4  080494d4  000004d4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 19 .dynamic      000000c8  080494d8  080494d8  000004d8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .got          00000004  080495a0  080495a0  000005a0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 21 .got.plt      00000010  080495a4  080495a4  000005a4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 22 .data         0000000c  080495b4  080495b4  000005b4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 23 .bss          00000004  080495c0  080495c0  000005c0  2**2
                  ALLOC
 24 .stab         00000360  00000000  00000000  000005c0  2**2
                  CONTENTS, READONLY, DEBUGGING
 25 .stabstr      0000043c  00000000  00000000  00000920  2**0
                  CONTENTS, READONLY, DEBUGGING
 26 .comment      0000010e  00000000  00000000  00000d5c  2**0
                  CONTENTS, READONLY
Contents of section .interp:
 8048114 2f6c6962 2f6c642d 6c696e75 782e736f  /lib/ld-linux.so
 8048124 2e3200                               .2.             
Contents of section .note.ABI-tag:
 8048128 04000000 10000000 01000000 474e5500  ............GNU.
 8048138 00000000 02000000 02000000 05000000  ................
Contents of section .hash:
 8048148 03000000 05000000 04000000 01000000  ................
 8048158 02000000 00000000 00000000 00000000  ................
 8048168 00000000 03000000                    ........        
Contents of section .dynsym:
 8048170 00000000 00000000 00000000 00000000  ................
 8048180 3d000000 00000000 dd000000 12000000  =...............
 8048190 2e000000 bc840408 04000000 11000f00  ................
 80481a0 01000000 00000000 00000000 20000000  ............ ...
 80481b0 15000000 00000000 00000000 20000000  ............ ...
Contents of section .dynstr:
 80481c0 005f4a76 5f526567 69737465 72436c61  ._Jv_RegisterCla
 80481d0 73736573 005f5f67 6d6f6e5f 73746172  sses.__gmon_star
 80481e0 745f5f00 6c696263 2e736f2e 36005f49  t__.libc.so.6._I
 80481f0 4f5f7374 64696e5f 75736564 005f5f6c  O_stdin_used.__l
 8048200 6962635f 73746172 745f6d61 696e0047  ibc_start_main.G
 8048210 4c494243 5f322e30 00                 LIBC_2.0.       
Contents of section .gnu.version:
 804821a 00000200 01000000 0000               ..........      
Contents of section .gnu.version_r:
 8048224 01000100 24000000 10000000 00000000  ....$...........
 8048234 1069690d 00000200 4f000000 00000000  .ii.....O.......
Contents of section .rel.dyn:
 8048244 a0950408 06040000                    ........        
Contents of section .rel.plt:
 804824c b0950408 07010000                    ........        
Contents of section .init:
 8048254 5589e583 ec08e851 000000e8 a4000000  U......Q........
 8048264 e8030200 00c9c3                      .......         
Contents of section .plt:
 804826c ff35a895 0408ff25 ac950408 00000000  .5.....%........
 804827c ff25b095 04086800 000000e9 e0ffffff  .%....h.........
Contents of section .text:
 804828c 31ed5e89 e183e4f0 50545268 28840408  1.^.....PTRh(...
 804829c 68d48304 08515668 85830408 e8cfffff  h....QVh........
 80482ac fff49090 5589e553 e8000000 005b81c3  ....U..S.....[..
 80482bc eb120000 528b83fc ffffff85 c07402ff  ....R........t..
 80482cc d0585bc9 c3909090 5589e583 ec08803d  .X[.....U......=
 80482dc c0950408 00740feb 1f8d7600 83c004a3  .....t....v.....
 80482ec bc950408 ffd2a1bc 9504088b 1085d275  ...............u
 80482fc ebc605c0 95040801 c9c389f6 5589e583  ............U...
 804830c ec08a1d4 94040885 c07419b8 00000000  .........t......
 804831c 85c07410 83ec0c68 d4940408 ffd083c4  ..t....h........
 804832c 108d7600 c9c39090 e81c0000 00e81700  ..v.............
 804833c 00009090 5589e583 ec048b45 080faf45  ....U......E...E
 804834c 0c8945fc 8b45fcc9 c35589e5 83ec0c8b  ..E..E...U......
 804835c 550c8b45 0829d089 45fc8b45 0c034508  U..E.)..E..E..E.
 804836c 8945f8ff 75f8ff75 fce8c6ff ffff83c4  .E..u..u........
 804837c 088945f4 8b45f4c9 c35589e5 83ec1883  ..E..E...U......
 804838c e4f0b800 00000083 c00f83c0 0fc1e804  ................
 804839c c1e00429 c4c745fc c8000000 c745f864  ...)..E......E.d
 80483ac 000000c7 45fc2c01 0000c745 f8900100  ....E.,....E....
 80483bc 00ff75f8 ff75fce8 8dffffff 83c40889  ..u..u..........
 80483cc 45f48b45 f4c9c390 5589e557 565383ec  E..E....U..WVS..
 80483dc 0ce80000 00005b81 c3c21100 00e866fe  ......[.......f.
 80483ec ffff8d83 20ffffff 8d9320ff ffff8945  .... ..... ....E
 80483fc f029d031 f6c1f802 39c67316 89d789f6  .).1....9.s.....
 804840c ff14b28b 4df029f9 46c1f902 39ce89fa  ....M.).F...9...
 804841c 72ee83c4 0c5b5e5f c9c389f6 5589e557  r....[^_....U..W
 804842c 5653e800 0000005b 81c37111 00008d83  VS.....[..q.....
 804843c 20ffffff 8dbb20ff ffff29f8 c1f80283   ..... ...).....
 804844c ec0c8d70 ffeb0590 ff14b74e 83feff75  ...p.......N...u
 804845c f7e83a00 000083c4 0c5b5e5f c9c39090  ..:......[^_....
 804846c 5589e553 52bbc494 0408a1c4 940408eb  U..SR...........
 804847c 0a8d7600 83eb04ff d08b0383 f8ff75f4  ..v...........u.
 804848c 585bc9c3                             X[..            
Contents of section .my_section:
 8048490 e8abfeff ffe8a6fe ffff               ..........      
Contents of section .fini:
 804849c 5589e553 e8000000 005b81c3 ff100000  U..S.....[......
 80484ac 50e822fe ffff595b c9c3               P."...Y[..      
Contents of section .rodata:
 80484b8 03000000 01000200                    ........        
Contents of section .eh_frame:
 80484c0 00000000                             ....            
Contents of section .ctors:
 80494c4 ffffffff 00000000                    ........        
Contents of section .dtors:
 80494cc ffffffff 00000000                    ........        
Contents of section .jcr:
 80494d4 00000000                             ....            
Contents of section .dynamic:
 80494d8 01000000 24000000 0c000000 54820408  ....$.......T...
 80494e8 0d000000 9c840408 04000000 48810408  ............H...
 80494f8 05000000 c0810408 06000000 70810408  ............p...
 8049508 0a000000 59000000 0b000000 10000000  ....Y...........
 8049518 15000000 00000000 03000000 a4950408  ................
 8049528 02000000 08000000 14000000 11000000  ................
 8049538 17000000 4c820408 11000000 44820408  ....L.......D...
 8049548 12000000 08000000 13000000 08000000  ................
 8049558 feffff6f 24820408 ffffff6f 01000000  ...o$......o....
 8049568 f0ffff6f 1a820408 00000000 00000000  ...o............
 8049578 00000000 00000000 00000000 00000000  ................
 8049588 00000000 00000000 00000000 00000000  ................
 8049598 00000000 00000000                    ........        
Contents of section .got:
 80495a0 00000000                             ....            
Contents of section .got.plt:
 80495a4 d8940408 00000000 00000000 82820408  ................
Contents of section .data:
 80495b4 00000000 00000000 d0940408           ............    
Contents of section .stab:
 0000 01000000 00004700 3c040000 01000000  ......G.<.......
 0010 64000000 34830408 00000000 44000200  d...4.......D...
 0020 90840408 00000000 44000300 95840408  ........D.......
 0030 00000000 44000500 34830408 00000000  ....D...4.......
 0040 44000600 39830408 06000000 64000000  D...9.......d...
 0050 40830408 35000000 64000000 40830408  @...5...d...@...
 0060 3e000000 3c000000 00000000 4d000000  >...<.......M...
 0070 80000000 00000000 77000000 80000000  ........w.......
 0080 00000000 91000000 80000000 00000000  ................
 0090 c0000000 80000000 00000000 f8000000  ................
 00a0 80000000 00000000 35010000 80000000  ........5.......
 00b0 00000000 86010000 80000000 00000000  ................
 00c0 d7010000 80000000 00000000 02020000  ................
 00d0 80000000 00000000 31020000 80000000  ........1.......
 00e0 00000000 5b020000 80000000 00000000  ....[...........
 00f0 84020000 80000000 00000000 9e020000  ................
 0100 80000000 00000000 b9020000 80000000  ................
 0110 00000000 da020000 80000000 00000000  ................
 0120 13030000 80000000 00000000 31030000  ............1...
 0130 80000000 00000000 51030000 80000000  ........Q.......
 0140 00000000 76030000 80000000 00000000  ....v...........
 0150 8a030000 80000000 00000000 ab030000  ................
 0160 80000000 00000000 c2030000 24000300  ............$...
 0170 40830408 ce030000 a0000200 08000000  @...............
 0180 d7030000 a0000200 0c000000 00000000  ................
 0190 44000300 00000000 00000000 44000500  D...........D...
 01a0 06000000 00000000 44000600 10000000  ........D.......
 01b0 00000000 44000700 13000000 e0030000  ....D...........
 01c0 80000400 fcffffff 00000000 c0000000  ................
 01d0 00000000 00000000 e0000000 15000000  ................
 01e0 00000000 24000000 15000000 e8030000  ....$...........
 01f0 24000b00 55830408 f4030000 a0000a00  $...U...........
 0200 08000000 fd030000 a0000a00 0c000000  ................
 0210 00000000 44000b00 00000000 00000000  ....D...........
 0220 44000e00 06000000 00000000 44000f00  D...........D...
 0230 11000000 00000000 44001000 1a000000  ........D.......
 0240 00000000 44001100 2b000000 00000000  ....D...+.......
 0250 44001200 2e000000 06040000 80000c00  D...............
 0260 fcffffff 0e040000 80000c00 f8ffffff  ................
 0270 16040000 80000d00 f4ffffff 00000000  ................
 0280 c0000000 00000000 00000000 e0000000  ................
 0290 30000000 00000000 24000000 30000000  0.......$...0...
 02a0 20040000 24001600 85830408 00000000   ...$...........
 02b0 44001600 00000000 00000000 44001800  D...........D...
 02c0 1c000000 00000000 44001900 23000000  ........D...#...
 02d0 00000000 44001b00 2a000000 00000000  ....D...*.......
 02e0 44001c00 31000000 00000000 44001d00  D...1.......D...
 02f0 38000000 00000000 44001e00 49000000  8.......D...I...
 0300 00000000 44001f00 4c000000 2c040000  ....D...L...,...
 0310 80001800 fcffffff 34040000 80001900  ........4.......
 0320 f8ffffff 16040000 80001a00 f4ffffff  ................
 0330 00000000 c0000000 00000000 00000000  ................
 0340 e0000000 4e000000 00000000 24000000  ....N.......$...
 0350 4e000000 00000000 64000000 d3830408  N.......d.......
Contents of section .stabstr:
 0000 0073322e 73002f68 6f6d652f 71696e77  .s2.s./home/qinw
 0010 65692f47 4a323833 2f636f64 652f6275  ei/GJ283/code/bu
 0020 696c645f 6c696e75 782f6465 6275672d  ild_linux/debug-
 0030 6764622f 0074705f 6274312e 63006763  gdb/.tp_bt1.c.gc
 0040 63325f63 6f6d7069 6c65642e 00696e74  c2_compiled..int
 0050 3a742830 2c31293d 7228302c 31293b2d  :t(0,1)=r(0,1);-
 0060 32313437 34383336 34383b32 31343734  2147483648;21474
 0070 38333634 373b0063 6861723a 7428302c  83647;.char:t(0,
 0080 32293d72 28302c32 293b303b 3132373b  2)=r(0,2);0;127;
 0090 006c6f6e 6720696e 743a7428 302c3329  .long int:t(0,3)
 00a0 3d722830 2c33293b 2d323134 37343833  =r(0,3);-2147483
 00b0 3634383b 32313437 34383336 34373b00  648;2147483647;.
 00c0 756e7369 676e6564 20696e74 3a742830  unsigned int:t(0
 00d0 2c34293d 7228302c 34293b30 30303030  ,4)=r(0,4);00000
 00e0 30303030 30303030 3b303033 37373737  00000000;0037777
 00f0 37373737 37373b00 6c6f6e67 20756e73  777777;.long uns
 0100 69676e65 6420696e 743a7428 302c3529  igned int:t(0,5)
 0110 3d722830 2c35293b 30303030 30303030  =r(0,5);00000000
 0120 30303030 303b3030 33373737 37373737  00000;0037777777
 0130 3737373b 006c6f6e 67206c6f 6e672069  777;.long long i
 0140 6e743a74 28302c36 293d4073 36343b72  nt:t(0,6)=@s64;r
 0150 28302c36 293b3031 30303030 30303030  (0,6);0100000000
 0160 30303030 30303030 30303030 303b3037  0000000000000;07
 0170 37373737 37373737 37373737 37373737  7777777777777777
 0180 37373737 3b006c6f 6e67206c 6f6e6720  7777;.long long 
 0190 756e7369 676e6564 20696e74 3a742830  unsigned int:t(0
 01a0 2c37293d 40733634 3b722830 2c37293b  ,7)=@s64;r(0,7);
 01b0 30303030 30303030 30303030 303b3031  0000000000000;01
 01c0 37373737 37373737 37373737 37373737  7777777777777777
 01d0 37373737 373b0073 686f7274 20696e74  77777;.short int
 01e0 3a742830 2c38293d 40733136 3b722830  :t(0,8)=@s16;r(0
 01f0 2c38293b 2d333237 36383b33 32373637  ,8);-32768;32767
 0200 3b007368 6f727420 756e7369 676e6564  ;.short unsigned
 0210 20696e74 3a742830 2c39293d 40733136   int:t(0,9)=@s16
 0220 3b722830 2c39293b 303b3635 3533353b  ;r(0,9);0;65535;
 0230 00736967 6e656420 63686172 3a742830  .signed char:t(0
 0240 2c313029 3d407338 3b722830 2c313029  ,10)=@s8;r(0,10)
 0250 3b2d3132 383b3132 373b0075 6e736967  ;-128;127;.unsig
 0260 6e656420 63686172 3a742830 2c313129  ned char:t(0,11)
 0270 3d407338 3b722830 2c313129 3b303b32  =@s8;r(0,11);0;2
 0280 35353b00 666c6f61 743a7428 302c3132  55;.float:t(0,12
 0290 293d7228 302c3129 3b343b30 3b00646f  )=r(0,1);4;0;.do
 02a0 75626c65 3a742830 2c313329 3d722830  uble:t(0,13)=r(0
 02b0 2c31293b 383b303b 006c6f6e 6720646f  ,1);8;0;.long do
 02c0 75626c65 3a742830 2c313429 3d722830  uble:t(0,14)=r(0
 02d0 2c31293b 31323b30 3b00636f 6d706c65  ,1);12;0;.comple
 02e0 7820696e 743a7428 302c3135 293d7338  x int:t(0,15)=s8
 02f0 7265616c 3a28302c 31292c30 2c33323b  real:(0,1),0,32;
 0300 696d6167 3a28302c 31292c33 322c3332  imag:(0,1),32,32
 0310 3b3b0063 6f6d706c 65782066 6c6f6174  ;;.complex float
 0320 3a742830 2c313629 3d52333b 383b303b  :t(0,16)=R3;8;0;
 0330 00636f6d 706c6578 20646f75 626c653a  .complex double:
 0340 7428302c 3137293d 52333b31 363b303b  t(0,17)=R3;16;0;
 0350 00636f6d 706c6578 206c6f6e 6720646f  .complex long do
 0360 75626c65 3a742830 2c313829 3d52333b  uble:t(0,18)=R3;
 0370 32343b30 3b00766f 69643a74 28302c31  24;0;.void:t(0,1
 0380 39293d28 302c3139 29005f5f 6275696c  9)=(0,19).__buil
 0390 74696e5f 76615f6c 6973743a 7428302c  tin_va_list:t(0,
 03a0 3230293d 2a28302c 3229005f 426f6f6c  20)=*(0,2)._Bool
 03b0 3a742830 2c323129 3d407338 3b2d3136  :t(0,21)=@s8;-16
 03c0 3b006675 6e323a46 28302c31 2900783a  ;.fun2:F(0,1).x:
 03d0 7028302c 31290079 3a702830 2c312900  p(0,1).y:p(0,1).
 03e0 7a3a2830 2c312900 66756e31 3a462830  z:(0,1).fun1:F(0
 03f0 2c312900 6b3a7028 302c3129 006c3a70  ,1).k:p(0,1).l:p
 0400 28302c31 29006d3a 28302c31 29006e3a  (0,1).m:(0,1).n:
 0410 28302c31 29007265 743a2830 2c312900  (0,1).ret:(0,1).
 0420 6d61696e 3a462830 2c312900 693a2830  main:F(0,1).i:(0
 0430 2c312900 6a3a2830 2c312900           ,1).j:(0,1).    
Contents of section .comment:
 0000 00474343 3a202847 4e552920 332e342e  .GCC: (GNU) 3.4.
 0010 36203230 30363034 30342028 52656420  6 20060404 (Red 
 0020 48617420 332e342e 362d3229 00004743  Hat 3.4.6-2)..GC
 0030 433a2028 474e5529 20332e34 2e362032  C: (GNU) 3.4.6 2
 0040 30303630 34303420 28526564 20486174  0060404 (Red Hat
 0050 20332e34 2e362d32 29000047 43433a20   3.4.6-2)..GCC: 
 0060 28474e55 2920332e 342e3620 32303036  (GNU) 3.4.6 2006
 0070 30343034 20285265 64204861 7420332e  0404 (Red Hat 3.
 0080 342e362d 33290000 4743433a 2028474e  4.6-3)..GCC: (GN
 0090 55292033 2e342e36 20323030 36303430  U) 3.4.6 2006040
 00a0 34202852 65642048 61742033 2e342e36  4 (Red Hat 3.4.6
 00b0 2d332900 00474343 3a202847 4e552920  -3)..GCC: (GNU) 
 00c0 332e342e 36203230 30363034 30342028  3.4.6 20060404 (
 00d0 52656420 48617420 332e342e 362d3329  Red Hat 3.4.6-3)
 00e0 00004743 433a2028 474e5529 20332e34  ..GCC: (GNU) 3.4
 00f0 2e362032 30303630 34303420 28526564  .6 20060404 (Red
 0100 20486174 20332e34 2e362d32 2900       Hat 3.4.6-2).  
Disassembly of section .init:

08048254 <_init>:
 8048254:	55                   	push   %ebp
 8048255:	89 e5                	mov    %esp,%ebp
 8048257:	83 ec 08             	sub    $0x8,%esp
 804825a:	e8 51 00 00 00       	call   80482b0 <call_gmon_start>
 804825f:	e8 a4 00 00 00       	call   8048308 <frame_dummy>
 8048264:	e8 03 02 00 00       	call   804846c <__do_global_ctors_aux>
 8048269:	c9                   	leave  
 804826a:	c3                   	ret    
Disassembly of section .plt:

0804826c <__libc_start_main@plt-0x10>:
 804826c:	ff 35 a8 95 04 08    	pushl  0x80495a8
 8048272:	ff 25 ac 95 04 08    	jmp    *0x80495ac
 8048278:	00 00                	add    %al,(%eax)
	...

0804827c <__libc_start_main@plt>:
 804827c:	ff 25 b0 95 04 08    	jmp    *0x80495b0
 8048282:	68 00 00 00 00       	push   $0x0
 8048287:	e9 e0 ff ff ff       	jmp    804826c <_init+0x18>
Disassembly of section .text:

0804828c <_start>:
 804828c:	31 ed                	xor    %ebp,%ebp
 804828e:	5e                   	pop    %esi
 804828f:	89 e1                	mov    %esp,%ecx
 8048291:	83 e4 f0             	and    $0xfffffff0,%esp
 8048294:	50                   	push   %eax
 8048295:	54                   	push   %esp
 8048296:	52                   	push   %edx
 8048297:	68 28 84 04 08       	push   $0x8048428
 804829c:	68 d4 83 04 08       	push   $0x80483d4
 80482a1:	51                   	push   %ecx
 80482a2:	56                   	push   %esi
 80482a3:	68 85 83 04 08       	push   $0x8048385
 80482a8:	e8 cf ff ff ff       	call   804827c <__libc_start_main@plt>
 80482ad:	f4                   	hlt    
 80482ae:	90                   	nop    
 80482af:	90                   	nop    

080482b0 <call_gmon_start>:
 80482b0:	55                   	push   %ebp
 80482b1:	89 e5                	mov    %esp,%ebp
 80482b3:	53                   	push   %ebx
 80482b4:	e8 00 00 00 00       	call   80482b9 <call_gmon_start+0x9>
 80482b9:	5b                   	pop    %ebx
 80482ba:	81 c3 eb 12 00 00    	add    $0x12eb,%ebx
 80482c0:	52                   	push   %edx
 80482c1:	8b 83 fc ff ff ff    	mov    0xfffffffc(%ebx),%eax
 80482c7:	85 c0                	test   %eax,%eax
 80482c9:	74 02                	je     80482cd <call_gmon_start+0x1d>
 80482cb:	ff d0                	call   *%eax
 80482cd:	58                   	pop    %eax
 80482ce:	5b                   	pop    %ebx
 80482cf:	c9                   	leave  
 80482d0:	c3                   	ret    
 80482d1:	90                   	nop    
 80482d2:	90                   	nop    
 80482d3:	90                   	nop    

080482d4 <__do_global_dtors_aux>:
 80482d4:	55                   	push   %ebp
 80482d5:	89 e5                	mov    %esp,%ebp
 80482d7:	83 ec 08             	sub    $0x8,%esp
 80482da:	80 3d c0 95 04 08 00 	cmpb   $0x0,0x80495c0
 80482e1:	74 0f                	je     80482f2 <__do_global_dtors_aux+0x1e>
 80482e3:	eb 1f                	jmp    8048304 <__do_global_dtors_aux+0x30>
 80482e5:	8d 76 00             	lea    0x0(%esi),%esi
 80482e8:	83 c0 04             	add    $0x4,%eax
 80482eb:	a3 bc 95 04 08       	mov    %eax,0x80495bc
 80482f0:	ff d2                	call   *%edx
 80482f2:	a1 bc 95 04 08       	mov    0x80495bc,%eax
 80482f7:	8b 10                	mov    (%eax),%edx
 80482f9:	85 d2                	test   %edx,%edx
 80482fb:	75 eb                	jne    80482e8 <__do_global_dtors_aux+0x14>
 80482fd:	c6 05 c0 95 04 08 01 	movb   $0x1,0x80495c0
 8048304:	c9                   	leave  
 8048305:	c3                   	ret    
 8048306:	89 f6                	mov    %esi,%esi

08048308 <frame_dummy>:
 8048308:	55                   	push   %ebp
 8048309:	89 e5                	mov    %esp,%ebp
 804830b:	83 ec 08             	sub    $0x8,%esp
 804830e:	a1 d4 94 04 08       	mov    0x80494d4,%eax
 8048313:	85 c0                	test   %eax,%eax
 8048315:	74 19                	je     8048330 <frame_dummy+0x28>
 8048317:	b8 00 00 00 00       	mov    $0x0,%eax
 804831c:	85 c0                	test   %eax,%eax
 804831e:	74 10                	je     8048330 <frame_dummy+0x28>
 8048320:	83 ec 0c             	sub    $0xc,%esp
 8048323:	68 d4 94 04 08       	push   $0x80494d4
 8048328:	ff d0                	call   *%eax
 804832a:	83 c4 10             	add    $0x10,%esp
 804832d:	8d 76 00             	lea    0x0(%esi),%esi
 8048330:	c9                   	leave  
 8048331:	c3                   	ret    
 8048332:	90                   	nop    
 8048333:	90                   	nop    
 8048334:	e8 1c 00 00 00       	call   8048355 <fun1>
 8048339:	e8 17 00 00 00       	call   8048355 <fun1>
 804833e:	90                   	nop    
 804833f:	90                   	nop    

08048340 <fun2>:
 8048340:	55                   	push   %ebp
 8048341:	89 e5                	mov    %esp,%ebp
 8048343:	83 ec 04             	sub    $0x4,%esp
 8048346:	8b 45 08             	mov    0x8(%ebp),%eax
 8048349:	0f af 45 0c          	imul   0xc(%ebp),%eax
 804834d:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 8048350:	8b 45 fc             	mov    0xfffffffc(%ebp),%eax
 8048353:	c9                   	leave  
 8048354:	c3                   	ret    

08048355 <fun1>:
 8048355:	55                   	push   %ebp
 8048356:	89 e5                	mov    %esp,%ebp
 8048358:	83 ec 0c             	sub    $0xc,%esp
 804835b:	8b 55 0c             	mov    0xc(%ebp),%edx
 804835e:	8b 45 08             	mov    0x8(%ebp),%eax
 8048361:	29 d0                	sub    %edx,%eax
 8048363:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 8048366:	8b 45 0c             	mov    0xc(%ebp),%eax
 8048369:	03 45 08             	add    0x8(%ebp),%eax
 804836c:	89 45 f8             	mov    %eax,0xfffffff8(%ebp)
 804836f:	ff 75 f8             	pushl  0xfffffff8(%ebp)
 8048372:	ff 75 fc             	pushl  0xfffffffc(%ebp)
 8048375:	e8 c6 ff ff ff       	call   8048340 <fun2>
 804837a:	83 c4 08             	add    $0x8,%esp
 804837d:	89 45 f4             	mov    %eax,0xfffffff4(%ebp)
 8048380:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 8048383:	c9                   	leave  
 8048384:	c3                   	ret    

08048385 <main>:
 8048385:	55                   	push   %ebp
 8048386:	89 e5                	mov    %esp,%ebp
 8048388:	83 ec 18             	sub    $0x18,%esp
 804838b:	83 e4 f0             	and    $0xfffffff0,%esp
 804838e:	b8 00 00 00 00       	mov    $0x0,%eax
 8048393:	83 c0 0f             	add    $0xf,%eax
 8048396:	83 c0 0f             	add    $0xf,%eax
 8048399:	c1 e8 04             	shr    $0x4,%eax
 804839c:	c1 e0 04             	shl    $0x4,%eax
 804839f:	29 c4                	sub    %eax,%esp
 80483a1:	c7 45 fc c8 00 00 00 	movl   $0xc8,0xfffffffc(%ebp)
 80483a8:	c7 45 f8 64 00 00 00 	movl   $0x64,0xfffffff8(%ebp)
 80483af:	c7 45 fc 2c 01 00 00 	movl   $0x12c,0xfffffffc(%ebp)
 80483b6:	c7 45 f8 90 01 00 00 	movl   $0x190,0xfffffff8(%ebp)
 80483bd:	ff 75 f8             	pushl  0xfffffff8(%ebp)
 80483c0:	ff 75 fc             	pushl  0xfffffffc(%ebp)
 80483c3:	e8 8d ff ff ff       	call   8048355 <fun1>
 80483c8:	83 c4 08             	add    $0x8,%esp
 80483cb:	89 45 f4             	mov    %eax,0xfffffff4(%ebp)
 80483ce:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 80483d1:	c9                   	leave  
 80483d2:	c3                   	ret    
 80483d3:	90                   	nop    

080483d4 <__libc_csu_init>:
 80483d4:	55                   	push   %ebp
 80483d5:	89 e5                	mov    %esp,%ebp
 80483d7:	57                   	push   %edi
 80483d8:	56                   	push   %esi
 80483d9:	53                   	push   %ebx
 80483da:	83 ec 0c             	sub    $0xc,%esp
 80483dd:	e8 00 00 00 00       	call   80483e2 <__libc_csu_init+0xe>
 80483e2:	5b                   	pop    %ebx
 80483e3:	81 c3 c2 11 00 00    	add    $0x11c2,%ebx
 80483e9:	e8 66 fe ff ff       	call   8048254 <_init>
 80483ee:	8d 83 20 ff ff ff    	lea    0xffffff20(%ebx),%eax
 80483f4:	8d 93 20 ff ff ff    	lea    0xffffff20(%ebx),%edx
 80483fa:	89 45 f0             	mov    %eax,0xfffffff0(%ebp)
 80483fd:	29 d0                	sub    %edx,%eax
 80483ff:	31 f6                	xor    %esi,%esi
 8048401:	c1 f8 02             	sar    $0x2,%eax
 8048404:	39 c6                	cmp    %eax,%esi
 8048406:	73 16                	jae    804841e <__libc_csu_init+0x4a>
 8048408:	89 d7                	mov    %edx,%edi
 804840a:	89 f6                	mov    %esi,%esi
 804840c:	ff 14 b2             	call   *(%edx,%esi,4)
 804840f:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 8048412:	29 f9                	sub    %edi,%ecx
 8048414:	46                   	inc    %esi
 8048415:	c1 f9 02             	sar    $0x2,%ecx
 8048418:	39 ce                	cmp    %ecx,%esi
 804841a:	89 fa                	mov    %edi,%edx
 804841c:	72 ee                	jb     804840c <__libc_csu_init+0x38>
 804841e:	83 c4 0c             	add    $0xc,%esp
 8048421:	5b                   	pop    %ebx
 8048422:	5e                   	pop    %esi
 8048423:	5f                   	pop    %edi
 8048424:	c9                   	leave  
 8048425:	c3                   	ret    
 8048426:	89 f6                	mov    %esi,%esi

08048428 <__libc_csu_fini>:
 8048428:	55                   	push   %ebp
 8048429:	89 e5                	mov    %esp,%ebp
 804842b:	57                   	push   %edi
 804842c:	56                   	push   %esi
 804842d:	53                   	push   %ebx
 804842e:	e8 00 00 00 00       	call   8048433 <__libc_csu_fini+0xb>
 8048433:	5b                   	pop    %ebx
 8048434:	81 c3 71 11 00 00    	add    $0x1171,%ebx
 804843a:	8d 83 20 ff ff ff    	lea    0xffffff20(%ebx),%eax
 8048440:	8d bb 20 ff ff ff    	lea    0xffffff20(%ebx),%edi
 8048446:	29 f8                	sub    %edi,%eax
 8048448:	c1 f8 02             	sar    $0x2,%eax
 804844b:	83 ec 0c             	sub    $0xc,%esp
 804844e:	8d 70 ff             	lea    0xffffffff(%eax),%esi
 8048451:	eb 05                	jmp    8048458 <__libc_csu_fini+0x30>
 8048453:	90                   	nop    
 8048454:	ff 14 b7             	call   *(%edi,%esi,4)
 8048457:	4e                   	dec    %esi
 8048458:	83 fe ff             	cmp    $0xffffffff,%esi
 804845b:	75 f7                	jne    8048454 <__libc_csu_fini+0x2c>
 804845d:	e8 3a 00 00 00       	call   804849c <_fini>
 8048462:	83 c4 0c             	add    $0xc,%esp
 8048465:	5b                   	pop    %ebx
 8048466:	5e                   	pop    %esi
 8048467:	5f                   	pop    %edi
 8048468:	c9                   	leave  
 8048469:	c3                   	ret    
 804846a:	90                   	nop    
 804846b:	90                   	nop    

0804846c <__do_global_ctors_aux>:
 804846c:	55                   	push   %ebp
 804846d:	89 e5                	mov    %esp,%ebp
 804846f:	53                   	push   %ebx
 8048470:	52                   	push   %edx
 8048471:	bb c4 94 04 08       	mov    $0x80494c4,%ebx
 8048476:	a1 c4 94 04 08       	mov    0x80494c4,%eax
 804847b:	eb 0a                	jmp    8048487 <__do_global_ctors_aux+0x1b>
 804847d:	8d 76 00             	lea    0x0(%esi),%esi
 8048480:	83 eb 04             	sub    $0x4,%ebx
 8048483:	ff d0                	call   *%eax
 8048485:	8b 03                	mov    (%ebx),%eax
 8048487:	83 f8 ff             	cmp    $0xffffffff,%eax
 804848a:	75 f4                	jne    8048480 <__do_global_ctors_aux+0x14>
 804848c:	58                   	pop    %eax
 804848d:	5b                   	pop    %ebx
 804848e:	c9                   	leave  
 804848f:	c3                   	ret    
Disassembly of section .my_section:

08048490 <.my_section>:
 8048490:	e8 ab fe ff ff       	call   8048340 <fun2>
 8048495:	e8 a6 fe ff ff       	call   8048340 <fun2>
Disassembly of section .fini:

0804849c <_fini>:
 804849c:	55                   	push   %ebp
 804849d:	89 e5                	mov    %esp,%ebp
 804849f:	53                   	push   %ebx
 80484a0:	e8 00 00 00 00       	call   80484a5 <_fini+0x9>
 80484a5:	5b                   	pop    %ebx
 80484a6:	81 c3 ff 10 00 00    	add    $0x10ff,%ebx
 80484ac:	50                   	push   %eax
 80484ad:	e8 22 fe ff ff       	call   80482d4 <__do_global_dtors_aux>
 80484b2:	59                   	pop    %ecx
 80484b3:	5b                   	pop    %ebx
 80484b4:	c9                   	leave  
 80484b5:	c3                   	ret    

[-- Attachment #4: log2 --]
[-- Type: application/octet-stream, Size: 4406 bytes --]


t:     file format elf32-i386

Contents of .stab section:

Symnum n_type n_othr n_desc n_value  n_strx String

-1     HdrSym 0      71     0000043c 1     
0      SO     0      0      08048334 1      s2.s
1      SLINE  0      2      08048490 0      
2      SLINE  0      3      08048495 0      
3      SLINE  0      5      08048334 0      
4      SLINE  0      6      08048339 0      
5      SO     0      0      08048340 6      /home/qinwei/GJ283/code/build_linux/debug-gdb/
6      SO     0      0      08048340 53     tp_bt1.c
7      OPT    0      0      00000000 62     gcc2_compiled.
8      LSYM   0      0      00000000 77     int:t(0,1)=r(0,1);-2147483648;2147483647;
9      LSYM   0      0      00000000 119    char:t(0,2)=r(0,2);0;127;
10     LSYM   0      0      00000000 145    long int:t(0,3)=r(0,3);-2147483648;2147483647;
11     LSYM   0      0      00000000 192    unsigned int:t(0,4)=r(0,4);0000000000000;0037777777777;
12     LSYM   0      0      00000000 248    long unsigned int:t(0,5)=r(0,5);0000000000000;0037777777777;
13     LSYM   0      0      00000000 309    long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;
14     LSYM   0      0      00000000 390    long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;
15     LSYM   0      0      00000000 471    short int:t(0,8)=@s16;r(0,8);-32768;32767;
16     LSYM   0      0      00000000 514    short unsigned int:t(0,9)=@s16;r(0,9);0;65535;
17     LSYM   0      0      00000000 561    signed char:t(0,10)=@s8;r(0,10);-128;127;
18     LSYM   0      0      00000000 603    unsigned char:t(0,11)=@s8;r(0,11);0;255;
19     LSYM   0      0      00000000 644    float:t(0,12)=r(0,1);4;0;
20     LSYM   0      0      00000000 670    double:t(0,13)=r(0,1);8;0;
21     LSYM   0      0      00000000 697    long double:t(0,14)=r(0,1);12;0;
22     LSYM   0      0      00000000 730    complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;
23     LSYM   0      0      00000000 787    complex float:t(0,16)=R3;8;0;
24     LSYM   0      0      00000000 817    complex double:t(0,17)=R3;16;0;
25     LSYM   0      0      00000000 849    complex long double:t(0,18)=R3;24;0;
26     LSYM   0      0      00000000 886    void:t(0,19)=(0,19)
27     LSYM   0      0      00000000 906    __builtin_va_list:t(0,20)=*(0,2)
28     LSYM   0      0      00000000 939    _Bool:t(0,21)=@s8;-16;
29     FUN    0      3      08048340 962    fun2:F(0,1)
30     PSYM   0      2      00000008 974    x:p(0,1)
31     PSYM   0      2      0000000c 983    y:p(0,1)
32     SLINE  0      3      00000000 0      
33     SLINE  0      5      00000006 0      
34     SLINE  0      6      00000010 0      
35     SLINE  0      7      00000013 0      
36     LSYM   0      4      fffffffc 992    z:(0,1)
37     LBRAC  0      0      00000000 0      
38     RBRAC  0      0      00000015 0      
39     FUN    0      0      00000015 0      
40     FUN    0      11     08048355 1000   fun1:F(0,1)
41     PSYM   0      10     00000008 1012   k:p(0,1)
42     PSYM   0      10     0000000c 1021   l:p(0,1)
43     SLINE  0      11     00000000 0      
44     SLINE  0      14     00000006 0      
45     SLINE  0      15     00000011 0      
46     SLINE  0      16     0000001a 0      
47     SLINE  0      17     0000002b 0      
48     SLINE  0      18     0000002e 0      
49     LSYM   0      12     fffffffc 1030   m:(0,1)
50     LSYM   0      12     fffffff8 1038   n:(0,1)
51     LSYM   0      13     fffffff4 1046   ret:(0,1)
52     LBRAC  0      0      00000000 0      
53     RBRAC  0      0      00000030 0      
54     FUN    0      0      00000030 0      
55     FUN    0      22     08048385 1056   main:F(0,1)
56     SLINE  0      22     00000000 0      
57     SLINE  0      24     0000001c 0      
58     SLINE  0      25     00000023 0      
59     SLINE  0      27     0000002a 0      
60     SLINE  0      28     00000031 0      
61     SLINE  0      29     00000038 0      
62     SLINE  0      30     00000049 0      
63     SLINE  0      31     0000004c 0      
64     LSYM   0      24     fffffffc 1068   i:(0,1)
65     LSYM   0      25     fffffff8 1076   j:(0,1)
66     LSYM   0      26     fffffff4 1046   ret:(0,1)
67     LBRAC  0      0      00000000 0      
68     RBRAC  0      0      0000004e 0      
69     FUN    0      0      0000004e 0      
70     SO     0      0      080483d3 0      


[-- Attachment #5: s2.s --]
[-- Type: application/octet-stream, Size: 81 bytes --]

    .section .my_section,"ax"
	call	fun2
	call	fun2
	.text
	call	fun1
	call	fun1

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

* Re: How to avoid "but contains no code." in command "info line"?
  2007-03-27  4:08   ` qinwei
@ 2007-03-27 11:16     ` Daniel Jacobowitz
  2007-03-28  2:46       ` qinwei
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-03-27 11:16 UTC (permalink / raw)
  To: qinwei; +Cc: gdb

On Tue, Mar 27, 2007 at 12:08:26PM +0800, qinwei@sunnorth.com.cn wrote:
> Hi, I tested this on x86:
> 
> 1, compile & dump:
> gcc -o t -gstabs+ s2.s tp_bt1.c
> objdump -dhs t &>log1
> objdump -G t &>log2

You're using stabs.  Don't!  DWARF-2 works much better, especially for
strange ranges and multiple sections.  If it still happens with
DWARF-2 I can look into it, but I'm not interested in trying to fix
this for stabs.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: How to avoid "but contains no code." in command "info line"?
  2007-03-27 11:16     ` Daniel Jacobowitz
@ 2007-03-28  2:46       ` qinwei
  0 siblings, 0 replies; 5+ messages in thread
From: qinwei @ 2007-03-28  2:46 UTC (permalink / raw)
  To: gdb

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

> You're using stabs.  Don't!  DWARF-2 works much better, especially for
> strange ranges and multiple sections.  If it still happens with
> DWARF-2 I can look into it, but I'm not interested in trying to fix
> this for stabs.

Hi, using DWARF-2 also has the problem. I use gcc-3.4 and gcc-4.0

gcc -o t -gdwarf-2 s2.s tp_bt1.c
objdump -dhs t &>log1
readelf --debug-dump t &>log2

1934      ALL_SYMTABS (objfile, s)
(gdb) 
1936        bv = BLOCKVECTOR (s);
(gdb) 
1937        b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
(gdb) 
1939        if (BLOCK_START (b) <= pc
(gdb) p *b
$1 = {
  startaddr = 0, 
  endaddr = 0, 
  function = 0x0, 
  superblock = 0x0, 
  dict = 0xa3317b4, 
  language_specific = {
    cplus_specific = {
      namespace = 0x0
    }
  }, 
  gcc_compile_flag = 2 '\002'
}
(gdb) 

The section .debug_aranges contains:

  Length:                   36
  Version:                  2
  Offset into .debug_info:  0
  Pointer Size:             4
  Segment Size:             0

    Address  Length
    08048334 10
    080484b4 10


[-- Attachment #2: tp_bt1.c --]
[-- Type: application/octet-stream, Size: 305 bytes --]

int 
fun2 (int x, int y)
{
  int z;
  z = x * y;
  return z;
}

int 
fun1 (int k, int l)
{
  int m, n;
  int ret;
  m = k - l;
  n = k + l;
  ret = fun2 (m, n);
  return ret;
}

int
main (void)
{

   int i = 200;
   int j = 100;
   int ret;
   i = 300;
   j = 400;
   ret = fun1 (i, j);
   return ret;	
}

[-- Attachment #3: log1 --]
[-- Type: application/octet-stream, Size: 27333 bytes --]


t:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       00000013  08048114  08048114  00000114  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  08048128  08048128  00000128  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         00000028  08048148  08048148  00000148  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000050  08048170  08048170  00000170  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       00000059  080481c0  080481c0  000001c0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  0000000a  0804821a  0804821a  0000021a  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000020  08048224  08048224  00000224  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rel.dyn      00000008  08048244  08048244  00000244  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rel.plt      00000008  0804824c  0804824c  0000024c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         00000017  08048254  08048254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt          00000020  0804826c  0804826c  0000026c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .text         00000224  08048290  08048290  00000290  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .my_section   0000000a  080484b4  080484b4  000004b4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .fini         0000001a  080484c0  080484c0  000004c0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .rodata       00000008  080484dc  080484dc  000004dc  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame     00000004  080484e4  080484e4  000004e4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .ctors        00000008  080494e8  080494e8  000004e8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .dtors        00000008  080494f0  080494f0  000004f0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .jcr          00000004  080494f8  080494f8  000004f8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 19 .dynamic      000000c8  080494fc  080494fc  000004fc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .got          00000004  080495c4  080495c4  000005c4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 21 .got.plt      00000010  080495c8  080495c8  000005c8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 22 .data         0000000c  080495d8  080495d8  000005d8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 23 .bss          00000004  080495e4  080495e4  000005e4  2**2
                  ALLOC
 24 .comment      000000bd  00000000  00000000  000005e4  2**0
                  CONTENTS, READONLY
 25 .debug_aranges 00000048  00000000  00000000  000006a8  2**3
                  CONTENTS, READONLY, DEBUGGING
 26 .debug_pubnames 0000002d  00000000  00000000  000006f0  2**0
                  CONTENTS, READONLY, DEBUGGING
 27 .debug_info   00000197  00000000  00000000  0000071d  2**0
                  CONTENTS, READONLY, DEBUGGING
 28 .debug_abbrev 0000007d  00000000  00000000  000008b4  2**0
                  CONTENTS, READONLY, DEBUGGING
 29 .debug_line   00000085  00000000  00000000  00000931  2**0
                  CONTENTS, READONLY, DEBUGGING
 30 .debug_frame  0000005c  00000000  00000000  000009b8  2**2
                  CONTENTS, READONLY, DEBUGGING
Contents of section .interp:
 8048114 2f6c6962 2f6c642d 6c696e75 782e736f  /lib/ld-linux.so
 8048124 2e3200                               .2.             
Contents of section .note.ABI-tag:
 8048128 04000000 10000000 01000000 474e5500  ............GNU.
 8048138 00000000 02000000 02000000 05000000  ................
Contents of section .hash:
 8048148 03000000 05000000 04000000 01000000  ................
 8048158 02000000 00000000 00000000 00000000  ................
 8048168 00000000 03000000                    ........        
Contents of section .dynsym:
 8048170 00000000 00000000 00000000 00000000  ................
 8048180 3d000000 00000000 dd000000 12000000  =...............
 8048190 2e000000 e0840408 04000000 11000f00  ................
 80481a0 01000000 00000000 00000000 20000000  ............ ...
 80481b0 15000000 00000000 00000000 20000000  ............ ...
Contents of section .dynstr:
 80481c0 005f4a76 5f526567 69737465 72436c61  ._Jv_RegisterCla
 80481d0 73736573 005f5f67 6d6f6e5f 73746172  sses.__gmon_star
 80481e0 745f5f00 6c696263 2e736f2e 36005f49  t__.libc.so.6._I
 80481f0 4f5f7374 64696e5f 75736564 005f5f6c  O_stdin_used.__l
 8048200 6962635f 73746172 745f6d61 696e0047  ibc_start_main.G
 8048210 4c494243 5f322e30 00                 LIBC_2.0.       
Contents of section .gnu.version:
 804821a 00000200 01000000 0000               ..........      
Contents of section .gnu.version_r:
 8048224 01000100 24000000 10000000 00000000  ....$...........
 8048234 1069690d 00000200 4f000000 00000000  .ii.....O.......
Contents of section .rel.dyn:
 8048244 c4950408 06040000                    ........        
Contents of section .rel.plt:
 804824c d4950408 07010000                    ........        
Contents of section .init:
 8048254 5589e583 ec08e855 000000e8 ac000000  U......U........
 8048264 e8170200 00c9c3                      .......         
Contents of section .plt:
 804826c ff35cc95 0408ff25 d0950408 00000000  .5.....%........
 804827c ff25d495 04086800 000000e9 e0ffffff  .%....h.........
Contents of section .text:
 8048290 31ed5e89 e183e4f0 50545268 30840408  1.^.....PTRh0...
 80482a0 68dc8304 08515668 89830408 e8cbffff  h....QVh........
 80482b0 fff49090 5589e553 e8000000 005b81c3  ....U..S.....[..
 80482c0 0b130000 528b83fc ffffff85 c07402ff  ....R........t..
 80482d0 d0585bc9 c3909090 90909090 90909090  .X[.............
 80482e0 5589e583 ec08803d e4950408 00740ceb  U......=.....t..
 80482f0 1c83c004 a3e09504 08ffd2a1 e0950408  ................
 8048300 8b1085d2 75ebc605 e4950408 01c9c390  ....u...........
 8048310 5589e583 ec08a1f8 94040885 c07412b8  U............t..
 8048320 00000000 85c07409 c70424f8 940408ff  ......t...$.....
 8048330 d0c9c390 e81c0000 00e81700 00009090  ................
 8048340 5589e583 ec108b45 080faf45 0c8945fc  U......E...E..E.
 8048350 8b45fcc9 c35589e5 83ec188b 550c8b45  .E...U......U..E
 8048360 0829d089 45f48b45 0c034508 8945f88b  .)..E..E..E..E..
 8048370 45f88944 24048b45 f4890424 e8bfffff  E..D$..E...$....
 8048380 ff8945fc 8b45fcc9 c35589e5 83ec1883  ..E..E...U......
 8048390 e4f0b800 00000083 c00f83c0 0fc1e804  ................
 80483a0 c1e00429 c4c745f4 c8000000 c745f864  ...)..E......E.d
 80483b0 000000c7 45f42c01 0000c745 f8900100  ....E.,....E....
 80483c0 008b45f8 89442404 8b45f489 0424e882  ..E..D$..E...$..
 80483d0 ffffff89 45fc8b45 fcc9c390 5589e557  ....E..E....U..W
 80483e0 565383ec 0ce80000 00005b81 c3de1100  VS........[.....
 80483f0 00e85efe ffff8d83 20ffffff 8d9320ff  ..^..... ..... .
 8048400 ffff8945 f029d031 f6c1f802 39c67316  ...E.).1....9.s.
 8048410 89d789f6 ff14b28b 4df029f9 46c1f902  ........M.).F...
 8048420 39ce89fa 72ee83c4 0c5b5e5f c9c389f6  9...r....[^_....
 8048430 5589e557 5653e800 0000005b 81c38d11  U..WVS.....[....
 8048440 00008d83 20ffffff 8dbb20ff ffff29f8  .... ..... ...).
 8048450 c1f80283 ec0c8d70 ffeb0590 ff14b74e  .......p.......N
 8048460 83feff75 f7e85600 000083c4 0c5b5e5f  ...u..V......[^_
 8048470 c9c39090 90909090 90909090 90909090  ................
 8048480 5589e553 83ec04a1 e8940408 83f8ff74  U..S...........t
 8048490 1cbbe894 04088d76 008dbc27 00000000  .......v...'....
 80484a0 ffd08b43 fc83eb04 83f8ff75 f3585b5d  ...C.......u.X[]
 80484b0 c3909090                             ....            
Contents of section .my_section:
 80484b4 e887feff ffe882fe ffff               ..........      
Contents of section .fini:
 80484c0 5589e553 e8000000 005b81c3 ff100000  U..S.....[......
 80484d0 50e80afe ffff595b c9c3               P.....Y[..      
Contents of section .rodata:
 80484dc 03000000 01000200                    ........        
Contents of section .eh_frame:
 80484e4 00000000                             ....            
Contents of section .ctors:
 80494e8 ffffffff 00000000                    ........        
Contents of section .dtors:
 80494f0 ffffffff 00000000                    ........        
Contents of section .jcr:
 80494f8 00000000                             ....            
Contents of section .dynamic:
 80494fc 01000000 24000000 0c000000 54820408  ....$.......T...
 804950c 0d000000 c0840408 04000000 48810408  ............H...
 804951c 05000000 c0810408 06000000 70810408  ............p...
 804952c 0a000000 59000000 0b000000 10000000  ....Y...........
 804953c 15000000 00000000 03000000 c8950408  ................
 804954c 02000000 08000000 14000000 11000000  ................
 804955c 17000000 4c820408 11000000 44820408  ....L.......D...
 804956c 12000000 08000000 13000000 08000000  ................
 804957c feffff6f 24820408 ffffff6f 01000000  ...o$......o....
 804958c f0ffff6f 1a820408 00000000 00000000  ...o............
 804959c 00000000 00000000 00000000 00000000  ................
 80495ac 00000000 00000000 00000000 00000000  ................
 80495bc 00000000 00000000                    ........        
Contents of section .got:
 80495c4 00000000                             ....            
Contents of section .got.plt:
 80495c8 fc940408 00000000 00000000 82820408  ................
Contents of section .data:
 80495d8 00000000 00000000 f4940408           ............    
Contents of section .comment:
 0000 00474343 3a202847 4e552920 332e342e  .GCC: (GNU) 3.4.
 0010 36203230 30363034 30342028 52656420  6 20060404 (Red 
 0020 48617420 332e342e 362d3229 00004743  Hat 3.4.6-2)..GC
 0030 433a2028 474e5529 20332e34 2e362032  C: (GNU) 3.4.6 2
 0040 30303630 34303420 28526564 20486174  0060404 (Red Hat
 0050 20332e34 2e362d32 29000047 43433a20   3.4.6-2)..GCC: 
 0060 28474e55 2920342e 302e3200 00474343  (GNU) 4.0.2..GCC
 0070 3a202847 4e552920 342e302e 32000047  : (GNU) 4.0.2..G
 0080 43433a20 28474e55 2920342e 302e3200  CC: (GNU) 4.0.2.
 0090 00474343 3a202847 4e552920 332e342e  .GCC: (GNU) 3.4.
 00a0 36203230 30363034 30342028 52656420  6 20060404 (Red 
 00b0 48617420 332e342e 362d3229 00        Hat 3.4.6-2).   
Contents of section .debug_aranges:
 0000 24000000 02000000 00000400 00000000  $...............
 0010 34830408 0a000000 b4840408 0a000000  4...............
 0020 00000000 00000000 1c000000 02005800  ..............X.
 0030 00000400 00000000 40830408 9b000000  ........@.......
 0040 00000000 00000000                    ........        
Contents of section .debug_pubnames:
 0000 29000000 02005800 00003f01 00005c00  ).....X...?...\.
 0010 00006675 6e3200a4 00000066 756e3100  ..fun2.....fun1.
 0020 ff000000 6d61696e 00000000 00        ....main.....   
Contents of section .debug_info:
 0000 54000000 02000000 00000401 00000000  T...............
 0010 73322e73 002f686f 6d652f71 696e7765  s2.s./home/qinwe
 0020 692f474a 3238332f 636f6465 2f627569  i/GJ283/code/bui
 0030 6c645f6c 696e7578 2f646562 75672d67  ld_linux/debug-g
 0040 64620047 4e552041 5320322e 31352e39  db.GNU AS 2.15.9
 0050 322e302e 32000180 3b010000 02001000  2.0.2...;.......
 0060 00000401 3e000000 db830408 40830408  ....>.......@...
 0070 474e5520 4320342e 302e3200 0174705f  GNU C 4.0.2..tp_
 0080 6274312e 63002f68 6f6d652f 71696e77  bt1.c./home/qinw
 0090 65692f47 4a323833 2f636f64 652f6275  ei/GJ283/code/bu
 00a0 696c645f 6c696e75 782f6465 6275672d  ild_linux/debug-
 00b0 67646200 029d0000 00016675 6e320001  gdb.......fun2..
 00c0 03019d00 00004083 04085583 04080155  ......@...U....U
 00d0 03780001 029d0000 00027508 03790001  .x........u..y..
 00e0 029d0000 0002750c 047a0001 049d0000  ......u..z......
 00f0 0002757c 0005696e 74000405 02ff0000  ..u|..int.......
 0100 00016675 6e310001 0b019d00 00005583  ..fun1........U.
 0110 04088983 04080155 036b0001 0a9d0000  .......U.k......
 0120 00027508 036c0001 0a9d0000 0002750c  ..u..l........u.
 0130 046d0001 0c9d0000 00027574 046e0001  .m........ut.n..
 0140 0c9d0000 00027578 04726574 00010d9d  ......ux.ret....
 0150 00000002 757c0006 016d6169 6e000116  ....u|...main...
 0160 019d0000 00898304 08db8304 08015504  ..............U.
 0170 69000118 9d000000 02757404 6a000119  i........ut.j...
 0180 9d000000 02757804 72657400 011a9d00  .....ux.ret.....
 0190 00000275 7c0000                      ...u|..         
Contents of section .debug_abbrev:
 0000 01110010 0603081b 08250813 05000000  .........%......
 0010 01110110 06120111 01250813 0b03081b  .........%......
 0020 08000002 2e010113 3f0c0308 3a0b3b0b  ........?...:.;.
 0030 270c4913 11011201 400a0000 03050003  '.I.....@.......
 0040 083a0b3b 0b491302 0a000004 34000308  .:.;.I......4...
 0050 3a0b3b0b 4913020a 00000524 0003080b  :.;.I......$....
 0060 0b3e0b00 00062e01 3f0c0308 3a0b3b0b  .>......?...:.;.
 0070 270c4913 11011201 400a0000 00        '.I.....@....   
Contents of section .debug_line:
 0000 3a000000 02001800 00000101 fb0e0a00  :...............
 0010 01010101 00000001 0073322e 73000000  .........s2.s...
 0020 00000005 02348304 08135602 05000101  .....4....V.....
 0030 000502b4 84040810 56020500 01014300  ........V.....C.
 0040 00000200 1c000000 0101fb0e 0a000101  ................
 0050 01010000 00010074 705f6274 312e6300  .......tp_bt1.c.
 0060 00000000 00050240 83040811 659c3a2f  .......@....e.:/
 0070 66aa8e08 483a2f08 ab727372 7208483a  f...H:/..rsrr.H:
 0080 02020001 01                          .....           
Contents of section .debug_frame:
 0000 10000000 ffffffff 0100017c 080c0404  ...........|....
 0010 88010000 14000000 00000000 40830408  ............@...
 0020 15000000 410e0885 02420d05 14000000  ....A....B......
 0030 00000000 55830408 34000000 410e0885  ....U...4...A...
 0040 02420d05 14000000 00000000 89830408  .B..............
 0050 52000000 410e0885 02420d05           R...A....B..    
Disassembly of section .init:

08048254 <_init>:
 8048254:	55                   	push   %ebp
 8048255:	89 e5                	mov    %esp,%ebp
 8048257:	83 ec 08             	sub    $0x8,%esp
 804825a:	e8 55 00 00 00       	call   80482b4 <call_gmon_start>
 804825f:	e8 ac 00 00 00       	call   8048310 <frame_dummy>
 8048264:	e8 17 02 00 00       	call   8048480 <__do_global_ctors_aux>
 8048269:	c9                   	leave  
 804826a:	c3                   	ret    
Disassembly of section .plt:

0804826c <__libc_start_main@plt-0x10>:
 804826c:	ff 35 cc 95 04 08    	pushl  0x80495cc
 8048272:	ff 25 d0 95 04 08    	jmp    *0x80495d0
 8048278:	00 00                	add    %al,(%eax)
	...

0804827c <__libc_start_main@plt>:
 804827c:	ff 25 d4 95 04 08    	jmp    *0x80495d4
 8048282:	68 00 00 00 00       	push   $0x0
 8048287:	e9 e0 ff ff ff       	jmp    804826c <_init+0x18>
Disassembly of section .text:

08048290 <_start>:
 8048290:	31 ed                	xor    %ebp,%ebp
 8048292:	5e                   	pop    %esi
 8048293:	89 e1                	mov    %esp,%ecx
 8048295:	83 e4 f0             	and    $0xfffffff0,%esp
 8048298:	50                   	push   %eax
 8048299:	54                   	push   %esp
 804829a:	52                   	push   %edx
 804829b:	68 30 84 04 08       	push   $0x8048430
 80482a0:	68 dc 83 04 08       	push   $0x80483dc
 80482a5:	51                   	push   %ecx
 80482a6:	56                   	push   %esi
 80482a7:	68 89 83 04 08       	push   $0x8048389
 80482ac:	e8 cb ff ff ff       	call   804827c <__libc_start_main@plt>
 80482b1:	f4                   	hlt    
 80482b2:	90                   	nop    
 80482b3:	90                   	nop    

080482b4 <call_gmon_start>:
 80482b4:	55                   	push   %ebp
 80482b5:	89 e5                	mov    %esp,%ebp
 80482b7:	53                   	push   %ebx
 80482b8:	e8 00 00 00 00       	call   80482bd <call_gmon_start+0x9>
 80482bd:	5b                   	pop    %ebx
 80482be:	81 c3 0b 13 00 00    	add    $0x130b,%ebx
 80482c4:	52                   	push   %edx
 80482c5:	8b 83 fc ff ff ff    	mov    0xfffffffc(%ebx),%eax
 80482cb:	85 c0                	test   %eax,%eax
 80482cd:	74 02                	je     80482d1 <call_gmon_start+0x1d>
 80482cf:	ff d0                	call   *%eax
 80482d1:	58                   	pop    %eax
 80482d2:	5b                   	pop    %ebx
 80482d3:	c9                   	leave  
 80482d4:	c3                   	ret    
 80482d5:	90                   	nop    
 80482d6:	90                   	nop    
 80482d7:	90                   	nop    
 80482d8:	90                   	nop    
 80482d9:	90                   	nop    
 80482da:	90                   	nop    
 80482db:	90                   	nop    
 80482dc:	90                   	nop    
 80482dd:	90                   	nop    
 80482de:	90                   	nop    
 80482df:	90                   	nop    

080482e0 <__do_global_dtors_aux>:
 80482e0:	55                   	push   %ebp
 80482e1:	89 e5                	mov    %esp,%ebp
 80482e3:	83 ec 08             	sub    $0x8,%esp
 80482e6:	80 3d e4 95 04 08 00 	cmpb   $0x0,0x80495e4
 80482ed:	74 0c                	je     80482fb <__do_global_dtors_aux+0x1b>
 80482ef:	eb 1c                	jmp    804830d <__do_global_dtors_aux+0x2d>
 80482f1:	83 c0 04             	add    $0x4,%eax
 80482f4:	a3 e0 95 04 08       	mov    %eax,0x80495e0
 80482f9:	ff d2                	call   *%edx
 80482fb:	a1 e0 95 04 08       	mov    0x80495e0,%eax
 8048300:	8b 10                	mov    (%eax),%edx
 8048302:	85 d2                	test   %edx,%edx
 8048304:	75 eb                	jne    80482f1 <__do_global_dtors_aux+0x11>
 8048306:	c6 05 e4 95 04 08 01 	movb   $0x1,0x80495e4
 804830d:	c9                   	leave  
 804830e:	c3                   	ret    
 804830f:	90                   	nop    

08048310 <frame_dummy>:
 8048310:	55                   	push   %ebp
 8048311:	89 e5                	mov    %esp,%ebp
 8048313:	83 ec 08             	sub    $0x8,%esp
 8048316:	a1 f8 94 04 08       	mov    0x80494f8,%eax
 804831b:	85 c0                	test   %eax,%eax
 804831d:	74 12                	je     8048331 <frame_dummy+0x21>
 804831f:	b8 00 00 00 00       	mov    $0x0,%eax
 8048324:	85 c0                	test   %eax,%eax
 8048326:	74 09                	je     8048331 <frame_dummy+0x21>
 8048328:	c7 04 24 f8 94 04 08 	movl   $0x80494f8,(%esp)
 804832f:	ff d0                	call   *%eax
 8048331:	c9                   	leave  
 8048332:	c3                   	ret    
 8048333:	90                   	nop    
 8048334:	e8 1c 00 00 00       	call   8048355 <fun1>
 8048339:	e8 17 00 00 00       	call   8048355 <fun1>
 804833e:	90                   	nop    
 804833f:	90                   	nop    

08048340 <fun2>:
 8048340:	55                   	push   %ebp
 8048341:	89 e5                	mov    %esp,%ebp
 8048343:	83 ec 10             	sub    $0x10,%esp
 8048346:	8b 45 08             	mov    0x8(%ebp),%eax
 8048349:	0f af 45 0c          	imul   0xc(%ebp),%eax
 804834d:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 8048350:	8b 45 fc             	mov    0xfffffffc(%ebp),%eax
 8048353:	c9                   	leave  
 8048354:	c3                   	ret    

08048355 <fun1>:
 8048355:	55                   	push   %ebp
 8048356:	89 e5                	mov    %esp,%ebp
 8048358:	83 ec 18             	sub    $0x18,%esp
 804835b:	8b 55 0c             	mov    0xc(%ebp),%edx
 804835e:	8b 45 08             	mov    0x8(%ebp),%eax
 8048361:	29 d0                	sub    %edx,%eax
 8048363:	89 45 f4             	mov    %eax,0xfffffff4(%ebp)
 8048366:	8b 45 0c             	mov    0xc(%ebp),%eax
 8048369:	03 45 08             	add    0x8(%ebp),%eax
 804836c:	89 45 f8             	mov    %eax,0xfffffff8(%ebp)
 804836f:	8b 45 f8             	mov    0xfffffff8(%ebp),%eax
 8048372:	89 44 24 04          	mov    %eax,0x4(%esp)
 8048376:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 8048379:	89 04 24             	mov    %eax,(%esp)
 804837c:	e8 bf ff ff ff       	call   8048340 <fun2>
 8048381:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 8048384:	8b 45 fc             	mov    0xfffffffc(%ebp),%eax
 8048387:	c9                   	leave  
 8048388:	c3                   	ret    

08048389 <main>:
 8048389:	55                   	push   %ebp
 804838a:	89 e5                	mov    %esp,%ebp
 804838c:	83 ec 18             	sub    $0x18,%esp
 804838f:	83 e4 f0             	and    $0xfffffff0,%esp
 8048392:	b8 00 00 00 00       	mov    $0x0,%eax
 8048397:	83 c0 0f             	add    $0xf,%eax
 804839a:	83 c0 0f             	add    $0xf,%eax
 804839d:	c1 e8 04             	shr    $0x4,%eax
 80483a0:	c1 e0 04             	shl    $0x4,%eax
 80483a3:	29 c4                	sub    %eax,%esp
 80483a5:	c7 45 f4 c8 00 00 00 	movl   $0xc8,0xfffffff4(%ebp)
 80483ac:	c7 45 f8 64 00 00 00 	movl   $0x64,0xfffffff8(%ebp)
 80483b3:	c7 45 f4 2c 01 00 00 	movl   $0x12c,0xfffffff4(%ebp)
 80483ba:	c7 45 f8 90 01 00 00 	movl   $0x190,0xfffffff8(%ebp)
 80483c1:	8b 45 f8             	mov    0xfffffff8(%ebp),%eax
 80483c4:	89 44 24 04          	mov    %eax,0x4(%esp)
 80483c8:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 80483cb:	89 04 24             	mov    %eax,(%esp)
 80483ce:	e8 82 ff ff ff       	call   8048355 <fun1>
 80483d3:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 80483d6:	8b 45 fc             	mov    0xfffffffc(%ebp),%eax
 80483d9:	c9                   	leave  
 80483da:	c3                   	ret    
 80483db:	90                   	nop    

080483dc <__libc_csu_init>:
 80483dc:	55                   	push   %ebp
 80483dd:	89 e5                	mov    %esp,%ebp
 80483df:	57                   	push   %edi
 80483e0:	56                   	push   %esi
 80483e1:	53                   	push   %ebx
 80483e2:	83 ec 0c             	sub    $0xc,%esp
 80483e5:	e8 00 00 00 00       	call   80483ea <__libc_csu_init+0xe>
 80483ea:	5b                   	pop    %ebx
 80483eb:	81 c3 de 11 00 00    	add    $0x11de,%ebx
 80483f1:	e8 5e fe ff ff       	call   8048254 <_init>
 80483f6:	8d 83 20 ff ff ff    	lea    0xffffff20(%ebx),%eax
 80483fc:	8d 93 20 ff ff ff    	lea    0xffffff20(%ebx),%edx
 8048402:	89 45 f0             	mov    %eax,0xfffffff0(%ebp)
 8048405:	29 d0                	sub    %edx,%eax
 8048407:	31 f6                	xor    %esi,%esi
 8048409:	c1 f8 02             	sar    $0x2,%eax
 804840c:	39 c6                	cmp    %eax,%esi
 804840e:	73 16                	jae    8048426 <__libc_csu_init+0x4a>
 8048410:	89 d7                	mov    %edx,%edi
 8048412:	89 f6                	mov    %esi,%esi
 8048414:	ff 14 b2             	call   *(%edx,%esi,4)
 8048417:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 804841a:	29 f9                	sub    %edi,%ecx
 804841c:	46                   	inc    %esi
 804841d:	c1 f9 02             	sar    $0x2,%ecx
 8048420:	39 ce                	cmp    %ecx,%esi
 8048422:	89 fa                	mov    %edi,%edx
 8048424:	72 ee                	jb     8048414 <__libc_csu_init+0x38>
 8048426:	83 c4 0c             	add    $0xc,%esp
 8048429:	5b                   	pop    %ebx
 804842a:	5e                   	pop    %esi
 804842b:	5f                   	pop    %edi
 804842c:	c9                   	leave  
 804842d:	c3                   	ret    
 804842e:	89 f6                	mov    %esi,%esi

08048430 <__libc_csu_fini>:
 8048430:	55                   	push   %ebp
 8048431:	89 e5                	mov    %esp,%ebp
 8048433:	57                   	push   %edi
 8048434:	56                   	push   %esi
 8048435:	53                   	push   %ebx
 8048436:	e8 00 00 00 00       	call   804843b <__libc_csu_fini+0xb>
 804843b:	5b                   	pop    %ebx
 804843c:	81 c3 8d 11 00 00    	add    $0x118d,%ebx
 8048442:	8d 83 20 ff ff ff    	lea    0xffffff20(%ebx),%eax
 8048448:	8d bb 20 ff ff ff    	lea    0xffffff20(%ebx),%edi
 804844e:	29 f8                	sub    %edi,%eax
 8048450:	c1 f8 02             	sar    $0x2,%eax
 8048453:	83 ec 0c             	sub    $0xc,%esp
 8048456:	8d 70 ff             	lea    0xffffffff(%eax),%esi
 8048459:	eb 05                	jmp    8048460 <__libc_csu_fini+0x30>
 804845b:	90                   	nop    
 804845c:	ff 14 b7             	call   *(%edi,%esi,4)
 804845f:	4e                   	dec    %esi
 8048460:	83 fe ff             	cmp    $0xffffffff,%esi
 8048463:	75 f7                	jne    804845c <__libc_csu_fini+0x2c>
 8048465:	e8 56 00 00 00       	call   80484c0 <_fini>
 804846a:	83 c4 0c             	add    $0xc,%esp
 804846d:	5b                   	pop    %ebx
 804846e:	5e                   	pop    %esi
 804846f:	5f                   	pop    %edi
 8048470:	c9                   	leave  
 8048471:	c3                   	ret    
 8048472:	90                   	nop    
 8048473:	90                   	nop    
 8048474:	90                   	nop    
 8048475:	90                   	nop    
 8048476:	90                   	nop    
 8048477:	90                   	nop    
 8048478:	90                   	nop    
 8048479:	90                   	nop    
 804847a:	90                   	nop    
 804847b:	90                   	nop    
 804847c:	90                   	nop    
 804847d:	90                   	nop    
 804847e:	90                   	nop    
 804847f:	90                   	nop    

08048480 <__do_global_ctors_aux>:
 8048480:	55                   	push   %ebp
 8048481:	89 e5                	mov    %esp,%ebp
 8048483:	53                   	push   %ebx
 8048484:	83 ec 04             	sub    $0x4,%esp
 8048487:	a1 e8 94 04 08       	mov    0x80494e8,%eax
 804848c:	83 f8 ff             	cmp    $0xffffffff,%eax
 804848f:	74 1c                	je     80484ad <__do_global_ctors_aux+0x2d>
 8048491:	bb e8 94 04 08       	mov    $0x80494e8,%ebx
 8048496:	8d 76 00             	lea    0x0(%esi),%esi
 8048499:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
 80484a0:	ff d0                	call   *%eax
 80484a2:	8b 43 fc             	mov    0xfffffffc(%ebx),%eax
 80484a5:	83 eb 04             	sub    $0x4,%ebx
 80484a8:	83 f8 ff             	cmp    $0xffffffff,%eax
 80484ab:	75 f3                	jne    80484a0 <__do_global_ctors_aux+0x20>
 80484ad:	58                   	pop    %eax
 80484ae:	5b                   	pop    %ebx
 80484af:	5d                   	pop    %ebp
 80484b0:	c3                   	ret    
 80484b1:	90                   	nop    
 80484b2:	90                   	nop    
 80484b3:	90                   	nop    
Disassembly of section .my_section:

080484b4 <.my_section>:
 80484b4:	e8 87 fe ff ff       	call   8048340 <fun2>
 80484b9:	e8 82 fe ff ff       	call   8048340 <fun2>
Disassembly of section .fini:

080484c0 <_fini>:
 80484c0:	55                   	push   %ebp
 80484c1:	89 e5                	mov    %esp,%ebp
 80484c3:	53                   	push   %ebx
 80484c4:	e8 00 00 00 00       	call   80484c9 <_fini+0x9>
 80484c9:	5b                   	pop    %ebx
 80484ca:	81 c3 ff 10 00 00    	add    $0x10ff,%ebx
 80484d0:	50                   	push   %eax
 80484d1:	e8 0a fe ff ff       	call   80482e0 <__do_global_dtors_aux>
 80484d6:	59                   	pop    %ecx
 80484d7:	5b                   	pop    %ebx
 80484d8:	c9                   	leave  
 80484d9:	c3                   	ret    

[-- Attachment #4: log2 --]
[-- Type: application/octet-stream, Size: 4406 bytes --]

The section .debug_aranges contains:

  Length:                   36
  Version:                  2
  Offset into .debug_info:  0
  Pointer Size:             4
  Segment Size:             0

    Address  Length
    08048334 10
    080484b4 10
  Length:                   28
  Version:                  2
  Offset into .debug_info:  58
  Pointer Size:             4
  Segment Size:             0

    Address  Length
    08048340 155

Contents of the .debug_pubnames section:

  Length:                              41
  Version:                             2
  Offset into .debug_info section:     88
  Size of area in .debug_info section: 319

    Offset	Name
    92    		fun2
    164   		fun1
    255   		main

The section .debug_info contains:

  Compilation Unit @ 0:
   Length:        84
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0	
     DW_AT_name        : s2.s	
     DW_AT_comp_dir    : /home/qinwei/GJ283/code/build_linux/debug-gdb	
     DW_AT_producer    : GNU AS 2.15.92.0.2	
     DW_AT_language    : 32769	(MIPS assembler)
  Compilation Unit @ 58:
   Length:        315
   Version:       2
   Abbrev Offset: 16
   Pointer Size:  4
 <0><63>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 62	
     DW_AT_high_pc     : 0x80483db	
     DW_AT_low_pc      : 0x8048340	
     DW_AT_producer    : GNU C 4.0.2	
     DW_AT_language    : 1	(ANSI C)
     DW_AT_name        : tp_bt1.c	
     DW_AT_comp_dir    : /home/qinwei/GJ283/code/build_linux/debug-gdb	
 <1><b4>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_sibling     : <f5>	
     DW_AT_external    : 1	
     DW_AT_name        : fun2	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 3	
     DW_AT_prototyped  : 1	
     DW_AT_type        : <f5>	
     DW_AT_low_pc      : 0x8048340	
     DW_AT_high_pc     : 0x8048355	
     DW_AT_frame_base  : 1 byte block: 55 	(DW_OP_reg5)
 <2><d0>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : x	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 2	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 8 	(DW_OP_breg5: 8)
 <2><dc>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : y	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 2	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 c 	(DW_OP_breg5: 12)
 <2><e8>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : z	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 4	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 7c 	(DW_OP_breg5: -4)
 <1><f5>: Abbrev Number: 5 (DW_TAG_base_type)
     DW_AT_name        : int	
     DW_AT_byte_size   : 4	
     DW_AT_encoding    : 5	(signed)
 <1><fc>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_sibling     : <157>	
     DW_AT_external    : 1	
     DW_AT_name        : fun1	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 11	
     DW_AT_prototyped  : 1	
     DW_AT_type        : <f5>	
     DW_AT_low_pc      : 0x8048355	
     DW_AT_high_pc     : 0x8048389	
     DW_AT_frame_base  : 1 byte block: 55 	(DW_OP_reg5)
 <2><118>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : k	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 10	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 8 	(DW_OP_breg5: 8)
 <2><124>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : l	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 10	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 c 	(DW_OP_breg5: 12)
 <2><130>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : m	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 12	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 74 	(DW_OP_breg5: -12)
 <2><13c>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : n	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 12	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 78 	(DW_OP_breg5: -8)
 <2><148>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : ret	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 13	
     DW_AT_type        : <f5>	
     DW_AT_location    : 2 byte block: 75 7c 	(DW_OP_breg5: -4)
 <1><157>: Abbrev Number: 6 (DW_TAG_subprogram)
     DW_AT_external    : 1	
     DW_AT_name        : main	
   

[-- Attachment #5: s2.s --]
[-- Type: application/octet-stream, Size: 81 bytes --]

    .section .my_section,"ax"
	call	fun2
	call	fun2
	.text
	call	fun1
	call	fun1

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

end of thread, other threads:[~2007-03-28  2:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-23  7:22 How to avoid "but contains no code." in command "info line"? qinwei
2007-03-23 11:58 ` Daniel Jacobowitz
2007-03-27  4:08   ` qinwei
2007-03-27 11:16     ` Daniel Jacobowitz
2007-03-28  2:46       ` qinwei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox