Re: __stack_start for ColdFire uClinux
Larry Baker <[email protected]>
| Newsgroups | gmane.linux.uclinux.devel |
|---|---|
| Message-ID | <[email protected]> |
On 4 Oct 2012, at 1:05 PM, Larry Baker wrote:
> I am still puzzled, though, why uClinux is silent when a program is aborted when it receives an unhandled fatal signal. Mainline Linux (really the shell?) prints out a message like
>
>> [root@atompc sdk]# ./SIGILL
>> Illegal instruction
>
> (SIGILL.c is the example program from http://en.wikipedia.org/wiki/SIGILL.) After a reboot of uClinux, I get nothing
>
>> / # SIGILL
>
> I have to enable print-fatal-signals as before to see anything:
>
>> / # echo 1 >/proc/sys/kernel/print-fatal-signals
>> / # SIGILL
>> SIGILL/79: potentially unexpected fatal signal 4.
>>
>>
>> Format 04 Vector: 002c PC: 4052e544 Status: 0000 Not tainted
>> ORIG_D0: ffffffff D0: 4052e544 A2: 4052ff60 A1: 4052e4ec
>> A0: 4052e544 D5: 4052e524 D4: 00000000
>> D3: 00000000 D2: 00000001 D1: 0000002f
>> USP: 4052ff04
>
> Is this a uClinux thing? Or, a BusyBox (my uClinux shell) thing?
I'll answer my own question.
It is the shell that prints out the "Illegal instruction" message. I found the code in bash that does that and added it to the BusyBox hush shell. The SDK I use has a rather old BusyBox, 1.13.3. The hush shell is in busybox-1.13.3/shell/hush.c. checkjobs() waits for all child processes -- there is no distinction made between job control jobs and non-job control jobs like there is in bash. There is already code there that can be (hand) enabled to be verbose about what happens to a job. Enabling that also makes hush very chatty. So, I added an #else clause for the #if DEBUG_JOBS conditional code in checkjobs() to mimic bash's behavior. Here's the patch for busybox-1.13.3:
--- busybox-1.13.3/shell/hush.c
+++ busybox-1.13.3-patched/shell/hush.c
@@ -1720,2 +1720,13 @@
childpid, WEXITSTATUS(status));
> +#else
> + if ((WIFSTOPPED (status) == 0) && WIFSIGNALED (status)) {
> + int sig = WTERMSIG (status);
> + if ((sig != SIGINT) && (sig != SIGPIPE)) {
> + char *s = strsignal (sig);
> + if ( s != NULL )
> + fprintf (stderr, "%s\n", s);
> + else
> + fprintf (stderr, "Unknown signal: %d\n", sig);
> + }
> + }
> #endif
With this patched hush, I get what I am used to seeing:
> / # trap
> Illegal instruction
> / # SIGILL
> Illegal instruction
Now I can go back and find out where the applications I use are failing. I suspect stack overflows, which my implementation of gcc -stack-check-symbol=__stack_start for non-68020 (e.g., ColdFire) processors can catch now.
Larry Baker
US Geological Survey
650-329-5608
[email protected]
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev