wingo pushed a commit to branch lightning
in repository guile.
commit 9cdcfcc38f8f3ee0e80335f14974287112c82548
Author: pcpa <[email protected]>
Date: Sat Oct 25 14:53:05 2014 -0200
Do not fail gratuitously in jit_init_debug
* lib/jit_disasm.c: Do not cause an fatal error if init_jit
fails in the jit_init_debug call.
---
ChangeLog | 5 +++++
lib/jit_disasm.c | 13 +++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2558395..2058def 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-25 Paulo Andrade <[email protected]>
+
+ * lib/jit_disasm.c: Do not cause an fatal error if init_jit
+ fails in the jit_init_debug call.
+
2014-10-24 Paulo Andrade <[email protected]>
* lib/jit_ia64.c, lib/jit_ppc.c: Correct handling of function
diff --git a/lib/jit_disasm.c b/lib/jit_disasm.c
index c80c9e2..31480af 100644
--- a/lib/jit_disasm.c
+++ b/lib/jit_disasm.c
@@ -59,13 +59,18 @@ static jit_state_t *disasm_jit;
void
jit_init_debug(char *progname)
{
- if (progname == NULL)
- return;
#if DISASSEMBLER
bfd_init();
- disasm_bfd = bfd_openr(progname, NULL);
- assert(disasm_bfd);
+ if (progname)
+ disasm_bfd = bfd_openr(progname, NULL);
+ if (disasm_bfd == NULL) {
+#if defined(__linux__)
+ disasm_bfd = bfd_openr("/proc/self/exe", NULL);
+ if (disasm_bfd == NULL)
+#endif
+ return;
+ }
bfd_check_format(disasm_bfd, bfd_object);
bfd_check_format(disasm_bfd, bfd_archive);
disasm_print = disassembler(disasm_bfd);