From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 3/7] New function windows_init_abi
Date: Fri, 20 Sep 2013 02:47:00 -0000 [thread overview]
Message-ID: <1379645226-8719-4-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1379645226-8719-1-git-send-email-yao@codesourcery.com>
Hi,
When I look for a function, which does all abi-related initialization in
windows-tdep.c, it doesn't exist. It would be good to create such
function, similar to linux_init_abi, and put all windows abi related
initialization in it.
This patch adds a new function windows_init_abi and move these two
functions calls in it,
set_gdbarch_has_dos_based_file_system (gdbarch, 1);
set_gdbarch_iterate_over_objfiles_in_search_order
(gdbarch, windows_iterate_over_objfiles_in_search_order);
amd64-windows doesn't set gdbarch flag has_dos_based_file_system, so
with this patch applied, this flag is set for amd64-windows.
I build GDB with "--host=i686-pc-linux-gnu --target=x86_64-mingw32",
and start GDB with a x86_64 PE executable,
Without this patch, we get,
(gdb) show target-file-system-kind
The assumed file system kind for target reported file names is "auto" (currently "unix").
With this path, we get,
(gdb) show target-file-system-kind
The assumed file system kind for target reported file names is "auto" (currently "dos-based").
As the result of this patch, windows_iterate_over_objfiles_in_search_order
can be made static too.
I don't have a x86_64-mingw32 env to test this patch.
gdb:
2013-09-08 Yao Qi <yao@codesourcery.com>
* amd64-windows-tdep.c (amd64_windows_init_abi): Don't call
set_gdbarch_iterate_over_objfiles_in_search_order. Call
windows_init_abi instead.
* i386-cygwin-tdep.c (i386_cygwin_init_abi): Don't call
set_gdbarch_has_dos_based_file_system and
set_gdbarch_iterate_over_objfiles_in_search_order. Call
windows_init_abi instead.
* windows-tdep.c (windows_init_abi): New function.
(windows_iterate_over_objfiles_in_search_order): Make it
static.
* windows-tdep.h (windows_init_abi): Declare.
(windows_iterate_over_objfiles_in_search_order): Remove
declaration.
---
gdb/amd64-windows-tdep.c | 5 ++---
gdb/i386-cygwin-tdep.c | 9 ++-------
gdb/windows-tdep.c | 16 +++++++++++++++-
gdb/windows-tdep.h | 6 ++----
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 4e750a1..0dfc906 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -972,6 +972,8 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_init_abi (info, gdbarch);
+ windows_init_abi (info, gdbarch);
+
/* On Windows, "long"s are only 32bit. */
set_gdbarch_long_bit (gdbarch, 32);
@@ -987,9 +989,6 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch,
amd64_windows_skip_trampoline_code);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, windows_iterate_over_objfiles_in_search_order);
-
set_gdbarch_skip_prologue (gdbarch, amd64_windows_skip_prologue);
set_gdbarch_auto_wide_charset (gdbarch, amd64_windows_auto_wide_charset);
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index a3e4e7c..01fc15b 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -233,6 +233,8 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ windows_init_abi (info, gdbarch);
+
set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code);
set_gdbarch_skip_main_prologue (gdbarch, i386_skip_main_prologue);
@@ -253,13 +255,6 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_core_pid_to_str (gdbarch, i386_windows_core_pid_to_str);
set_gdbarch_auto_wide_charset (gdbarch, i386_cygwin_auto_wide_charset);
-
- /* Canonical paths on this target look like
- `c:\Program Files\Foo App\mydll.dll', for example. */
- set_gdbarch_has_dos_based_file_system (gdbarch, 1);
-
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, windows_iterate_over_objfiles_in_search_order);
}
static enum gdb_osabi
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index f90323f..50c5795 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -427,7 +427,7 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
to print the value of another global variable defined with the same
name, but in a different DLL. */
-void
+static void
windows_iterate_over_objfiles_in_search_order
(struct gdbarch *gdbarch,
iterate_over_objfiles_in_search_order_cb_ftype *cb,
@@ -481,6 +481,20 @@ init_w32_command_list (void)
}
}
+/* To be called from the various GDB_OSABI_CYGWIN handlers for the
+ various Windows architectures and machine types. */
+
+void
+windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ /* Canonical paths on this target look like
+ `c:\Program Files\Foo App\mydll.dll', for example. */
+ set_gdbarch_has_dos_based_file_system (gdbarch, 1);
+
+ set_gdbarch_iterate_over_objfiles_in_search_order
+ (gdbarch, windows_iterate_over_objfiles_in_search_order);
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_windows_tdep;
diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h
index 99136fa..7b04bb2 100644
--- a/gdb/windows-tdep.h
+++ b/gdb/windows-tdep.h
@@ -30,8 +30,6 @@ extern void windows_xfer_shared_library (const char* so_name,
struct gdbarch *gdbarch,
struct obstack *obstack);
-extern void windows_iterate_over_objfiles_in_search_order
- (struct gdbarch *gdbarch,
- iterate_over_objfiles_in_search_order_cb_ftype *cb,
- void *cb_data, struct objfile *current_objfile);
+extern void windows_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch);
#endif
--
1.7.7.6
next prev parent reply other threads:[~2013-09-20 2:47 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-06 2:03 [PATCH 0/3] Trust readonly sections if target has memory protection Yao Qi
2013-09-06 2:03 ` [PATCH 2/3] " Yao Qi
2013-09-06 6:05 ` Eli Zaretskii
2013-09-06 9:07 ` Yao Qi
2013-09-06 9:24 ` Eli Zaretskii
2013-09-06 2:03 ` [PATCH 1/3] set trust-readonly-sections off in test cases Yao Qi
2013-09-06 5:56 ` Eli Zaretskii
2013-09-06 17:23 ` Pedro Alves
2013-09-06 2:03 ` [PATCH 3/3] Linux has memory protection Yao Qi
2013-09-06 5:57 ` [PATCH 0/3] Trust readonly sections if target " Eli Zaretskii
2013-09-06 8:24 ` Yao Qi
2013-09-06 8:45 ` Eli Zaretskii
2013-09-06 13:03 ` Joel Brobecker
2013-09-06 13:27 ` Yao Qi
2013-09-06 13:32 ` Eli Zaretskii
2013-09-06 14:17 ` Pierre Muller
[not found] ` <"000d01ceab0b$d53ae600$7fb0b200$@muller"@ics-cnrs.unistra.fr>
2013-09-06 14:38 ` Eli Zaretskii
2013-09-06 14:52 ` Joel Brobecker
2013-09-06 15:56 ` Eli Zaretskii
2013-09-06 18:10 ` Joel Brobecker
2013-09-06 18:36 ` Eli Zaretskii
2013-09-06 13:00 ` Joel Brobecker
2013-09-08 12:04 ` [PATCH 0/7 V2] " Yao Qi
2013-09-08 12:04 ` [PATCH 1/7] Emit a warning when writing to a readonly section and trust_readonly is true Yao Qi
2013-09-08 15:10 ` Eli Zaretskii
2013-09-08 12:05 ` [PATCH 4/7] Trust readonly sections if target has memory protection Yao Qi
2013-09-08 15:13 ` Eli Zaretskii
2013-09-09 7:49 ` Yao Qi
2013-09-09 16:25 ` Eli Zaretskii
2013-09-08 12:05 ` [PATCH 3/7] New function windows_init_abi Yao Qi
2013-09-08 12:05 ` [PATCH 7/7] Windows has memory protection Yao Qi
2013-09-08 12:05 ` [PATCH 2/7] set trust-readonly-sections off in test cases Yao Qi
2013-09-08 12:05 ` [PATCH 5/7] DOC and NEWS Yao Qi
2013-09-08 12:05 ` [PATCH 6/7] Linux has memory protection Yao Qi
2013-09-09 19:16 ` [PATCH 0/7 V2] Trust readonly sections if target " Mark Kettenis
2013-09-10 4:06 ` Yao Qi
2013-09-12 8:30 ` Yao Qi
2013-09-12 9:49 ` Mark Kettenis
2013-09-13 8:17 ` Yao Qi
2013-09-30 17:50 ` Pedro Alves
2013-09-30 18:08 ` Pedro Alves
2013-10-07 22:29 ` Stan Shebs
2013-10-08 12:18 ` Pedro Alves
2013-10-08 12:47 ` Abid, Hafiz
2013-10-08 13:36 ` tmirza
2013-10-09 2:24 ` Doug Evans
2013-10-23 10:16 ` Yao Qi
2013-10-15 0:44 ` Yao Qi
2013-09-20 2:47 ` [PATCH 0/7 V3] " Yao Qi
2013-09-20 2:47 ` Yao Qi [this message]
2013-09-30 18:23 ` [PATCH 3/7] New function windows_init_abi Pedro Alves
2013-10-01 6:47 ` Yao Qi
2013-10-01 9:35 ` Pedro Alves
2013-10-01 13:23 ` Yao Qi
2013-09-20 2:47 ` [PATCH 2/7] set trust-readonly-sections off in test cases Yao Qi
2013-09-20 2:47 ` [PATCH 6/7] Linux has memory protection Yao Qi
2013-09-20 2:47 ` [PATCH 5/7] DOC and NEWS Yao Qi
2013-09-20 8:21 ` Eli Zaretskii
2013-09-20 2:47 ` [PATCH 4/7] Trust readonly sections if target has memory protection and in remote debugging Yao Qi
2013-09-20 2:47 ` [PATCH 7/7] Windows has memory protection Yao Qi
2013-09-20 2:47 ` [PATCH 1/7] Emit a query when writing to a readonly section and trust_readonly is true Yao Qi
2013-09-29 13:51 ` [PATCH 0/7 V3] Trust readonly sections if target has memory protection Yao Qi
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=1379645226-8719-4-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@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