9front - general discussion about 9front
 help / color / mirror / Atom feed
* profiling bug on amd64
@ 2014-02-17  6:11 Nick Owens
  2014-02-17  6:18 ` [9front] " Nick Owens
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Owens @ 2014-02-17  6:11 UTC (permalink / raw)
  To: 9front

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-17 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17  6:11 profiling bug on amd64 Nick Owens
2014-02-17  6:18 ` [9front] " Nick Owens
2014-02-17 18:58   ` Nick Owens

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).