[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109219: Fix export of symbols to GDB
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109219: Fix export of symbols to GDB. |
Date: |
Thu, 26 Jul 2012 11:35:50 -0700 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109219
fixes bug: http://debbugs.gnu.org/12036
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-26 11:35:50 -0700
message:
Fix export of symbols to GDB.
* alloc.c (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL)
(ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Move these here from
emacs.c, as this is a more-suitable home. Had this been done earlier
the fix for 12036 would have avoided some of the problems noted in
<http://bugs.gnu.org/12036#13> by Eli Zaretskii, as the scope problems
would have been more obvious.
* emacs.c (gdb_CHECK_LISP_OBJECT_TYPE, gdb_DATA_SEG_BITS)
(gdb_GCTYPEBITS, gdb_USE_LSB_TAG)
(CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS, GCTYPEBITS, USE_LSB_TAG):
Remove; now done in lisp.h.
* lisp.h (PUBLISH_TO_GDB): New macro.
(GCTYPEBITS, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE, enum pvec_type)
(DATA_SEG_BITS): Use it.
(GCTYPEBITS, USE_LSB_TAG): Now also an enum, for GDB.
(CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS): Now just an enum, for GDB.
* mem-limits.h (EXCEEDS_LISP_PTR): Redo so that DATA_SEG_BITS need
not be usable in #if. This simplifies things.
modified:
src/ChangeLog
src/alloc.c
src/emacs.c
src/lisp.h
src/mem-limits.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-26 13:59:01 +0000
+++ b/src/ChangeLog 2012-07-26 18:35:50 +0000
@@ -1,3 +1,24 @@
+2012-07-26 Paul Eggert <address@hidden>
+
+ Fix export of symbols to GDB (Bug#12036).
+ * alloc.c (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL)
+ (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Move these here from
+ emacs.c, as this is a more-suitable home. Had this been done earlier
+ the fix for 12036 would have avoided some of the problems noted in
+ <http://bugs.gnu.org/12036#13> by Eli Zaretskii, as the scope problems
+ would have been more obvious.
+ * emacs.c (gdb_CHECK_LISP_OBJECT_TYPE, gdb_DATA_SEG_BITS)
+ (gdb_GCTYPEBITS, gdb_USE_LSB_TAG)
+ (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS, GCTYPEBITS, USE_LSB_TAG):
+ Remove; now done in lisp.h.
+ * lisp.h (PUBLISH_TO_GDB): New macro.
+ (GCTYPEBITS, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE, enum pvec_type)
+ (DATA_SEG_BITS): Use it.
+ (GCTYPEBITS, USE_LSB_TAG): Now also an enum, for GDB.
+ (CHECK_LISP_OBJECT_TYPE, DATA_SEG_BITS): Now just an enum, for GDB.
+ * mem-limits.h (EXCEEDS_LISP_PTR): Redo so that DATA_SEG_BITS need
+ not be usable in #if. This simplifies things.
+
2012-07-26 Juanma Barranquero <address@hidden>
* makefile.w32-in ($(BLD)/emacs.$(O)): Update dependencies.
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-07-23 11:15:43 +0000
+++ b/src/alloc.c 2012-07-26 18:35:50 +0000
@@ -6875,3 +6875,29 @@
defsubr (&Sgc_status);
#endif
}
+
+/* Make some symbols visible to GDB. These cannot be done as enums, like
+ GCTYPEBITS or USE_LSB_TAG, since values might not be in 'int' range.
+ Each symbol X has a corresponding X_VAL symbol, verified to have
+ the correct value.
+
+ This is last, so that the #undef lines don't mess up later code. */
+
+#define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN
+#define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2)
+#define VALMASK_VAL (USE_LSB_TAG ? -1 << GCTYPEBITS : VAL_MAX)
+
+verify (ARRAY_MARK_FLAG_VAL == ARRAY_MARK_FLAG);
+verify (PSEUDOVECTOR_FLAG_VAL == PSEUDOVECTOR_FLAG);
+verify (VALMASK_VAL == VALMASK);
+
+#undef ARRAY_MARK_FLAG
+#undef PSEUDOVECTOR_FLAG
+#undef VALMASK
+
+ptrdiff_t const EXTERNALLY_VISIBLE
+ ARRAY_MARK_FLAG = ARRAY_MARK_FLAG_VAL,
+ PSEUDOVECTOR_FLAG = PSEUDOVECTOR_FLAG_VAL;
+
+EMACS_INT const EXTERNALLY_VISIBLE
+ VALMASK = VALMASK_VAL;
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2012-07-26 08:12:03 +0000
+++ b/src/emacs.c 2012-07-26 18:35:50 +0000
@@ -2490,50 +2490,3 @@
/* Make sure IS_DAEMON starts up as false. */
daemon_pipe[1] = 0;
}
-
-/* Make these values available in GDB, which doesn't see macros.
- This is last, so that the #undef lines don't mess up later code. */
-
-enum
- {
- gdb_CHECK_LISP_OBJECT_TYPE = CHECK_LISP_OBJECT_TYPE,
- gdb_DATA_SEG_BITS = DATA_SEG_BITS,
- gdb_GCTYPEBITS = GCTYPEBITS,
- gdb_USE_LSB_TAG = USE_LSB_TAG
- };
-
-#undef CHECK_LISP_OBJECT_TYPE
-#undef DATA_SEG_BITS
-#undef GCTYPEBITS
-#undef USE_LSB_TAG
-
-enum
- {
- CHECK_LISP_OBJECT_TYPE = gdb_CHECK_LISP_OBJECT_TYPE,
- DATA_SEG_BITS = gdb_DATA_SEG_BITS,
- GCTYPEBITS = gdb_GCTYPEBITS,
- USE_LSB_TAG = gdb_USE_LSB_TAG
- };
-
-/* These are trickier since they might fall out of int range. Each
- symbol X has a corresponding X_VAL symbol, verified to have the
- correct value. */
-
-#define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN
-#define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2)
-#define VALMASK_VAL (USE_LSB_TAG ? -1 << GCTYPEBITS : VAL_MAX)
-
-verify (ARRAY_MARK_FLAG_VAL == ARRAY_MARK_FLAG);
-verify (PSEUDOVECTOR_FLAG_VAL == PSEUDOVECTOR_FLAG);
-verify (VALMASK_VAL == VALMASK);
-
-#undef ARRAY_MARK_FLAG
-#undef PSEUDOVECTOR_FLAG
-#undef VALMASK
-
-ptrdiff_t const EXTERNALLY_VISIBLE
- ARRAY_MARK_FLAG = ARRAY_MARK_FLAG_VAL,
- PSEUDOVECTOR_FLAG = PSEUDOVECTOR_FLAG_VAL;
-
-EMACS_INT const EXTERNALLY_VISIBLE
- VALMASK = VALMASK_VAL;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-07-26 08:51:23 +0000
+++ b/src/lisp.h 2012-07-26 18:35:50 +0000
@@ -64,6 +64,12 @@
# endif
#endif
+/* If an enum type is not used, the enum symbols are not put into the
+ executable so the debugger cannot see them on many systems, e.g.,
+ GCC 4.7.1 + GDB 7.4.1 + GNU/Linux. Work around this problem by
+ explicitly using the names in the integer constant expression EXPR. */
+#define PUBLISH_TO_GDB(expr) extern int (*gdb_dummy (int))[(expr) || 1]
+
/* Number of bits in some machine integer types. */
enum
{
@@ -155,7 +161,10 @@
variable VAR of type TYPE with the added requirement that it be
TYPEBITS-aligned. */
-/* Number of bits in a Lisp_Object tag. This can be used in #if. */
+/* Number of bits in a Lisp_Object tag. This can be used in #if,
+ and for GDB's sake also as a regular symbol. */
+enum { GCTYPEBITS = 3 };
+PUBLISH_TO_GDB (GCTYPEBITS);
#define GCTYPEBITS 3
/* Number of bits in a Lisp_Object value, not counting the tag. */
@@ -202,7 +211,16 @@
# endif
# endif
#endif
-#ifndef USE_LSB_TAG
+/* USE_LSB_TAG can be used in #if; default it to 0 and make it visible
+ to GDB. */
+#ifdef USE_LSB_TAG
+# undef USE_LSB_TAG
+enum { USE_LSB_TAG = 1 };
+PUBLISH_TO_GDB (USE_LSB_TAG);
+# define USE_LSB_TAG 1
+#else
+enum { USE_LSB_TAG = 0 };
+PUBLISH_TO_GDB (USE_LSB_TAG);
# define USE_LSB_TAG 0
#endif
@@ -317,6 +335,8 @@
}
#define LISP_INITIALLY_ZERO {0}
+#undef CHECK_LISP_OBJECT_TYPE
+enum { CHECK_LISP_OBJECT_TYPE = 1 };
#else /* CHECK_LISP_OBJECT_TYPE */
@@ -327,8 +347,9 @@
#define XIL(i) (i)
#define LISP_MAKE_RVALUE(o) (0+(o))
#define LISP_INITIALLY_ZERO 0
-#define CHECK_LISP_OBJECT_TYPE 0
+enum { CHECK_LISP_OBJECT_TYPE = 0 };
#endif /* CHECK_LISP_OBJECT_TYPE */
+PUBLISH_TO_GDB (CHECK_LISP_OBJECT_TYPE);
/* In the size word of a vector, this bit means the vector has been marked. */
@@ -368,6 +389,7 @@
PVEC_SUB_CHAR_TABLE = 0x30,
PVEC_FONT = 0x40
};
+PUBLISH_TO_GDB ((enum pvec_type) 0); /* This also publishes PVEC_*. */
/* For convenience, we also store the number of elements in these bits.
Note that this size is not necessarily the memory-footprint size, but
@@ -386,10 +408,16 @@
enum { BOOL_VECTOR_BITS_PER_CHAR = 8 };
/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
- which were stored in a Lisp_Object */
-#ifndef DATA_SEG_BITS
-# define DATA_SEG_BITS 0
+ which were stored in a Lisp_Object. It is not needed in #if, so
+ for GDB's sake change it from a macro to a regular symbol. */
+#ifdef DATA_SEG_BITS
+enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS };
+# undef DATA_SEG_BITS
+enum { DATA_SEG_BITS = gdb_DATA_SEG_BITS };
+#else
+enum { DATA_SEG_BITS = 0 };
#endif
+PUBLISH_TO_GDB (DATA_SEG_BITS);
/* These macros extract various sorts of values from a Lisp_Object.
For example, if tem is a Lisp_Object whose type is Lisp_Cons,
=== modified file 'src/mem-limits.h'
--- a/src/mem-limits.h 2012-07-26 08:12:03 +0000
+++ b/src/mem-limits.h 2012-07-26 18:35:50 +0000
@@ -36,9 +36,7 @@
extern char *start_of_data (void) ATTRIBUTE_CONST;
#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
#define EXCEEDS_LISP_PTR(ptr) 0
-#elif DATA_SEG_BITS
+#else
#define EXCEEDS_LISP_PTR(ptr) \
(((uintptr_t) (ptr) & ~DATA_SEG_BITS) >> VALBITS)
-#else
-#define EXCEEDS_LISP_PTR(ptr) ((uintptr_t) (ptr) >> VALBITS)
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109219: Fix export of symbols to GDB.,
Paul Eggert <=