> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect coredumps

<Note>
  The coredump feature is currently not supported and will be added in a future release.
</Note>

A coredump is a memory snapshot of a user-space process that allows you to analyze the cause of a process crash.

The system collects coredumps according to the Yocto Project Linux standard for all user-space process crashes. By default, the build allows coredumps. The device saves generated coredumps in the `/var/coredump` directory.

* To verify the location of the coredump, run the following command:
  > > ```text theme={null}
  > > cat /proc/sys/kernel/core_pattern
  > > ```
  >
  > **Sample output:**
  >
  > /var/coredump/%e.core

* To verify the size of the coredump, run the following command (the coredump size must be greater than 0 \[zero]):
  > ```text theme={null}
  > ulimit -c
  > ```
  >
  > **Sample output:**
  >
  > unlimited

* If the coredumps aren't enabled, use the following file to enable it:
  > `meta-qcom-distro/recipes-products/packagegroups/packagegroup-qcom-utilities.bb`.
  >
  > > ```text theme={null}
  > > RDEPENDS:${PN}-support-utils = " \
  > > dtc \
  > > efivar \
  > > file \
  > > less \
  > > ltrace \
  > > ++  procps \
  > >  tinyalsa \
  > > ```
  <Note>
    * Use this patch to enable coredumps, then rebuild and reflash the device.
  </Note>

## **Analyze coredump using GDB**

You can generate a coredump by forcibly killing a process. To do this, run the following commands:

```text theme={null}
ps -ef | grep -i 'tqftp*'
```

**Sample output:**

root 1024 1 0 17:46 ? 00:00:00 /usr/bin/tqftpserv

root 1047 934 0 17:47 pts/0 00:00:00 grep -i tqftp\*

```text theme={null}
kill -11 1024
```

```text theme={null}
cd /var/coredump
```

```text theme={null}
ls
```

**Sample output:**

tqftpserv.core

The `tqftpserv.core` is the coredump file.

If the device already has debug symbols, run the following commands to use the GDB tool on the coredump:

```text theme={null}
cd /usr/bin/
```

```text theme={null}
gdb tqftpserv /var/coredump/tqftpserv.core
```

**Sample output:**

```text theme={null}
gdb: warning: Couldn't determine a path for the index cache directory.
Copyright (C) 2022 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.
Type "apropos word" to search for commands related to "word"...
Reading symbols from tqftpserv...

warning: exec file is newer than core file.
[New LWP 1024]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Core was generated by `/usr/bin/tqftpserv'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000ffff8629ef34 in __GI___select (nfds=4,
  readfds=readfds@entry=0xffffd04ccb28, writefds=writefds@entry=0x0,
--Type <RET> for more, q to quit, c to continue without paging--
  exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x0)
  at ../sysdeps/unix/sysv/linux/select.c:69
69      ../sysdeps/unix/sysv/linux/select.c: No such file or directory.
(gdb) bt
#0  0x0000ffff8629ef34 in __GI___select (nfds=4,
  readfds=readfds@entry=0xffffd04ccb28, writefds=writefds@entry=0x0,
  exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x0)
  at ../sysdeps/unix/sysv/linux/select.c:69
#1  0x00000000004013cc in main (argc=<optimized out>, argv=<optimized out>)
  at tqftpserv.c:552
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
```

For more information, see [Linux manual page](https://man7.org/linux/man-pages/man5/core.5.html).
