Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Debug Symbols

未关闭
#666 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, postgres
领域
database, devops

调研方向

从镜像构建配置开始,并使用 file 和 readelf 检查 postgres 入口点;审查所提议的 configure CFLAGS 和 find-dbgsym-packages 方法。完成的标准是建立一种受支持的方式,使镜像能够提供可用的调试符号,或者记录一种可复现的派生镜像工作流及其在 image-size 和 flavor 方面的权衡。

由索引模型根据 Issue 内容生成。

描述

question

Problem

The postgres binaries shipped with the docker images in this repo seem to be stripped:

root@0d42c3d8cd06:/# postgres --version
postgres (PostgreSQL) 12.1 (Debian 12.1-1.pgdg100+1)
root@0d42c3d8cd06:/# file $(which postgres)
/usr/lib/postgresql/12/bin/postgres: ELF 64-bit LSB shared object, x86-64, version 1
(SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
3.2.0, BuildID[sha1]=e775eb7dcaa0306329f0624056df0fa892d48f03, stripped
-----------------------------------------------------------------^

This makes it difficult to use tools such as gdb or perf to debug problems as the resulting stack traces will often be useless.

See my tweet here for a practical example of what can be done when symbols are present.

Proposal

It'd be great if this image would start to ship with debug symbols by default, e.g. by compiling with ./configure CFLAGS="-fno-omit-frame-pointer -ggdb".

If not, it'd be great to document how to derive an image that includes symbols. My first attempts at doing so below have failed. I still get the same output for file $(which postgres) as above, and readelf -s $(which postgres) | wc -l gives me the same ~9k symbols contained in this image, rather than the ~30k symbols usually available for a non-stripped postgres binary.

FROM postgres
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
  debian-goodies \
  binutils
RUN apt-get install -y $(find-dbgsym-packages $(which postgres))

I suspect the image above doesn't work because postgres is pulled from apt.postgresql.org, but find-dbgsym-packages is not smart enough to search that repo for debug package, if those even exist.

I'd be happy to try to help with creating a PR to improve the debugging/symbol situation once the direction is clear.

From my PoV the only downside to including symbols is image size, so maybe they shouldn't go into the alpine flavor of this image.

主要语言
Shell
星标
2.5k
派生
1.2k
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

docker-library/postgres 的其他 Issue

查看 docker-library/postgres 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。