Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Strange problen with sprintf on PPC: Page 1 of 5 (5 Items)
   
Strange problen with sprintf on PPC  
Hello,

below is a gdb session showing that problem on a Lite5200 EVB.
What could be the problem ??

# make -f mApp
qcc -g -Vgcc_ntoppcbe -Wall -I. -I../../examples/m1 -I../../canopen/include -I../../drivers/shar_inc -I../../drivers/
generic -o co_appl  main.c -L obj -l co -l appl -l co -l CAN
# ntoppc-gdb
GNU gdb 5.0 (UI_OUT)
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86-pc-nto-qnx --target=ntoppc".
(gdb) target qnx 192.168.178.77:10000
Remote debugging using 192.168.178.77:10000
(gdb) set qnxremotecwd /
(gdb) upload co_appl  co_appl
(gdb) sy  co_appl
Reading symbols from co_appl...done.
(gdb) b main
Breakpoint 1 at 0x48040b60: file main.c, line 246.
(gdb) ru  co_appl
Starting program:  co_appl
(gdb) c
Continuing.

Breakpoint 1, main (argc=???, argv=???) at main.c:246
246     {
(gdb) n
main (argc=1, argv=0x4803fe84) at main.c:249
249         BOOL_T              err = CO_FALSE; /* error flag */
(gdb)
259             ThreadCtl( _NTO_TCTL_IO, 0 );
(gdb)
261         setOptions(CO_EXAMPLE_ARGS);
(gdb)
267         lNodeId = NODE_ID;
(gdb)
271             memset(CAN_resmgr_name, 0x00, 32);
(gdb)
272             sprintf(CAN_resmgr_name, "/dev/%s%d", can_device, curr_channel);
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0xfe34bfd8 in ?? () from /ppcbe/lib/libc.so.2
(gdb) print can_device
$1 = "CANDRV", '\000' <repeats 23 times>
(gdb) print curr_channel
$2 = 1
(gdb)