Mercurial > emacs
annotate lisp/cedet/semantic/db-debug.el @ 104433:77f14bf50035
Directory eieio removed.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 30 Aug 2009 02:04:33 +0000 |
parents | 2e15afd37998 |
children | da5b2513c225 |
rev | line source |
---|---|
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; db-debug.el --- Extra level debugging routines for Semantic |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; (at your option) any later version. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Various routines for debugging SemanticDB issues, or viewing |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; semanticdb state. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 (require 'semantic/db) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;;; Code: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (defun semanticdb-dump-all-table-summary () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 "Dump a list of all databases in Emacs memory." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (let ((db semanticdb-database-list)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (data-debug-new-buffer "*SEMANTICDB*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (data-debug-insert-stuff-list db "*"))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (defalias 'semanticdb-adebug-database-list 'semanticdb-dump-all-table-summary) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (defun semanticdb-adebug-current-database () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 "Run ADEBUG on the current database." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 (let ((p semanticdb-current-database) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (data-debug-new-buffer "*SEMANTICDB ADEBUG*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (data-debug-insert-stuff-list p "*"))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (defun semanticdb-adebug-current-table () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 "Run ADEBUG on the current database." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (let ((p semanticdb-current-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (data-debug-new-buffer "*SEMANTICDB ADEBUG*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (data-debug-insert-stuff-list p "*"))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (defun semanticdb-adebug-project-database-list () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "Run ADEBUG on the current database." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (let ((p (semanticdb-current-database-list))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (data-debug-new-buffer "*SEMANTICDB ADEBUG*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (data-debug-insert-stuff-list p "*"))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 ;;; Sanity Checks |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (defun semanticdb-table-oob-sanity-check (cache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 "Validate that CACHE tags do not have any overlays in them." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (while cache |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (when (semantic-overlay-p (semantic-tag-overlay cache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (message "Tag %s has an erroneous overlay!" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (semantic-format-tag-summarize (car cache)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (semanticdb-table-oob-sanity-check |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (semantic-tag-components-with-overlays (car cache))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (setq cache (cdr cache)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (defun semanticdb-table-sanity-check (&optional table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "Validate the current semanticdb TABLE." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (if (not table) (setq table semanticdb-current-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (let* ((full-filename (semanticdb-full-filename table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (buff (find-buffer-visiting full-filename))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (if buff |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (save-excursion |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (set-buffer buff) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (semantic-sanity-check)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;; We can't use the usual semantic validity check, so hack our own. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (semanticdb-table-oob-sanity-check (semanticdb-get-tags table))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (defun semanticdb-database-sanity-check () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 "Validate the current semantic database." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (let ((tables (semanticdb-get-database-tables |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 semanticdb-current-database))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (while tables |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (semanticdb-table-sanity-check (car tables)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (setq tables (cdr tables))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (provide 'semantic/db-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 ;;; semanticdb-debug.el ends here |