aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorEli Zaretskii2011-10-29 15:35:23 +0200
committerEli Zaretskii2011-10-29 15:35:23 +0200
commit8b058d447425857f933c119edbac3c1e2da3e1f3 (patch)
tree61907528bf161ea6783014135d6924d173cb22f7 /src/alloc.c
parentaa4dfba7fd52e598b29e3a13efe8743837a2e53b (diff)
downloademacs-8b058d447425857f933c119edbac3c1e2da3e1f3.tar.gz
emacs-8b058d447425857f933c119edbac3c1e2da3e1f3.zip
Fix the `xbytecode' user-defined command in .gdbinit.
src/.gdbinit (xprintbytestr): New command. (xwhichsymbols): Renamed from `which'; all callers changed. (xbytecode): Print the byte-code string as well. src/alloc.c (which_symbols): New function.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 6e999a0ba6d..ac5da1c2fa1 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6250,6 +6250,55 @@ Frames, windows, buffers, and subprocesses count as vectors
6250 return Flist (8, consed); 6250 return Flist (8, consed);
6251} 6251}
6252 6252
6253/* Find at most FIND_MAX symbols which have OBJ as their value or
6254 function. This is used in gdbinit's `xwhichsymbols' command. */
6255
6256Lisp_Object
6257which_symbols (Lisp_Object obj, int find_max)
6258{
6259 struct symbol_block *sblk;
6260 int gc_count = inhibit_garbage_collection ();
6261 Lisp_Object found = Qnil;
6262
6263 if (!EQ (obj, Vdead))
6264 {
6265 for (sblk = symbol_block; sblk; sblk = sblk->next)
6266 {
6267 struct Lisp_Symbol *sym = sblk->symbols;
6268 int bn;
6269
6270 for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, sym++)
6271 {
6272 Lisp_Object val;
6273 Lisp_Object tem;
6274
6275 if (sblk == symbol_block && bn >= symbol_block_index)
6276 break;
6277
6278 XSETSYMBOL (tem, sym);
6279 val = find_symbol_value (tem);
6280 if (EQ (val, obj)
6281 || EQ (sym->function, obj)
6282 || (!NILP (sym->function)
6283 && COMPILEDP (sym->function)
6284 && EQ (AREF (sym->function, COMPILED_BYTECODE), obj))
6285 || (!NILP (val)
6286 && COMPILEDP (val)
6287 && EQ (AREF (val, COMPILED_BYTECODE), obj)))
6288 {
6289 found = Fcons (tem, found);
6290 if (--find_max == 0)
6291 goto out;
6292 }
6293 }
6294 }
6295 }
6296
6297 out:
6298 unbind_to (gc_count, Qnil);
6299 return found;
6300}
6301
6253#ifdef ENABLE_CHECKING 6302#ifdef ENABLE_CHECKING
6254int suppress_checking; 6303int suppress_checking;
6255 6304