On 25 November 2010 12:33, marius zbihlei <marius.zbihlei@1and1.ro> wrote:
On 11/25/2010 01:31 PM, dotnetdub wrote:

There are 36 section headers, starting at offset 0x17b34:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .hash             HASH            000000b4 0000b4 000498 04   A  3   0  4
  [ 2] .gnu.hash         GNU_HASH        0000054c 00054c 0002d8 04   A  3   0  4
  [ 3] .dynsym           DYNSYM          00000824 000824 000650 10   A  4   1  4
  [ 4] .dynstr           STRTAB          00000e74 000e74 000581 00   A  0   0  1
  [ 5] .gnu.version      VERSYM          000013f6 0013f6 0000ca 02   A  3   0  2
  [ 6] .gnu.version_r    VERNEED         000014c0 0014c0 000030 00   A  4   1  4
  [ 7] .rel.dyn          REL             000014f0 0014f0 0001d0 08   A  3   0  4
  [ 8] .rel.plt          REL             000016c0 0016c0 000210 08   A  3  10  4
  [ 9] .init             PROGBITS        000018d0 0018d0 000030 00  AX  0   0  4
  [10] .plt              PROGBITS        00001900 001900 000430 04  AX  0   0  4
  [11] .text             PROGBITS        00001d30 001d30 0080d8 00  AX  0   0 16
  [12] .fini             PROGBITS        00009e08 009e08 00001c 00  AX  0   0  4
  [13] .rodata           PROGBITS        00009e24 009e24 001618 01 AMS  0   0  4
  [14] .eh_frame         PROGBITS        0000b43c 00b43c 000004 00   A  0   0  4
  [15] .ctors            PROGBITS        0000c440 00b440 000008 00  WA  0   0  4
  [16] .dtors            PROGBITS        0000c448 00b448 000008 00  WA  0   0  4
  [17] .jcr              PROGBITS        0000c450 00b450 000004 00  WA  0   0  4
  [18] .dynamic          DYNAMIC         0000c454 00b454 0000c8 08  WA  4   0  4
  [19] .got              PROGBITS        0000c51c 00b51c 00006c 04  WA  0   0  4
  [20] .got.plt          PROGBITS        0000c588 00b588 000114 04  WA  0   0  4
  [21] .data             PROGBITS        0000c6a0 00b6a0 00012c 00  WA  0   0 32
  [22] .bss              NOBITS          0000c7e0 00b7cc 0004a0 00  WA  0   0 32
  [23] .comment          PROGBITS        00000000 00b7cc 0000d9 00      0   0  1
  [24] .debug_aranges    PROGBITS        00000000 00b8a8 0000b0 00      0   0  8
  [25] .debug_pubnames   PROGBITS        00000000 00b958 000448 00      0   0  1
  [26] .debug_info       PROGBITS        00000000 00bda0 005dd1 00      0   0  1
  [27] .debug_abbrev     PROGBITS        00000000 011b71 0007a8 00      0   0  1
  [28] .debug_line       PROGBITS        00000000 012319 0014b9 00      0   0  1
  [29] .debug_frame      PROGBITS        00000000 0137d4 0004b0 00      0   0  4
  [30] .debug_str        PROGBITS        00000000 013c84 001d76 01  MS  0   0  1
  [31] .debug_loc        PROGBITS        00000000 0159fa 001ebe 00      0   0  1
  [32] .debug_ranges     PROGBITS        00000000 0178b8 000140 00      0   0  8
  [33] .shstrtab         STRTAB          00000000 0179f8 00013b 00      0   0  1
  [34] .symtab           SYMTAB          00000000 0180d4 0009e0 10     35  58  4
  [35] .strtab           STRTAB          00000000 018ab4 0006ec 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)


 
in the gdb console load the topoh.so


add-symbol-file /path/to/topoh.so 0xb7004000 + 0x<offset of .text segment found as above>


Ok.

Hello

Did you give gdb the command
add-symbol-file /path/to/topoh.so 0xb7004000+0x00001d30





 

Gdb should inquire you if you want to lead topoh.so at offset 0xb7005d30 (press 'y'). Then the IP should not be out of bounds ... it should be mapped to the topoh.so text segment. Ah, I have made a mistake, there should be no spaces between the address and the offset (as seen above)

Anyway you should get something like this (on my machine - on your use the offsets from above)
(gdb) add-symbol-file modules/topoh/topoh.so 0xb7004000+0x00001d80
add symbol table from file "modules/topoh/topoh.so" at
        .text_addr = 0xb7005d80
(y or n) y
Reading symbols from /home/marius/dev/sip-router/modules/topoh/topoh.so...done.

Then
(gdb) x/s 0xb70070d9
!!!!!!!!!!!!!!!!!!0xb70070d9 <th_get_hdr_cookie+25>:       <Address 0xb70070d9 out of bounds>!!!!!!!!!!!!!!!!!

The line between all the !!!!!! is the line I care about


Also don't forget
(gdb)info registers

Thank you
Marius

Hi Marius,

I hope this is what your after!

(gdb) add-symbol-file /lib/kamailio/modules/topoh.so 0xb7004000+0x00001d30
add symbol table from file "/lib/kamailio/modules/topoh.so" at
.text_addr = 0xb7005d30
(y or n) y
Reading symbols from /lib/kamailio/modules/topoh.so...done.
(gdb) x/s 0xb70070d9
0xb70070d9 <th_skip_msg+9>: <Address 0xb70070d9 out of bounds>
(gdb) info registers 
eax            0xbf916160 -1080991392
ecx            0x0 0
edx            0x2 2
ebx            0xb7010588 -1224669816
esp            0xbf916118 0xbf916118
ebp            0xbf916118 0xbf916118
esi            0xbf916160 -1080991392
edi            0x82500c0 136642752
eip            0xb70070d9 0xb70070d9 <th_skip_msg+9>
eflags         0x10246 [ PF ZF IF RF ]
cs             0x73 115
ss             0x7b 123
ds             0x7b 123
es             0x7b 123
fs             0x0 0
gs             0x33 51


Thanks
Brian