Rhys Kidd 2424a2d347 Fix stack traces missing penultimate frame
bz#344560
- Also fixes memcheck/tests/badpoll test on OS X
- Problem occurs because the guest stack seen in a system call pre or post
  function happens to not have a correct topmost stack frame, as Darwin system
  call stubs do not start with the usual function prolog.
- New regression test case added.
- Thanks to Greg Banks for research, patch and test case.

Before:

== 587 tests, 240 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

After:

== 588 tests, 239 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14985
2015-03-07 05:22:12 +00:00

42 lines
475 B
C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int func_six(int x)
{
char b[32];
int r = write(1, b, sizeof(b));
return x;
}
int func_five(int x)
{
return func_six(x + 5);
}
int func_four(int x)
{
return func_five(x + 4);
}
int func_three(int x)
{
return func_four(x + 3);
}
int func_two(int x)
{
return func_three(x + 2);
}
int func_one(int x)
{
return func_two(x + 1);
}
int main(void)
{
func_one(10);
return 0;
}