9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Nick Owens <mischief@9.offblast.org>
To: 9front@9front.org
Subject: profiling bug on amd64
Date: Sun, 16 Feb 2014 22:11:31 -0800	[thread overview]
Message-ID: <20140217061131.GF25422@iota.offblast.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

when attempting to profile a program on amd64 (games/nes), there's a
problem where function arguments fail to be restored by the profiling
code.

acid: lstk()
_tas()+0x5 /sys/src/libc/amd64/tas.s:5
lock(lk=0x0)+0x13 /sys/src/libc/port/lock.c:10
	i=0x206b9700000000
atexit(f=0x0)+0x18 /sys/src/libc/port/atexit.c:21
	i=0x205f9f00000000
_profmain()+0x18d /sys/src/libc/port/profile.c:268
	n=0x7d0
	f=0x7d0ffffffff
	ename=0x0
_mainp+0x2c /sys/src/libc/amd64/main9p.s:12

obviously something is wrong here, with f=0x0 and i=0x205f9f00000000
in atexit.

but, if you move #pragma profile off up a little ways before the
definition of atexit in /sys/src/libc/port/atexit.c, you get the same
problem in lock() still.

acid: lstk()
_tas()+0x5 /sys/src/libc/amd64/tas.s:5
lock(lk=0x0)+0x13 /sys/src/libc/port/lock.c:10
  i=0x206b9200000000
atexit(f=0x205a6e)+0x13 /sys/src/libc/port/atexit.c:23
  i=0x205f9f00000000
_profmain()+0x18d /sys/src/libc/port/profile.c:268
  n=0x7d0
  f=0x7d0ffffffff
  ename=0x0
_mainp+0x2c /sys/src/libc/amd64/main9p.s:12

here, the argument to atexit is valid, but lock's argument is still zero,
so something in the profiling code is certainly affecting the program's behavior.

mischief


[-- Attachment #2: Type: application/pgp-signature, Size: 834 bytes --]

             reply	other threads:[~2014-02-17  6:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17  6:11 Nick Owens [this message]
2014-02-17  6:18 ` [9front] " Nick Owens
2014-02-17 18:58   ` Nick Owens

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=20140217061131.GF25422@iota.offblast.org \
    --to=mischief@9.offblast.org \
    --cc=9front@9front.org \
    /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).