SGI: Development

Instruction tracing

Does anyone know how to do instruction by instruction tracing under IRIX? I.e. I want to run an application on my Tezro and generate an execution trace of every instruction executed including program counter, the raw instruction, and if a load or store the memory reference.

On my PowerPC box I would set the single step bit in MSR which causes a SIGTRAP on every instruction, so I just catch the handler, look at the context, save what I want, and then return. I have been mining the web for someone doing something equivalent on SGI but haven't been able to find anything.

Anyone have any pointers? I don't want to have to go find an emulator running Linux/MIPS and hack the sh** out of it to get a simple instruction trace lol.

Thanks,
--E
emachine wrote: Does anyone know how to do instruction by instruction tracing under IRIX? I.e. I want to run an application on my Tezro and generate an execution trace of every instruction executed including program counter, the raw instruction, and if a load or store the memory reference.

On my PowerPC box I would set the single step bit in MSR which causes a SIGTRAP on every instruction, so I just catch the handler, look at the context, save what I want, and then return. I have been mining the web for someone doing something equivalent on SGI but haven't been able to find anything.

Anyone have any pointers? I don't want to have to go find an emulator running Linux/MIPS and hack the sh** out of it to get a simple instruction trace lol.

Thanks,
--E



Not sure if there is anything that works at the level you describe but ProDev workshop has a profiler at the C/C++ level and there is par and prfstat..

http://techpubs.sgi.com/library/tpl/cgi ... ch=prfstat

http://techpubs.sgi.com/library/tpl/cgi ... z&srch=par

http://techpubs.sgi.com/library/tpl/cgi ... &srch=padc


Why do you want to look at things at the assembler level...? You could always run things through spim (in nekoware if I recall) .. xspim will show you all registers and memory and everything but it is only for MIPS I or MIPS II so nothing newer the R3000, IIRC. Again, this leads back to the question.. why..? If you strip (man strip) a copy of the binary what does single stepping dbx do..?

http://techpubs.sgi.com/library/tpl/cgi ... /ix01.html

R.
死の神はりんごだけ食べる

開いた括弧は必ず閉じる -- あるプログラマー

:Tezro: :Tezro: :Onyx2R: :Onyx2RE: :Onyx2: :O3x04R: :O3x0: :O200: :Octane: :Octane2: :O2: :O2: :Indigo2IMP: :PI: :PI: :1600SW: :1600SW: :Indy: :Indy: :Indy: :Indy: :Indy:
:hpserv: J5600, 2 x Mac, 3 x SUN, Alpha DS20E, Alpha 800 5/550, 3 x RS/6000, Amiga 4000 VideoToaster, Amiga4000 -030, 733MHz Sam440 AmigaOS 4.1 update 1.

Sold: :Indy: :Indy: :Indy: :Indigo: Tandem Himalaya S-Series Nonstop S72000 ServerNet.

Twitter @PymbleSoftware
Current Apps (iOS) -> https://itunes.apple.com/au/artist/pymb ... d553990081
(Android) https://play.google.com/store/apps/deve ... +Ltd&hl=en
(Onyx2) Cortex ---> http://www.facebook.com/pages/Cortex-th ... 11?sk=info
(0300s) Minnie ---> http://www.facebook.com/pages/Minnie-th ... 02?sk=info
Github ---> https://github.com/pymblesoftware
Look at the "par" command. It's been a while since I used it, but something like

Code: Select all

par -i -SS -s -o <outputfilename> <cmdline that you're interested in>
was a good start.
Not sure what your intentions are but it looks like BSD has a binary emulation layer that includes IRIX support..
This may or may not be an interesting read..

http://onlamp.com/pub/a/bsd/2002/08/08/irix.html?page=1

Not sure what tools are available under *BSDs either.

R.
死の神はりんごだけ食べる

開いた括弧は必ず閉じる -- あるプログラマー

:Tezro: :Tezro: :Onyx2R: :Onyx2RE: :Onyx2: :O3x04R: :O3x0: :O200: :Octane: :Octane2: :O2: :O2: :Indigo2IMP: :PI: :PI: :1600SW: :1600SW: :Indy: :Indy: :Indy: :Indy: :Indy:
:hpserv: J5600, 2 x Mac, 3 x SUN, Alpha DS20E, Alpha 800 5/550, 3 x RS/6000, Amiga 4000 VideoToaster, Amiga4000 -030, 733MHz Sam440 AmigaOS 4.1 update 1.

Sold: :Indy: :Indy: :Indy: :Indigo: Tandem Himalaya S-Series Nonstop S72000 ServerNet.

Twitter @PymbleSoftware
Current Apps (iOS) -> https://itunes.apple.com/au/artist/pymb ... d553990081
(Android) https://play.google.com/store/apps/deve ... +Ltd&hl=en
(Onyx2) Cortex ---> http://www.facebook.com/pages/Cortex-th ... 11?sk=info
(0300s) Minnie ---> http://www.facebook.com/pages/Minnie-th ... 02?sk=info
Github ---> https://github.com/pymblesoftware
First of all, thanks for the replies so far.

Why do you want to look at things at the assembler level...? You could always run things through spim (in nekoware if I recall) .. xspim will show you all registers and memory and everything but it is only for MIPS I or MIPS II so nothing newer the R3000, IIRC. Again, this leads back to the question.. why..? If you strip (man strip) a copy of the binary what does single stepping dbx do..?


Sorry to give you the impression that this was for program optimization. I need to generate MIPS instruction traces (yes, they can be billions of instructions long) to feed into a cycle accurate trace driven SystemC model of a MIPS processor to evaluate its micro-architectural performance. So things like single stepping a debugger, etc, etc are out.

Like I mentioned before I have generated traces in the past directly from hardware on PPC by turning SS on and off at regular intervals during program execution to get a trace based statistical sampling of a programs behaviour. With the information per instruction like I mentioned (program counter, raw instruction, and memory reference if a load or store) with an appropraite model that models not ontly the processor pipeline and caches, but also a cache hierarchy (L2, L3 and beyond) and memory nest a microprocessor architect (me) can get a very accurate view of the IPC of a machine as well as cache characteristics, sensitivities to queue depths, branch predictor sensitivities, etc.

par -i -SS -s -o <outputfilename> <cmdline that you're interested in>


Doesn't par only give me system call traces of a particular processes execution?

--E
emachine wrote: Does anyone know how to do instruction by instruction tracing under IRIX? I.e. I want to run an application on my Tezro and generate an execution trace of every instruction executed including program counter, the raw instruction, and if a load or store the memory reference.

On my PowerPC box I would set the single step bit in MSR which causes a SIGTRAP on every instruction, so I just catch the handler, look at the context, save what I want, and then return. I have been mining the web for someone doing something equivalent on SGI but haven't been able to find anything.


This is what logic analyzers are for... Some of the modern MIPS cores have tracing facilities, but the `` original '' MIPS chips used by SGI do not have anything comparable to the hardware single-stepping found on e.g. x86 or powerpc (R10k family has watchpoints, though).
:Indigo: R4000 :Indigo: R4000 :Indigo: R4000 :Indigo2: R4400 :Indigo2IMP: R4400 :Indigo2: R8000 :Indigo2IMP: R10000 :Indy: R4000PC :Indy: R4000SC :Indy: R4600 :Indy: R5000SC :O2: R5000 :O2: RM7000 :Octane: 2xR10000 :Octane: R12000 :O200: 2xR12000 :O200: - :O200: 2x2xR10000 :Fuel: R16000 :O3x0: 4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI , Motorola, NeXT, SGI, Solbourne, Sun...
emachine wrote: Doesn't par only give me system call traces of a particular processes execution?

Yes, and child processes. Sounds like I misunderstood what you were looking for. (I'm not a programmer, just a sysadmin who knows enough to be dangerous.)
A logic analyzer would probably work - and is something I've done in the past - depending on the capacity, but a half a trillion instruction trace takes up quite a bit of storage...

Unfortunately not an option in my current environment.

--E
If your program is capable of running on IRIX 5.3 as made available for SimOS then perhaps try using that. It had fairly sophisticated annotation (i.e. run a custom script when an instruction/reference/event occurs) and tracing capabilities. Or if you are lazy, you can just hack the instruction decode loop to print the instruction being processed. Or if you are really lazy, print just the program counter, and write a script to convert this list of addresses by grepping in a objdump disassembly of the binary (but this might not be practical for massive instruction traces obviously).

The downside is that SimOS is old, and therefore is awkward to build, and wont support the 'modern' IRIX 6.5 release. It is also difficult or impossible to officially obtain now the site is gone.

Seeing as you are to ultimately run the trace in a MIPS CPU model, is there actually any IRIX dependency here - Do you actually need a trace from an *IRIX* executable? Perhaps a trace of some code in any other MIPS emulator (see http://www.linux-mips.org/wiki/Emulators ) would be sufficient. Perhaps one of the full system simulators already has an option to generate suitable instruction traces. You could just extract the user level instructions based on virtual address if that is all you are interested in. I recall GXemul definately has something like this for generating instruction, register and PC traces.