diff options
| author | Jeremy Bryant | 2025-12-06 23:03:21 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2025-12-08 16:11:50 +0200 |
| commit | 22bf7158a5803aa98d5b580e5a00a6356343d90b (patch) | |
| tree | c5511b7556d94603c42c340548cf52067d1394b9 /src | |
| parent | 24297f6d9a2fb3bf464f25bdf80c85b13aa04a36 (diff) | |
| download | emacs-22bf7158a5803aa98d5b580e5a00a6356343d90b.tar.gz emacs-22bf7158a5803aa98d5b580e5a00a6356343d90b.zip | |
; * src/.gdbinit: Improve comments of .gdbinit helper functions (bug#79932)
xgetptr: Improve comment describing helper function.
xgetint: Add comment describing helper function.
xgettype: Add comment describing helper function.
xgetsym: Add comment describing helper function.
xprintstr: Add comment describing helper function.
Co-authored-by: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index 673edaf9ec7..cf007c1f99e 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -50,6 +50,9 @@ if defined_HAVE_PGTK | |||
| 50 | handle SIGPIPE nostop noprint | 50 | handle SIGPIPE nostop noprint |
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | # Helper command to get the pointer to the C struct that holds the data | ||
| 54 | # of a Lisp object given as argument, by removing the GC and type-tag bits. | ||
| 55 | # Stores the result in $ptr. | ||
| 53 | # Use $bugfix so that the value isn't a constant. | 56 | # Use $bugfix so that the value isn't a constant. |
| 54 | # Using a constant runs into GDB bugs sometimes. | 57 | # Using a constant runs into GDB bugs sometimes. |
| 55 | define xgetptr | 58 | define xgetptr |
| @@ -61,6 +64,8 @@ define xgetptr | |||
| 61 | set $ptr = (EMACS_INT) $bugfix & VALMASK | 64 | set $ptr = (EMACS_INT) $bugfix & VALMASK |
| 62 | end | 65 | end |
| 63 | 66 | ||
| 67 | # Helper command to extract the C integer value of a Lisp fixnum given as argument. | ||
| 68 | # Stores the result in $int. | ||
| 64 | define xgetint | 69 | define xgetint |
| 65 | if (CHECK_LISP_OBJECT_TYPE) | 70 | if (CHECK_LISP_OBJECT_TYPE) |
| 66 | set $bugfix = $arg0.i | 71 | set $bugfix = $arg0.i |
| @@ -70,6 +75,9 @@ define xgetint | |||
| 70 | set $int = (EMACS_INT) $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS | 75 | set $int = (EMACS_INT) $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS |
| 71 | end | 76 | end |
| 72 | 77 | ||
| 78 | # Helper command to produce the type of a Lisp_Object, given as argument, | ||
| 79 | # as a value from the 'Lisp_Type' enumeration. | ||
| 80 | # Stores the result in $type. | ||
| 73 | define xgettype | 81 | define xgettype |
| 74 | if (CHECK_LISP_OBJECT_TYPE) | 82 | if (CHECK_LISP_OBJECT_TYPE) |
| 75 | set $bugfix = $arg0.i | 83 | set $bugfix = $arg0.i |
| @@ -79,6 +87,9 @@ define xgettype | |||
| 79 | set $type = (enum Lisp_Type) (USE_LSB_TAG ? (EMACS_INT) $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS) | 87 | set $type = (enum Lisp_Type) (USE_LSB_TAG ? (EMACS_INT) $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS) |
| 80 | end | 88 | end |
| 81 | 89 | ||
| 90 | # Helper command to get the pointer to 'struct Lisp_Symbol' | ||
| 91 | # corresponding to the Lisp object given as argument. | ||
| 92 | # Stores the result in $ptr. | ||
| 82 | define xgetsym | 93 | define xgetsym |
| 83 | xgetptr $arg0 | 94 | xgetptr $arg0 |
| 84 | set $ptr = ((struct Lisp_Symbol *) ((char *) &lispsym + $ptr)) | 95 | set $ptr = ((struct Lisp_Symbol *) ((char *) &lispsym + $ptr)) |
| @@ -1121,6 +1132,10 @@ document xpr | |||
| 1121 | Print $ as a lisp object of any type. | 1132 | Print $ as a lisp object of any type. |
| 1122 | end | 1133 | end |
| 1123 | 1134 | ||
| 1135 | # Helper command to print the text of a Lisp string given as argument. | ||
| 1136 | # Stores the pointer to the C string data in $data and its length in | ||
| 1137 | # characters (excluding the terminating null) in $strsize. | ||
| 1138 | # Prints "0" for empty strings and strings longer than 1000 characters. | ||
| 1124 | define xprintstr | 1139 | define xprintstr |
| 1125 | if (! $arg0) | 1140 | if (! $arg0) |
| 1126 | output "DEAD" | 1141 | output "DEAD" |