Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

More on my Tiger problems

5 views
Skip to first unread message

Alberto Simões

unread,
Oct 14, 2005, 5:21:58 PM10/14/05
to perl6-i...@perl.org
Again, my foo.pir is
.include "datatypes.pasm"

.sub test :main

# load library
.local pmc libnci_test
libnci_test = loadlib "libnci_test"
unless libnci_test goto NOT_LOADED
print "libnci_test was successfully loaded\n"

# calling a function in libnci_test
.local pmc nci_c
dlfunc nci_c, libnci_test, "nci_c", "c"
.local int nci_c_out
( nci_c_out ) = nci_c( )
print nci_c_out
print "\n"
.end

and now compiled with dmalloc.
Here is a backtrace... it might be readable by people who knows parrot
internals.

Also, as I'm not very used to use gdb, if I can give more information,
let me know.

Cheers,
Thanks

(gdb) r foo.pir
Starting program: /Users/ambs/tmp/parrot/t/pmc/parrot foo.pir
Reading symbols for shared libraries . done
debug-malloc library: dumping program, fatal error
Error: pointer is not to start of memory block (err 30)

Program received signal SIGABRT, Aborted.
0x9004a12c in kill ()
(gdb) bt
#0 0x9004a12c in kill ()
#1 0x90120954 in abort ()
#2 0x00267dd8 in _dmalloc_die (silent_b=0) at error.c:656
#3 0x00267e70 in dmalloc_error (func=0x28992c "free") at error.c:703
#4 0x00268764 in log_error_info (now_file=0x0, now_line=0,
user_pnt=0xae4389, slot_p=0xadaae4, reason=0x289ed0 "checking pointer
admin", where=0xbfffded3 "0¿ÿß\034") at chunk.c:1013
#5 0x0026a010 in _dmalloc_chunk_free (file=0x0, line=0,
user_pnt=0xae4389, func_id=10) at chunk.c:2544
#6 0x0026702c in dmalloc_free (file=0x0, line=0, pnt=0xae4389,
func_id=17) at malloc.c:974
#7 0x000400b8 in scan_paths (filename=0xfcc888
"/Users/ambs/tmp/parrot/runtime/parrot/dynext/libnci_test.bundle",
libpath=0xbffff8a8 ":") at config/gen/platform/darwin/dl.c:35
#8 0x00040200 in get_lib (filename=0xfcc888
"/Users/ambs/tmp/parrot/runtime/parrot/dynext/libnci_test.bundle") at
config/gen/platform/darwin/dl.c:65
#9 0x000402a8 in Parrot_dlopen (filename=0xfcc888
"/Users/ambs/tmp/parrot/runtime/parrot/dynext/libnci_test.bundle") at
config/gen/platform/darwin/dl.c:85
#10 0x000a6e04 in get_path (interpreter=0xad5f08, lib=0xf274f0,
handle=0xbffff2bc, lib_name=0xbffff2c0) at src/dynext.c:168
#11 0x000a72d4 in Parrot_load_lib (interpreter=0xad5f08, lib=0xf274f0,
initializer=0x0) at src/dynext.c:334
#12 0x0006ebdc in Parrot_loadlib_p_sc (cur_opcode=0xfcc788,
interpreter=0xad5f08) at ops/core.ops:1187
#13 0x001dc5c4 in runops_slow_core (interpreter=0xad5f08, pc=0xfcc788)
at src/runops_cores.c:153
#14 0x0004ba40 in runops_int (interpreter=0xad5f08, offset=0) at
src/interpreter.c:750
#15 0x00044a04 in runops (interpreter=0xad5f08, offs=0) at
src/inter_run.c:81
#16 0x00044cec in runops_args (interpreter=0xad5f08, sub=0xf31208,
obj=0xc345d8, meth=0x0, sig=0x270104 "vP", ap=0xbffff564 "") at
src/inter_run.c:181
#17 0x00044e90 in Parrot_runops_fromc_args (interpreter=0xad5f08,
sub=0xf31208, sig=0x270104 "vP") at src/inter_run.c:275
#18 0x00017c70 in Parrot_runcode (interpreter=0xad5f08, argc=1,
argv=0xbffff73c) at src/embed.c:841
#19 0x000179dc in Parrot_runcode (interpreter=0xad5f08, argc=1,
argv=0xbffff73c) at src/embed.c:772
#20 0x000043c8 in main (argc=1, argv=0xbffff73c) at imcc/main.c:643
(gdb)


--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal

Jonathan Worthington

unread,
Oct 14, 2005, 8:29:47 PM10/14/05
to Alberto Simões, perl6-i...@perl.org
"Alberto Simões" <al...@alfarrabio.di.uminho.pt> wrote:
> #7 0x000400b8 in scan_paths (filename=0xfcc888
> "/Users/ambs/tmp/parrot/runtime/parrot/dynext/libnci_test.bundle",
> libpath=0xbffff8a8 ":") at config/gen/platform/darwin/dl.c:35
That gives it away. :-)

--
path_list = strdup(libpath);

path = strsep(&path_list, ":"); <-- NOTE: strsep modifies path_list
pointer!

while(path) {
snprintf(buf, PATH_MAX, "%s/%s", path, filename);
if(stat(buf, &st) == 0) {
free(path_list); <--Blows up here, as not pointing at start of block
now
return buf;
}
path = strsep(&path_list, ":");
}
free(path_list);
--

Try the attached patch (I can't test it, so don't want to apply it).

Jonathan

darwindl.diff

Jonathan Worthington

unread,
Oct 15, 2005, 6:50:47 AM10/15/05
to Alberto Simões, perl6-i...@perl.org
"Alberto Simões" <al...@alfarrabio.di.uminho.pt> wrote:
> W0rks, W0rks :)
>
I'll take your word for it. :-)

> Somebody please apply it? :)
>
Applied (r9486).

Thanks for bug hunting (and a great YAPC::EU),

Jonathan

Alberto Simões

unread,
Oct 15, 2005, 6:30:34 AM10/15/05
to Jonathan Worthington, perl6-i...@perl.org
W0rks, W0rks :)

Somebody please apply it? :)

Cheers
Alberto

--

Alberto Simões

unread,
Oct 15, 2005, 6:50:18 AM10/15/05
to Jonathan Worthington, perl6-i...@perl.org
Jonathan Worthington wrote:
> "Alberto Simões" <al...@alfarrabio.di.uminho.pt> wrote:
>> W0rks, W0rks :)
>>
> I'll take your word for it. :-)

Well, it passes the tests :)

Cheers,
Alberto

0 new messages