Wind River Support Network

HomeDefectsLIN8-9288
Fixed

LIN8-9288 : gdb crashes when debugging remote process

Created: Jun 12, 2018    Updated: Mar 27, 2019
Resolved Date: Aug 20, 2018
Found In Version: 8.0.0.25
Fix Version: 8.0.0.27
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Toolchain

Description

We encountered gdb crash when debugging remote process which includes fork/exec system calls.  Crashing point is xfree(info->name) in free_private_thread_info().

We noticed that following patch is applied for gdb of WRL8:

  - Target remote mode fork and exec event support
    https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=8020350c5277e056e89b0ea5e14a8d09408f7fb3

However, following hunk is not applied:

@@ -1918,7 +1918,8 @@ demand_private_info (ptid_t ptid)
       info->priv = XNEW (struct private_thread_info);
       info->private_dtor = free_private_thread_info;
       info->priv->core = -1;
-      info->priv->extra = 0;
+      info->priv->extra = NULL;
+      info->priv->name = NULL;

Therefore, when gdb called free_private_thread_info() and name member is non-NULL invalid value, gdb crashes.  We verified applying this hunk resolved the issue.

Attachment:
- gdb-demand_private_info.patch: patch for WRL8
- host.log: terminal log when gdb crashed
- test.c: test program

Steps to Reproduce

1. Configure a platform project:

/WindRiver-wrlinux-8/wrlinux-8/wrlinux/configure --enable-reconfig --enable-board=intel-x86-64 --enable-kernel=standard --enable-rootfs=glibc-std+debug --enable-build=production --with-rcpl-version=0025

2. Build the project, usb-image and SDK:

  $ make
  $ make usb-image
  $ make SDK

3. Install SDK

4. Compile test.c using SDK

5. Boot the target with usb-image (I used KVM)

6. On the target, run the test program build by step 4 with gdbserver:

  $ gdbserver 192.168.122.1:9876 ./test

7. On the host, run gdb and connect to the test program on the target:

  $ x86_64-wrs-linux-gdb test
  (gdb) set target-async 1
  (gdb) set pagination off
  (gdb) set non-stop on
  (gdb) set detach-on-fork off
  (gdb) target remote 192.168.122.58:9876
  (gdb) cont

8. gdb crashes on the host

I assumes host ip address is 192.168.122.1 and target ip address is 192.168.122.58.

Other Downloads


Live chat
Online