[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109224: Improve GDB symbol export.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109224: Improve GDB symbol export. |
Date: |
Thu, 26 Jul 2012 23:18:36 -0700 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109224
fixes bug: http://debbugs.gnu.org/12036
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-26 23:18:36 -0700
message:
Improve GDB symbol export.
* .gdbinit (xgetptr, xgetint, xgettype): Set $bugfix in different
arms of an 'if', not using conditional expressions; otherwise GDB
complains about the types in the unevaluated arm when the argument
is an integer literal.
(xgetint): Simplify expression.
* alloc.c (gdb_make_enums_visible): New constant. This ports to
GCC 3.4.2 the export of symbols to GDB. Problem reported by Eli
Zaretskii in <http://bugs.gnu.org/12036#13>.
* lisp.h (PUBLISH_TO_GDB): Remove. All uses removed. No longer
needed now that we have gdb_make_enums_visible.
(enum CHECK_LISP_OBJECT_TYPE, enum Lisp_Bits, enum More_Lisp_Bits)
(enum enum_USE_LSB_TAG):
New enum types, packaging up enums that need to be exported to GDB.
modified:
src/.gdbinit
src/ChangeLog
src/alloc.c
src/lisp.h
=== modified file 'src/.gdbinit'
--- a/src/.gdbinit 2012-07-26 08:12:03 +0000
+++ b/src/.gdbinit 2012-07-27 06:18:36 +0000
@@ -46,17 +46,29 @@
# Use $bugfix so that the value isn't a constant.
# Using a constant runs into GDB bugs sometimes.
define xgetptr
- set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS
end
define xgetint
- set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0
- set $int = USE_LSB_TAG ? $bugfix >> INTTYPEBITS : $bugfix << INTTYPEBITS >>
INTTYPEBITS
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
+ set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
end
define xgettype
- set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1
: $bugfix >> VALBITS)
end
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-27 06:04:35 +0000
+++ b/src/ChangeLog 2012-07-27 06:18:36 +0000
@@ -1,3 +1,20 @@
+2012-07-27 Paul Eggert <address@hidden>
+
+ Improve GDB symbol export (Bug#12036).
+ * .gdbinit (xgetptr, xgetint, xgettype): Set $bugfix in different
+ arms of an 'if', not using conditional expressions; otherwise GDB
+ complains about the types in the unevaluated arm when the argument
+ is an integer literal.
+ (xgetint): Simplify expression.
+ * alloc.c (gdb_make_enums_visible): New constant. This ports to
+ GCC 3.4.2 the export of symbols to GDB. Problem reported by Eli
+ Zaretskii in <http://bugs.gnu.org/12036#13>.
+ * lisp.h (PUBLISH_TO_GDB): Remove. All uses removed. No longer
+ needed now that we have gdb_make_enums_visible.
+ (enum CHECK_LISP_OBJECT_TYPE, enum Lisp_Bits, enum More_Lisp_Bits)
+ (enum enum_USE_LSB_TAG):
+ New enum types, packaging up enums that need to be exported to GDB.
+
2012-07-27 Dmitry Antipov <address@hidden>
Utility function to make a list from specified amount of objects.
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-07-27 06:04:35 +0000
+++ b/src/alloc.c 2012-07-27 06:18:36 +0000
@@ -6910,12 +6910,25 @@
#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. */
+/* Make some symbols visible to GDB. This section is last, so that
+ the #undef lines don't mess up later code. */
+
+/* When compiled with GCC, GDB might say "No enum type named
+ pvec_type" if we don't have at least one symbol with that type, and
+ then xbacktrace could fail. Similarly for the other enums and
+ their values. */
+union
+{
+ enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE;
+ enum enum_USE_LSB_TAG enum_USE_LSB_TAG;
+ enum Lisp_Bits Lisp_Bits;
+ enum More_Lisp_Bits More_Lisp_Bits;
+ enum pvec_type pvec_type;
+} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
+
+/* These symbols cannot be done as enums, since values might not be
+ in '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)
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-07-27 06:04:35 +0000
+++ b/src/lisp.h 2012-07-27 06:18:36 +0000
@@ -64,12 +64,6 @@
# 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
{
@@ -161,14 +155,23 @@
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,
- and for GDB's sake also as a regular symbol. */
-enum { GCTYPEBITS = 3 };
-PUBLISH_TO_GDB (GCTYPEBITS);
+enum Lisp_Bits
+ {
+ /* Number of bits in a Lisp_Object tag. This can be used in #if,
+ and for GDB's sake also as a regular symbol. */
+ GCTYPEBITS =
#define GCTYPEBITS 3
-
-/* Number of bits in a Lisp_Object value, not counting the tag. */
-enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS };
+ GCTYPEBITS,
+
+ /* Number of bits in a Lisp_Object value, not counting the tag. */
+ VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS,
+
+ /* Number of bits in a Lisp fixnum tag. */
+ INTTYPEBITS = GCTYPEBITS - 1,
+
+ /* Number of bits in a Lisp fixnum value, not counting the tag. */
+ FIXNUM_BITS = VALBITS + 1
+ };
/* The maximum value that can be stored in a EMACS_INT, assuming all
bits other than the type bits contribute to a nonnegative signed value.
@@ -211,16 +214,12 @@
# endif
# endif
#endif
-/* 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);
+enum enum_USE_LSB_TAG { USE_LSB_TAG = 1 };
# define USE_LSB_TAG 1
#else
-enum { USE_LSB_TAG = 0 };
-PUBLISH_TO_GDB (USE_LSB_TAG);
+enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
# define USE_LSB_TAG 0
#endif
@@ -239,8 +238,6 @@
/* Lisp integers use 2 tags, to give them one extra bit, thus
extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */
-enum { INTTYPEBITS = GCTYPEBITS - 1 };
-enum { FIXNUM_BITS = VALBITS + 1 };
#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
#define LISP_INT_TAG Lisp_Int0
#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
@@ -335,9 +332,9 @@
}
#define LISP_INITIALLY_ZERO {0}
+
#undef CHECK_LISP_OBJECT_TYPE
-enum { CHECK_LISP_OBJECT_TYPE = 1 };
-
+enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 };
#else /* CHECK_LISP_OBJECT_TYPE */
/* If a struct type is not wanted, define Lisp_Object as just a number. */
@@ -347,9 +344,8 @@
#define XIL(i) (i)
#define LISP_MAKE_RVALUE(o) (0+(o))
#define LISP_INITIALLY_ZERO 0
-enum { CHECK_LISP_OBJECT_TYPE = 0 };
+enum CHECK_LISP_OBJECT_TYPE { 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. */
@@ -390,35 +386,32 @@
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
- only the number of Lisp_Object fields (that need to be traced by the GC).
- The distinction is used e.g. by Lisp_Process which places extra
- non-Lisp_Object fields at the end of the structure. */
-enum
+
+/* 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
+#endif
+enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS };
+#undef DATA_SEG_BITS
+
+enum More_Lisp_Bits
{
+ DATA_SEG_BITS = gdb_DATA_SEG_BITS,
+
+ /* For convenience, we also store the number of elements in these bits.
+ Note that this size is not necessarily the memory-footprint size, but
+ only the number of Lisp_Object fields (that need to be traced by GC).
+ The distinction is used, e.g., by Lisp_Process, which places extra
+ non-Lisp_Object fields at the end of the structure. */
PSEUDOVECTOR_SIZE_BITS = 16,
PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1,
- PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS
+ PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS,
+
+ /* Number of bits to put in each character in the internal representation
+ of bool vectors. This should not vary across implementations. */
+ BOOL_VECTOR_BITS_PER_CHAR = 8
};
-
-/* Number of bits to put in each character in the internal representation
- of bool vectors. This should not vary across implementations. */
-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. 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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109224: Improve GDB symbol export.,
Paul Eggert <=