add valgrind_stack_change

Unlike valgrind_stack_register, this won't automatically swap
if `start > end`. It's probably wiser to pretend it doesn't swap at all.
This commit is contained in:
edef 2015-04-15 22:45:50 -04:00
parent 476a63b817
commit 04bbeb88f4
2 changed files with 11 additions and 2 deletions

View File

@ -7,6 +7,10 @@ valgrind_stack_id_t valgrind_stack_register(const void *start, const void *end)
return VALGRIND_STACK_REGISTER(start, end); return VALGRIND_STACK_REGISTER(start, end);
} }
void valgrind_stack_change(valgrind_stack_id_t id, const void *start, const void *end) {
VALGRIND_STACK_CHANGE(id, start, end);
}
void valgrind_stack_deregister(valgrind_stack_id_t id) { void valgrind_stack_deregister(valgrind_stack_id_t id) {
VALGRIND_STACK_DEREGISTER(id); VALGRIND_STACK_DEREGISTER(id);
} }

View File

@ -1,6 +1,6 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
//! In order for Valgrind to keep track of stack overflows and such, it needs //! In order for Valgrind to keep track of stack overflows and such, it needs
//! a little help. That help unfortunately comes in the form of a pair of C //! a little help. That help unfortunately comes in the form of a set of C
//! macros. Calling out to un-inlineable C code for this is pointlessly slow, //! macros. Calling out to un-inlineable C code for this is pointlessly slow,
//! but that's the way it is for now. //! but that's the way it is for now.
@ -9,9 +9,14 @@ extern "C" {
#[link_name = "valgrind_stack_register"] #[link_name = "valgrind_stack_register"]
/// Register a stack with Valgrind. Returns an integer ID that can /// Register a stack with Valgrind. Returns an integer ID that can
/// be used to deregister the stack when it's deallocated. /// be used to deregister the stack when it's deallocated.
/// `start < end`, though Valgrind will happily accept either. /// `start < end`.
pub fn stack_register(start: *const u8, end: *const u8) -> stack_id_t; pub fn stack_register(start: *const u8, end: *const u8) -> stack_id_t;
#[link_name = "valgrind_stack_change"]
/// Change the size or location of a stack registered with Valgrind.
/// `start < end`.
pub fn stack_change(id: stack_id_t, start: *const u8, end: *const u8) -> stack_id_t;
#[link_name = "valgrind_stack_deregister"] #[link_name = "valgrind_stack_deregister"]
/// Deregister a stack from Valgrind. Takes the integer ID that was returned /// Deregister a stack from Valgrind. Takes the integer ID that was returned
/// on registration. /// on registration.