This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add CTF support to GDB [5] Add test for CTF function
- From: Yao Qi <yao at codesourcery dot com>
- To: Hui Zhu <teawater at gmail dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, Joel Brobecker <brobecker at adacore dot com>, gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Mon, 18 Feb 2013 18:38:20 +0800
- Subject: Re: [PATCH] Add CTF support to GDB [5] Add test for CTF function
- References: <CANFwon2=EmBWtGqx5ygrmMNt0MBM0oLbjOZ2VMsx5+S9TErP7w@mail.gmail.com> <50F3ADB8.1000603@codesourcery.com> <CANFwon1LH6ipUFXE2xHwXaG6ChzBEVVvoVn-bcnZJVbbYkQz3w@mail.gmail.com> <50F55E11.40008@codesourcery.com> <CANFwon2auJH47FLg8yZPpL6=60db_ZYmbjCEa2_9LfqEDAj2pw@mail.gmail.com> <50F67844.5040007@codesourcery.com> <CANFwon2m3D3MDKjuL9Hp+t-RBj7BoSUz_OapdNUP=P27rhjD0Q@mail.gmail.com> <87a9s6a4tu.fsf@fleche.redhat.com> <CANFwon2DTOKJR-D=Gys534s0C51Bgg=4+i1KoB6GGC49_C_v2A@mail.gmail.com>
On 01/25/2013 07:09 PM, Hui Zhu wrote:
+# Get the pathname of babeltrace and set it to $which_babeltrace.
+# If host doesn't have babeltrace, $which_babeltrace will set to 0.
+if [info exists BABELTRACE] {
+ set which_babeltrace ${BABELTRACE}
+} else {
+ remote_exec host "which babeltrace" "" "/dev/null" "babeltrace.which"
+ remote_upload host "babeltrace.which"
+ set which_babeltrace [file_contents "babeltrace.which"]
+ remote_file build delete "babeltrace.which"
+ remote_file host delete "babeltrace.which"
+}
+
+# Use $which_babeltrace check $ctfdir.
+if { $which_babeltrace == "" } then {
+ unsupported "babeltrace check ctf directory"
+} else {
+ # Let babeltrace output an error to make sure current way is right.
+ remote_exec host "$which_babeltrace not_exist" "" "/dev/null" "babeltrace.output"
+ remote_upload host "babeltrace.output"
+ set babeltrace_output [file_contents "babeltrace.output"]
+ remote_file build delete "babeltrace.output"
+ remote_file host delete "babeltrace.output"
+ if { [string last "\[error\]" $babeltrace_output] == -1 } then {
+ unsupported "cannot handle babeltrace output"
+ } else {
+ #Call $which_babeltrace check $ctfdir.
+ remote_exec host "$which_babeltrace $ctfdir" "" "/dev/null" "babeltrace.output"
+ remote_upload host "babeltrace.output"
+ set babeltrace_output [file_contents "babeltrace.output"]
+ remote_file build delete "babeltrace.output"
+ remote_file host delete "babeltrace.output"
+ if { [string last "\[error\]" $babeltrace_output] != -1 } then {
+ fail "babeltrace open ctf directory"
+ }
+ }
+}
Unless I misunderstand it, it is still incorrect. IIUC, what you want
to do here is to run "babeltrace" to check your trace data, you can
simply do
remote_exec host "babeltrace $ctfdir < /dev/null" "" "/dev/null"
"output"
You can tell from the return value and "output" about
1) whether babeltrace is installed on host machine,
2) whether babeltrace is executed successfully.
DejaGNU is smart enough to know what is the host machine, and execute
this command there, which is determined by the board file. If you are
testing a native gdb, the command will be run in local machine, if you
are testing GDB in a remote host way (test a native mingw32 native gdb
on linux machine), this command will be executed on the remote host (a
windows machine).
--
Yao (éå)