Bug 198696 - base system's objdump -g doesn't display any information
Summary: base system's objdump -g doesn't display any information
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 229046
  Show dependency treegraph
 
Reported: 2015-03-19 03:04 UTC by Kurt Lidl
Modified: 2021-01-16 20:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kurt Lidl freebsd_committer freebsd_triage 2015-03-19 03:04:21 UTC
On a relatively recent -CURRENT system:

uname -a:
FreeBSD busybox.pix.net 11.0-CURRENT FreeBSD 11.0-CURRENT #19 r280171M: Tue Mar 17 10:55:28 EDT 2015     lidl@busybox.pix.net:/usr/obj/usr/src/sys/BUSYBOX  amd64

clang -v:
FreeBSD clang version 3.6.0 (tags/RELEASE_360/final 230434) 20150225
Target: x86_64-unknown-freebsd11.0
Thread model: posix

/usr/bin/objdump doesn't display any useful information from a
.o object file compiled with 'clang -g':

lidl@busybox-234: /usr/bin/objdump -v
GNU objdump 2.17.50 [FreeBSD] 2007-07-03
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
lidl@busybox-235: /usr/bin/objdump -g ls.o

ls.o:     file format elf64-x86-64-freebsd

/usr/bin/objdump: ls.o: no recognized debugging information

The latest binutils from /usr/ports, however, does work:

lidl@busybox-236: /usr/local/bin/objdump -v
GNU objdump (GNU Binutils) 2.25
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
lidl@busybox-237: /usr/local/bin/objdump -g ls.o | head

ls.o:     file format elf64-x86-64-freebsd

Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x1172 (32-bit)
   Version:       2
   Abbrev Offset: 0x0
   Pointer Size:  8

Is there any hope for getting a working 'objdump -g' in the base system?
Isn't there a 'objdump' in the elf-toolchain?

Trying to use 'llvm-objdump -g ls.o' just spits out a usage message.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2015-03-20 01:54:19 UTC
elftoolchain doesn't include an objdump. Some of objdump's capabilities are also available in other tools, but as elftoolchain currently doesn't have a disassembler it can't provide a viable objdump at the moment.

There is llvm-objdump though, which we might bring in.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2015-10-14 13:27:03 UTC
> There is llvm-objdump though, which we might bring in.

Somehow I missed that you commented on llvm-objdump already, reporting that lacked -g. I think the most likely path here is still to add the missing functionality to llvm-objdump and bring it in.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2015-10-14 13:31:14 UTC
That said, it seems base system objdump does emit the appropriate debug info with -W. It just doesn't detect DWARF debug info with -g like later versions of objdump do.