Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding unit tests for non-x86 architectures (#720)
* Use `pytest` on top of `unittest` to allow multi-proc execution
- Loading branch information
Showing
16 changed files
with
226 additions
and
100 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
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
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
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,12 +1,12 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
|
||
#include "utils.h" | ||
int myglobal = 1; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
// breakpoints hardcoded for convenience | ||
myglobal = strtoll(argv[1], NULL, 16); | ||
__builtin_trap(); | ||
DebugBreak(); | ||
return 0; | ||
} |
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,2 +1,3 @@ | ||
int f1(int i){ if(i==10) {__builtin_trap(); return 0;} return f1(++i); } | ||
#include "utils.h" | ||
int f1(int i){ if(i==10) {DebugBreak(); return 0;} return f1(++i); } | ||
int main(){ return f1(0); } |
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,36 @@ | ||
#include <signal.h> | ||
|
||
/** | ||
* Provide an cross-architecture way to break into the debugger. | ||
* On some architectures, we resort to `raise(SIGINT)` which is not | ||
* optimal, as it adds an extra frame to the stack. | ||
*/ | ||
|
||
/* Intel x64 */ | ||
#if defined(__x86_64__) | ||
#define DebugBreak() __asm__("int $3") | ||
|
||
/* Intel x32 */ | ||
#elif defined(__i386) || defined(i386) || defined(__i386__) | ||
#define DebugBreak() __asm__("int $3") | ||
|
||
/* AARCH64 */ | ||
#elif defined(__aarch64__) | ||
#define DebugBreak() { raise( SIGINT ) ; } | ||
|
||
/* ARM */ | ||
#elif defined(__arm__) || defined(__arm) | ||
#define DebugBreak() { raise( SIGINT ) ; } | ||
|
||
/* MIPS */ | ||
#elif defined(mips) || defined(__mips__) || defined(__mips) | ||
#define DebugBreak() __builtin_trap() | ||
|
||
/* PowerPC */ | ||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC) | ||
#define DebugBreak() __builtin_trap() | ||
|
||
/* the rest */ | ||
#else | ||
#error "Unsupported architecture" | ||
#endif |
Oops, something went wrong.