How to debug
Posted: Sat Jan 28, 2012 10:00 am
Ok, this is kinda embarrasing but I just don't know.
I'm trying to run programs compiled by my own toolchain including newlib and ran into a weird issue.
This is my test program:
If I do not uncomment any of the comments my program will work and print test1 and test2 but if I either uncomment the first or the second (obviously not both) it will only print test1 before page fault giving me a very low memory address, either 0x17e4 or 0x88. Especially notice that uncommenting the second line would still only print test1.
Any hints on what could be wrong? I know I'm not zeroing bss on program loading, which could be a start but I don't see why that would matter in this case.
I'm trying to run programs compiled by my own toolchain including newlib and ran into a weird issue.
This is my test program:
Code: Select all
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
write(STDOUT_FILENO, "test1\n", 6);
// FILE *out = fopen("stdout", "w");
fputs("test2\n", stdout);
// FILE *out = fopen("stdout", "w");
return 0;
}
Any hints on what could be wrong? I know I'm not zeroing bss on program loading, which could be a start but I don't see why that would matter in this case.