Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code: Page 1 of 2 (33 Items)
   
Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Hi,
I am using QNX Momentics IDE Version: 4.7.0, Build id: 201006232051 and running QNX 6.5.0 in the target (ARM-le).
I created a test project (QNX C Project) to see if I can step through the code with just a 'main()' and couple of 
'printf()' (I have also tried by adding function calls and eluminating printf() but with the same issue).
I had set multiple break points and I started the debugger (with verbose) and the program stopped at main() as expected.
 
Then I did 'resume', it went to the first breakpoint. 
I then did 'step over' twice and the debugger terminated with 'Illegal Instruction'. 
I am sure that it has not exited the main() function.
Seems like it has something to do with the 'libc.so.3'. I double checked to see if I loaded the correct library file 
(libc.so.3) in the target.
The following is present in /usr/lib
ldqnx.so.2 -> ../../proc/boot/libc.so.3

I have 'qconn' and network running on the board (no'inetd'). I also have serial connected (Ran it with and without the 
Terminal connected). I am able to view the 'QNX System Perspective' so I think that the 'qconn' is functional.

There is only one source file and the contents are as below. I had the first breakpoint set at the second 'printf()' 
statement and the next at the 5th printf().

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
	printf("Welcome to the QNX Momentics IDE\n");
	printf("Welcome to the QNX Momentics IDE\n");
	printf("Welcome to the QNX Momentics IDE\n");
	printf("Welcome to the QNX Momentics IDE\n");
	printf("Welcome to the QNX Momentics IDE\n");
	printf("Welcome to the QNX Momentics IDE\n");
	return EXIT_SUCCESS;
}


Please help me understand what I am missing to be able to step through the code. 
Attached are logs from the console.

Thanks,
Arun
Attachment: Text QNXIDE_Debug_Console.txt 10.12 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Attached is the screenshot of the debugger.
Attachment: Image QNX_IDE_Debugger.JPG 205.46 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Cannot access memory sign of library mismatch. Are you target running exact same version as host? Are you running proper
 version of binary, i.e. arm-le not arm-v7-le?

On 27/09/10 02:52 PM, Arun Parameswaran wrote:
> Hi,
> I am using QNX Momentics IDE Version: 4.7.0, Build id: 201006232051 and running QNX 6.5.0 in the target (ARM-le).
> I created a test project (QNX C Project) to see if I can step through the code with just a 'main()' and couple of 
'printf()' (I have also tried by adding function calls and eluminating printf() but with the same issue).
> I had set multiple break points and I started the debugger (with verbose) and the program stopped at main() as 
expected. 
> Then I did 'resume', it went to the first breakpoint. 
> I then did 'step over' twice and the debugger terminated with 'Illegal Instruction'. 
> I am sure that it has not exited the main() function.
> Seems like it has something to do with the 'libc.so.3'. I double checked to see if I loaded the correct library file 
(libc.so.3) in the target.
> The following is present in /usr/lib
> ldqnx.so.2 -> ../../proc/boot/libc.so.3
> 
> I have 'qconn' and network running on the board (no'inetd'). I also have serial connected (Ran it with and without the
 Terminal connected). I am able to view the 'QNX System Perspective' so I think that the 'qconn' is functional.
> 
> There is only one source file and the contents are as below. I had the first breakpoint set at the second 'printf()' 
statement and the next at the 5th printf().
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> int main(int argc, char *argv[]) {
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	printf("Welcome to the QNX Momentics IDE\n");
> 	return EXIT_SUCCESS;
> }
> 
> 
> Please help me understand what I am missing to be able to step through the code. 
> Attached are logs from the console.
> 
> Thanks,
> Arun
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68687
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Hi Elena,
Thanks for the reply.
I am using the correct version of the library for arm-le. I double checked after I read about it in the Debugger FAQ.
Attached is the screenshot of the location from where I had included the library.

Thanks,
Arun
Attachment: Image libc library.JPG 56.12 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
How about the binary? Are you sure it is not v7? I think it builds both by default

On 27/09/10 03:15 PM, Arun Parameswaran wrote:
> Hi Elena,
> Thanks for the reply.
> I am using the correct version of the library for arm-le. I double checked after I read about it in the Debugger FAQ.
> Attached is the screenshot of the location from where I had included the library.
> 
> Thanks,
> Arun
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68692
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
The application is built only for ARM-le (and only debug).
Attached is the 'Build Variant' screenshot for the project.
Attachment: Image BuildVariant.JPG 69.7 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
When I do a file size comparison of the libc.so.3 in the target and the host (PC) there seems to be a difference. 

On the host (PC) the 'ls -l' command on the libc.so.3 prints:
-rwx------+ 1 xxxxxxx Domain Users 68697 2010-07-09 13:02 libc.so.3
On the target (arm-le) the 'ls -l' command prints:
-rwxrwxrwx  1 0         0            503108 Jul 09  2010 /proc/boot/libc.so.3

It seems like the IDE is stripping some information when adding the library to the image. Could this be creating the 
issue? 
I am including the libc.so.3 using the Momentics IDE in the BSP from the project.bld. 
If this is an issue, how can I disable the IDE for stripping the library in the BSP? I can see the option in the QNX C 
project in the 'Debug As' configurations ('Upload' tab has a check box) but I am not able to see it in the BSP project 
when building the image.
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
The size difference is normal. Image libc.so.3 is stripped and the one
you have on your host should have symbols in it.


On Mon, 2010-09-27 at 16:34 -0400, Arun Parameswaran wrote:
> When I do a file size comparison of the libc.so.3 in the target and the host (PC) there seems to be a difference. 
> 
> On the host (PC) the 'ls -l' command on the libc.so.3 prints:
> -rwx------+ 1 xxxxxxx Domain Users 68697 2010-07-09 13:02 libc.so.3
> On the target (arm-le) the 'ls -l' command prints:
> -rwxrwxrwx  1 0         0            503108 Jul 09  2010 /proc/boot/libc.so.3
> 
> It seems like the IDE is stripping some information when adding the library to the image. Could this be creating the 
issue? 
> I am including the libc.so.3 using the Momentics IDE in the BSP from the project.bld. 

Could you give more details? How are you including libc? Gdb is supposed
to recognize if the libraries do not match by printing a warning (which
I couldn't see in your IDE Debug terminal log).


---
Aleksandar
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Ok. Thanks for the clarification.
I tried copying the libc.so.3 directly to the target, it didnt help.
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
You can not just copy the libc to the target, process will still use the
one from the image.

What is the target version you are running? (output from "uname -a")?



On Mon, 2010-09-27 at 18:22 -0400, Arun Parameswaran wrote:
> Ok. Thanks for the clarification.
> I tried copying the libc.so.3 directly to the target, it didnt help.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68710
> 

Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Here is the output from 'uname -a'. I masked the processor number, hope that is alright.

QNX localhost 6.5.0 2010/07/09-14:24:27EDT BCMxxxxx armle
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
I don't know how to help you. Can you send you binary here? I will try to run on my target

On 27/09/10 06:22 PM, Arun Parameswaran wrote:
> Ok. Thanks for the clarification.
> I tried copying the libc.so.3 directly to the target, it didnt help.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68710
> 
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Attached is the binary of the application.
Attachment: Text Debugging1_g 7.87 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
> Attached is the binary of the application.


Also attached is the libc.so.3 from the QNX650 installation.
Attachment: Text libc.so.3 670.87 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
> > Attached is the binary of the application.
> 
> 
> Also attached is the libc.so.3 from the QNX650 installation.


I have zipped the application workspace, just in case.
Attachment: Compressed file Debugging1.zip 8.63 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Sorry if I had asked this before:

Does your application run without issues when you use "Run" (as opposed
to "Debug")?

If you haven't done that already, could you just run it (without
debugger attached) and see if it works?


On Tue, 2010-09-28 at 12:24 -0400, Arun Parameswaran wrote:
> > > Attached is the binary of the application.
> > 
> > 
> > Also attached is the libc.so.3 from the QNX650 installation.
> 
> 
> I have zipped the application workspace, just in case.
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68816

Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Yes. It runs without any issues. 
I have 6 consecutive printf() statements and they all get printed and the program exits.
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Something is mismatched. I just run with your binary and I get normal
debugging session with two breakpoints hit:

$ ntoarm-gdb Debugging1_g --ex "target qnx tarmle:8000"
GNU gdb 6.8 qnx-nto (rev. 506)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-unknown-nto-qnx6.5.0"...
Remote debugging using tarmle:8000
MsgNak received - resending
Remote target is little-endian
(gdb) upload Debugging1_g /tmp/Debugging1_g
(gdb) b main
Breakpoint 1 at 0x100830: file C:/qnx-workspace/Debugging1/Debugging1.c,
line 5.
(gdb) b Debugging1.c:8
Breakpoint 2 at 0x100848: file C:/qnx-workspace/Debugging1/Debugging1.c,
line 8.
(gdb) r
Starting
program: /home/aristovski/testcases/ARMDebugproblem/Debugging1_g 
Remote: /tmp/Debugging1_g
[New pid 94226 tid 1]

Breakpoint 1, main (argc=1, argv=0xffef4) at
C:/qnx-workspace/Debugging1/Debugging1.c:5
5       C:/qnx-workspace/Debugging1/Debugging1.c: No such file or
directory.
        in C:/qnx-workspace/Debugging1/Debugging1.c
(gdb) n
Welcome to the QNX Momentics IDE
6       in C:/qnx-workspace/Debugging1/Debugging1.c
(gdb) 
Welcome to the QNX Momentics IDE
7       in C:/qnx-workspace/Debugging1/Debugging1.c
(gdb) 
Welcome to the QNX Momentics IDE

Breakpoint 2, main (argc=1, argv=0xffef4) at
C:/qnx-workspace/Debugging1/Debugging1.c:8
8       in C:/qnx-workspace/Debugging1/Debugging1.c
(gdb) 
Welcome to the QNX Momentics IDE
9       in C:/qnx-workspace/Debugging1/Debugging1.c
(gdb) c
Continuing.
Welcome to the QNX Momentics IDE
Welcome to the QNX Momentics IDE

Process 94226 (Debugging1_g) terminated signo=0 code=0 by process 0
value=0.

Program exited normally.
(gdb) 


On Tue, 2010-09-28 at 12:32 -0400, Arun Parameswaran wrote:
> Yes. It runs without any issues. 
> I have 6 consecutive printf() statements and they all get printed and the program exits.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68820
> 

Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Here is the output from my setup:

$ ntoarm-gdb Debugging1_g --ex "target qnx 10.136.18.132:8000"
GNU gdb 6.8 qnx-nto (rev. 506)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i386-mingw32msvc --target=arm-unknown-nto-qnx6.5.0"...
Remote debugging using 10.136.18.132:8000
MsgNak received - resending
Remote target is little-endian
(gdb) upload Debugging1_g /tmp/Debugging1_g
(gdb) b main
Breakpoint 1 at 0x100830: file C:/qnx-workspace/Debugging1/Debugging1.c, line 5.
(gdb) b Debugging1.c:8
Breakpoint 2 at 0x100848: file C:/qnx-workspace/Debugging1/Debugging1.c, line 8.
(gdb) r
Starting program: C:\qnx-workspace\Debugging1\arm\o-le-g/Debugging1_g
Remote: /tmp/Debugging1_g
[New pid 233493 tid 1]

Breakpoint 1, main (argc=1, argv=0xffef4) at C:/qnx-workspace/Debugging1/Debugging1.c:5
5               printf("Welcome to the QNX Momentics IDE\n");
(gdb) n

Program received signal SIGILL, Illegal instruction.
0x00100834 in main (argc=1, argv=0xffef4) at C:/qnx-workspace/Debugging1/Debugging1.c:5
5               printf("Welcome to the QNX Momentics IDE\n");
(gdb) c
Continuing.

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Ok, now please see below.

On Tue, 2010-09-28 at 12:54 -0400, Arun Parameswaran wrote:
> Here is the output from my setup:
> 
> $ ntoarm-gdb Debugging1_g --ex "target qnx 10.136.18.132:8000"
> GNU gdb 6.8 qnx-nto (rev. 506)
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=i386-mingw32msvc --target=arm-unknown-nto-qnx6.5.0"...
> Remote debugging using 10.136.18.132:8000
> MsgNak received - resending
> Remote target is little-endian
> (gdb) upload Debugging1_g /tmp/Debugging1_g
> (gdb) b main
> Breakpoint 1 at 0x100830: file C:/qnx-workspace/Debugging1/Debugging1.c, line 5.
> (gdb) b Debugging1.c:8
> Breakpoint 2 at 0x100848: file C:/qnx-workspace/Debugging1/Debugging1.c, line 8.
> (gdb) r
> Starting program: C:\qnx-workspace\Debugging1\arm\o-le-g/Debugging1_g
> Remote: /tmp/Debugging1_g
> [New pid 233493 tid 1]
> 
> Breakpoint 1, main (argc=1, argv=0xffef4) at C:/qnx-workspace/Debugging1/Debugging1.c:5
> 5               printf("Welcome to the QNX Momentics IDE\n");
> (gdb) n
> 
> Program received signal SIGILL, Illegal instruction.
> 0x00100834 in main (argc=1, argv=0xffef4) at C:/qnx-workspace/Debugging1/Debugging1.c:5
> 5               printf("Welcome to the QNX Momentics IDE\n");

(gdb) p/x $pc

(gdb) x/i $pc-16


(and send the output here).




Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Hi Aleksandar/ Elena,
I appreciate you taking the time to help me out.
Is the libc.so.3 binary that I uploaded the same as in your installation?
Does the debugger require any other libraries/binaries to be present in the target/host?

Below are the outputs of the 'gdb' commands:
(gdb) p/x $pc
$1 = 0x100834
(gdb) x/i $pc-16
0x100824 <main+12>:     sub     sp, sp, #8      ; 0x8
(gdb)

I have also attached a list of files in the target, not sure if it is useful.
Thanks,
Arun
Attachment: Text arm-le_target_files 6.75 KB
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
I am sorry, it should have been

x/16i $pc-16 

so that I can see instruction at $pc + some context before and after (I
simply want to compare it to the binary itself).

On Tue, 2010-09-28 at 13:09 -0400, Arun Parameswaran wrote:
> Hi Aleksandar/ Elena,
> I appreciate you taking the time to help me out.
> Is the libc.so.3 binary that I uploaded the same as in your installation?
> Does the debugger require any other libraries/binaries to be present in the target/host?
> 
> Below are the outputs of the 'gdb' commands:
> (gdb) p/x $pc
> $1 = 0x100834
> (gdb) x/i $pc-16
> 0x100824 <main+12>:     sub     sp, sp, #8      ; 0x8
> (gdb)
> 
> I have also attached a list of files in the target, not sure if it is useful.
> Thanks,
> Arun
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post68835

Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
Here it is:

Program received signal SIGILL, Illegal instruction.
0x00100834 in main (argc=1, argv=0xffef4) at C:/qnx-workspace/Debugging1/Debugging1.c:5
5               printf("Welcome to the QNX Momentics IDE\n");
(gdb) x/16i $pc-16
0x100824 <main+12>:     sub     sp, sp, #8      ; 0x8
0x100828 <main+16>:     str     r0, [r11, #-16]
0x10082c <main+20>:     str     r1, [r11, #-20]
0x100830 <main+24>:     ldr     r0, [pc, #56]   ; 0x100870 <main+88>
0x100834 <main+28>:     bl      0x100538 <puts>
0x100838 <main+32>:     ldr     r0, [pc, #48]   ; 0x100870 <main+88>
0x10083c <main+36>:     bl      0x100538 <puts>
0x100840 <main+40>:     ldr     r0, [pc, #40]   ; 0x100870 <main+88>
0x100844 <main+44>:     bl      0x100538 <puts>
0x100848 <main+48>:     ldr     r0, [pc, #32]   ; 0x100870 <main+88>
0x10084c <main+52>:     bl      0x100538 <puts>
0x100850 <main+56>:     ldr     r0, [pc, #24]   ; 0x100870 <main+88>
0x100854 <main+60>:     bl      0x100538 <puts>
0x100858 <main+64>:     ldr     r0, [pc, #16]   ; 0x100870 <main+88>
0x10085c <main+68>:     bl      0x100538 <puts>
0x100860 <main+72>:     mov     r3, #0  ; 0x0
(gdb) p/x $pc
$2 = 0x100834
(gdb)
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
I noticed the following being printed in the verbose logs for the debugger in the console.

(gdb) 
184-stack-info-depth
&"Cannot access memory at address 0xeeeb699c\n"
Cannot access memory at address 0xeeeb699c
184^done,depth="1"

Not sure what the gdb is trying to access/write at this particular memory location. Is this a hardcoded value in the 
debugger where it stores some information or something? 
Does the gdb have some limitation on the RAM size? Since we are using a part of the RAM for some process (for bootup), 
we have specified the RAM size as 240MB in the BSP. Will a non-standard value like 240MB create any issue for the 
debugger/QNX?
Re: Debugger terminates with 'Illegal Instruction' (SIGILL) when Stepping through code  
I will look into this for you. I need to first locate an armle target I can use to reproduce your issue and go from 
there.