Exemple #1
0
static void
buildfuncs(void)
{
	extern byte etext[];

	if(func != nil)
		return;

	// Memory profiling uses this code;
	// can deadlock if the profiler ends
	// up back here.
	m->nomemprof++;

	// count funcs, fnames
	nfunc = 0;
	nfname = 0;
	walksymtab(dofunc);

	// initialize tables
	func = runtime·mal((nfunc+1)*sizeof func[0]);
	func[nfunc].entry = (uint64)etext;
	fname = runtime·mal(nfname*sizeof fname[0]);
	nfunc = 0;
	walksymtab(dofunc);

	// split pc/ln table by func
	splitpcln();

	// record src file and line info for each func
	walksymtab(dosrcline);

	m->nomemprof--;
}
Exemple #2
0
static void
buildfuncs(void)
{
    extern byte etext[];

    if(func != nil)
        return;
    // count funcs, fnames
    nfunc = 0;
    nfname = 0;
    walksymtab(dofunc);

    // initialize tables
    func = mal((nfunc+1)*sizeof func[0]);
    func[nfunc].entry = (uint64)etext;
    fname = mal(nfname*sizeof fname[0]);
    nfunc = 0;
    walksymtab(dofunc);

    // split pc/ln table by func
    splitpcln();

    // record src file and line info for each func
    walksymtab(dosrcline);
}
Exemple #3
0
static void
buildfuncs(void)
{
	extern byte etext[];

	if(func != nil)
		return;

	// Memory profiling uses this code;
	// can deadlock if the profiler ends
	// up back here.
	m->nomemprof++;

	// count funcs, fnames
	nfunc = 0;
	nfname = 0;
	walksymtab(dofunc);

	// Initialize tables.
	// Can use FlagNoPointers - all pointers either point into sections of the executable
	// or point into hugestring.
	func = runtime·mallocgc((nfunc+1)*sizeof func[0], FlagNoPointers, 0, 1);
	func[nfunc].entry = (uint64)etext;
	fname = runtime·mallocgc(nfname*sizeof fname[0], FlagNoPointers, 0, 1);
	nfunc = 0;
	walksymtab(dofunc);

	// split pc/ln table by func
	splitpcln();

	// record src file and line info for each func
	walksymtab(dosrcline);  // pass 1: determine hugestring_len
	hugestring.str = runtime·mallocgc(hugestring_len, FlagNoPointers, 0, 0);
	hugestring.len = 0;
	walksymtab(dosrcline);  // pass 2: fill and use hugestring

	if(hugestring.len != hugestring_len)
		runtime·throw("buildfunc: problem in initialization procedure");

	m->nomemprof--;
}