diff options
author | Pedro Alves <palves@redhat.com> | 2008-10-09 13:49:13 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-10-09 13:49:13 +0000 |
commit | 0b62613e314d15b0bab396b3b0ae8343d67e33c3 (patch) | |
tree | 6418d5683963264d1b7bfa66e594d49e7dfabf1b /gdb/procfs.c | |
parent | c67d8df719f66676c4bf7d78fd6d1471e85dfb84 (diff) | |
download | gdb-0b62613e314d15b0bab396b3b0ae8343d67e33c3.zip gdb-0b62613e314d15b0bab396b3b0ae8343d67e33c3.tar.gz gdb-0b62613e314d15b0bab396b3b0ae8343d67e33c3.tar.bz2 |
2008-10-09 Pedro Alves <pedro@codesourcery.com>
Make it compile without warnings.
* procfs.c (create_procinfo): Initialize `parent'.
(dead_procinfo): Pass a constant string as format to error.
(procfs_address_to_host_pointer): Add cast to gdb_type *.
(procfs_find_LDT_entry): Adjust format string to long int
ptid.tid.
(procfs_xfer_partial): Adjust prototype. Add gdb_byte* cast.
(procfs_xfer_memory): Adjust prototype.
(info_mappings_callback, info_proc_mappings): Adjust to not pass a
variable as printf_filtered format.
(procfs_make_note_section): Change type of auxv local to gdb_byte.
* Makefile.in: Remove special rule.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r-- | gdb/procfs.c | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index bee5b87..248dd3a 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -126,13 +126,13 @@ static void procfs_kill_inferior (void); static void procfs_mourn_inferior (void); static void procfs_create_inferior (char *, char *, char **, int); static ptid_t procfs_wait (ptid_t, struct target_waitstatus *); -static int procfs_xfer_memory (CORE_ADDR, char *, int, int, +static int procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *attrib, struct target_ops *); static LONGEST procfs_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, - void *readbuf, const void *writebuf, + gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len); static int procfs_thread_alive (ptid_t); @@ -715,7 +715,7 @@ open_procinfo_files (procinfo *pi, int which) static procinfo * create_procinfo (int pid, int tid) { - procinfo *pi, *parent; + procinfo *pi, *parent = NULL; if ((pi = find_procinfo (pid, tid))) return pi; /* Already exists, nothing to do. */ @@ -866,7 +866,7 @@ dead_procinfo (procinfo *pi, char *msg, int kill_p) kill (pi->pid, SIGKILL); destroy_procinfo (pi); - error ((msg)); + error ("%s", msg); } /* @@ -2902,7 +2902,8 @@ procfs_address_to_host_pointer (CORE_ADDR addr) void *ptr; gdb_assert (sizeof (ptr) == TYPE_LENGTH (ptr_type)); - gdbarch_address_to_pointer (target_gdbarch, ptr_type, &ptr, addr); + gdbarch_address_to_pointer (target_gdbarch, ptr_type, + (gdb_byte *) &ptr, addr); return ptr; } @@ -3064,14 +3065,14 @@ procfs_find_LDT_entry (ptid_t ptid) /* Find procinfo for the lwp. */ if ((pi = find_procinfo (PIDGET (ptid), TIDGET (ptid))) == NULL) { - warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%d."), + warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."), PIDGET (ptid), TIDGET (ptid)); return NULL; } /* get its general registers. */ if ((gregs = proc_get_gregs (pi)) == NULL) { - warning (_("procfs_find_LDT_entry: could not read gregs for %d:%d."), + warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."), PIDGET (ptid), TIDGET (ptid)); return NULL; } @@ -4375,18 +4376,18 @@ wait_again: static LONGEST procfs_xfer_partial (struct target_ops *ops, enum target_object object, - const char *annex, void *readbuf, - const void *writebuf, ULONGEST offset, LONGEST len) + const char *annex, gdb_byte *readbuf, + const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { switch (object) { case TARGET_OBJECT_MEMORY: if (readbuf) - return (*ops->deprecated_xfer_memory) (offset, readbuf, len, - 0/*read*/, NULL, ops); + return (*ops->deprecated_xfer_memory) (offset, readbuf, + len, 0/*read*/, NULL, ops); if (writebuf) - return (*ops->deprecated_xfer_memory) (offset, writebuf, len, - 1/*write*/, NULL, ops); + return (*ops->deprecated_xfer_memory) (offset, (gdb_byte *) writebuf, + len, 1/*write*/, NULL, ops); return -1; #ifdef NEW_PROC_API @@ -4415,7 +4416,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object, negative values, but this capability isn't implemented here.) */ static int -procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite, +procfs_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int dowrite, struct mem_attrib *attrib, struct target_ops *target) { procinfo *pi; @@ -5780,23 +5781,28 @@ mappingflags (long flags) static int info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused) { - char *data_fmt_string; + unsigned int pr_off; - if (gdbarch_addr_bit (current_gdbarch) == 32) - data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n"; - else - data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n"; - - printf_filtered (data_fmt_string, - (unsigned long) map->pr_vaddr, - (unsigned long) map->pr_vaddr + map->pr_size - 1, - map->pr_size, #ifdef PCAGENT /* Horrible hack: only defined on Solaris 2.6+ */ - (unsigned int) map->pr_offset, + pr_off = (unsigned int) map->pr_offset; #else - map->pr_off, + pr_off = map->pr_off; #endif - mappingflags (map->pr_mflags)); + + if (gdbarch_addr_bit (current_gdbarch) == 32) + printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n", + (unsigned long) map->pr_vaddr, + (unsigned long) map->pr_vaddr + map->pr_size - 1, + map->pr_size, + pr_off, + mappingflags (map->pr_mflags)); + else + printf_filtered (" %#18lx %#18lx %#10x %#10x %7s\n", + (unsigned long) map->pr_vaddr, + (unsigned long) map->pr_vaddr + map->pr_size - 1, + map->pr_size, + pr_off, + mappingflags (map->pr_mflags)); return 0; } @@ -5810,23 +5816,24 @@ info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused) static void info_proc_mappings (procinfo *pi, int summary) { - char *header_fmt_string; - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - header_fmt_string = "\t%10s %10s %10s %10s %7s\n"; - else - header_fmt_string = " %18s %18s %10s %10s %7s\n"; - if (summary) return; /* No output for summary mode. */ printf_filtered (_("Mapped address spaces:\n\n")); - printf_filtered (header_fmt_string, - "Start Addr", - " End Addr", - " Size", - " Offset", - "Flags"); + if (gdbarch_ptr_bit (current_gdbarch) == 32) + printf_filtered ("\t%10s %10s %10s %10s %7s\n", + "Start Addr", + " End Addr", + " Size", + " Offset", + "Flags"); + else + printf_filtered (" %18s %18s %10s %10s %7s\n", + "Start Addr", + " End Addr", + " Size", + " Offset", + "Flags"); iterate_over_mappings (pi, NULL, NULL, info_mappings_callback); printf_filtered ("\n"); @@ -6150,7 +6157,7 @@ procfs_make_note_section (bfd *obfd, int *note_size) char *note_data = NULL; char *inf_args; struct procfs_corefile_thread_data thread_args; - char *auxv; + gdb_byte *auxv; int auxv_len; if (get_exec_file (0)) |