My OS is OSX 10.9.4, and I'm using gdb 7.7.1.
I can open gdb in shell mode in emacs.
but cannot open gdb using M-x gdb. Emacs just says "No such file or directory, gdb". Why does this happen? Do I need to configure the M-x command?
Probably PATH is set differently in the shell and in Emacs. You can get around that by specifying the path explicitly in M-x gdb.
In the shell, type which gdb, and note what it prints, something like /foo/bar/gdb.
Then, type M-x gdb. The minibuffer asks for Run gdb (like this):, and the default value is gdb -i=mi. Edit the command line in the minibuffer, replacing the initial gdb with the result of which gdb.
If that works, you can customize gud-gdb-command-line and set the correct path once and forever.
Related
First of all, I use OSX.
When I use default bash and type emacs in terminal, it will open emacs inside terminal.
But when I switch to zsh, this operation will call my emacs app.
I have tried use emacs -nw, but the terminal just flash and nothing else happen.
Thanks for help me.
I was setting up with emacs on my macbook. In order to open the emacs from command line, I was follow other's suggestion to add an emacs script to my /usr/bin.
Now I can open graphic emacs from command line, but the problem is that every time when I open the terminal, the emacs is automatic run. I don't know why this happened.
Here is the script I added:
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$#"
I also use chmod +x /usr/bin/emacs after the script was added.
Please tell me what cause the problem happens.
If your using the standard OS X terminal, look under preferences->profile and the shell tab and make sure there isn't something set in the run on startup option.
If your using another terminal, such as iTerm, check the profiles.
I am wondering if it is possible to debug/execute a Ocaml program step by step, for instance like debugging C++ programs in Visual Studio. In other words, I would like to run a Ocaml program line by line, also it would be great if we could "watch" the value of some variables.
By the way, I am using Emacs as editor.
Could anyone help? Thank you very much
Edit-1: As sepp2k suggested, I am trying to run camldebug under Emacs. I have a problem in the beginning: the web page mentions "The Caml debugger is started under Emacs by the command M-x camldebug, with argument the name of the executable file progname to debug." Actually I have only 3 choices:
M-x camldebug
M-x camldebug-mode
M-x camldebug-step
Edit-2: When I type M-x camldebug, enter, it shows Symbol's value as variable is void: caml-mode-map which does not allow me to enter the executable file.
Could anyone help? Thank you!
You can step through the code using the debugger ocamldebug, which can be run in emacs.
The documentation is telling you to supply the executable file's name to camldebug. You can do this by M-x camldebug, then press enter, and then type in the path of the executable when emacs prompts you for it.
I use gdb version 7.0 for debugging from emacs. The gdb when launched from emacs behaves slighlty differently compared with one launched from the shell. The points of differences are :-
gdb prompt, when launched from emacs doesn't recogonize the files in the current directory (from which the gdb session is launched.) This very cumbersome as when you run the application through gdb (using run), you have to give the full absolute path of the file. This is not the case when you launch the application through gdb from shell.
The arrow keys (that give the most recent commands typed on the gdb prompt), doesn't work for gdb launched from emacs. Instead, it moves the scroll up and down in the emacs gdb command prompt. Am I doing anything wrong here.. ?
Thanks and regards
since you are in a buffer, up and down move up and down in the buffer. most of the emacs shell-like buffers access the command history using "C-up" and "C-down".
I like emacs's gdb mode a lot better than GDB's command line or TUI modes, but there are some programs that want a "debugger command line" program that it can take and run in an environment it sets up.
I'm wondering if there's a simple way to make emacs pop up in gdb mode using a command line substitute for gdb.
Thanks in advance.
Put this in your .bashrc:
gdbtool () { emacs --eval "(gdb \"gdb
--annotate=3 $*\")";}
Then you can run "gdbtool programToDebug"
Source: http://www.inet.net.nz/~nickrob/