From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5a682828a2720cadb959cedf87d4621f@plan9.bell-labs.com> Date: Sat, 15 Jul 2006 13:02:32 -0400 From: jmk@plan9.bell-labs.com To: 9fans@cse.psu.edu Subject: Re: [9fans] An acid-question In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 8106f47c-ead1-11e9-9d60-3106f5b1d025 On Sat Jul 15 08:37:19 EDT 2006, sretzki@gmx.de wrote: > ... > Thanks Erik. Nevertheless, that is not the problem. > Do you have an idea why acid does not 'see' i ? Or how > I can investigate i? Erik is right that 'i' is optimised. It's not optimised away, but it does not appear in the symbol table because its entire use lifetime it is held in a register; acid therefore can't find it. Assuming this code was in file a.c, after you have done 8c -FTVw a.c then nm -a a.8 will show a line for 'j': 8 a j indicating it is an automatic variable, but there is no output for 'i'. If you look at the code with acid (e.g. 'asm(convertchannels)' followed by 'casm()' until you get to the code you are interested in you will see something like this: ethel% acid 8.out 8.out:386 plan 9 executable /sys/lib/acid/port /sys/lib/acid/386 lib/acid acid: asm(convertchannels) convertchannels 0x00001020 SUBL $0x20,SP convertchannels+0x3 0x00001023 MOVL fmt(SB),BX convertchannels+0x9 0x00001029 MOVL $0x0,j+0x18(SP) convertchannels+0x11 0x00001031 MOVL 0x0(BX),AX convertchannels+0x13 0x00001033 MOVL 0x4(BX),CX convertchannels+0x16 0x00001036 IMULL AX,CX convertchannels+0x18 0x00001038 ADDL AX,AX convertchannels+0x1a 0x0000103a MOVL AX,CX convertchannels+0x1c 0x0000103c MOVL datacopy+0x4(FP),AX convertchannels+0x20 0x00001040 MOVL AX,0x0(SP) convertchannels+0x23 0x00001043 MOVL data+0x0(FP),AX convertchannels+0x27 0x00001047 MOVL AX,0x4(SP) convertchannels+0x2b 0x0000104b MOVL CX,AX convertchannels+0x2d 0x0000104d MOVL CX,inbyterate+0x14(SP) convertchannels+0x31 0x00001051 ADDL AX,AX convertchannels+0x33 0x00001053 MOVL AX,0x8(SP) convertchannels+0x37 0x00001057 CALL memcpy(SB) convertchannels+0x3c 0x0000105c MOVL data+0x0(FP),DI convertchannels+0x40 0x00001060 MOVL j+0x18(SP),SI convertchannels+0x44 0x00001064 MOVL fmt(SB),AX convertchannels+0x4a 0x0000106a MOVL 0x4(AX),AX convertchannels+0x4d 0x0000106d CMPL AX,$0x1 convertchannels+0x50 0x00001070 JNE convertchannels+0x87(SB) convertchannels+0x52 0x00001072 XORL BP,BP convertchannels+0x54 0x00001074 CMPL inbyterate+0x14(SP),BP convertchannels+0x58 0x00001078 JGT convertchannels+0x83(SB) convertchannels+0x5a 0x0000107a MOVL SI,AX convertchannels+0x5c 0x0000107c INCL SI convertchannels+0x5d 0x0000107d LEAL 0x0(DI)(AX*2),AX convertchannels+0x60 0x00001080 MOVL datacopy+0x4(FP),BX acid: casm() convertchannels+0x64 0x00001084 MOVWSX 0x0(BX)(BP*2),CX convertchannels+0x68 0x00001088 MOVW CX,0x0(AX) convertchannels+0x6b 0x0000108b MOVL SI,AX convertchannels+0x6d 0x0000108d INCL SI convertchannels+0x6e 0x0000108e LEAL 0x0(DI)(AX*2),AX convertchannels+0x71 0x00001091 MOVL datacopy+0x4(FP),BX convertchannels+0x75 0x00001095 MOVWSX 0x0(BX)(BP*2),CX convertchannels+0x79 0x00001099 MOVW CX,0x0(AX) convertchannels+0x7c 0x0000109c INCL BP convertchannels+0x7d 0x0000109d CMPL inbyterate+0x14(SP),BP convertchannels+0x81 0x000010a1 JLE convertchannels+0x5a(SB) convertchannels+0x83 0x000010a3 ADDL $0x20,SP convertchannels+0x86 0x000010a6 RET convertchannels+0x87 0x000010a7 MOVL $.string(SB),AX convertchannels+0x8c 0x000010ac MOVL AX,0x0(SP) convertchannels+0x8f 0x000010af CALL sysfatal(SB) convertchannels+0x94 0x000010b4 JMP convertchannels+0x83(SB) acid: ethel% The loop using 'i' starts at convertchannels+0x52 and 'i is held in register BP. You can use the 'regs()' or 'gpr()' commands to examine BP in a broken proc.