[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is compiling Emacs with -finstrument-functions supported?
From: |
Arthur Miller |
Subject: |
Re: Is compiling Emacs with -finstrument-functions supported? |
Date: |
Thu, 09 Dec 2021 21:33:41 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Arthur Miller <arthur.miller@live.com>
>> Date: Thu, 09 Dec 2021 18:11:13 +0100
>>
>> temacs crashes when compiled with -finstrument-functions when it tries to
>> produce dump file:
>>
>> CC json.o
>> CC terminfo.o
>> CC lastfile.o
>> CCLD temacs
>> /usr/bin/mkdir -p ../etc
>> make -C ../lisp update-subdirs
>> make[3]: Går till katalogen ”/home/arthur/repos/emacs-tests/emacs/lisp”
>> make[3]: Lämnar katalogen ”/home/arthur/repos/emacs-tests/emacs/lisp”
>> cp -f temacs bootstrap-emacs
>> rm -f bootstrap-emacs.pdmp
>> ./temacs --batch -l loadup --temacs=pbootstrap \
>> --bin-dest /usr/local/bin/ --eln-dest /usr/local/lib/emacs/29.0.50/
>> make[2]: *** [Makefile:908: bootstrap-emacs.pdmp] Segmenteringsfel
>> (minnesdump)
>> make[2]: Lämnar katalogen ”/home/arthur/repos/emacs-tests/emacs/src”
>> make[1]: *** [Makefile:456: src] Fel 2
>> make[1]: Lämnar katalogen ”/home/arthur/repos/emacs-tests/emacs”
>> make: *** [Makefile:1166: bootstrap] Fel 2
>
> Can you run the failing command under GDB, and when it crashes, post
> the C-level backtrace?
Seems like I can not read function addresses:
$ gdb --args src/temacs --batch -l loadup --temacs=pbootstrap --bin-dest
--eln-dest
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from src/temacs...
(gdb) r
Starting program: /home/arthur/repos/emacs-tests/emacs/src/temacs --batch -l
loadup --temacs=pbootstrap --bin-dest --eln-dest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x000055555572c41c in __cyg_profile_func_enter (func=<error reading variable:
Cannot access memory at address 0x7fffff66fff8>, caller=<error reading
variable: Cannot access memory at address 0x7fffff66fff0>) at emacs.c:173
173 __cyg_profile_func_enter (void *func, void *caller) {
(gdb)
I put my trace hooks in emacs.c. This is maybe nuts place to put them into? I
don't really know where I should put them, but it shouldn't matter? Or I am
wrong there?
static FILE *log_file = 0;
void __attribute__ ((constructor)) trace_begin (void);
void __attribute__ ((destructor)) trace_end (void);
void __cyg_profile_func_enter (void *func, void *caller);
void __cyg_profile_func_exit (void *func, void *caller);
void
__attribute__ ((constructor))
trace_begin (void) {
log_file = fopen("trace.log", "w");
}
void
__attribute__ ((destructor))
trace_end (void) {
if(log_file) {
fclose(log_file);
}
}
void
__cyg_profile_func_enter (void *func, void *caller) {
if(log_file) {
fprintf(log_file, "IN %p %p\n", func, caller);
}
}
void
__cyg_profile_func_exit (void *func, void *caller) {
if(log_file) {
fprintf(log_file, "UT %p %p\n", func, caller);
}
}