}
}
+/*
+ * Find the bounds of the stack (if any) which includes the
+ * specified stack pointer.
+ */
+void VG_(stack_limits)(Addr SP, Addr *start, Addr *end )
+{
+ Stack* stack = find_stack_by_addr(SP);
+
+ if (stack) {
+ *start = stack->start;
+ *end = stack->end;
+ }
+}
+
/* This function gets called if new_mem_stack and/or die_mem_stack are
tracked by the tool, and one of the specialised cases
(eg. new_mem_stack_4) isn't used in preference.
Addr sp = VG_(get_SP)(tid);
Addr lr = VG_(get_LR)(tid);
Addr stack_highest_word = VG_(threads)[tid].client_stack_highest_word;
+ Addr stack_lowest_word = 0;
# if defined(VGP_x86_linux)
/* Nasty little hack to deal with syscalls - if libc is using its
}
# endif
+ /* See if we can get a better idea of the stack limits */
+ VG_(stack_limits)(sp, &stack_lowest_word, &stack_highest_word);
+
/* Take into account the first_ip_delta. */
vg_assert( sizeof(Addr) == sizeof(Word) );
ip += first_ip_delta;
ctst->client_stack_highest_word = (Addr)VG_PGROUNDUP(rsp);
ctst->client_stack_szB = ctst->client_stack_highest_word - seg->start;
+ VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
+
if (debug)
VG_(printf)("tid %d: guessed client stack range %p-%p\n",
ctid, seg->start, VG_PGROUNDUP(rsp));
ctst->client_stack_highest_word = (Addr)VG_PGROUNDUP(sp);
ctst->client_stack_szB = ctst->client_stack_highest_word - seg->start;
+ VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
+
if (debug)
VG_(printf)("\ntid %d: guessed client stack range %p-%p\n",
ctid, seg->start, VG_PGROUNDUP(sp));
ctst->client_stack_highest_word = (Addr)VG_PGROUNDUP(sp);
ctst->client_stack_szB = ctst->client_stack_highest_word - seg->start;
+ VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
+
if (debug)
VG_(printf)("\ntid %d: guessed client stack range %p-%p\n",
ctid, seg->start, VG_PGROUNDUP(sp));
ctst->client_stack_highest_word = (Addr)VG_PGROUNDUP(esp);
ctst->client_stack_szB = ctst->client_stack_highest_word - seg->start;
+ VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
+
if (debug)
VG_(printf)("tid %d: guessed client stack range %p-%p\n",
ctid, seg->start, VG_PGROUNDUP(esp));
extern UWord VG_(register_stack) ( Addr start, Addr end );
extern void VG_(deregister_stack) ( UWord id );
extern void VG_(change_stack) ( UWord id, Addr start, Addr end );
+extern void VG_(stack_limits) ( Addr SP, Addr *start, Addr *end );
extern VG_REGPARM(2)
void VG_(unknown_SP_update) ( Addr old_SP, Addr new_SP );