diff options
| author | Andrew Waterman <waterman@eecs.berkeley.edu> | 2016-07-19 17:10:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-19 17:10:24 -0700 |
| commit | a27ddca0570517e7e40a91c16e4c96c6c5f329e1 (patch) | |
| tree | 361a63af04da0d4fc42fbe28f79c2d280c54f396 /debug/programs/init.c | |
| parent | 0849aad0c23f24ed7728128873fc852839e988b1 (diff) | |
| parent | edfe598fd06366170628e88aa6dee762d2c37bbc (diff) | |
| download | riscv-tests-a27ddca0570517e7e40a91c16e4c96c6c5f329e1.zip riscv-tests-a27ddca0570517e7e40a91c16e4c96c6c5f329e1.tar.gz riscv-tests-a27ddca0570517e7e40a91c16e4c96c6c5f329e1.tar.bz2 | |
Merge pull request #17 from timsifive/debug
Add end-to-end debug tests
Diffstat (limited to 'debug/programs/init.c')
| -rw-r--r-- | debug/programs/init.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/debug/programs/init.c b/debug/programs/init.c new file mode 100644 index 0000000..a2b41b0 --- /dev/null +++ b/debug/programs/init.c @@ -0,0 +1,24 @@ +int main(void); + +void handle_trap(unsigned int mcause, unsigned int mepc, unsigned int sp) +{ + while (1) + ; +} + +void _exit(int status) +{ + // Make sure gcc doesn't inline _exit, so we can actually set a breakpoint + // on it. + volatile int i = 42; + while (i) + ; + // _exit isn't supposed to return. + while (1) + ; +} + +void _init() +{ + _exit(main()); +} |
