summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-11 21:51:55 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-11 21:51:55 +0000
commit51b8e3dd88d5e9252cf283cc783f39a97749e14d (patch)
treeebbc9e93af805bcdab792d7a5376b7824b7bcc81 /bfd
parentcdc1d011fe62449929c3e738dad1551bd7fb9e77 (diff)
downloadgdb-51b8e3dd88d5e9252cf283cc783f39a97749e14d.tar.gz
1999-09-11 Donn Terry <donn@interix.com>
* libbfd-in.h (_bfd_abort): Declare. (abort): Define. * bfd.c (_bfd_abort): New function. * libbfd.h: Rebuild.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/bfd.c24
-rw-r--r--bfd/libbfd-in.h11
-rw-r--r--bfd/libbfd.h11
4 files changed, 51 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4895d5f7358..c9aa5e1516c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -7,6 +7,11 @@
1999-09-11 Donn Terry <donn@interix.com>
+ * libbfd-in.h (_bfd_abort): Declare.
+ (abort): Define.
+ * bfd.c (_bfd_abort): New function.
+ * libbfd.h: Rebuild.
+
* coffcode.h (coff_set_alignment_hook): Delete POWERPC_LE_PE
special handling.
diff --git a/bfd/bfd.c b/bfd/bfd.c
index c6809d7986d..e04172fb016 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -679,6 +679,30 @@ bfd_assert (file, line)
(*_bfd_error_handler) (_("bfd assertion fail %s:%d"), file, line);
}
+/* A more or less friendly abort message. In libbfd.h abort is
+ defined to call this function. */
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+void
+_bfd_abort (file, line, fn)
+ const char *file;
+ int line;
+ const char *fn;
+{
+ if (fn != NULL)
+ (*_bfd_error_handler)
+ (_("BFD internal error, aborting at %s line %d in %s\n"),
+ file, line, fn);
+ else
+ (*_bfd_error_handler)
+ (_("BFD internal error, aborting at %s line %d\n"),
+ file, line);
+ (*_bfd_error_handler) (_("Please report this bug.\n"));
+ xexit (EXIT_FAILURE);
+}
/*
FUNCTION
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index f2ac8230995..79a176d063c 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -503,6 +503,17 @@ void bfd_assert PARAMS ((const char*,int));
#define BFD_FAIL() \
{ bfd_assert(__FILE__,__LINE__); }
+extern void _bfd_abort PARAMS ((const char *, int, const char *))
+ ATTRIBUTE_NORETURN;
+
+/* if gcc, we can give a function name, too */
+#if !defined (__GNUC__) || __GNUC_MINOR__ <= 5
+#define __PRETTY_FUNCTION__ ((char *) NULL)
+#endif
+
+#undef abort
+#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
extern bfd *bfd_last_cache;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 9a252ee7ef5..4918d260742 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -503,6 +503,17 @@ void bfd_assert PARAMS ((const char*,int));
#define BFD_FAIL() \
{ bfd_assert(__FILE__,__LINE__); }
+extern void _bfd_abort PARAMS ((const char *, int, const char *))
+ ATTRIBUTE_NORETURN;
+
+/* if gcc, we can give a function name, too */
+#if !defined (__GNUC__) || __GNUC_MINOR__ <= 5
+#define __PRETTY_FUNCTION__ ((char *) NULL)
+#endif
+
+#undef abort
+#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
extern bfd *bfd_last_cache;