This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[1/5] publicize print_function_pointer_address
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 28 Feb 2012 14:29:20 -0700
- Subject: [1/5] publicize print_function_pointer_address
I'm checking this one in.
I wanted to use print_function_pointer_address outside of c-valprint.c,
then I noticed it was duplicated in m2-valprint.c.
This drops one copy and moves the other to valprint.c.
Tom
* c-valprint.c (print_function_pointer_address): Move...
* valprint.c: ... here. Make non-static.
* m2-valprint.c (print_function_pointer_address): Remove.
* valprint.h (print_function_pointer_address): Declare.
>From 87f878f934dfd0c1d6b49223a8cade0040dee365 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Fri, 24 Feb 2012 09:15:16 -0700
Subject: [PATCH 1/5] * c-valprint.c (print_function_pointer_address):
Move... * valprint.c: ... here. Make
non-static. * m2-valprint.c
(print_function_pointer_address): Remove. *
valprint.h (print_function_pointer_address): Declare.
---
gdb/c-valprint.c | 25 -------------------------
gdb/m2-valprint.c | 21 ---------------------
gdb/valprint.c | 25 +++++++++++++++++++++++++
gdb/valprint.h | 5 +++++
4 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 25c6688..0054dc0 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -31,31 +31,6 @@
#include "target.h"
-/* Print function pointer with inferior address ADDRESS onto stdio
- stream STREAM. */
-
-static void
-print_function_pointer_address (struct gdbarch *gdbarch,
- CORE_ADDR address,
- struct ui_file *stream,
- int addressprint)
-{
- CORE_ADDR func_addr
- = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
- ¤t_target);
-
- /* If the function pointer is represented by a description, print
- the address of the description. */
- if (addressprint && func_addr != address)
- {
- fputs_filtered ("@", stream);
- fputs_filtered (paddress (gdbarch, address), stream);
- fputs_filtered (": ", stream);
- }
- print_address_demangle (gdbarch, func_addr, stream, demangle);
-}
-
-
/* A helper for c_textual_element_type. This checks the name of the
typedef. This is bogus but it isn't apparent that the compiler
provides us the help we may need. */
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 4378b00..abe1960 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -43,27 +43,6 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
int len);
-/* Print function pointer with inferior address ADDRESS onto stdio
- stream STREAM. */
-
-static void
-print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
- struct ui_file *stream, int addressprint)
-{
- CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
- ¤t_target);
-
- /* If the function pointer is represented by a description, print the
- address of the description. */
- if (addressprint && func_addr != address)
- {
- fputs_filtered ("@", stream);
- fputs_filtered (paddress (gdbarch, address), stream);
- fputs_filtered (": ", stream);
- }
- print_address_demangle (gdbarch, func_addr, stream, demangle);
-}
-
/* get_long_set_bounds - assigns the bounds of the long set to low and
high. */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 325cf40..a100823 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1161,6 +1161,31 @@ print_char_chars (struct ui_file *stream, struct type *type,
}
}
+/* Print function pointer with inferior address ADDRESS onto stdio
+ stream STREAM. */
+
+void
+print_function_pointer_address (struct gdbarch *gdbarch,
+ CORE_ADDR address,
+ struct ui_file *stream,
+ int addressprint)
+{
+ CORE_ADDR func_addr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
+ ¤t_target);
+
+ /* If the function pointer is represented by a description, print
+ the address of the description. */
+ if (addressprint && func_addr != address)
+ {
+ fputs_filtered ("@", stream);
+ fputs_filtered (paddress (gdbarch, address), stream);
+ fputs_filtered (": ", stream);
+ }
+ print_address_demangle (gdbarch, func_addr, stream, demangle);
+}
+
+
/* Print on STREAM using the given OPTIONS the index for the element
at INDEX of an array whose index type is INDEX_TYPE. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index a34d09b..234a18a 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -148,6 +148,11 @@ extern void print_hex_chars (struct ui_file *, const gdb_byte *,
extern void print_char_chars (struct ui_file *, struct type *,
const gdb_byte *, unsigned int, enum bfd_endian);
+extern void print_function_pointer_address (struct gdbarch *gdbarch,
+ CORE_ADDR address,
+ struct ui_file *stream,
+ int addressprint);
+
int read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
enum bfd_endian byte_order, gdb_byte **buffer,
int *bytes_read);
--
1.7.7.6