disassemble segfaults

0 views
Skip to first unread message

Bob Rogers

unread,
May 3, 2005, 11:12:34 PM5/3/05
to perl6-i...@perl.org
. . . but I can't figure out why. I thought the patch below would
help, but it appears that the value of c is itself broken somehow.

. . .
This GDB was configured as "i586-suse-linux"...
(gdb) r runtime/parrot/library/config.pbc
Starting program: /usr/src/parrot/disassemble runtime/parrot/library/config.pbc
[New Thread 16384 (LWP 24464)]
[New Thread 32769 (LWP 24466)]
[New Thread 16386 (LWP 24467)]
[New Thread 32771 (LWP 24468)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 24464)]
0x08083966 in Parrot_disassemble (interpreter=0x8253d00) at src/embed.c:880
(gdb) bt
#0 0x08083966 in Parrot_disassemble (interpreter=0x8253d00) at src/embed.c:880
#1 0x08082871 in do_dis (interpreter=0x8253d00) at src/disassemble.c:99
#2 0x0808283f in main (argc=2, argv=0xbffff554) at src/disassemble.c:79
(gdb)

I find disassemble useful, but it seems subject to periodic bit rot.
So, I think I would like to write some basic tests for it. Is it worth
extending Parrot::Test to include disassemble_output_is, etc., or should
I do something more special-purpose?

-- Bob Rogers
http://rgrjr.dyndns.org/

------------------------------------------------------------------------
Index: embed.c
===================================================================
--- embed.c (revision 7955)
+++ embed.c (working copy)
@@ -877,7 +877,7 @@
if (line->label)
PIO_printf(interpreter, "L%li:\t", line->label->number);
c = pdb->file->source + line->source_offset;
- while (*c != '\n' && c)
+ while (*c && *c != '\n')
PIO_printf(interpreter, "%c", *(c++));
PIO_printf(interpreter, "\n");
line = line->next;

Matt Fowles

unread,
May 3, 2005, 11:41:00 PM5/3/05
to Bob Rogers, perl6-i...@perl.org
Bob~

Not knowing any of the surrounding code, shouldn't that be

while (c && *c != '\n')

Matt
--
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-???

Leopold Toetsch

unread,
May 4, 2005, 3:38:41 AM5/4/05
to Bob Rogers, perl6-i...@perl.org
Bob Rogers wrote:
> . . . but I can't figure out why. I thought the patch below would
> help, but it appears that the value of c is itself broken somehow.

The memory handling was broken and disassemble didn't know how to handle
PMC constants.

Fixed - rev 7971.

Thanks for testing,
leo

Bob Rogers

unread,
May 11, 2005, 10:13:12 PM5/11/05
to Leopold Toetsch, perl6-i...@perl.org
From: Leopold Toetsch <l...@toetsch.at>
Date: Wed, 04 May 2005 09:38:41 +0200

Fixed - rev 7971.

Thanks for testing,
leo

I'm sorry, but I'm still seeing the same syndrome in r8070, segfaulting
in the same place, though now for only a subset of *.pbc files . . .

-- Bob

------------------------------------------------------------------------
rogers@rgrjr> ./disassemble ./runtime/parrot/library/dumper.pbc
Segmentation fault
rogers@rgrjr> for file in `find . -name '*.pbc'`; do if [ 0 == `./disassemble $file | wc -l` ]; then echo $file; fi; done
./runtime/parrot/library/Data/Dumper/Base.pbc
./runtime/parrot/library/Data/Sort.pbc
./runtime/parrot/library/Stream/Combiner.pbc
./runtime/parrot/library/Stream/Writer.pbc
./runtime/parrot/library/Stream/ParrotIO.pbc
./runtime/parrot/library/Stream/Lines.pbc
./runtime/parrot/library/Stream/Filter.pbc
./runtime/parrot/library/Stream/Replay.pbc
./runtime/parrot/library/Stream/Coroutine.pbc
./runtime/parrot/library/dumper.pbc
rogers@rgrjr>

Leopold Toetsch

unread,
May 12, 2005, 3:19:00 AM5/12/05
to Bob Rogers, perl6-i...@perl.org
Bob Rogers wrote:
>
> I'm sorry, but I'm still seeing the same syndrome in r8070, segfaulting
> in the same place, though now for only a subset of *.pbc files . . .

Yet another uninitialized pointer variable - fixed.

> -- Bob

Thanks for reporting.

BTW could you/someone make a test for disassemble, to be included in
"make fulltest" where, after "make test", plenty of pbcs are populating
the tree. The test should skip the skipped t/native_pbc though.

Thanks,
leo

Bob Rogers

unread,
May 12, 2005, 9:53:53 PM5/12/05
to Leopold Toetsch, perl6-i...@perl.org
From: Leopold Toetsch <l...@toetsch.at>
Date: Thu, 12 May 2005 09:19:00 +0200

Bob Rogers wrote:
>
> I'm sorry, but I'm still seeing the same syndrome in r8070, segfaulting
> in the same place, though now for only a subset of *.pbc files . . .

Yet another uninitialized pointer variable - fixed.

Great; thanks.

Thanks for reporting.

BTW could you/someone make a test for disassemble, to be included in
"make fulltest" where, after "make test", plenty of pbcs are populating
the tree. The test should skip the skipped t/native_pbc though.

Thanks,
leo

I'd be happy to, but won't have time before late next week. So if
someone else wants to beat me to it, go for it.

-- Bob

Reply all
Reply to author
Forward
0 new messages