bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

contribution for gud.el


From: Eric Gebhart
Subject: contribution for gud.el
Date: Mon, 24 Feb 2003 02:08:49 -0500
User-agent: Mutt/1.2.5i

Hi,

I've added another debugger to gud.el.  In the process I refined the
speedbar functionality to make it easier to plug into.  I also added
functionality for a breaklist.  It'd be nice to make an option to turn
one or the other off but I haven't gone that far yet. it would also
be nice to make them folders.  Maybe next week.

I wrote a new function: gud-speedbar-common-init that serves to 
turn on speedbar support and supply the defined functions.

There are also new generic functions for getting command output:
gud-get-command-output, gud-run-command-fetch-output-lines,
gud-command-output-filter.

I also modified gud-speedbar-buttons so that it no longer needs to be
modified to add another debugger.

So, in this version, the speedbar has a clickable break list and stack trace.

There are only 4 functions that need to be implemented by the debugger specific
code.  And those four functions are very short and simple.

For stack trace support:  gud-<name>-get-stackframe, gud-<name>-goto-stackframe.

For break list support: gud-<name>-get-break-list, 
gud-<name>-enable-disable-break

Thanks to the new functions, implementing the get-stack-frame and get-break-list
functions is now very easy.

(defun gud-cpr-get-stackframe (buffer)
  ;"  1* In routine sas:\hamain.c\main 49"
  ;"  2  Called from sas:\hamain.c\main 49"
  (setq expression "^ *\\([0-9]*\\)[\*]*[ ]*\\(In routine \\|Called from 
\\)\\(.*\\)")

  ;" Don't want to see these:  4  Called from hostcm:\wobmth.c\wobmth 101"
  (setq gud-exclude-output-expression "^ *[0-9]*[\*]*[a-zA-Z 
]*:\\\\wobmth.c.*") 

  (setq stacklst 
    ; Name is in the 3 regex, number is in the 1st.
    (gud-get-command-output buffer "where" expression 3 1 "No application 
loaded.*") )
    ;; We need to set exclude back to nil so we won't mess anyone else up.
    (setq gud-exclude-output-expression nil) 
  stacklst)

(defun gud-cpr-get-break-list (buffer)
  ;Enabled:
  ; 1  0x080510CB sas:\hamain.c\main 49
  ;Disabled:
  ; 1* 0x080510CB sas:\hamain.c\main 49

  (setq expression  "^ \\([0-9\*]*\\) *\\(0x[0-9ABCDEF]*\\|(not yet loaded)\\) 
\\(.*\\)" )

  ; Name is in the 3 regex, number is in the 1st.
  (gud-get-command-output buffer "bl" expression 3 1 "empty break list"))


I merged my changes with the current head of gud.el version 1.175.

I am running emacs 21.2.1 on FreeBSD so I was unable to run the merged version
of the .el.  No toolbars....

I've included both my original and the merged version.  

Thanks,

Eric

Attachment: gud-merged.el
Description: Text document

Attachment: gud.el
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]