在 Linux 上创建核心转储

发布于 2024-07-15 13:06:21 字数 646 浏览 11 评论 0原文

复制:

在 Linux 中生成核心转储

我正在尝试在我的“Fedora Core 版本 3(海德堡)”。

[root@testserver test_core_dump]# uname -a

Linux testserver 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686 athlon i386 GNU/Linux

我正在关注 创建核心转储。

问题是,此版本中不存在 /proc/sys/kernel/suid_dumpable。 我还在这里检查了 /proc/sys/fs/suid_dumpable,但 suid_dumpable 不存在。

1)有什么解决办法吗? 2)我在这里错过了什么吗?

Duplicate:

generate a core dump in linux

I am trying to create a core dump in my "Fedora Core release 3 (Heidelberg)".

[root@testserver test_core_dump]# uname -a

Linux testserver 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686 athlon i386 GNU/Linux

I am following this to create core dumps.

The problem is, /proc/sys/kernel/suid_dumpable is not present in this version. I also checked here /proc/sys/fs/suid_dumpable, but suid_dumpable is not present.

1) Is there any work around for this?
2) Am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

書生途 2024-07-22 13:06:21

您遵循的说明只是为了覆盖可能阻止您获取核心转储的操作系统限制。

核心转储的生成是一个微不足道的过程,您可以向进程发送一个信号,如下所示。

kill -ABRT pid_of_process

但是,有很多事情可能会阻止这种情况发生,但是您应该首先尝试一下,看看它是否在当前目录中生成核心转储。 如果程序是交互式的并且不捕获退出信号,那么您可以通过向进程发送 SIGQUIT 来导致核心转储,这通常绑定到 CTRL-\

您在引用的文档中遇到问题的区域是指处理运行 setuid/setguid 的进程,如果您的进程未在这两种模式下运行,那么您可以安全地忽略该步骤。 (您可以通过查看程序的文件权限并检查 setuid 和 setguid 位来判断进程是否正在运行 setuid/setguid,这可以通过发出 ls -l 命令并在第 4 个位置查找 s 来完成(setuid)或第 7 个位置 (setgid)(下面的 setuid 示例)

-r-sr-xr-x 1 root wheel 57616 28 Oct 03:28 /usr/bin/login

您是否尝试过在不使用的情况下生成核心使用不起作用的步骤并且它起作用了吗?

您将需要能够在进程运行的目录中写入,或者如果不是当前目录,则为核心转储定义的目录可以解决问题。权限问题。

The instructions you are following are simply to over-ride the o/s limits that may prevent you from getting a core dump.

The generation of a core dump is a trivial process, you send a signal to the process as follows

kill -ABRT pid_of_process

There are many things however that may prevent this from happening, however you should try this first and see if it produces a core dump in your current directory. If the program is interactive and doesn't trap the quit signnal then you may be able to cause core to dump by sending SIGQUIT to the process, this is usually bound to CTRL-\

The area you are having problems with in the referenced document refers to process that run setuid/setguid if your process is not running in either of those modes then you can safely ignore that step. (You can tell if the process is running setuid/setguid by looking at the file permissions of the program and examining the setuid and setguid bits this can be done by issuing an ls -l command and looking for s in the 4th position (setuid) or 7th position (setgid) (example of setuid below)

-r-sr-xr-x 1 root wheel 57616 28 Oct 03:28 /usr/bin/login

Have you tried to generate a core without using the step that is not working and did it work?

You will need to be able to write in the directory that the process is running in, or the directory defined for core dumps if that is not the current directory. Running as root may solve the permissions issues.

守护在此方 2024-07-22 13:06:21

我不确定我明白你想要什么。 您引用的网页讨论了启用核心转储,而不是触发它们。 不要担心缺少 sysctl —— 我的 Linux 系统也没有它,我可以愉快地转储周围的核心:) 您想为特定进程创建核心转储吗?

除了SIGABRT之外,您还可以尝试使用gcore

NAME
gcore - 为正在运行的进程生成核心文件

概要
gcore [-o 文件名] pid

描述
gcore 为由进程 ID pid 指定的进程生成核心文件。 默认情况下,核心文件写入当前目录中的 core.pid。

I am not sure I understand what you want. The webpage you references talks about ENABLING core-dumps, not triggering them. Do not worry about the missing sysctl -- my Linux systems also doesn't have it and I can happily dump cores all around :) Do you want to create a core dump for a specific process?

Apart from SIGABRT, you can also try using gcore:

NAME
gcore - Generate a core file for a running process

SYNOPSIS
gcore [-o filename] pid

DESCRIPTION
gcore generates a core file for the process specified by its process ID, pid. By default, the core file is written to core.pid, in the current directory.

爱已欠费 2024-07-22 13:06:21

这是此问题的重复项。 接受的答案,以及得票最多的一个建议如下:

在Bash中:

ulimit -c unlimited

在tcsh中:

limit coredumpsize unlimited

在这种情况下,如果程序崩溃,将在运行该程序的名为 core 的文件中创建核心转储。

This is a duplicate of this question. The accepted answer, and the one with most votes suggest the following:

In Bash:

ulimit -c unlimited

and in tcsh:

limit coredumpsize unlimited

In this case, if a program crashes, the core dump will be created in a file called core where the program was run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文