mirror of
https://github.com/gperftools/gperftools
synced 2025-03-11 07:17:38 +00:00
more coverage for stacktrace_unittest
This commit is contained in:
parent
25698cd1b8
commit
58d6842576
@ -224,6 +224,21 @@ int ATTRIBUTE_NOINLINE CaptureLeafPlain(void **stack, int stack_len) {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ATTRIBUTE_NOINLINE CaptureLeafPlainEmptyUCP(void **stack, int stack_len) {
|
||||||
|
INIT_ADDRESS_RANGE(CheckStackTraceLeaf, start, end, &expected_range[0]);
|
||||||
|
DECLARE_ADDRESS_LABEL(start);
|
||||||
|
|
||||||
|
int size = GetStackTraceWithContext(stack, stack_len, 0, nullptr);
|
||||||
|
|
||||||
|
printf("Obtained %d stack frames.\n", size);
|
||||||
|
CHECK_GE(size, 1);
|
||||||
|
CHECK_LE(size, stack_len);
|
||||||
|
|
||||||
|
DECLARE_ADDRESS_LABEL(end);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
int ATTRIBUTE_NOINLINE CaptureLeafWSkip(void **stack, int stack_len) {
|
int ATTRIBUTE_NOINLINE CaptureLeafWSkip(void **stack, int stack_len) {
|
||||||
INIT_ADDRESS_RANGE(CheckStackTraceLeaf, start, end, &expected_range[0]);
|
INIT_ADDRESS_RANGE(CheckStackTraceLeaf, start, end, &expected_range[0]);
|
||||||
DECLARE_ADDRESS_LABEL(start);
|
DECLARE_ADDRESS_LABEL(start);
|
||||||
@ -334,6 +349,11 @@ int main(int argc, char ** argv) {
|
|||||||
CheckStackTrace(0);
|
CheckStackTrace(0);
|
||||||
printf("PASS\n");
|
printf("PASS\n");
|
||||||
|
|
||||||
|
printf("Will test capturing stack trace with nullptr ucontext\n");
|
||||||
|
leaf_capture_fn = CaptureLeafPlainEmptyUCP;
|
||||||
|
CheckStackTrace(0);
|
||||||
|
printf("PASS\n");
|
||||||
|
|
||||||
printf("Will test capturing stack trace with skipped frames\n");
|
printf("Will test capturing stack trace with skipped frames\n");
|
||||||
leaf_capture_fn = CaptureLeafWSkip;
|
leaf_capture_fn = CaptureLeafWSkip;
|
||||||
CheckStackTrace(0);
|
CheckStackTrace(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user