Re: [Valgrind-users] Use of valgrind with microthreading

2020-08-14 Thread Mark Wielaard
Hi Shachar,

On Fri, Aug 14, 2020 at 06:35:14PM +0300, Shachar Shemesh wrote:
> I am writing my own C++ microthreading library. At the very first switch, I
> get the following message from Valgrind:
> 
> ==15122== Warning: client switching stacks?  SP change: 0x1ffeffe788 -->
> 0x75d0f80
> ==15122==  to suppress, use: --max-stackframe=137298630664 or
> greater
> 
> 
> I understand that valgrind needs to know where the stack starts and ends. I
> am wondering whether is any way I can tell it that information. Since I'm
> writing the library, what I was thinking was compiling the library with a
> special flag saying "you're running with valgrind", and then have my library
> call a valgrind function that says "This is the new stack range, this is the
> old one".
>  
> Is there such a thing? If so, how do I interface with it?

Yes, there is such a thing. The valgrind client request mechanism:
https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq

It does have various VALGRIND_STACK_* macros to signal use of user
threads/stacks. But note that the documentations says:
Warning: Unfortunately, this client request is unreliable and best avoided.
Unfortunately I don't know why that is, or what alternative mechanisms there 
are.

Cheers,

Mark


___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


[Valgrind-users] Use of valgrind with microthreading

2020-08-14 Thread Shachar Shemesh

Hi all,


I am writing my own C++ microthreading library. At the very first 
switch, I get the following message from Valgrind:


==15122== Warning: client switching stacks?  SP change: 0x1ffeffe788 --> 
0x75d0f80
==15122==  to suppress, use: --max-stackframe=137298630664 or 
greater



I understand that valgrind needs to know where the stack starts and 
ends. I am wondering whether is any way I can tell it that information. 
Since I'm writing the library, what I was thinking was compiling the 
library with a special flag saying "you're running with valgrind", and 
then have my library call a valgrind function that says "This is the new 
stack range, this is the old one".



Is there such a thing? If so, how do I interface with it?


Thank you,

Shachar


___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users