9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] An acid-question
Date: Sat, 15 Jul 2006 13:02:32 -0400	[thread overview]
Message-ID: <5a682828a2720cadb959cedf87d4621f@plan9.bell-labs.com> (raw)
In-Reply-To: <f922c3ebb9b910062887c323645bbc40@mail.gmx.net>

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.


  parent reply	other threads:[~2006-07-15 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-15 10:55 Sascha Retzki
2006-07-15 11:22 ` erik quanstrom
2006-07-15 15:28   ` Sascha Retzki
2006-07-15 12:15     ` erik quanstrom
2006-07-15 12:36       ` Sascha Retzki
2006-07-15 12:39         ` erik quanstrom
2006-07-15 17:02         ` jmk [this message]
2006-07-15 17:09           ` Sascha Retzki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a682828a2720cadb959cedf87d4621f@plan9.bell-labs.com \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).