aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-06-01 00:06:28 -0700
committerPaul Eggert2014-06-01 00:06:28 -0700
commitbba89481ee6c91cf1af94804442f345da618adee (patch)
treeddd49e83a979b3a7f486fb3fbf1f1a46efcc4f15 /src
parent08c0f6266af07be30de58623d26f47a5a69bcf10 (diff)
downloademacs-bba89481ee6c91cf1af94804442f345da618adee.tar.gz
emacs-bba89481ee6c91cf1af94804442f345da618adee.zip
Bring back the changes to GDB-visible symbols, but only on AIX.
And only if it's not pre-4.2 GCC. * lisp.h (ENUMABLE, DEFINE_GDB_SYMBOL_ENUM): New macros. (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Use them. (ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val): New macros.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/lisp.h52
2 files changed, 56 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bde0ec68c53..23027c38c73 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12014-06-01 Paul Eggert <eggert@cs.ucla.edu>
2
3 Bring back the changes to GDB-visible symbols, but only on AIX.
4 And only if it's not pre-4.2 GCC.
5 * lisp.h (ENUMABLE, DEFINE_GDB_SYMBOL_ENUM): New macros.
6 (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Use them.
7 (ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val):
8 New macros.
9
12014-05-31 Eli Zaretskii <eliz@gnu.org> 102014-05-31 Eli Zaretskii <eliz@gnu.org>
2 11
3 * fileio.c (Finsert_file_contents): Call prepare_to_modify_buffer 12 * fileio.c (Finsert_file_contents): Call prepare_to_modify_buffer
diff --git a/src/lisp.h b/src/lisp.h
index b483eff0846..2b632ad19f1 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -36,14 +36,40 @@ INLINE_HEADER_BEGIN
36 36
37/* Define a TYPE constant ID as an externally visible name. Use like this: 37/* Define a TYPE constant ID as an externally visible name. Use like this:
38 38
39 #define ID_val (some integer preprocessor expression)
40 #if ENUMABLE (ID_val)
41 DEFINE_GDB_SYMBOL_ENUM (ID)
42 #else
39 DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID) 43 DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID)
40 #define ID something 44 # define ID ID_val
41 DEFINE_GDB_SYMBOL_END (ID) 45 DEFINE_GDB_SYMBOL_END (ID)
46 #endif
42 47
43 This hack is for the benefit of compilers that do not make macro 48 This hack is for the benefit of compilers that do not make macro
44 definitions visible to the debugger. It's used for symbols that 49 definitions visible to the debugger. It's used for symbols that
45 .gdbinit needs, symbols whose values may not fit in 'int' (where an 50 .gdbinit needs, symbols whose values may not fit in 'int' (where an
46 enum would suffice). */ 51 enum would suffice).
52
53 Some GCC versions before GCC 4.2 omit enums in debugging output;
54 see GCC bug 23336. So don't use enums with older GCC. */
55
56#if !defined __GNUC__ || 4 < __GNUC__ + (2 <= __GNUC_MINOR__)
57# define ENUMABLE(val) (INT_MIN <= (val) && (val) <= INT_MAX)
58#else
59# define ENUMABLE(val) 0
60#endif
61
62/* On AIX 7.1 ENUMABLE should return true when possible, otherwise the
63 linker can optimize the symbols away, making it harder to debug.
64 This was discovered only late in the release process, so to play it
65 safe for now, non-AIX platforms do not use enums for debugging symbols.
66 FIXME: remove this comment and the following four lines of code. */
67#ifndef _AIX
68# undef ENUMABLE
69# define ENUMABLE(val) 0
70#endif
71
72#define DEFINE_GDB_SYMBOL_ENUM(id) enum { id = id##_val };
47#if defined MAIN_PROGRAM 73#if defined MAIN_PROGRAM
48# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE 74# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE
49# define DEFINE_GDB_SYMBOL_END(id) = id; 75# define DEFINE_GDB_SYMBOL_END(id) = id;
@@ -571,15 +597,25 @@ LISP_MACRO_DEFUN (XIL, Lisp_Object, (EMACS_INT i), (i))
571 597
572/* In the size word of a vector, this bit means the vector has been marked. */ 598/* In the size word of a vector, this bit means the vector has been marked. */
573 599
600#define ARRAY_MARK_FLAG_val PTRDIFF_MIN
601#if ENUMABLE (ARRAY_MARK_FLAG_val)
602DEFINE_GDB_SYMBOL_ENUM (ARRAY_MARK_FLAG)
603#else
574DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG) 604DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG)
575#define ARRAY_MARK_FLAG PTRDIFF_MIN 605# define ARRAY_MARK_FLAG ARRAY_MARK_FLAG_val
576DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG) 606DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG)
607#endif
577 608
578/* In the size word of a struct Lisp_Vector, this bit means it's really 609/* In the size word of a struct Lisp_Vector, this bit means it's really
579 some other vector-like object. */ 610 some other vector-like object. */
611#define PSEUDOVECTOR_FLAG_val (PTRDIFF_MAX - PTRDIFF_MAX / 2)
612#if ENUMABLE (PSEUDOVECTOR_FLAG_val)
613DEFINE_GDB_SYMBOL_ENUM (PSEUDOVECTOR_FLAG)
614#else
580DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG) 615DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG)
581#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) 616# define PSEUDOVECTOR_FLAG PSEUDOVECTOR_FLAG_val
582DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG) 617DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG)
618#endif
583 619
584/* In a pseudovector, the size field actually contains a word with one 620/* In a pseudovector, the size field actually contains a word with one
585 PSEUDOVECTOR_FLAG bit set, and one of the following values extracted 621 PSEUDOVECTOR_FLAG bit set, and one of the following values extracted
@@ -641,9 +677,15 @@ enum More_Lisp_Bits
641 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for 677 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for
642 that cons. */ 678 that cons. */
643 679
680/* Mask for the value (as opposed to the type bits) of a Lisp object. */
681#define VALMASK_val (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX)
682#if ENUMABLE (VALMASK_val)
683DEFINE_GDB_SYMBOL_ENUM (VALMASK)
684#else
644DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) 685DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK)
645#define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) 686# define VALMASK VALMASK_val
646DEFINE_GDB_SYMBOL_END (VALMASK) 687DEFINE_GDB_SYMBOL_END (VALMASK)
688#endif
647 689
648/* Largest and smallest representable fixnum values. These are the C 690/* Largest and smallest representable fixnum values. These are the C
649 values. They are macros for use in static initializers. */ 691 values. They are macros for use in static initializers. */