Git Product home page Git Product logo

realgud-ipdb's Introduction

Build Status GNU ELPA MELPA MELPA Stable

RealGUD logo

An extensible, modular GNU Emacs front-end for interacting with external debuggers, brought to you by Rocky Bernstein (@rocky) and Clément Pit-Claudel (@cpitclaudel).

RealGUD screenshot

Setup

You can install RealGUD from MELPA, a repository of Emacs packages. If you don't have MELPA set up, add the following to your .emacs and restart Emacs:

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize)

You can then run the following commands to install RealGUD:

M-x package-refresh-contents RET      (to refresh your package database)
M-x package-install RET realgud RET   (to install and compile `realgud` and its dependencies)

Alternatively, you can install RealGUD using el-get or from source directly. See this article in our wiki for more info.

Quick start

Use M-x load-library RET realgud RET to load RealGUD.

Launching the debugger

Open a source file, then use M-x realgud:<debugger-name> to start your favorite debugger (for example, you can use M-x realgud:pdb to launch PDB, a Python debugger). RealGUD opens two windows: the command window (showing the debugger's REPL), and the source window, showing your code (with some debuggers, such as realgud:gdb, this window does not appear until you type start in the command window). An solid arrow indicates the current line in the source window. Grayed out arrows indicate previous positions.

Using the debugger

All usual debugger commands work in the command window: for example, you can type n RET in the command window to step forward one source line. But RealGUD's power lies in the source window: in it, most single keys correspond to a debugger action. For example, you can press n in the source window to step forward.

Source window commands

Here is a quick rundown of the most useful commands. “🐁” indicates mouse commands (commands that can be run by clicking on a variable or in the margins). Many of the commands are accessible from the tool bar (tool-bar-mode) and the menu (menu-bar-mode).

  • Motion commands

    Command Action
    n, F10 Next (aka “step over”, “step through”)
    s, SPC, F11 Step (aka “step into”)
    f, S-F11 Finish (aka “step out”, “return”)
    c, F5 Continue (run to next break point)
  • Using breakpoints

    Command Action
    b, F9 Set breakpoint 🐁
    D Clear breakpoint 🐁 (by number)
  • Inspecting variables

    Command Action
    mouse-2 (middle button) Inspect variable under cursor (in tooltip) 🐁
    e Evaluate expression
  • Control commands

    Command Action
    q, S-F5 Quit
    R, r Run (aka “restart”)
    S Go to command window

Supported debuggers

RealGUD supports many external debuggers. Help us support even more!

Advanced topics

Extra commands

“⚙” indicates a work-in-progress (contributions welcome!)

Command Action
U Until (run to a greater source line)
u, > Up stack (move to older stack frame)
d, < Down stack (move to younger stack frame)
X Clear breakpoint (by line)
j Jump to current line ⚙
- Disable breakpoint ⚙
+ Enable breakpoint ⚙

Tracking an existing debugger process

Use M-x realgud-track-mode inside an existing shell, or eshell buffer to track an already-running debugger process.

RealGUD's wiki

Browse the wiki for more information about setting up, using realgud, exploring features, and lots more.

realgud-ipdb's People

Contributors

pataquets avatar rocky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

realgud-ipdb's Issues

Source window out of sync with ipdb window

@rbarzic commented on Mon Nov 26 2018

Hi,

I've installed realgud and tried it with ipdb and get this strange behaviour where the source code position indicated by ipdb is not updated in the source window (basically the green cursor in the source window is "late" compared to the current source line seen by pdb)

image

I have the following message at the startup of ipdb 👍
WARNING: your terminal doesn't support cursor position requests (CPR).

I don't have the problem when running with pdb

I've using realgud-20180925.10 from elpa on emacs 26.1


@rocky commented on Mon Nov 26 2018

See if commit b8b587b fixes this.

It looks like a new ANSI control sequence was added before the prompt (> ...) and that messed (messes?) up the location tracking.


@rocky commented on Mon Nov 26 2018

One other thing - if the synchonization occasionally gets off, you can sometimes for a resync by issuing up 0 in (i)pdb.


@rbarzic commented on Mon Nov 26 2018

Thanks for the tip - Unfortunatly, I'm struggling a bit to install the realgud stuff from git when not having sudo access and a local installation of emacs under /opt and be sure that the right version is used by emacs. I think I've install the latest version properly but the bug seems to be still here. Is there a way to get the version of realgud from emacs ?


@rocky commented on Mon Nov 26 2018

This version of realgud is already on melpa.

To see whether you are getting the new code, you should not be seeing ASCII escape characters like
�[J> before where it shows where you are stopped or �[6C after listing the source code.

Also, you need to make sure you are running in new comint shell, so that the changed functions are picked up.: shell hook, which is one of the places where a change was made, stores a copy of the function and doesn't automatcally get updated when the function changes.

The simplest thing is to do here then is run a new emacs where you load everything from scratch.

Since Emacs is dynamic, all you need to do is load-file any of the files that have changed, before running realgud for the first time. To get a list of files that have changed, look at the commit.

And lastly, I note that for a guy that seems to request this much assistance you are relucant to star any project


@rbarzic commented on Mon Nov 26 2018

Thanks - I was confused about the version to use because the commit you pointed to appears to be done 9 hours ago while the latest melpa version is 20180925.10 - which I read as "25 September 2018"- so I was not expected to get the fix through MELPA - thus I had to be sure to remove any realgud versions already installed and do a reinstallation using git. I think I got it right now.
And I was asking for a possible way to get the realgud version as some other modes( like Verilog-mode ) sometimes provide a way to get it easily from a menu or a command.


@rocky commented on Mon Nov 26 2018

Acually you are correct melpa: is out of date. I read the date wrong. But I guess it will catch up eventually.

If you look at the README.md there is a link to instructions for setting up. You read that, right?


@rbarzic commented on Mon Nov 26 2018

Yes I did - And I don't have any ASCII escape sequence on screen. Only the message "WARNING: your terminal doesn't support cursor position requests (CPR)" at the beginning of the session.


@rocky commented on Mon Nov 26 2018

Ok. Well, if this doesn't do it, then I guess I would like to leave it here. Things work for me well enough with this. (Actually, I don't use ipdb at all.)

As this is open source feel free to dig in and investigate and/or fix. Or we can wait until someone else is interested in this.


@rbarzic commented on Mon Nov 26 2018

ok I understand - I'm not particularly familiar with emacs interaction with other processes so I may not be able to help much on this unfortunatly


@rocky commented on Mon Nov 26 2018

No one is born understanding emacs interaction with other processes.

Symbol's value as variable is void

That's all I get for ipdb related functions:

  • realgud:ipdb-completion-at-point
  • realgud:ipdb-minibuffer-history

I'm unable to autocomplete anything.

ANSI Escape sequences printed verbatim with realgud:ipdb

@stnbu commented on Thu Apr 20 2017

I'm quite new to emacs so please forgive any stupid...

I have the following in my ~/.emacs

(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(add-to-list 'comint-output-filter-functions 'ansi-color-process-output)

This does address a similar problem (re ANSI color sequences) with elpy+ipython.

But when I

M-x load-library [RET] realgud [RET]
M-x realgud:ipdb [RET]

from within a python buffer, I get a new ipdb interpreter in another window (that appears to be working as expected). But I get the above mentioned ANSI color escape sequence problem:

Current directory: /foo/
Command: ipdb /foo/__init__.py
> /foo/__init__.py(1)<module>()
----> 1 import paramiko
      2 
      3 

�[6n�[Jipdb> �[6D�[6C
�[6D�[Jipdb> �[6D
�[J�[6n�[Jipdb> �[6D�[6C�[6D�[J�[6n�[Jipdb> �[6D�[6C

From my package listing buffer:

 realgud       20170218.740  installed

@eflanigan00 commented on Thu Jul 13 2017

Anyone know anything about this? I'm having the same problem.


@xkal36 commented on Sun Aug 13 2017

I came across this problem also. I detailed my fix here: https://emacs.stackexchange.com/questions/34854/ipdb-displaying-ansi-color-escape-sequences


@rocky commented on Sun Aug 13 2017

@xkal36 I'd be grateful if you documented the workaround in off of https://github.com/realgud/realgud/wiki

Although beggars can't be choosers, my suggestion would be to document the problem in general: ANSI escape codes in Emacs shells, and then under ipdb notes add a mention to that along with your sample shell script that disables ANSI control codes. Thanks in advance.

I've added entries to the wiki. I may also try more aggressive ANSI Escape code filtering in the future.


@rocky commented on Tue Aug 15 2017

@stnbu @eflanigan00 @xkal36 I have just created a branch that may address this by filtering out all ANSI escape codes. Try this patch and let me know if this helps:

diff --git a/realgud/common/track.el b/realgud/common/track.el
index f26a0ed..3097de0 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -41,6 +41,11 @@
   :type 'symbolp
   :group 'realgud)
 
+(defcustom realgud-strip-ansi? nil
+"If non-nil, set strip ANSI control characters from output text we see"
+  :type 'symbolp
+  :group 'realgud)
+
 (declare-function fn-p-to-fn?-alias                   'realgud-helper)
 (declare-function realgud-bp-add-info                 'realgud-bp)
 (declare-function realgud-bp-del-info                 'realgud-bp)
@@ -182,7 +187,8 @@ evaluating (realgud-cmdbuf-info-loc-regexp realgud-cmdbuf-info)"
 
   (interactive "r")
   (if (> from to) (psetq to from from to))
-  (let* ((text (buffer-substring-no-properties from to))
+  (let* ((raw-text (buffer-substring-no-properties from to))
+	 (text (if realgud-strip-ansi? (ansi-color-filter-apply raw-text) raw-text))
 	 (loc (realgud-track-loc text cmd-mark))
 	 ;; If we see a selected frame number, it is stored
 	 ;; in frame-num. Otherwise, nil.

It is also in the strip-ansi-var branch on github.

Installation

Hi,

What do I do first to start installing this?

RuntimeError: There is no current event loop in thread 'Thread-1'

This package looks awesome, I installed it with elpa (I'm using spacemacs).
realgud:pdb works just fine, ipdb by itself works fine as well, but I have a repeating error/traceback when I start realgud:ipdb

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/pierre/Apps/anaconda3/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/pierre/Apps/anaconda3/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pierre/Apps/anaconda3/lib/python3.7/site-packages/IPython/terminal/debugger.py", line 122, in in_thread
    line = self.pt_app.prompt()
  File "/home/pierre/Apps/anaconda3/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1011, in prompt
    return get_event_loop().run_until_complete(self._dumb_prompt(self.message))
  File "/home/pierre/Apps/anaconda3/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-1'.

This error repeats indefinitely, incrementing the thread number at each iteration. It fills up the screen so fast that you get to millions of characters in the buffer in a matter of seconds.

To reproduce this:

  • install realgud and realgud-ipdb (in spacemacs these packages are inserted in dotspacemacs-additional-packages)
  • open a python script
  • realgud is already loaded, but I need to load realgud-ipdb: M-x load-library then realgud-ipdb
  • M-x realgud:ipdb
  • I use the default command: ipdb script.py
  • I get the error above

I checked, all the package dependencies specified in the realgud tutorial are installed.
Thanks for your help and that cool package!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.