From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20487 invoked by alias); 20 Sep 2013 02:47:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20444 invoked by uid 89); 20 Sep 2013 02:47:53 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Sep 2013 02:47:53 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VMql2-0004hp-U0 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 19 Sep 2013 19:47:48 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 19 Sep 2013 19:47:48 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Thu, 19 Sep 2013 19:47:47 -0700 From: Yao Qi To: Subject: [PATCH 3/7] New function windows_init_abi Date: Fri, 20 Sep 2013 02:47:00 -0000 Message-ID: <1379645226-8719-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1379645226-8719-1-git-send-email-yao@codesourcery.com> References: <1378641807-24256-1-git-send-email-yao@codesourcery.com> <1379645226-8719-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00715.txt.bz2 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 * 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