Re: [Cgdb-devel] Patch: Additional vim-prompt commands/short-cuts.
Brought to you by:
bobbybrasko,
crouchingturbo
From: Gilboa D. <gi...@gm...> - 2008-05-08 08:13:53
|
On Wed, 2008-05-07 at 20:31 -0400, Bob Rossi wrote: > On Wed, May 07, 2008 at 11:13:41AM +0300, Gilboa Davara wrote: > > Hello all, > > Hi Gilboa! > > > I'm trying to add some missing functionality (as in, required by my > > team-mates) to cgdb's vim-prompt. > > > > Patch 1: Replace the a2-tgdb enum_cmd->gdb_cmd conversion with easier to > > hack switch/case. > > Looks good, thanks. > > > Patch 2: Additional vim-prompt commands and shortcuts. > > diff -X patch/diff.exclude -ur cgdb/cgdb/src/cgdbrc.c cgdb-new/cgdb/src/cgdbrc.c > > --- cgdb/cgdb/src/cgdbrc.c 2008-05-07 09:12:25.000000000 +0300 > > +++ cgdb-new/cgdb/src/cgdbrc.c 2008-05-07 10:11:40.000000000 +0300 > > @@ -175,7 +175,7 @@ > > /* edit */ { "e", command_source_reload, 0 }, > > /* focus */ { "focus", command_do_focus, 0 }, > > /* help */ { "help", command_do_help, 0 }, > > - /* highlight */ { "highlight", command_parse_highlight,0 }, > > + /* highlight */ { "highlight", command_parse_highlight,0 }, > > /* highlight */ { "hi", command_parse_highlight,0 }, > > /* imap */ { "imap", command_parse_map, 0 }, > > /* imap */ { "im", command_parse_map, 0 }, > > @@ -191,10 +191,18 @@ > > /* unmap */ { "unmap", command_parse_unmap, 0 }, > > /* unmap */ { "unm", command_parse_unmap, 0 }, > > /* continue */ { "continue", command_do_tgdbcommand, TGDB_CONTINUE }, > > + /* continue */ { "c", command_do_tgdbcommand, TGDB_CONTINUE }, > > /* finish */ { "finish", command_do_tgdbcommand, TGDB_FINISH }, > > + /* finish */ { "f", command_do_tgdbcommand, TGDB_FINISH }, > > /* next */ { "next", command_do_tgdbcommand, TGDB_NEXT }, > > + /* next */ { "n", command_do_tgdbcommand, TGDB_NEXT }, > > /* run */ { "run", command_do_tgdbcommand, TGDB_RUN }, > > - /* step */ { "step", command_do_tgdbcommand, TGDB_STEP } > > + /* run */ { "r", command_do_tgdbcommand, TGDB_RUN }, > > + /* kill */ { "kill", command_do_tgdbcommand, TGDB_KILL }, > > + /* kill */ { "k", command_do_tgdbcommand, TGDB_KILL }, > > + /* step */ { "step", command_do_tgdbcommand, TGDB_STEP }, > > + /* step */ { "s", command_do_tgdbcommand, TGDB_STEP }, > > + /* start */ { "start", command_do_tgdbcommand, TGDB_START } > > > What do we all think about this? There is a problem where :f and :n > actually mean something in vim. So, if we use them for cgdb, > we can never implement the underlying vim commands. Does anyone care? I wonder if this could be use toggle-able. (if any when cgdb gets buffer and print support) set purevimmode yes/no > > > diff -X patch/diff.exclude -ur cgdb/tgdb/annotate-two/src/a2-tgdb.c cgdb-new/tgdb/annotate-two/src/a2-tgdb.c > > --- cgdb/tgdb/annotate-two/src/a2-tgdb.c 2008-05-07 09:57:20.000000000 +0300 > > +++ cgdb-new/tgdb/annotate-two/src/a2-tgdb.c 2008-05-07 09:59:01.000000000 +0300 > > @@ -384,9 +384,16 @@ > > case TGDB_NEXT: > > return "next"; > > > > + case TGDB_START: > > + return "start"; > > + > > case TGDB_RUN: > > return "run"; > > > > + case TGDB_KILL: > > + /* Awful hack around send limitation. Should work never the less :) */ > > + return "set confirm no\n kill\n set confirm yes"; > > Sorry Gilboa, I can't accept this into cgdb. What problem where you > trying to work around? > If you issue a 'kill' command, you get a confirmation dialog that cannot be disable (within gdb). The same is true for start and run. In theory, I can issue the run/start/kill gdb command and then switch to the gdb window for the user input. However, this created what-looked-to-me-like a horrible layering violation. (cgdb shouldn't be forced to understand the inner-workings of the tgdb/gdb layer) A better solution will be to create a tgdb->cgdb callback that's being called by tgdb if the lower level requires input. While this, again, does present a certain layering problem - it should be less intrusive. > Thanks, > Bob Rossi - Gilboa |