Problem with gdb

Jan Kiszka jan.kiszka at siemens.com
Sun Apr 26 10:33:46 CEST 2020


On 25.04.20 09:18, Paolo Minazzi via Xenomai wrote:
> I'm Paolo Minazzi.
> I am working on an ARM board with iMX6SX.
> 
> Linux kernel : 4.9
> Ipipe        : ipipe-core-4.9.38-arm-3.patch

Can you cross-check with ipipe-core-4.19.114-cip24-arm-08? 4.9 is 
unmaintained regarding I-pipe.

> Xenomai      : 3.1
> 
> All works well.
> I have a problem debugging with GDB (both native and remote).
> The problem is that before an alchemy small demo starts, I have the hit 
> 2 times CTRL-C and use "c" command.
> 
> Details:
> [1] gdb demo
> [2] I use the "r" command to run.
>      gdb remain blocked
> [3] I press CTRL-C, then "c" command.
>      gdb remain blocked
> [4] I press CTRL-C, then "c" command.
>      Then demo start correctly
> 
> Can you help me ?
> 

How did you build Xenomai (configure options)? How are you building your 
demo?

Jan

> Kind regards,
> Paolo Minazzi
> 
> 
> EXTRA DETAILS
> =============
> 
> GDB SESSION
>          GNU gdb (GDB) 7.12
>          Copyright (C) 2016 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 "arm-linux-gnueabihf".
>          Type "show configuration" for configuration details.
>          For bug reporting instructions, please see:
>          <http://www.gnu.org/software/gdb/bugs/>.
>          Find the GDB manual and other documentation resources online at:
>          <http://www.gnu.org/software/gdb/documentation/>.
>          For help, type "help".
>          Type "apropos word" to search for commands related to "word"...
>          Reading symbols from demo...done.
>                  (gdb) r
>          Starting program: /demo
>          [Thread debugging using libthread_db enabled]
>          Using host libthread_db library "/lib/libthread_db.so.1".
>          [New Thread 0xb6c61470 (LWP 432)]
>                  <<< BLOCKED. I press CTRL-C >>>
>          Thread 1 "demo" received signal SIGINT, Interrupt.
>          0xb6fa4d08 in __wrap_pthread_mutex_lock () from 
> /lib/libcobalt.so.2
>                  (gdb) c
>          Continuing.
>                  <<< BLOCKED. I press CTRL-C >>>
>          Thread 1 "demo" received signal SIGINT, Interrupt.
>          0xb6fa4d08 in __wrap_pthread_mutex_lock () from 
> /lib/libcobalt.so.2
>                  (gdb) c
>          Continuing.
>                  <<< NOW DEMO RUN CORRECTLY >>>
> 
> BACKTRACE
>          If at [3] I use backtrace gdb command:
>                  (gdb) backtrace
>                  #0  0xb6fa4d08 in __wrap_pthread_mutex_lock () from 
> /lib/libcobalt.so.2
>                  #1  0xb6fa8cb2 in add_extent () from /lib/libcobalt.so.2
>                  #2  0xb6fa9122 in heapmem_init () from /lib/libcobalt.so.2
>                  #3  0xb6fc0db2 in heapobj_pkg_init_private () from 
> /lib/libcopperplate.so.0
>                  #4  0xb6fbe9d4 in copperplate_init () from 
> /lib/libcopperplate.so.0
>                  #5  0xb6fa9ae2 in __xenomai_init () from 
> /lib/libcobalt.so.2
>                  #6  0xb6fa9fbe in xenomai_init () from /lib/libcobalt.so.2
>                  #7  0x00008928 in xenomai_bootstrap ()
>                  #8  0x00008b64 in __libc_csu_init ()
>                  #9  0xb6e7af98 in __libc_start_main () from /lib/libc.so.6
>                  #10 0x00008966 in _start ()
>                  Backtrace stopped: previous frame identical to this 
> frame (corrupt stack?)
> 
>          If at [4] I use backtrace gdb command:
>                  (gdb) backtrace
>                  #0  0xb6fa4d08 in __wrap_pthread_mutex_lock () from 
> /lib/libcobalt.so.2
>                  #1  0xb6fa8d9a in heapmem_alloc () from 
> /lib/libcobalt.so.2
>                  #2  0xb6fbfaec in __threadobj_alloc () from 
> /lib/libcopperplate.so.0
>                  #3  0xb6fc0318 in threadobj_pkg_init () from 
> /lib/libcopperplate.so.0
>                  #4  0xb6fbea28 in copperplate_init () from 
> /lib/libcopperplate.so.0
>                  #5  0xb6fa9ae2 in __xenomai_init () from 
> /lib/libcobalt.so.2
>                  #6  0xb6fa9fbe in xenomai_init () from /lib/libcobalt.so.2
>                  #7  0x00008928 in xenomai_bootstrap ()
>                  #8  0x00008b64 in __libc_csu_init ()
>                  #9  0xb6e7af98 in __libc_start_main () from /lib/libc.so.6
>                  #10 0x00008966 in _start ()
>                  Backtrace stopped: previous frame identical to this 
> frame (corrupt stack?)
> 
> 
> /proc/xenomai/sched
>          When gdb is blocked ([3] and [4]) I always have this situation:
>                  /# cat /proc/xenomai/sched/stat
>                  CPU  PID    MSW        CSW        XSC        PF 
> STAT       %CPU  NAME
>                    0  0      0          779        0          0 
> 00018000  100.0  [ROOT]
>                    0  19165  1          1          4          0 
> 00460040    0.0  demo
>                    0  0      0          39725      0          0 
> 00000000    0.0  [IRQ16: [timer]]
> 
> 
> DEMO.c
> =====================================================================
>          #include <stdio.h>
>          #include <alchemy/task.h>
> 
>          RT_TASK rt_task;
>          volatile unsigned int cnt;
> 
>          void rt_inc_fn(void *dummy) {
>                  while(1) {
>                          cnt++;
>                          rt_task_sleep(100*1000*1000);
>                  }
>          }
> 
>          int main(int argc, char **argv) {
>                  int ret;
>                  ret = rt_task_create(&rt_task, "demo", 0, 50, 0);
>                  assert(ret==0);
>                  ret = rt_task_start(&rt_task, &rt_inc_fn, NULL);
>                  assert(ret==0);
>                   while(1) {
>                          usleep(1000000);
>                          printf("%d\n", cnt);
>                  }
>          }
> =====================================================================
> 
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list