Hello, 

Ok, after digging a bit more, it looks as though the issue is due to bmem being 
linked to libbigloo_u and the profiled program being linked to libbigloo_s. 
This results in two version of the runtime being loaded at once, and 
unfortunately, on linux at least, one set of functions are not used 
exclusively. I see bgl_get_symtab being used from one and bgl_init_symtable 
from the other, resulting in an unitialized symbol table being returned and a 
subsequent segmentation fault. After compiling the test program as unsafe, I 
was able to successfully use bmem.

To fix this, we will probably need to have both unsafe and safe versions of 
bmem and choose the appropriate version when running bmemrun. Or we could also 
try not linking bmem with the runtime at all and rely on the dynamic loader to 
patch the symbols with those provided by the program to be profiled. Although, 
this will only work on systems that support unclosed libraries. For Windows and 
OSX, we will need safe threaded, safe unthreaded, unsafe threaded, and unsafe 
unthreaded variations of the libraries.
What do people think? Are there other solutions I have not thought of?
Thanks,Joseph Donaldson

 
      From: Joseph Donaldson <[email protected]>
 To: Sven Hartrumpf <[email protected]>; "[email protected]" <[email protected]> 
 Sent: Saturday, December 10, 2016 2:33 PM
 Subject: Re: [bigloo] Memory profiling with 4.3a
   
Hello, 

I am seeing the same behavior with bglmemrun on AMD64 Arch Linux with bigloo 
4.3a from Dec 7th. As reported earlier, it is segfaulting in 
bgl_bstring_to_symbol for some reason. 

It may not have anything to do with the bglmemrun issue, but while 
investigating it, I did notice that the current release is being compiled with 
closelibs by default, resulting in the threaded version of libraries being 
linked with both libbigloogc and libbiglogc_fth. I suspect this is asking for 
trouble. 

I will continue to look into bglmemrun and will let people know if I find 
anything.
Best Regards,Joseph Donaldson


 
      From: Sven Hartrumpf <[email protected]>
 To: [email protected] 
 Sent: Wednesday, December 7, 2016 4:52 AM
 Subject: Re: [bigloo] Memory profiling with 4.3a
  
I wrote, 2016-12-07 08:10:
> Hi.
> 
> "Ollagnon, Pierre-Francois", 2016-12-06:
>> I am trying to profile memory with bglmemrun but I can't get it work.
>> Here is my little test:
>> 
>> test.scm:
>> -----------
>> (module main
>>        (main main))
>> (define (main argv)
>>  (print "Ok"))
>> 
>> Compilation
>> ---------------
>> bigloo test.scm -g2 -o test
> 
> You should add the option -pmem .

I must admit that this does not fix the problem.
I get a similar "Segmentation fault" in the bglmemrun step
of the current beta - for all programs I tried.

Manuel, any ideas?

BTW:
bglmemrun has only an -u / -unsafe / --unsafe option, but as this
is the default in file bde/bmem/lib/init.c 
one is stuck to unsafe libraries.
Could you change
 char *bglsafe = "_u";
to
 char *bglsafe = "_s";

Ciao
Sven


   
 

   
 

Reply via email to