Wishlist: signals, format() & other ;>
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
Hi,
First I'd like to catch all SIGSEGV signals, and dump core with it.
in c, we can do it but in pascal rather not ;/
In c handling sigsegv looks like it
static void handle_sigsegv() {
printf("sigsegv !!!\n");
signal(SIGSEGV, SIG_DFL);
raise(SIGSEGV);
}
in pascal we cannot assign any signal to SIG_DFL because it's integer constant (realy ?)
but in c it's valid.
so i write my own signal function
it's compilant with old once but it assign var SIG_DFL (type sighandler_t) as old signal.
procedure signal(sig : integer; sighandler_ : SigHandler_t);
begin
if sighandler_ = nil then sighandler_ := SIG_def;
sig_def := libc.signal(sig, sighandler_);
end;
(*
we call signal only once, so it's good.
but we should do if sig_def = nil then .....
but nevermind ;>
*)
so we got
shared.init_unit()-> program pid = 20763
PANICCCCC: main.handle_sigsegv()-> sigsegv! @ pid 20763
// catching signal looks good.
An unhandled exception occurred at 0x08075DF1 :
EAccessViolation : Access violation
$08075DF1
but it is fpc sigsegv handler ;/
so we cannot dump core ;//
ofcorz i don't realy now if we can, I don't read source really much. Frankly speaking i don't know where it is ;>
/me lame ;/ (rtl/???)
and second we cannot do raise(SIG_SEGV) function in pascal.
but we can do kill(getpid(), SIG_SEGV) so it's ok.
2nd short point ;>
Why elf binary compilated in fpc is so heavy ? ;/
Simple hello world program takes almost 80k size.
and i think it's stripped by fpc!
So what takes so much memory ?
Handler of sigsegv ? :>>>>
3rd point.
I cannot found libc.close() function.
I must close() sockets. simple shutdown() don't do it.
4th point
formating pointers to memory.
see attached program.
i'd like to know where some variables and function is in memory.
and i don't want to use gdb to debug it.
because i'd like to write it to debug file.
Yes i know with gdb I can do it.
But i want do it for my own ;>
thx, and i 'm looking forward for replies.
--
[GG 1058968] [JID darkjames@chrome.pl]
[UID 97320776] [IRC darkjames@POLnet]
[darkjames[@]darkjames[dot]ath[dot]cx]
Additional information:
Reporter: Jakub 'darkjames' Zawadzki
EMail: darkjames[at]darkjames[dot]ath[dot]cx
Mantis conversion info:
- Mantis ID: 5359
- OS: Linux
- Version: 1.9.5