Roman Y. Andronov
Roman Y. Andronov

Reputation: 51

How to suppress the gdb running process attachment information?

Moving from dbx to gdb:

I would like to permanently suppress the information gdb prints out on my terminal while attaching to a running process in its entirety. Does anyone know how to do that? Thank you for any help.

Sample (64-bit CentOS 6.6) session:

gdb -p 12345
Attaching to process 12345
Reading symbols from /some/path/to/my/ELF executable...done.
Reading symbols from /some/other/path/to/my/library.so...done.
Loaded symbols for /some/other/path/to/my/library.so
[New LWP 12345]
[New LWP 12345]
[New LWP 12345]
[New LWP 12345]
[Thread debugging using libthread_db enabled]
0x000000338a6aca3d in nanosleep () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install ...

In reality there are multiple screens of the above 'Reading' and 'Loading' entries which I am suppressing manually for sanity sake. There are also 4 100-character long lines of complaints about "Missing separate debuginfo" which I am also manually suppressing for the post.

Do not want to see any of it. All I want is this:

gbd -p 12345
in nanosleep () from /lib64/libc.so.6

which is somewhat useless - where are the current file and function names plus the line number and thread id? But I am willing to overlook this. More interested in suppressing the output for now (not eliciting it).

Is this easily achievable with gdb? An entry in .gdbinit or some such? Thanks again.

Upvotes: 3

Views: 1548

Answers (3)

user4891857
user4891857

Reputation:

You may suppress the "Missing separate debuginfos" complaints with the command set build-id-verbose 0 (this setting does not appear to be well documented).

If these warnings appear when you start a program with gdb, it may be useful to include that line in your .gdbinit file.

Upvotes: 5

Roman Y. Andronov
Roman Y. Andronov

Reputation: 51

Resolved.

Though I could not find a way to silence the "Missing separate debuginfos" complaints via redirecting them to /dev/null I have managed to get rid of them by doing what they suggested:

  1. become root.
  2. vi /etc/yum.repos.d/CentOS-Debuginfo.repo
  3. change "enabled=0" to "enabled=1"
  4. save and exit vi.
  5. yum install yum-utils
  6. debuginfo-install glibc
  7. debuginfo-install keyutils-libs
  8. debuginfo-install krb5-libs
  9. debuginfo-install libgcc
  10. debuginfo-install libuuid
  11. debuginfo-install openssl

gdb sessions look much cleaner now. Thanks.

Upvotes: 1

Tom Tromey
Tom Tromey

Reputation: 22599

As far as I know there is no way to disable these.

Some extra messages are printed if you have set print inferior-events on. So, make sure it is off. But, it probably is for you, as that is the default.

You can make some specific commands quiet by writing your own wrapper using define and having it redirect output to /dev/null.

I think giving users more control over the output would be a reasonable feature request for gdb.

Upvotes: 1

Related Questions