* [PATCH] Run catch-load.exp on Windows
@ 2013-09-12 1:00 Yao Qi
2013-09-12 2:44 ` Eli Zaretskii
2013-09-16 14:22 ` Pedro Alves
0 siblings, 2 replies; 9+ messages in thread
From: Yao Qi @ 2013-09-12 1:00 UTC (permalink / raw)
To: gdb-patches
Hi,
I find a compilation error when catch-load.c is compiled.
catch-load.c:18:19: fatal error: dlfcn.h: No such file or directory
This patch is to fix this compilation error. With this patch applied,
test case can be compiled successfully. However, there is one fail
caused by matching "/" in file name, which doesn't exist on Windows.
This patch fixes it by matching either "/" or "\" in file name.
gdb/testsuite:
2013-09-12 Yao Qi <yao@codesourcery.com>
* gdb.base/catch-load.c: Remove the include of "dlfcn.h".
[__WIN32__]: Include "windows.h" and define macro dlopen
and dlclose.
[!__WIN32__]: Include "dlfcn.h".
* gdb.base/catch-load.exp (one_catch_load_test): Match
directory separator.
---
gdb/testsuite/gdb.base/catch-load.c | 9 ++++++++-
gdb/testsuite/gdb.base/catch-load.exp | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/catch-load.c b/gdb/testsuite/gdb.base/catch-load.c
index 9a0010e..33c0a66 100644
--- a/gdb/testsuite/gdb.base/catch-load.c
+++ b/gdb/testsuite/gdb.base/catch-load.c
@@ -15,9 +15,16 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <dlfcn.h>
#include <stdio.h>
+#ifdef __WIN32__
+#include <windows.h>
+#define dlopen(name, mode) LoadLibrary (TEXT (name))
+#define dlclose(handle) FreeLibrary (handle)
+#else
+#include <dlfcn.h>
+#endif
+
/* This is updated by the .exp file. */
char *libname = "catch-load-so.so";
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index 4bcaa44..28445b8 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -64,7 +64,7 @@ proc one_catch_load_test {scenario kind match sostop} {
gdb_test "catch $kind" "Catchpoint $decimal \\(.*\\)"
gdb_test_multiple "continue" "continue" {
- -re "Catchpoint $decimal\r\n.*loaded .*/$testfile2.*\r\n.*$gdb_prompt $" {
+ -re "Catchpoint $decimal\r\n.*loaded .*(\\\\|/)$testfile2.*\r\n.*$gdb_prompt $" {
if {$match} {
pass "continue"
} else {
--
1.7.7.6
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Run catch-load.exp on Windows
2013-09-12 1:00 [PATCH] Run catch-load.exp on Windows Yao Qi
@ 2013-09-12 2:44 ` Eli Zaretskii
2013-09-12 11:38 ` Yao Qi
2013-09-16 14:22 ` Pedro Alves
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2013-09-12 2:44 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> From: Yao Qi <yao@codesourcery.com>
> Date: Thu, 12 Sep 2013 08:59:23 +0800
>
> I find a compilation error when catch-load.c is compiled.
>
> catch-load.c:18:19: fatal error: dlfcn.h: No such file or directory
>
> This patch is to fix this compilation error. With this patch applied,
> test case can be compiled successfully. However, there is one fail
> caused by matching "/" in file name, which doesn't exist on Windows.
> This patch fixes it by matching either "/" or "\" in file name.
>
> gdb/testsuite:
>
> 2013-09-12 Yao Qi <yao@codesourcery.com>
>
> * gdb.base/catch-load.c: Remove the include of "dlfcn.h".
> [__WIN32__]: Include "windows.h" and define macro dlopen
> and dlclose.
> [!__WIN32__]: Include "dlfcn.h".
Isn't it better to create a new file gdb_dlfcn.h, and move all the
portability stuff there?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Run catch-load.exp on Windows
2013-09-12 2:44 ` Eli Zaretskii
@ 2013-09-12 11:38 ` Yao Qi
2013-09-12 15:36 ` Pierre Muller
[not found] ` <33630.1438547254$1379000229@news.gmane.org>
0 siblings, 2 replies; 9+ messages in thread
From: Yao Qi @ 2013-09-12 11:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On 09/12/2013 10:44 AM, Eli Zaretskii wrote:
> Isn't it better to create a new file gdb_dlfcn.h, and move all the
> portability stuff there?
It makes troubles on remote-host testing, because gdb_dlfcn.h is not
copied to the remote machine. Dejagnu only copies *.c files to the
remote host before compilation.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 9+ messages in thread* RE: [PATCH] Run catch-load.exp on Windows
2013-09-12 11:38 ` Yao Qi
@ 2013-09-12 15:36 ` Pierre Muller
2013-09-16 13:21 ` Yao Qi
[not found] ` <33630.1438547254$1379000229@news.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Pierre Muller @ 2013-09-12 15:36 UTC (permalink / raw)
To: 'Yao Qi', 'Eli Zaretskii'; +Cc: gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Yao Qi
> Envoyé : jeudi 12 septembre 2013 13:37
> À : Eli Zaretskii
> Cc : gdb-patches@sourceware.org
> Objet : Re: [PATCH] Run catch-load.exp on Windows
>
> On 09/12/2013 10:44 AM, Eli Zaretskii wrote:
> > Isn't it better to create a new file gdb_dlfcn.h, and move all the
> > portability stuff there?
>
> It makes troubles on remote-host testing, because gdb_dlfcn.h is not
> copied to the remote machine. Dejagnu only copies *.c files to the
> remote host before compilation.
I don't get, I always thought that
when using remote debugger, the debuggee is cross-compiled
on the machine where GDB is run, not on the remote machine where gdbserver is run.
Thus, I always believed that there is no need to copy
the source files to the remote machine, as GDB has the sources available.
Are these assumptions wrong?
Pierre Muller
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Run catch-load.exp on Windows
2013-09-12 15:36 ` Pierre Muller
@ 2013-09-16 13:21 ` Yao Qi
2013-09-16 14:26 ` Pedro Alves
2013-09-16 16:24 ` Pierre Muller
0 siblings, 2 replies; 9+ messages in thread
From: Yao Qi @ 2013-09-16 13:21 UTC (permalink / raw)
To: Pierre Muller; +Cc: 'Eli Zaretskii', gdb-patches
On 09/12/2013 11:36 PM, Pierre Muller wrote:
> I don't get, I always thought that
> when using remote debugger, the debuggee is cross-compiled
> on the machine where GDB is run, not on the remote machine where gdbserver is run.
This is remote-target, not remote-host. Dejagnu is running on build,
test case is compiled on host, and executable is running on target. In
the case you described, host == build, so the test case is not copied.
However, in remote-host, host != build, Dejagnu has to copy source file
to the remote host first, and launch compiler on the remote host to
compile the test case. The executable can be run on the same machine or
a different one.
> Thus, I always believed that there is no need to copy
> the source files to the remote machine, as GDB has the sources available.
>
> Are these assumptions wrong?
Usually, we don't, but in remote-host testing, we have to.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Run catch-load.exp on Windows
2013-09-16 13:21 ` Yao Qi
@ 2013-09-16 14:26 ` Pedro Alves
2013-09-16 16:24 ` Pierre Muller
1 sibling, 0 replies; 9+ messages in thread
From: Pedro Alves @ 2013-09-16 14:26 UTC (permalink / raw)
To: Yao Qi; +Cc: Pierre Muller, 'Eli Zaretskii', gdb-patches
On 09/16/2013 02:20 PM, Yao Qi wrote:
> On 09/12/2013 11:36 PM, Pierre Muller wrote:
>> I don't get, I always thought that
>> when using remote debugger, the debuggee is cross-compiled
>> on the machine where GDB is run, not on the remote machine where gdbserver is run.
>
> This is remote-target, not remote-host. Dejagnu is running on build,
> test case is compiled on host, and executable is running on target. In
> the case you described, host == build, so the test case is not copied.
> However, in remote-host, host != build, Dejagnu has to copy source file
> to the remote host first, and launch compiler on the remote host to
> compile the test case. The executable can be run on the same machine or
> a different one.
We do have several other tests that have .h files though.
$ find . -name "*.h" | wc -l
33
Sounds like we should come up with a way to make dejagnu handle
them in this scenario then. (tbc, not saying you should do that
yourself).
>
>> Thus, I always believed that there is no need to copy
>> the source files to the remote machine, as GDB has the sources available.
>>
>> Are these assumptions wrong?
>
> Usually, we don't, but in remote-host testing, we have to.
--
Pedro Alves
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] Run catch-load.exp on Windows
2013-09-16 13:21 ` Yao Qi
2013-09-16 14:26 ` Pedro Alves
@ 2013-09-16 16:24 ` Pierre Muller
1 sibling, 0 replies; 9+ messages in thread
From: Pierre Muller @ 2013-09-16 16:24 UTC (permalink / raw)
To: 'Yao Qi'; +Cc: 'Eli Zaretskii', gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Yao Qi
> Envoyé : lundi 16 septembre 2013 15:20
> À : Pierre Muller
> Cc : 'Eli Zaretskii'; gdb-patches@sourceware.org
> Objet : Re: [PATCH] Run catch-load.exp on Windows
>
> On 09/12/2013 11:36 PM, Pierre Muller wrote:
> > I don't get, I always thought that
> > when using remote debugger, the debuggee is cross-compiled
> > on the machine where GDB is run, not on the remote machine where gdbserver
> is run.
>
> This is remote-target, not remote-host. Dejagnu is running on build,
> test case is compiled on host, and executable is running on target. In
> the case you described, host == build, so the test case is not copied.
> However, in remote-host, host != build, Dejagnu has to copy source file
> to the remote host first, and launch compiler on the remote host to
> compile the test case. The executable can be run on the same machine or
> a different one.
So, I think I was confusing GDB's idea of build/host/target
with dejagnu idea, which is not exactly the same.
> > Thus, I always believed that there is no need to copy
> > the source files to the remote machine, as GDB has the sources available.
> >
> > Are these assumptions wrong?
>
> Usually, we don't, but in remote-host testing, we have to.
OK, thank you for the explanation.
Pierre Muller
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <33630.1438547254$1379000229@news.gmane.org>]
* Re: [PATCH] Run catch-load.exp on Windows
[not found] ` <33630.1438547254$1379000229@news.gmane.org>
@ 2013-09-17 18:39 ` Tom Tromey
0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2013-09-17 18:39 UTC (permalink / raw)
To: Pierre Muller; +Cc: 'Yao Qi', 'Eli Zaretskii', gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> I don't get, I always thought that
Pierre> when using remote debugger, the debuggee is cross-compiled
Pierre> on the machine where GDB is run, not on the remote machine where
Pierre> gdbserver is run.
Pierre> Thus, I always believed that there is no need to copy the
Pierre> source files to the remote machine, as GDB has the sources
Pierre> available.
Pierre> Are these assumptions wrong?
Not wrong, just incomplete. There are different kinds of remote
testing, including "remote host", where the compiler and gdb are both
run on the remote, and just dejagnu is run locally.
However, there is some support in the test suite and dejagnu for copying
files over.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Run catch-load.exp on Windows
2013-09-12 1:00 [PATCH] Run catch-load.exp on Windows Yao Qi
2013-09-12 2:44 ` Eli Zaretskii
@ 2013-09-16 14:22 ` Pedro Alves
1 sibling, 0 replies; 9+ messages in thread
From: Pedro Alves @ 2013-09-16 14:22 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 09/12/2013 01:59 AM, Yao Qi wrote:
> Hi,
> I find a compilation error when catch-load.c is compiled.
>
> catch-load.c:18:19: fatal error: dlfcn.h: No such file or directory
>
> This patch is to fix this compilation error. With this patch applied,
> test case can be compiled successfully.
Looks fine to me. It's how we do things in other similar
cases.
> However, there is one fail
> caused by matching "/" in file name, which doesn't exist on Windows.
> This patch fixes it by matching either "/" or "\" in file name.
(I think we could just as well just remove the '/', which looks to be
how gdb.base/info-shared.exp handles things, and probably what makes it
work on Windows without caring for this detail).
> gdb/testsuite:
>
> 2013-09-12 Yao Qi <yao@codesourcery.com>
>
> * gdb.base/catch-load.c: Remove the include of "dlfcn.h".
> [__WIN32__]: Include "windows.h" and define macro dlopen
> and dlclose.
> [!__WIN32__]: Include "dlfcn.h".
> * gdb.base/catch-load.exp (one_catch_load_test): Match
> directory separator.
> ---
> gdb/testsuite/gdb.base/catch-load.c | 9 ++++++++-
> gdb/testsuite/gdb.base/catch-load.exp | 2 +-
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/catch-load.c b/gdb/testsuite/gdb.base/catch-load.c
> index 9a0010e..33c0a66 100644
> --- a/gdb/testsuite/gdb.base/catch-load.c
> +++ b/gdb/testsuite/gdb.base/catch-load.c
> @@ -15,9 +15,16 @@
> You should have received a copy of the GNU General Public License
> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>
> -#include <dlfcn.h>
> #include <stdio.h>
>
> +#ifdef __WIN32__
> +#include <windows.h>
> +#define dlopen(name, mode) LoadLibrary (TEXT (name))
> +#define dlclose(handle) FreeLibrary (handle)
> +#else
> +#include <dlfcn.h>
> +#endif
> +
> /* This is updated by the .exp file. */
> char *libname = "catch-load-so.so";
>
> diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
> index 4bcaa44..28445b8 100644
> --- a/gdb/testsuite/gdb.base/catch-load.exp
> +++ b/gdb/testsuite/gdb.base/catch-load.exp
> @@ -64,7 +64,7 @@ proc one_catch_load_test {scenario kind match sostop} {
> gdb_test "catch $kind" "Catchpoint $decimal \\(.*\\)"
>
> gdb_test_multiple "continue" "continue" {
> - -re "Catchpoint $decimal\r\n.*loaded .*/$testfile2.*\r\n.*$gdb_prompt $" {
> + -re "Catchpoint $decimal\r\n.*loaded .*(\\\\|/)$testfile2.*\r\n.*$gdb_prompt $" {
> if {$match} {
> pass "continue"
> } else {
>
--
Pedro Alves
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-09-17 18:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-12 1:00 [PATCH] Run catch-load.exp on Windows Yao Qi
2013-09-12 2:44 ` Eli Zaretskii
2013-09-12 11:38 ` Yao Qi
2013-09-12 15:36 ` Pierre Muller
2013-09-16 13:21 ` Yao Qi
2013-09-16 14:26 ` Pedro Alves
2013-09-16 16:24 ` Pierre Muller
[not found] ` <33630.1438547254$1379000229@news.gmane.org>
2013-09-17 18:39 ` Tom Tromey
2013-09-16 14:22 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox