tags:

views:

77

answers:

2

Hi everyone,

I have recently switched to gdb-emacs integration, and its cool as you no longer need to a list of source code everytime, Although i miss a few features or may be i dont know how to do them?

I Use emacs in commandline mode emacs -nw as i dont like being away from console.

  1. Now when i execute some command say c1 under gdb and then want to re-execute it, i guess i can access my previous command using the up-arrow key. Instead it takes me up. In emacs x-window mode, this can be done by ctrl+up-arrow. but not in this case.

  2. The section in which source code is displayed happens to be editable, I dont want it to be so, can I?

  3. How do I switch between two split-sections?

I normally use vi, so these are not intuitive to me as they may to the emacs users ;).

Thx.

+3  A: 

1/ Now when i execute some command say c1 under gdb and then want to re-execute it, i guess i can access my previous command using the up-arrow key. Instead it takes me up. In emacs x-window mode, this can be done by ctrl+up-arrow. but not in this case.

On my case, it does work using C-up even when launching emacs with -nw. Maybe you have a problem with your keybindings at the emacs level or at the terminal level. Do C-h k C-up to check if C-up is really associated to the simultaneous key pressing of Control key and Up key.

2/ The section in which source code is displayed happens to be editable, I dont want it to be so, can I?

Go to the window containing the source code using C-x o. Then, you can make the buffer read-only by pressing C-x C-q.

3/ How do I switch between two split-sections?

If you mean "window", you can change the current active window of the GDB Graphical Interface using C-x o. Or you can use windmove by adding the following line in your .emacs :

(windmove-default-keybindings)

Then, you can move the point between windows using S-right S-left S-up and S-down

Jérôme Radix
+1  A: 

Now when i execute some command say c1 under gdb and then want to re-execute it, i guess i can access my previous command using the up-arrow key. Instead it takes me up. In emacs x-window mode, this can be done by ctrl+up-arrow. but not in this case.ctrl+up-arrow. but not in this case.

Try Alt-P and Alt-N to cycle through the commands that you already inserted. Hopefully it will work for you :) One single Alt-P should return you the last command that you typed. That is not only used in GDB mode, but in lots of places in emacs and it should work in most console configurations, even in those in which ctrl-up does not work. For instance, if you press Alt-X to write a command (like gdb), you can press Alt-P to retype the command that you put the last time you used Alt-X.

The section in which source code is displayed happens to be editable, I dont want it to be so, can I?dont want it to be so, can I?

Automatically? As far as I know (but I am not an emacs expert), very few things. In emacs there are hooks or lisp functions that you can define to be called in some circumstances. For instance, there is a hook for the C-mode, that will be called when the c-mode is used (when you open a .c file if you are not familiar with modes), and you can customize your C-programming settings there (like the type of indent that you want to use). Unfortunately, there are no many hooks in the GDB-related mode (called GUD), and none of the hooks in that mode will work for you. There is a generic hook for when a file is visited (when it is open), but it is quite generic.

Manually, the reply kindly provided by Jérôme will work.

Apologies for my rather bad english.

Javier