8.3 pic-objdump Utility

The pic-objdump utility displays information about one or more object files. The options control what particular information to display. The output can provide information similar to that of a disassembly listing.

The pic-objdump utility takes ELF object files as input. If no object files are listed as arguments, pic-objdump attempts to read from the file a.out.

The general command-line usage of pic-objdump is:
pic-objdump options OBJFILE...

The OBJFILE are the object files to be examined. When you specify archives, pic-objdump shows information on each of the member object files.

A common usage of this tool is to obtain a full list file for the entire program. To do this, use the compiler’s -g option when you build the project, then call the pic-objdump application with a command similar to the following.
pic-objdump -SD -l a.out > pic.lst
This will create an pic.lst listing file from the default compiler output file, showing the original C source code and line number information in the listing.

The long and short forms of options, shown in the following table, as alternatives, are equivalent. At least one of the following options -a, -d, -D, -f, -g, -h, -H, -i, -r, -S, -t, -V or -x must be given.

Table 8-7. OBJDUMP Options
OptionFunction
-a

--archive-header

If any of the OBJFILE files are archives, display the archive header information (in a format similar to ls -l). Besides the information you could list with xc8-ar tv, pic-objdump -a shows the object file format of each archive member.
-b format

--target=format

Specify the target object file format. The option -b binary, fr example, allows the utility to work on a raw binary file.
-d

--disassemble

Display the assembler mnemonics for the machine instructions from OBJFILE. This option only disassembles those sections that are expected to contain instructions.
-D

--disassemble-all

Like -d, but disassemble the contents of all sections, not just those expected to contain instructions.
-f

--file-header

Display summary information from the overall header of each of the OBJFILE files.
--file-start-contextSpecify that when displaying inter-listed source code/disassembly (assumes -S) from a file that has not yet been displayed, extend the context to the start of the file.
-g

--debugging

Display debugging information. This attempts to parse debugging information stored in the file and print it out using a C like syntax. Only certain types of debugging information have been implemented.
-h

--section-header

--header

Display summary information from the section headers of the object file.

Some object file formats, such as a.out, do not store the starting address of the file segments. In those situations, although ld relocates the sections correctly, using pic-objdump -h to list the file section headers cannot show the correct addresses. Instead, it shows the usual addresses, which are implicit for the target.

-H

--help

Print a summary of the options to pic-objdump and exit.
-i

--info

Print a list of the object formats and architectures supported and exit.
-j name

--section=name

Display information only for section name.
-l

--line-numbers

Label the display (using debugging information) with the filename and source line numbers corresponding to the object code or relocs shown. Only useful with -d, -D or -r.
-m arch

--architecture=arch

Specify the target architecture.
-M options

--disassembler-
 options=options

Pass target specific information to the disassembler. The following options are supported:

symbolic - Will perform symbolic disassembly.

-P,

--private=options

Display object format specific contents
--prefix-addressesWhen disassembling, print the complete address on each line. This is the older disassembly format.
-r

--reloc

Print the relocation entries of the file. If used with -d or -D, the relocations are printed interspersed with the disassembly.
-s

--full-contents

Display the full contents of any sections requested.
-S

--source

Display source code intermixed with disassembly, if possible. Implies -d.
--show-raw-insnWhen disassembling instructions, print the instruction in hex, as well as in symbolic form. This is the default except when --prefix-addresses is used.
--no-show-raw-insnWhen disassembling instructions, do not print the instruction bytes. This is the default when --prefix-addresses is used.
--start-address=addressStart displaying data at the specified address. This affects the output of the -d, -r and -s options.
--stop-address=addressStop displaying data at the specified address. This affects the output of the -d, -r and -s options.
-t

--syms

Print the symbol table entries of the file.
-V

--version

Print the version number of pic-objdump and exit.
-w

--wide

Format some lines for output devices that have more than 80 columns.
-x

--all-header

Display all available header information, including the symbol table and relocation entries. Using -x is equivalent to specifying all of -a -f -h -r -t.
-z

--disassemble-zeroes

Normally the disassembly output will skip blocks of zeros. This option directs the disassembler to disassemble those blocks, just like any other data.