Joshua Gatcomb wrote:
I am not sure where to go from here. Any suggestions?

Ok, here is a sample debugging session:

$ cat hello.pasm
  print "hello\n"
  end

$ parrot hello.pasm
hello

$ gdb parrot
...
(gdb) b new_pmc_header
(gdb) r hello.pasm
Breakpoint 1, new_pmc_header (interpreter=0x82e5668, flags=1024)
    at src/headers.c:244
244         pool = flags & PObj_constant_FLAG ?
(gdb) n
(gdb) n
249         if (flags & PObj_is_PMC_EXT_FLAG) {
(gdb) p *pool
...
(gdb) p *pool->last_Arena
...
(gdb) n
251             *((Dead_PObj*)pmc)->arena_dod_flag_ptr |=
(gdb) n
256             pmc->pmc_ext = new_pmc_ext(interpreter);
(gdb)

When it passes the first few times without problems then you could disable
the breakpoint:

(gdb) dis 1

and continue until the program fails:

(gdb) c

Then (p)rint again *pool, pmc, *pmc, *pool->last_Arena.

PMCs are taken from the free_list which points to the end of the arena:

(gdb) p pmc
$9 = (PMC *) 0x40b0c018
(gdb) c
(gdb) n
(gdb) n
(gdb) p pmc

the next one is at old - 0x18:

$10 = (PMC *) 0x40b0c000
(gdb) p sizeof(PMC)
$11 = 24
(gdb) p /x sizeof(PMC)
$12 = 0x18
(gdb)

(gdb) p *pool
$15 = {last_Arena = 0x40b00000, object_size = 24,
  objects_per_alloc = 21843, total_objects = 2048, num_free_objects = 2046,
  skip = 0, replenish_level = 614, free_list = 0x40b0bfe8 ...

(gdb) p *(PMC*)pool->free_list
...

(gdb) p *(Dead_PObj*)pmc
$17 = {free_list_ptr = 0x40b0bfe8, object_buflen_dont_use = 0,
  object_flags_dont_use = 0, arena_dod_flag_ptr = 0x82f0f04,
  flag_shift = 24}

The arena_dod_flag_ptr must point somewhere into arena->dod_flags.

Actual adresses will of course differ.

leo



Reply via email to