-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #314 from steve-s/add/improve-debug-ctx-usability
Improve debug context usability
- Loading branch information
Showing
16 changed files
with
432 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Smoke test for the create_stacktrace function | ||
|
||
#include <stdarg.h> | ||
#include "acutest.h" // https://github.com/mity/acutest | ||
#include "hpy/debug/src/debug_internal.h" | ||
|
||
void test_create_stacktrace(void) | ||
{ | ||
char *trace; | ||
create_stacktrace(&trace, 16); | ||
if (trace != NULL) { | ||
printf("\n\nTRACE:\n%s\n\n", trace); | ||
free(trace); | ||
} | ||
} | ||
|
||
#define MYTEST(X) { #X, X } | ||
|
||
TEST_LIST = { | ||
MYTEST(test_create_stacktrace), | ||
{ NULL, NULL } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Run with HPY_DEBUG=1 | ||
import hpy.debug | ||
import snippets | ||
|
||
hpy.debug.set_handle_stack_trace_limit(16) | ||
from hpy.debug.pytest import LeakDetector | ||
with LeakDetector() as ld: | ||
snippets.test_leak_stacktrace() | ||
|
||
print("SUCCESS") # Should not be actually printed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
from .leakdetector import HPyDebugError, HPyLeakError, LeakDetector | ||
|
||
|
||
def set_handle_stack_trace_limit(limit): | ||
from hpy.universal import _debug | ||
_debug.set_handle_stack_trace_limit(limit) | ||
|
||
|
||
def disable_handle_stack_traces(): | ||
from hpy.universal import _debug | ||
_debug.set_handle_stack_trace_limit(None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.