On 9/15/05, Marcus Crestani <crestani(a)informatik.uni-tuebingen.de> wrote:
thanks for your investigation, I could use more of it on that bug.
>>>>>"AM" == Alexey Mahotkin <squadette(a)gmail.com>
writes:
AM> #0 0x081b1e9d in set_lookup_table (ptr=0xb7a4a800, ph=0x83fb6b0)
AM> at mc-alloc.c:533
AM> 533 LEVEL2 (l2, L2_INDEX (ptr)) = ph;
AM> (gdb) print l2
AM> $1 = (struct level_2_lookup_tree *) 0x3
This is probably a memory corruption bug, debugging these is a real
pain in the ass... However, you should be able to set a watchpoint on
this slot of the lookup table and see what writes the 0x3 to it.
Something like this should work:
First, figure out the address of the lookup table slot:
(gdb) print &mc_allocator_globals.ptr_lookup_table[l1_index]
$1 = (level_2_lookup_tree **) 0xXXXXXXXX
#0 0x081b1e8f in set_lookup_table (ptr=0xb7a4a800, ph=0x83fb6b0)
at mc-alloc.c:531
531 LEVEL2 (l2, L2_INDEX (ptr)) = ph;
(gdb) print &mc_allocator_globals.ptr_lookup_table[l1_index]
$1 = (struct level_2_lookup_tree **) 0x83c6b7c
(gdb) watch *$1
Hardware watchpoint 1: *$1
(gdb) run
Starting program: /home/alexm/src/xemacs-21.5.21/src/xemacs
Hardware watchpoint 1: *$1
---Type <return> to continue, or q <return> to quit---
Old value = (struct level_2_lookup_tree *) 0x0
New value = (struct level_2_lookup_tree *) 0x3
init_mc_allocator () at mc-alloc.c:1734
1734 PLH_FIRST (plh) = 0;
(gdb) bt
#0 init_mc_allocator () at mc-alloc.c:1734
#1 0x080daaaf in xemacs_21_5_b21_i686_pc_linux (argc=1, argv=0xbffff584,
unused_envp=0x0, restart=0) at emacs.c:921
#2 0x080dc507 in main (argc=1, argv=0xbffff584, unused_envp=0xbffff58c)
at emacs.c:3064
#3 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
I think this could also be helpful:
(gdb) print i
$2 = 2
(gdb) print plh
$3 = (struct page_list_header *) 0x83c6b78
(gdb) print *plh
$4 = {list_type = FREE_LIST, size = 3, first = 0x0, last = 0x0,
mark_bit_free_list = 0x0, page_count = 0, used_cells = 0, used_space = 0,
total_cells = 0, total_space = 0}
--alexm