History log of /netbsd-current/lib/libc/gmon/gmon.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.37 06-May-2022 rin

PR lib/56395
PR toolchain/56771

Fix profiling on CPUs that do not support unaligned memory access;
Allocate objects (referenced from struct gmonparam) with proper
alignments.

For monstartup(), objects are allocated on heap. Break is not
guaranteed to be aligned at all, unlike stack pointer.

For _m_gmon_alloc(), objects are allocated on anonymous memory.
p->tos is not aligned properly in general.

This fixes quasi-random crashes for *_profile tests, at least on
SH-4 and PowerPC 403 [1]. Also, no regression is observed for
others as far as I can see.

This change does not cause any ABI breakage, as long as application
uses proper pointers; use p->tos instead of evil pointer arithmetic
like (struct tostruct *)((char *)p->froms + p->fromssize) [2].

[1] Timeout should be increased for some tests. "pic" variants
still fail as expected. Dynamically-linked binaries also crash in
rtld for SH-4, but this seems different problem...

[2] This example did not work even before, since the order of
froms[] and tos[] is reversed depending on which of monstartup() or
_m_gmon_alloc() is used for allocation.


# 1.36 03-Jul-2021 christos

PR/56246: Yuichiro Naito: gprof(1) never show call graphs when profiling
multi-threaded application


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.35 18-Sep-2014 christos

make more descriptors that we open as close-on-exec


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base yamt-pagecache-base5 yamt-pagecache-base4
# 1.34 13-Mar-2012 christos

PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.33 05-Jan-2011 wiz

branches: 1.33.6;
Fix fdleak in #ifdef DEBUG. Found by cppcheck.


Revision tags: matt-mips64-premerge-20101231
# 1.32 01-Mar-2010 christos

- KNF
- fix hertz()
- fix error and warning messages


# 1.31 17-Jan-2010 wiz

Close log file handle after using it. Found by cppcheck.


Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.30 12-Feb-2009 lukem

sign-compare fixes


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.29 15-Oct-2006 christos

branches: 1.29.28;
fix incomplete initializers


# 1.28 04-Oct-2006 christos

don't include <sys/param.h> twice.


# 1.27 04-Oct-2006 dogcow

use rownddown/rowndup in sys/param.h instead of their now-deleted UC equivs
formerly in sys/gmon.h.


Revision tags: abandoned-netbsd-4-base
# 1.26 11-May-2006 mrg

in _m_gmon_destructor(0 when traversing the list, add (void *) to the cast
chain.


# 1.25 24-Jan-2006 christos

fix debugging printf formats.


# 1.24 24-Jan-2006 christos

fix compilation with -DDEBUG


# 1.23 29-Nov-2005 christos

WARNS=4


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.22 10-May-2004 thorpej

Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before dumping
the profile buffers.

Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.


Revision tags: netbsd-2-0-base
# 1.21 07-Aug-2003 agc

branches: 1.21.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.


# 1.20 06-Apr-2003 dsl

Use snprintf instead of hand crafted string copy and numeric conversion.
Avoids problems if/when the pid is greater than 999999.
(approved by christos)


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.19 11-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.18 26-Apr-2002 christos

disable profiling set{u,g}id binaries.


# 1.17 19-Feb-2001 cgd

branches: 1.17.2;
convert from __progname to getprogname()


# 1.16 20-Dec-2000 christos

fix nested extern
fix sbrk casts


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-4-PATCH003 netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 14-Jan-1999 kleink

branches: 1.15.10;
* On architectures using ELF, and conditionally on those in transition, rename
_ASM_LABEL(cerror) and _ASM_LABEL(curbrk) to _C_LABEL(__cerror) and
_C_LABEL(__curbrk) (or their respective architecture-specific equivalents) to
avoid possible name clashes with identifiers used in user applications.
* Do the same for minbrk on all architectures to avoid a GCC-specific (and
on ELF architectures effectively useless) symbol reference renaming in MI code.


# 1.14 13-Nov-1998 christos

delint


# 1.13 10-Aug-1998 perry

bzero->memset, bcopy->memcpy, bcmp->memcmp


# 1.12 04-Jul-1998 kleink

Prefer STDERR_FILENO over 2.


# 1.11 03-Feb-1998 perry

remove obsolete register declarations


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.10 13-Jul-1997 christos

Fix RCSID's
Use warn instead of perror()
Use "namespace.h"
Add missing prototypes


# 1.9 22-Apr-1997 mrg

be safe with buffers. KNF.


# 1.8 23-Jan-1997 mrg

- convert unsafe strcpy(), strcat() and sprintf() to the `n' versions.
- some KNF.


# 1.7 19-Dec-1996 cgd

use __inline and __asm, rather than inline and asm. By default (without -g)
lint won't accept the latter two, but will accept the former two as valid.
As far as gcc's concerned, they're the same.


# 1.6 12-Jun-1996 cgd

branches: 1.6.2;
use p->hashfraction when doing non-time-critical calculations, rather than
using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
is a power of two, check that p->hashfraction == HASHFRACTION and if so do
the calculation with the compiled-in value so that the compiler can optimize
out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
actually do the division. This has the result that on machines with slow
division, the division can be optimized out of the common case, but that
if HASHFRACTION changes from the compiled-in value (for whatever reason),
profiling will still work. Changes suggested by Chris Torek.


Revision tags: netbsd-1-2-base
# 1.5 21-Nov-1995 jtc

branches: 1.5.4;
Add support for PROFDIR environment variable


# 1.4 04-Nov-1995 cgd

kill a gratuitous cast of lowpc to an int


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.3 27-Feb-1995 cgd

clean up Ids


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 14-May-1994 cgd

branches: 1.2.4;
rcsids. also, avoid floating point when picking scale value. doesn't
cost much, only done once.


# 1.1 14-May-1994 cgd

branches: 1.1.1;
Initial revision