CVS: setedit/setedit debug.cc,1.55,1.56
Brought to you by:
set
From: Salvador E. T. <se...@us...> - 2009-09-25 15:09:21
|
Update of /cvsroot/setedit/setedit/setedit In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29984/setedit Modified Files: debug.cc Log Message: * Added: Now the user can specify files containing the commands to be executed after starting gdb and after the target connection. Index: debug.cc =================================================================== RCS file: /cvsroot/setedit/setedit/setedit/debug.cc,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** debug.cc 26 Feb 2009 17:35:18 -0000 1.55 --- debug.cc 25 Sep 2009 15:09:11 -0000 1.56 *************** *** 1,3 **** ! /* Copyright (C) 2004-2007 by Salvador E. Tropea (SET), see copyrigh file for details */ /**[txh]******************************************************************** --- 1,3 ---- ! /* Copyright (C) 2004-2009 by Salvador E. Tropea (SET), see copyrigh file for details */ /**[txh]******************************************************************** *************** *** 294,297 **** --- 294,301 ---- // Executable for xterm static char *xtermExe=NULL; + // Commands to execute after starting gdb + static char *gdbStart=NULL; + // Commands to execute after target connection + static char *gdbConn=NULL; // Miscellaneous gdb settings static char miscGDBset=0; *************** *** 434,437 **** --- 438,491 ---- static inline + const char *GetGDBStartFile() + { + if (gdbStart) + return gdbStart; + return GetVariable("SET_GDB_START",MIDebugger::GetGDBStartFile()); + } + + static inline + const char *GetGDBStartFileNoD() + { + if (gdbStart) + return gdbStart; + return GetVariable("SET_GDB_START",NULL); + } + + static void SetGDBStartFile(const char *name, Boolean copy=True); + static + void SetGDBStartFile(const char *name, Boolean copy) + { + delete[] gdbStart; + gdbStart=copy ? newStr(name) : (char *)name; + InsertEnvironmentVar("SET_GDB_START",IsEmpty(name) ? NULL: name); + } + + static inline + const char *GetGDBConnFile() + { + if (gdbConn) + return gdbConn; + return GetVariable("SET_GDB_CONN",MIDebugger::GetGDBConnFile()); + } + + static inline + const char *GetGDBConnFileNoD() + { + if (gdbConn) + return gdbConn; + return GetVariable("SET_GDB_CONN",NULL); + } + + static void SetGDBConnFile(const char *name, Boolean copy=True); + static + void SetGDBConnFile(const char *name, Boolean copy) + { + delete[] gdbConn; + gdbConn=copy ? newStr(name) : (char *)name; + InsertEnvironmentVar("SET_GDB_CONN",IsEmpty(name) ? NULL: name); + } + + static inline const char *GetMainFunc() { *************** *** 817,820 **** --- 871,880 ---- if (aux) dbg->SetXTermExe(aux); + aux=GetGDBStartFileNoD(); + if (aux) + dbg->SetGDBStartFile(aux); + aux=GetGDBConnFileNoD(); + if (aux) + dbg->SetGDBConnFile(aux); int res=dbg->Connect(); if (res) *************** *** 8239,8243 **** TSViewCol *col=new TSViewCol(__("Advanced Debug Options")); ! // EN: BCFGILMSTX // ES: TSVeGroup *o1= --- 8299,8303 ---- TSViewCol *col=new TSViewCol(__("Advanced Debug Options")); ! // EN: BCFGILMNSTUX // ES: TSVeGroup *o1= *************** *** 8245,8248 **** --- 8305,8310 ---- new TSChooseFile(__("~G~DB executable"),hID_DbgGDB,wVisible,"gdb*"), new TSChooseFile(__("~X~ terminal executable"),hID_DbgXTerm,wVisible,"xterm*"), + new TSChooseFile(__("GDB start-~u~p commands"),hID_DbgGDBStartCmds,wVisible,""), + new TSChooseFile(__("GDB co~n~nected commands"),hID_DbgGDBConnCmds,wVisible,""), new TSLabel(__("~M~ain function"), new TSInputLine(wFunction,1,hID_DbgMainFunc,wVisible)), *************** *** 8273,8276 **** --- 8335,8340 ---- char gdb[wFilename]; char xterm[wFilename]; + char gdbStart[wFilename]; + char gdbConn[wFilename]; char main[wFunction]; char to[wTimeOut]; *************** *** 8285,8288 **** --- 8349,8354 ---- const char *xterm=GetXTermExe(); const char *mainf=GetMainFunc(); + const char *gdbStart=GetGDBStartFile(); + const char *gdbConn=GetGDBConnFile(); unsigned to=GetGDBTimeOut(); unsigned lines=GetMsgLines(); *************** *** 8293,8296 **** --- 8359,8364 ---- strncpyZ(box.gdb,gdb,wFilename); strncpyZ(box.xterm,xterm,wFilename); + strncpyZ(box.gdbStart,gdbStart,wFilename); + strncpyZ(box.gdbConn,gdbConn,wFilename); strncpyZ(box.main,mainf,wFunction); CLY_snprintf(box.to,wTimeOut,"%d",to); *************** *** 8306,8309 **** --- 8374,8381 ---- if (strcmp(box.xterm,xterm)) SetXTermExe(box.xterm); + if (!IsEmpty(box.gdbStart)) + SetGDBStartFile(box.gdbStart); + if (!IsEmpty(box.gdbConn)) + SetGDBConnFile(box.gdbConn); if (strcmp(box.main,mainf)) SetMainFunc(box.main,True); *************** *** 8591,8594 **** --- 8663,8670 ---- // Miscellaneous gdb settings os << miscGDBset << miscGDB; + // GDB start file + os << svPresent; + os.writeString(gdbStart); + os.writeString(gdbConn); // No more data os << svAbsent; *************** *** 8704,8707 **** --- 8780,8791 ---- if (miscGDBset) SetGDBMisc(miscGDB); + // GDB start file + is >> aux; + if (!aux) + return; + mf=is.readString(); + SetGDBStartFile(mf,False); + mf=is.readString(); + SetGDBConnFile(mf,False); // No more data is >> aux; |