public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: insight@sourceware.org
Subject: [RFA] GDB API Updates
Date: Wed, 22 Feb 2012 05:29:00 -0000	[thread overview]
Message-ID: <20120221222916.263f6dd1@mesquite.lan> (raw)

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];
 

             reply	other threads:[~2012-02-22  5:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22  5:29 Kevin Buettner [this message]
2012-02-28 17:22 ` Keith Seitz
2012-02-28 21:53   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120221222916.263f6dd1@mesquite.lan \
    --to=kevinb@redhat.com \
    --cc=insight@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).