Sun Studio 12: Performance Analyzer

Viewing Source/Disassembly Without An Experiment

You can view annotated source code and annotated disassembly code using the er_src utility, without running an experiment. The display is generated in the same way as in the Analyzer, except that it does not display any metrics. The syntax of the er_src command is

er_src [ -func | -{source,src} item tag | -disasm item tag |
-{cc,scc,dcc} com_spec | -outfile filename | -V ] object

object is the name of an executable, a shared object, or an object file (.o file).

item is the name of a function or of a source or object file used to build the executable or shared object. item can also be specified in the form functionfile’, in which case er_src displays the source or disassembly of the named function in the source context of the named file.

tag is an index used to determine which item is being referred to when multiple functions have the same name. It is required, but is ignored if not necessary to resolve the function.

The special item and tag, all -1, tells er_src to generate the annotated source or disassembly for all functions in the object.

Note –

The output generated as a result of using all -1 on executables and shared objects may be very large.

The following sections describe the options accepted by the er_src utility.


List all the functions from the given object.

-{source,src} item tag

Show the annotated source for the listed item.

-disasm item tag

Include the disassembly in the listing. The default listing does not include the disassembly. If there is no source available, a listing of the disassembly without compiler commentary is produced.

-{c,scc,dcc} com-spec

Specify which classes of compiler commentary classes to show. com-spec is a list of classes separated by colons. The com-spec is applied to source compiler commentary if the -scc option is used, to disassembly commentary if the -dcc option is used, or to both source and disassembly commentary if -c is used. See Commands That Control the Source and Disassembly Listings for a description of these classes.

The commentary classes can be specified in a defaults file. The system wide er.rc defaults file is read first, then an .er.rc file in the user’s home directory, if present, then an .er.rc file in the current directory. Defaults from the .er.rc file in your home directory override the system defaults, and defaults from the .er.rc file in the current directory override both home and system defaults. These files are also used by the Analyzer and the er_print utility, but only the settings for source and disassembly compiler commentary are used by the er_src utility. See Commands That Set Defaults for a description of the defaults files. Commands in a defaults file other than scc and dcc are ignored by the er_src utility.

-outfile filename

Open the file filename for output of the listing. By default, or if the filename is a dash (-), output is written to stdout.


Print the current release version.