Skip to content

Instantly share code, notes, and snippets.

@kaushiks
Created August 4, 2015 15:36
Show Gist options
  • Save kaushiks/07e8c5e3a2496da0e1d1 to your computer and use it in GitHub Desktop.
Save kaushiks/07e8c5e3a2496da0e1d1 to your computer and use it in GitHub Desktop.
author Kaushik Srenevasan <ksrenevasan@gmail.com> 2012-03-13 07:07:10 (GMT)
committer Glenn Morris <rgm@gnu.org> 2012-03-13 07:07:10 (GMT)
commit 4a07df36a52547d272107151e9251ba96cb37224 (patch) (side-by-side diff)
tree 0a8e4a84a982a8a3e303aa7cdc97723d3a360647
parent 4aaa93566b7bbc3cb57e6c15b4c5bc5a140b3355 (diff)
download emacs-4a07df36a52547d272107151e9251ba96cb37224.tar.gz
GDB change for dynamically generated code (tiny change)
Ref: http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00753.html
* lisp/progmodes/gdb-mi.el (gdb-invalidate-disassembly):
For dynamically generated code, follow $PC.
(gdb-disassembly-handler-custom): Handle no function name case.
Fixes: debbugs:10597
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r-- lisp/ChangeLog 6
-rw-r--r-- lisp/progmodes/gdb-mi.el 16
2 files changed, 18 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0528eda..bd0e6f8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-13 Kaushik Srenevasan <ksrenevasan@gmail.com> (tiny change)
+
+ * progmodes/gdb-mi.el (gdb-invalidate-disassembly):
+ For dynamically generated code, follow $PC.
+ (gdb-disassembly-handler-custom): Handle no function name case.
+
2012-03-13 Tim Landscheidt <tim@tim-landscheidt.de> (tiny change)
* calendar/icalendar.el (icalendar-export-file, icalendar-import-file):
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 8ea255e..89450cd 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -3269,8 +3269,12 @@ DOC is an optional documentation string."
(let* ((frame (gdb-current-buffer-frame))
(file (bindat-get-field frame 'fullname))
(line (bindat-get-field frame 'line)))
- (when file
- (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line)))
+ (if file
+ (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line)
+ ;; If we're unable to get a file name / line for $PC, simply
+ ;; follow $PC, disassembling the next 10 (x ~15 (on IA) ==
+ ;; 150 bytes) instructions.
+ "-data-disassemble -s $pc -e \"$pc + 150\" -- 0"))
gdb-disassembly-handler
;; We update disassembly only after we have actual frame information
;; about all threads, so no there's `update' signal in this list
@@ -3329,8 +3333,12 @@ DOC is an optional documentation string."
(gdb-table-add-row table
(list
(bindat-get-field instr 'address)
- (apply #'format "<%s+%s>:"
- (gdb-get-many-fields instr 'func-name 'offset))
+ (let
+ ((func-name (bindat-get-field instr 'func-name))
+ (offset (bindat-get-field instr 'offset)))
+ (if func-name
+ (format "<%s+%s>:" func-name offset)
+ ""))
(bindat-get-field instr 'inst)))
(when (string-equal (bindat-get-field instr 'address)
address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment