I can run this code in Linux PC. but after cross compilation and run it in ARM target board, i met Segmentation fault. I used GDB to check the traceback, but couldn't get the actual source line number.
How can i solve the segmentation fault.
Below is my operation:
1. cross compilation:
Code:
arm-linux-gcc -g -o test test.c
2. copy test to target
3. run
Code:
./test
Segmentation fault
4. debug
Code:
Program received signal SIGSEGV, Segmentation fault.
Cannot access memory at address 0x6e7a6974
5. source code
Code:
#include<stdio.h>
int main(void)
{
char lg[64];
char cmd[64]="1.1.1.1";
sprintf(lg,"sed -i 's/2.2.2.2/%s/' /mnt/jffs2/ddns_var/named/gotowiznet.com.dns ",cmd);
system (lg);
return 0;
}