all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Is compiling Emacs with -finstrument-functions supported?
Date: Thu, 09 Dec 2021 21:33:41 +0100	[thread overview]
Message-ID: <AM9PR09MB49778651897D124E9E8A51F096709@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <83fsr1ty9m.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Dec 2021 20:43:17 +0200")

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);
 }
}



  reply	other threads:[~2021-12-09 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 17:11 Is compiling Emacs with -finstrument-functions supported? Arthur Miller
2021-12-09 18:43 ` Eli Zaretskii
2021-12-09 20:33   ` Arthur Miller [this message]
2021-12-09 20:56   ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR09MB49778651897D124E9E8A51F096709@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.