Дамп ядра собирает только пространство процесса, но не общую память, которая создается для межпроцессного взаимодействия. Как я могу сделать дамп ядра, чтобы он также включал общую память запущенного процесса?
Собрать дамп ядра с общей памятью запущенного процесса
Ответы (2)
Установите фильтр файла ядра в /proc/PID/coredump_filter
на http://man7.org/linux/man-pages/man5/core.5.html:
Управление сопоставлениями, записываемыми в дамп ядра
Since kernel 2.6.23, the Linux-specific /proc/PID/coredump_filter
file can be used to control which memory segments are written to the
core dump file in the event that a core dump is performed for the
process with the corresponding process ID.
The value in the file is a bit mask of memory mapping types (see
mmap(2)). If a bit is set in the mask, then memory mappings of the
corresponding type are dumped; otherwise they are not dumped. The
bits in this file have the following meanings:
bit 0 Dump anonymous private mappings.
bit 1 Dump anonymous shared mappings.
bit 2 Dump file-backed private mappings.
bit 3 Dump file-backed shared mappings.
bit 4 (since Linux 2.6.24)
Dump ELF headers.
bit 5 (since Linux 2.6.28)
Dump private huge pages.
bit 6 (since Linux 2.6.28)
Dump shared huge pages.
bit 7 (since Linux 4.4)
Dump private DAX pages.
bit 8 (since Linux 4.4)
Dump shared DAX pages.
By default, the following bits are set: 0, 1, 4 (if the
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS kernel configuration option is
enabled), and 5. This default can be modified at boot time using the
coredump_filter boot option.
person
Andrew Henle
schedule
18.02.2016
Это помогло, я использовал sprintf(cmd, echo 0xff › /proc/%d/coredump_filter,getpid()); система (командная команда); и это сработало. Спасибо Андрей!
- person shim_mang; 18.02.2016
Основной файл захватывает полное адресное пространство процесса, включая разделяемую память. Вы можете проверить это, создав основной файл с помощью команды gcore в Linux, а затем проверив конкретное содержимое, которое вы сохранили в общей памяти, в основном файле.
person
Umamahesh P
schedule
18.02.2016
Я пробовал, но общая память недоступна. Должен быть способ включить дамп ядра с общей памятью. Пожалуйста помоги
- person shim_mang; 18.02.2016
Вы создали основной файл от пользователя root?
- person Umamahesh P; 18.02.2016
Да, нам нужно включить бит в coredump_filter.
- person shim_mang; 18.02.2016