This is the mail archive of the insight@sourceware.org mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] GDB API Updates


I ran into some build errors while building insight earlier today. 
(Actually, they're warnings, but I had -Werror set.) I found that the
return type of some gdb functions have been changed from char * to
const char *.  The patch below adjusts insight specific files to match
the rest of gdb.

Okay?

	* generic/gdbtk-cmds.h (pc_function_name): Make return type
	const.
	* generic/gdbtk-bp.c (gdb_get_breakpoint_info)
	(gdb_get_tracepoint_info): Make char * variables const to match
	recent GDB API changes.
	* generic/gdbtk-stack.c (get_frame_name): Likewise.
	* generic/gdbtk-cmds.c (gdb_get_function_command, gdb_listfuncs)
	(gdb_loc, perror_with_name_wrapper): Likewise.
	(pc_function_name): Likewise, plus change return type to be const.

Index: gdbtk/generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.44
diff -u -p -r1.44 gdbtk-bp.c
--- gdbtk/generic/gdbtk-bp.c	17 Dec 2011 19:30:39 -0000	1.44
+++ gdbtk/generic/gdbtk-bp.c	22 Feb 2012 05:10:55 -0000
@@ -282,7 +282,7 @@ gdb_get_breakpoint_info (ClientData clie
   int bpnum;
   struct breakpoint *b;
   struct watchpoint *w;
-  char *funcname, *filename;
+  const char *funcname, *filename;
   int isPending = 0;
 
   Tcl_Obj *new_obj;
@@ -690,7 +690,7 @@ gdb_get_tracepoint_info (ClientData clie
   struct breakpoint *bp;
   struct command_line *cl;
   Tcl_Obj *action_list;
-  char *filename, *funcname;
+  const char *filename, *funcname;
 
   if (objc != 2)
     {
Index: gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.123
diff -u -p -r1.123 gdbtk-cmds.c
--- gdbtk/generic/gdbtk-cmds.c	17 Dec 2011 19:30:39 -0000	1.123
+++ gdbtk/generic/gdbtk-cmds.c	22 Feb 2012 05:10:55 -0000
@@ -1021,7 +1021,7 @@ static int
 gdb_get_function_command (ClientData clientData, Tcl_Interp *interp,
 			  int objc, Tcl_Obj *CONST objv[])
 {
-  char *function;
+  const char *function;
   struct symtabs_and_lines sals;
   char *args;
 
@@ -1513,7 +1513,7 @@ gdb_listfuncs (clientData, interp, objc,
 	  if (SYMBOL_CLASS (sym) == LOC_BLOCK)
 	    {
 
-	      char *name = SYMBOL_DEMANGLED_NAME (sym);
+	      const char *name = SYMBOL_DEMANGLED_NAME (sym);
 
 	      if (name)
 		{
@@ -2159,7 +2159,7 @@ gdb_loc (ClientData clientData, Tcl_Inte
 {
   char *filename;
   struct symtab_and_line sal;
-  char *fname;
+  const char *fname;
   CORE_ADDR pc;
 
   if (objc == 1)
@@ -2919,11 +2919,11 @@ perror_with_name_wrapper (PTR args)
 
    If no symbol is found, it returns an empty string. In either
    case, memory is owned by gdb. Do not attempt to free it. */
-char *
+const char *
 pc_function_name (CORE_ADDR pc)
 {
   struct symbol *sym;
-  char *funcname = NULL;
+  const char *funcname = NULL;
 
   /* First lookup the address in the symbol table... */
   sym = find_pc_function (pc);
Index: gdbtk/generic/gdbtk-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.h,v
retrieving revision 1.5
diff -u -p -r1.5 gdbtk-cmds.h
--- gdbtk/generic/gdbtk-cmds.h	23 Dec 2005 18:23:16 -0000	1.5
+++ gdbtk/generic/gdbtk-cmds.h	22 Feb 2012 05:10:55 -0000
@@ -40,7 +40,7 @@ extern int gdbtk_call_wrapper (ClientDat
 
 /* Returns the source (demangled) name for a function at PC. Returns empty string
    if not found. Memory is owned by gdb. Do not free it. */
-extern char *pc_function_name (CORE_ADDR pc);
+extern const char *pc_function_name (CORE_ADDR pc);
 
 /* Convenience function to sprintf something(s) into a new element in
    a Tcl list object. */
Index: gdbtk/generic/gdbtk-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-stack.c,v
retrieving revision 1.37
diff -u -p -r1.37 gdbtk-stack.c
--- gdbtk/generic/gdbtk-stack.c	17 Dec 2011 19:30:39 -0000	1.37
+++ gdbtk/generic/gdbtk-stack.c	22 Feb 2012 05:10:55 -0000
@@ -523,7 +523,7 @@ get_frame_name (Tcl_Interp *interp, Tcl_
 {
   struct symtab_and_line sal;
   struct symbol *func = NULL;
-  register char *funname = 0;
+  const char *funname = 0;
   enum language funlang = language_unknown;
   Tcl_Obj *objv[1];
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]