diff options
author | Tim Newsome <tim@sifive.com> | 2016-06-30 18:57:24 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2016-07-19 11:24:25 -0700 |
commit | 3ed5afdc5b7e2c32bc6facf410c8fa091dd55470 (patch) | |
tree | 736738c27c4366d2583b93ea91eb8710b7995a1a /debug/programs | |
parent | a8f4c20794b4eff8089f7fedb2d1bb4eff0a08d4 (diff) | |
download | riscv-tests-3ed5afdc5b7e2c32bc6facf410c8fa091dd55470.zip riscv-tests-3ed5afdc5b7e2c32bc6facf410c8fa091dd55470.tar.gz riscv-tests-3ed5afdc5b7e2c32bc6facf410c8fa091dd55470.tar.bz2 |
I think I've finally got malloc working right.
Now gdb can call functions and change strings.
Diffstat (limited to 'debug/programs')
-rw-r--r-- | debug/programs/debug.c | 7 | ||||
-rwxr-xr-x | debug/programs/entry.S | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/debug/programs/debug.c b/debug/programs/debug.c index 2010eaa..20b1cdc 100644 --- a/debug/programs/debug.c +++ b/debug/programs/debug.c @@ -1,11 +1,10 @@ #include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> unsigned int crc32a(uint8_t *message, unsigned int size); -char __malloc_start[512]; - void rot13(char *buf) { while (*buf) { @@ -28,8 +27,12 @@ size_t strlen(const char *buf) return len; } +extern void *__malloc_freelist; + int main() { + __malloc_freelist = 0; + volatile int i = 0; int j = 0; char *fox = "The quick brown fox jumps of the lazy dog."; diff --git a/debug/programs/entry.S b/debug/programs/entry.S index 480b404..80904cd 100755 --- a/debug/programs/entry.S +++ b/debug/programs/entry.S @@ -3,7 +3,7 @@ #include "encoding.h" -#define STACK_SIZE 128 +#define STACK_SIZE 512 #ifdef __riscv64 # define LREG ld @@ -124,9 +124,9 @@ trap_entry: addi sp, sp, 32*REGBYTES mret - .bss + // Fill the stack with data so we can see if it was overrun. .align 4 stack_bottom: - .skip STACK_SIZE + .fill STACK_SIZE/4, 4, 0x22446688 stack_top: #endif |