Debug RTEMS RTL using qemu-system-arm

Peng Fan van.freenix at gmail.com
Tue Jul 8 12:49:07 UTC 2014


2014-07-07 1:05 GMT+08:00 Mihaela Panescu <mihaela.panescu. at gmail.com
<mihaela.panescu at gmail.com>>:

> Hi,
>
> Can you try with the following configuration:
> #define CONFIGURE_MAXIMUM_POSIX_KEYS             16
> #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  16
>

It works. Thanks.

Peng

>
> Mihaela
>
>
>
>
>
> On Sun, Jul 6, 2014 at 4:21 PM, Peng Fan <van.freenix at gmail.com> wrote:
>
>> I use qemu and gdb to debug,  The following is the backtrace. and I found
>> that _POSIX_Keys_Allocate() returns NULL/0, is this correct? Any tips? I do
>> not know how to debug this, or there should be some shell configuration
>> when call rtems_shell_init?
>>
>> Breakpoint 1, pthread_key_create (key=0x20b2c8,
>>     destructor=0x157d55 <rtems_shell_env_free>)
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/posix/src/keycreate.c:41
>> 41  the_key = _POSIX_Keys_Allocate();
>> (gdb) bt
>> #0  *pthread_key_create* (key=0x20b2c8,
>>     destructor=0x157d55 <rtems_shell_env_free>)
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/posix/src/keycreate.c:41
>> #1  0x00157db8 in *rtems_shell_current_env_make_key *()
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/libmisc/shell/shell.c:109
>> #2  0x0013f2fa in _Once (once_state=0x2071d8
>> <rtems_shell_current_env_once+4>,
>>     init_routine=0x157da1 <rtems_shell_current_env_make_key>)
>>     at ../../../../../../rtems-new/c/src/../../cpukit/score/src/once.c:42
>> #3  0x00136aca in pthread_once (
>>     once_control=0x2071d4 <rtems_shell_current_env_once>,
>>     init_routine=0x157da1 <rtems_shell_current_env_make_key>)
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/posix/src/pthreadonce.c:39
>> #4  0x00158f96 in rtems_shell_main_loop (shell_env_arg=0x5a4118)
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/libmisc/shell/shell.c:707
>> #5  0x00158f2e in rtems_shell_task (task_argument=5914904)
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/libmisc/shell/shell.c:671
>> #6  0x0014207c in _Thread_Handler ()
>>     at
>> ../../../../../../rtems-new/c/src/../../cpukit/score/src/threadhandler.c:192
>> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>> *(gdb) n*
>> *43  if ( !the_key ) {*
>> *(gdb) p the_key*
>> *$1 = (POSIX_Keys_Control *) 0x0*
>>
>> Regards,
>> Peng.
>>
>> 2014-07-05 15:44 GMT+08:00 Peng Fan <van.freenix at gmail.com>:
>>
>> Hi,
>>>
>>> I encountered a problem when using qemu-system-arm to simulate RTEMS RTL
>>> using `qemu-system-arm -no-reboot -net none -nographic -M realview-pbx-a9
>>> -m 256M -kernel build/arm-rtems4.11-realview_pbx_a9_qemu/rtld`
>>>
>>> it continuly outputs the following msg, but not run into a shell prompt:
>>> "
>>> pthread_setspecific(shell_current_env_key)
>>> Starting shell....
>>>
>>> pthread_setspecific(shell_current_env_key)
>>> Starting shell....
>>>
>>> pthread_setspecific(shell_current_env_key)
>>> Starting shell....
>>>
>>> pthread_setspecific(shell_current_env_key)
>>> Starting shell....
>>> "
>>> I found that  `sc = rtems_shell_init ("fstst", 60 * 1024, 150,
>>> "/dev/console", 0, 1, NULL);`  returns immediately with the return
>>> value RTEMS_SUCCESSFULL.
>>>
>>> If I `git reset --hard *ffc862cbf567*` to the following RTEMS commit,
>>> "commit *ffc862cbf567*068d1cc2b8417bafdf808dfcc67a
>>> Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
>>> Date:   Tue Sep 17 13:08:49 2013 +0200
>>>
>>>     bsp/realview-pbx-a9: Add NULL pointer protection
>>>
>>>     Qemu Git version 8641136c54d216edb5bb8ef723c754039b4ce5cf3 or later
>>> is
>>>     required."
>>> RTL runs well. I am not familiar with RTEMS internal, not sure why this.
>>> The qemu verison is 2.0.0. RTEMS is 4.11.
>>>
>>> Regards,
>>> Peng.
>>>
>>
>>
>> _______________________________________________
>> users mailing list
>> users at rtems.org
>> http://lists.rtems.org/mailman/listinfo/users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140708/fb2e34b6/attachment-0002.html>


More information about the users mailing list