Fix debugging with GDB when a breakpoint has multiple locations
* lisp/progmodes/gdb-mi.el (gdb-breakpoints--add-breakpoint-row): New function, extracted from 'gdb-breakpoints-list-handler-custom'. Don't print "in <unknown>" for header-rows of breakpoints with multiple locations that don't have a function name attached. (gdb-breakpoints-list-handler-custom): Add to the breakpoint table also any locations in multiple-location breakpoints, which are supported since GDB 6.8.
This commit is contained in:
parent
25e53e9391
commit
7f778c6943
1 changed files with 47 additions and 31 deletions
|
@ -3076,6 +3076,45 @@ See `def-gdb-auto-update-handler'."
|
||||||
'gdb-breakpoints-mode
|
'gdb-breakpoints-mode
|
||||||
'gdb-invalidate-breakpoints)
|
'gdb-invalidate-breakpoints)
|
||||||
|
|
||||||
|
(defun gdb-breakpoints--add-breakpoint-row (tbl bkpt)
|
||||||
|
(let ((at (gdb-mi--field bkpt 'at))
|
||||||
|
(pending (gdb-mi--field bkpt 'pending))
|
||||||
|
(addr (gdb-mi--field bkpt 'addr))
|
||||||
|
(func (gdb-mi--field bkpt 'func))
|
||||||
|
(type (gdb-mi--field bkpt 'type)))
|
||||||
|
(if (and (not func) (string-equal addr "<MULTIPLE>"))
|
||||||
|
(setq func ""))
|
||||||
|
(gdb-table-add-row tbl
|
||||||
|
(list
|
||||||
|
(gdb-mi--field bkpt 'number)
|
||||||
|
(or type "")
|
||||||
|
(or (gdb-mi--field bkpt 'disp) "")
|
||||||
|
(let ((flag (gdb-mi--field bkpt 'enabled)))
|
||||||
|
(if (string-equal flag "y")
|
||||||
|
(eval-when-compile
|
||||||
|
(propertize "y" 'font-lock-face
|
||||||
|
font-lock-warning-face))
|
||||||
|
(eval-when-compile
|
||||||
|
(propertize "n" 'font-lock-face
|
||||||
|
font-lock-comment-face))))
|
||||||
|
addr
|
||||||
|
(or (gdb-mi--field bkpt 'times) "")
|
||||||
|
(if (and type (string-match ".*watchpoint" type))
|
||||||
|
(gdb-mi--field bkpt 'what)
|
||||||
|
(or (and (equal func "") "")
|
||||||
|
pending at
|
||||||
|
(concat "in "
|
||||||
|
(propertize (or func "unknown")
|
||||||
|
'font-lock-face
|
||||||
|
font-lock-function-name-face)
|
||||||
|
(gdb-frame-location bkpt)))))
|
||||||
|
;; Add clickable properties only for
|
||||||
|
;; breakpoints with file:line information
|
||||||
|
(append (list 'gdb-breakpoint bkpt)
|
||||||
|
(when func
|
||||||
|
'(help-echo "mouse-2, RET: visit breakpoint"
|
||||||
|
mouse-face highlight))))))
|
||||||
|
|
||||||
(defun gdb-breakpoints-list-handler-custom ()
|
(defun gdb-breakpoints-list-handler-custom ()
|
||||||
(let ((breakpoints-list (gdb-mi--field
|
(let ((breakpoints-list (gdb-mi--field
|
||||||
(gdb-mi--field (gdb-mi--partial-output 'bkpt)
|
(gdb-mi--field (gdb-mi--partial-output 'bkpt)
|
||||||
|
@ -3088,37 +3127,14 @@ See `def-gdb-auto-update-handler'."
|
||||||
(add-to-list 'gdb-breakpoints-list
|
(add-to-list 'gdb-breakpoints-list
|
||||||
(cons (gdb-mi--field breakpoint 'number)
|
(cons (gdb-mi--field breakpoint 'number)
|
||||||
breakpoint))
|
breakpoint))
|
||||||
(let ((at (gdb-mi--field breakpoint 'at))
|
;; Add the breakpoint/header row to the table.
|
||||||
(pending (gdb-mi--field breakpoint 'pending))
|
(gdb-breakpoints--add-breakpoint-row table breakpoint)
|
||||||
(func (gdb-mi--field breakpoint 'func))
|
;; If this breakpoint has multiple locations, add them as well.
|
||||||
(type (gdb-mi--field breakpoint 'type)))
|
(when-let ((locations (gdb-mi--field breakpoint 'locations)))
|
||||||
(gdb-table-add-row table
|
(dolist (loc locations)
|
||||||
(list
|
(add-to-list 'gdb-breakpoints-list
|
||||||
(gdb-mi--field breakpoint 'number)
|
(cons (gdb-mi--field loc 'number) loc))
|
||||||
(or type "")
|
(gdb-breakpoints--add-breakpoint-row table loc))))
|
||||||
(or (gdb-mi--field breakpoint 'disp) "")
|
|
||||||
(let ((flag (gdb-mi--field breakpoint 'enabled)))
|
|
||||||
(if (string-equal flag "y")
|
|
||||||
(eval-when-compile
|
|
||||||
(propertize "y" 'font-lock-face
|
|
||||||
font-lock-warning-face))
|
|
||||||
(eval-when-compile
|
|
||||||
(propertize "n" 'font-lock-face
|
|
||||||
font-lock-comment-face))))
|
|
||||||
(gdb-mi--field breakpoint 'addr)
|
|
||||||
(or (gdb-mi--field breakpoint 'times) "")
|
|
||||||
(if (and type (string-match ".*watchpoint" type))
|
|
||||||
(gdb-mi--field breakpoint 'what)
|
|
||||||
(or pending at
|
|
||||||
(concat "in "
|
|
||||||
(propertize (or func "unknown")
|
|
||||||
'font-lock-face font-lock-function-name-face)
|
|
||||||
(gdb-frame-location breakpoint)))))
|
|
||||||
;; Add clickable properties only for breakpoints with file:line
|
|
||||||
;; information
|
|
||||||
(append (list 'gdb-breakpoint breakpoint)
|
|
||||||
(when func '(help-echo "mouse-2, RET: visit breakpoint"
|
|
||||||
mouse-face highlight))))))
|
|
||||||
(insert (gdb-table-string table " "))
|
(insert (gdb-table-string table " "))
|
||||||
(gdb-place-breakpoints)))
|
(gdb-place-breakpoints)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue