This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[commit] gdb_byte misc fixes (this time with patch)


misc gdb_byte fixes, breakpoint.c was seen compiling cleanly
2005-05-26  Andrew Cagney  <cagney@gnu.org>

	* command.h (add_setshow_integer_cmd): Make VAR an integer.
	* cli/cli-decode.c (add_setshow_integer_cmd): Update to match.
	* valops.c (value_string): Add a cast.
	* eval.c (evaluate_subexp_standard): Use gdb_byte for byte buffers.
	* breakpoint.c (re_enable_breakpoints_in_shlibs): Use gdb_byte for
	byte buffers.
	* target.h (struct target_ops): For to_insert_hw_breakpoint and
	to_remove_hw_breakpoint use gdb_byte for byte buffer parameters.
	* breakpoint.h (struct bp_location): Make shadow_contents a
	gdb_byte buffer.
	* cli/cli-setshow.c (do_setshow_command): Fix cast.
	* cli/cli-dump.c (restore_section_callback)
	(restore_binary_file): Use gdb_byte for byte buffers.
	* proc-service.c (ps_ptwrite, ps_ptread, ps_pdwrite): Fix casts.
	(ps_xfer_memory): Use gdb_byte for byte buffers.
	* tracepoint.c (mem2hex): Use gdb_byte for byte buffers, and char
	for string buffers.
	* ser-tcp.c (net_open): Make len a socklen_t.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.215
diff -p -u -r1.215 breakpoint.c
--- breakpoint.c	22 May 2005 14:53:33 -0000	1.215
+++ breakpoint.c	26 May 2005 20:47:45 -0000
@@ -4441,7 +4441,8 @@ re_enable_breakpoints_in_shlibs (void)
   {
     if (b->enable_state == bp_shlib_disabled)
       {
-	char buf[1], *lib;
+	gdb_byte buf[1];
+	char *lib;
 	
 	/* Do not reenable the breakpoint if the shared library is
 	   still not mapped in.  */
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.34
diff -p -u -r1.34 breakpoint.h
--- breakpoint.h	13 May 2004 16:39:11 -0000	1.34
+++ breakpoint.h	26 May 2005 20:47:45 -0000
@@ -247,7 +247,7 @@ struct bp_location
      control of the target insert_breakpoint and remove_breakpoint routines.
      No other code should assume anything about the value(s) here.
      Valid only for bp_loc_software_breakpoint.  */
-  char shadow_contents[BREAKPOINT_MAX];
+  gdb_byte shadow_contents[BREAKPOINT_MAX];
 
   /* Address at which breakpoint was requested, either by the user or
      by GDB for internal breakpoints.  This will usually be the same
Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.52
diff -p -u -r1.52 command.h
--- command.h	21 Feb 2005 17:14:02 -0000	1.52
+++ command.h	26 May 2005 20:47:45 -0000
@@ -305,7 +305,7 @@ extern void add_setshow_optional_filenam
 
 extern void add_setshow_integer_cmd (char *name,
 				     enum command_class class,
-				     unsigned int *var,
+				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
 				     const char *help_doc,
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.54
diff -p -u -r1.54 eval.c
--- eval.c	8 Mar 2005 14:35:17 -0000	1.54
+++ eval.c	26 May 2005 20:47:45 -0000
@@ -559,7 +559,7 @@ evaluate_subexp_standard (struct type *e
 	  && TYPE_CODE (type) == TYPE_CODE_SET)
 	{
 	  struct value *set = allocate_value (expect_type);
-	  char *valaddr = value_contents_raw (set);
+	  gdb_byte *valaddr = value_contents_raw (set);
 	  struct type *element_type = TYPE_INDEX_TYPE (type);
 	  struct type *check_type = element_type;
 	  LONGEST low_bound, high_bound;
Index: proc-service.c
===================================================================
RCS file: /cvs/src/src/gdb/proc-service.c,v
retrieving revision 1.7
diff -p -u -r1.7 proc-service.c
--- proc-service.c	24 Feb 2002 22:31:19 -0000	1.7
+++ proc-service.c	26 May 2005 20:47:45 -0000
@@ -67,7 +67,7 @@ typedef size_t gdb_ps_size_t;
 
 static ps_err_e
 ps_xfer_memory (const struct ps_prochandle *ph, paddr_t addr,
-		char *buf, size_t len, int write)
+		gdb_byte *buf, size_t len, int write)
 {
   struct cleanup *old_chain = save_inferior_ptid ();
   int ret;
@@ -201,7 +201,7 @@ ps_err_e
 ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr,
 	    gdb_ps_write_buf_t buf, gdb_ps_size_t size)
 {
-  return ps_xfer_memory (ph, addr, (char *) buf, size, 1);
+  return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 1);
 }
 
 /* Read SIZE bytes from the target process PH at address ADDR and copy
@@ -211,7 +211,7 @@ ps_err_e
 ps_ptread (gdb_ps_prochandle_t ph, paddr_t addr,
 	   gdb_ps_read_buf_t buf, gdb_ps_size_t size)
 {
-  return ps_xfer_memory (ph, addr, buf, size, 0);
+  return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 0);
 }
 
 /* Write SIZE bytes from BUF into the target process PH at address ADDR.  */
@@ -220,7 +220,7 @@ ps_err_e
 ps_ptwrite (gdb_ps_prochandle_t ph, paddr_t addr,
 	    gdb_ps_write_buf_t buf, gdb_ps_size_t size)
 {
-  return ps_xfer_memory (ph, addr, (char *) buf, size, 1);
+  return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 1);
 }
 
 /* Get the general registers of LWP LWPID within the target process PH
Index: ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.21
diff -p -u -r1.21 ser-tcp.c
--- ser-tcp.c	21 Apr 2005 05:34:33 -0000	1.21
+++ ser-tcp.c	26 May 2005 20:47:45 -0000
@@ -187,7 +187,8 @@ net_open (struct serial *scb, const char
 
   /* Got something.  Is it an error? */
   {
-    int res, err, len;
+    int res, err;
+    socklen_t len;
     len = sizeof(err);
     /* On Windows, the fourth parameter to getsockopt is a "char *";
        on UNIX systems it is generally "void *".  The cast to "void *"
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.74
diff -p -u -r1.74 target.h
--- target.h	23 May 2005 19:32:27 -0000	1.74
+++ target.h	26 May 2005 20:47:46 -0000
@@ -338,8 +338,8 @@ struct target_ops
     int (*to_insert_breakpoint) (CORE_ADDR, gdb_byte *);
     int (*to_remove_breakpoint) (CORE_ADDR, gdb_byte *);
     int (*to_can_use_hw_breakpoint) (int, int, int);
-    int (*to_insert_hw_breakpoint) (CORE_ADDR, char *);
-    int (*to_remove_hw_breakpoint) (CORE_ADDR, char *);
+    int (*to_insert_hw_breakpoint) (CORE_ADDR, gdb_byte *);
+    int (*to_remove_hw_breakpoint) (CORE_ADDR, gdb_byte *);
     int (*to_remove_watchpoint) (CORE_ADDR, int, int);
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.76
diff -p -u -r1.76 tracepoint.c
--- tracepoint.c	8 Mar 2005 10:03:47 -0000	1.76
+++ tracepoint.c	26 May 2005 20:47:46 -0000
@@ -150,7 +150,7 @@ static void trace_mention (struct tracep
 
 struct collection_list;
 static void add_aexpr (struct collection_list *, struct agent_expr *);
-static unsigned char *mem2hex (unsigned char *, unsigned char *, int);
+static char *mem2hex (gdb_byte *, char *, int);
 static void add_register (struct collection_list *collection,
 			  unsigned int regno);
 static struct cleanup *make_cleanup_free_actions (struct tracepoint *t);
@@ -2645,10 +2645,10 @@ trace_dump_command (char *args, int from
 
 static const char hexchars[] = "0123456789abcdef";
 
-static unsigned char *
-mem2hex (unsigned char *mem, unsigned char *buf, int count)
+static char *
+mem2hex (gdb_byte *mem, char *buf, int count)
 {
-  unsigned char ch;
+  gdb_byte ch;
 
   while (count-- > 0)
     {
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.159
diff -p -u -r1.159 valops.c
--- valops.c	22 May 2005 14:53:34 -0000	1.159
+++ valops.c	26 May 2005 20:47:46 -0000
@@ -1039,7 +1039,7 @@ value_string (char *ptr, int len)
      copy LEN bytes from PTR in gdb to that address in the inferior. */
 
   addr = allocate_space_in_inferior (len);
-  write_memory (addr, ptr, len);
+  write_memory (addr, (gdb_byte *) ptr, len);
 
   val = value_at_lazy (stringtype, addr);
   return (val);
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.54
diff -p -u -r1.54 cli-decode.c
--- cli/cli-decode.c	21 Feb 2005 17:14:03 -0000	1.54
+++ cli/cli-decode.c	26 May 2005 20:47:46 -0000
@@ -537,7 +537,7 @@ add_setshow_optional_filename_cmd (char 
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
 add_setshow_integer_cmd (char *name, enum command_class class,
-			  unsigned int *var,
+			 int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
 			  cmd_sfunc_ftype *set_func,
Index: cli/cli-dump.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v
retrieving revision 1.21
diff -p -u -r1.21 cli-dump.c
--- cli/cli-dump.c	23 Feb 2005 15:24:22 -0000	1.21
+++ cli/cli-dump.c	26 May 2005 20:47:47 -0000
@@ -463,7 +463,7 @@ restore_section_callback (bfd *ibfd, ase
   bfd_size_type sec_offset = 0;
   bfd_size_type sec_load_count = size;
   struct cleanup *old_chain;
-  char *buf;
+  gdb_byte *buf;
   int ret;
 
   /* Ignore non-loadable sections, eg. from elf files. */
@@ -525,7 +525,7 @@ restore_binary_file (char *filename, str
 {
   FILE *file = fopen_with_cleanup (filename, FOPEN_RB);
   int status;
-  char *buf;
+  gdb_byte *buf;
   long len;
 
   /* Get the file size for reading.  */
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.24
diff -p -u -r1.24 cli-setshow.c
--- cli/cli-setshow.c	21 Feb 2005 07:08:42 -0000	1.24
+++ cli/cli-setshow.c	26 May 2005 20:47:47 -0000
@@ -301,12 +301,8 @@ do_setshow_command (char *arg, int from_
       switch (c->var_type)
 	{
 	case var_string:
-	  {
-	    unsigned char *p;
-
-	    if (*(unsigned char **) c->var)
-	      fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
-	  }
+	  if (((char *)c->var)[0] != '\0')
+	    fputstr_filtered ((char *)c->var, '"', stb->stream);
 	  break;
 	case var_string_noescape:
 	case var_optional_filename:

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