SparcAidsDoc.tioga
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Michael Plass, February 4, 1992 5:08 pm PST
Last tweaked by Mike Spreitzer July 23, 1992 2:40 pm PDT
SPARC AIDS
SPARC AIDS
CEDAR 10.0 — FOR INTERNAL XEROX USE ONLY
CEDAR 10.0 — FOR INTERNAL XEROX USE ONLY
SparcAids
© Copyright 1991, 1992 Xerox Corporation. All rights reserved.
Abstract: Some commands aid debugging at the machine-language level, including a SPARC disassembler.
Created by: Michael Plass
Maintained by: Michael Plass <Plass:PARC>
Keywords: SPARC, Disassembler, Debugging, Performance
XEROX Xerox Corporation
Palo Alto Research Center
3333 Coyote Hill Road
Palo Alto, California 94304
For Internal Xerox Use Only
News
July 23, 1992 - Added the ability to use (C) ProgramName.ProcedureName as arguments.
February 4, 1992 - Added ability to use to InterfaceName.ProcedureName as arguments. New PCFromSymbol command.
March 11, 1991 - Floating point operations are now decoded. Also fixed an incorrect mneumonic for bne.
Disassembler
Introduction
When attempts at source-level debugging fail, it is occasionally useful to be able to examine the actual machine code. This is especially the case with optimized code. This component provides a disassembler so that you can take a peek at the machine instructions that the compilation pipeline has transformed your beautiful source code into.
This is also very handy for squeezing the last few cycles out of inner loops.
Commands
Disassemble <procid>
Disassembles the loaded machine code of the named procedure. The procid may be a c-procedure name, the address of the code (the address need not be at the start of the procedure), a qualified name (interpreted as either (Mesa)InterfaceName.ProcedureName, or (C)ProgramName.ProcedureName). An address may be specified with either a mesa-style numeric literal, or a 0x... style hexadecimal literal.
SymbolFromPC <procid>
Shows the module name and c-procedure name for a given pc; <procid> is the same as for Disassemble.
PCFromSymbol <procid>
Shows the pc for a given procedure; <procid> is the same as for Disassemble.
Examples
% SymbolFromPC ViewerOps.FetchProp
ViewerOpsImplA.tchProp←P120
% PCFromSymbol ViewerOpsImplA.tchProp←P120
0x004AD38C
% Disassemble tchProp←P120
ViewerOpsImplA.tchProp←P120
004AD38C: 9DE3BFA0 save %o6,-96,%o6
004AD390: 11001723 sethi &hi(0x005C8C00),%o0 ! 0x005C8C00
004AD394: 901222B4 or %o0,692,%o0 ! 0x005C8EB4
004AD398: D0022194 ld [%o0+404],%o0 ! 0x00E06F08
004AD39C: 92100019 or %g0,%i1,%o1
004AD3A0: D402202C ld [%o0+44],%o2 ! 0x005775A8
004AD3A4: D0062064 ld [%i0+100],%o0
004AD3A8: C2028000 ld [%o2],%g1 ! 0x0024F158
004AD3AC: 9FC04000 jmpl %g1,%g0,%o7 ! AtomImpl.←GetPropFromList←P1080
004AD3B0: 01000000 sethi &hi(0x00000000),%g0
004AD3B4: 81C7E008 jmpl %i7,8,%g0
004AD3B8: 91E80008 restore %g0,%o0,%o0
% -- recommendation: redirect big things to a file and open them, e.g.
% Disassemble ←XR𡤏orward0 >Forward0.s
%
Bugs
The disassembler makes an attempt at enough static evaluation to be able to show the value of 32-bit constants (which need multiple instructions to create) and the names of procedures called via interface records. However, it does no control flow, so the values shown may be wrong.
When attempting to disassemble the last procedure in a loaded unit, the disassembler might not know when to stop.
This package only works in the current world (no cross-world abilities). This may be partially alleviated by using the NetCommander facilities.
Register window statistics
Introduction
SPARC processors have a smallish set of register windows. It would be nice to know how often they overflow and underflow, to have a feeling for how badly the performance is affected. If you have a kernel with the appropriate options enabled (see Requirements, below), you can find out.
Client Interface
SPARCWindowDelta.mesa
Commands
SPARCWindowDelta Do a command, measuring overflowcnt/underflowcnt statistics
SPARCWindowStats get overflowcnt/underflowcnt statistics
SPARCWindowThrash Beat on register windows. args: count calldepth
Examples
% SPARCWindowDelta
-- Register window overflows: 1409, underflows: 1382
{ 0.16 sec }
% SPARCWindowStats
99193486 96428282
{ 0.08 sec }
% SPARCWindowDelta SPARCWindowThrash 1000000 1
-- Register window overflows: 2387, underflows: 2336
{ 1.05 sec }
% SPARCWindowDelta SPARCWindowThrash 1000000 5
-- Register window overflows: 2223, underflows: 2195
{ 0.97 sec }
% SPARCWindowDelta SPARCWindowThrash 1000000 14
-- Register window overflows: 580055, underflows: 579975
{ 5.18 sec }
%
Each of the SPARCWindowThrash commands are doing 1000000 proc calls/returns, but with different call stack depths. As you can see, exceeding the hardware register windows does degrade performance by quite a bit.
Kernel Requirements
To build a kernel which will support the SPARCWindow* commands:
1. Read /sunos/4.1.1/Kernel𡤋uild←README and use it to set up your kernel build area.
2. Add the following entry to the kernel configuration file:
options PERFMETER
3. Copy overflow.s and underflow.s from the SunOS source tree to .../sunos/ in your kernel build area.
4. Copy assym.s from (FIXTHIS need a better place than /net/aria/aria/kernel/sys/sun4c/PRINTING/assym.s)
5. Rebuild the kernel as described in /sunos/4.1.1/Kernel𡤋uild←README.
Bugs
It's a real hack to get these numbers out of the kernel. Take a look at the impl if you have the stomach for it. There's a lot of background noise in the measurements.