Date: Thu, 15 Nov 2001 12:16:44 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: "PSI, Mike Smith" <mlsmith@mitre.org> Cc: hackers@freebsd.org Subject: Re: _init execs in middle of code Message-ID: <3BF422AC.CE9806E@mindspring.com> References: <3BF4185B.35A8B872@mitre.org>
next in thread | previous in thread | raw e-mail | index | archive | help
"PSI, Mike Smith" wrote: > > Does anyone know exactly what _init is? An "nm" of my executable lists: > > 080486a8 ? _init > > It is the lowest numeric address (before _start and main) so I would > assume it is some sort of program initialization code. But when trying > to determine the cause of a kernel freeze (caused by my user app), I > found that _init is being "called" after quite a bit of code has been > executed. > > I scanned every library known to man and of course all of my objects. I > cannot find any symbol reference to _init anywhere so I can only guess > it is set up by the linker. HELP! My kernel freezes (every 2nd/3rd > execution of the program) so I can't run the debugger on the kernel. > > However, the freeze condition is very repeatable (happens what appears > to be the same point in the execution WHEN it happens) so if I can > figure out what _init is, I may have a chance to solve this. > > Also if _init isn't supposed to be called during a program running, can > anyone give a clue as to what stupid programming error could cause this > to happen? _init is called by crt0.o. It is used to, among other things, initialize per thread exception stacks and instance statically or globally declared classes, template base classes, and set up pur virtual base classes for use. It also executes anything else in the ".entry" code segment linker set list (which is where this stuff is done). See "dumpobj". If you want to run this in the debugger, then you should set a breakpoint on _main (or just _init), and then single step the machine instructions from there. See the GCC web site for more detailed information. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BF422AC.CE9806E>