This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add system test before "set remote system-call-allowed 1"
- From: Hui Zhu <hui_zhu at mentor dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches ml <gdb-patches at sourceware dot org>, Nathan Sidwell <nathan_sidwell at mentor dot com>
- Date: Sun, 8 Jun 2014 18:05:59 +0800
- Subject: Re: [PATCH] Add system test before "set remote system-call-allowed 1"
- Authentication-results: sourceware.org; auth=none
- References: <5371910C dot 9020607 at mentor dot com> <53871605 dot 2060605 at redhat dot com> <538EC056 dot 3080607 at mentor dot com> <538F4971 dot 4030305 at redhat dot com>
On 06/05/14 00:29, Pedro Alves wrote:
On 06/04/2014 07:44 AM, Hui Zhu wrote:
On 05/29/14 19:12, Pedro Alves wrote:
On 05/13/2014 04:27 AM, Hui Zhu wrote:
This patch is update version according to the discussion in
https://www.sourceware.org/ml/gdb-patches/2009-11/msg00090.html.
If test get the target doesn't support fileio system according to the
remote log. It will set this test as "unsupported".
Before I made this patch, I want add a check before all of tests in this
file. But I found that the target maybe support one call but not others.
For example: my target support Fwrite, Fopen and so on. But not
Fgettimeofday.
And it doesn't support Fsystem NULL but it support Fsystem not NULL.
So IIUC, the test will still have system (NULL) FAIL on your
target, right?
It will use fileio if argument of Fsystem is not NULL.
But will not use fileio if its argument is NULL.
I mean, you still get one FAIL when you run the test
against your target, even with your patch applied.
No. It will not because the fail just happen when the target use remote
file io to handle this system call.
Otherwise, I think I'm missing something.
Hmm, looking again at the patch, I'm pretty much confused. :-/
gdb_test continue \
-"Continuing\\..*system 1:.*OK$stop_msg" \
-"System says shell is available"
+gdb_test_no_output "set debug remote 1"
+set msg "System says shell is not available"
+gdb_test_multiple "continue" $msg {
+ -re "Continuing\\..*Fsystem.*system 1:.*OK$stop_msg\r\n$gdb_prompt $" {
^^^^^^^
What's this "Fsystem" supposed to be matching here? At this point
"set remote system-call-allowed 1" has NOT been issued yet, so
how come we expect to see that?
I am so sorry that I didn't explain this patch very clear.
The test before "set remote system-call-allowed 1" is to test the
function that introduced in
https://sourceware.org/gdb/current/onlinedocs/gdb/system.html "Due to
security concerns, the system call is by default refused by GDB. The
user has to allow this call explicitly with the set remote
system-call-allowed 1 command."
So 3 part of this test is for:
gdb_test_no_output "set debug remote 1"
# Open the switch to check if this target use file io to handle this
system or not.
set msg "System says shell is not available"
gdb_test_multiple "continue" $msg {
-re "Continuing\\..*Fsystem.*system 1:.*OK$stop_msg\r\n$gdb_prompt $" {
pass $msg
}
Target uses file io handle system and it gets OK.
Then the test pass.
-re ".*Fsystem.*$gdb_prompt $" {
fail $msg
}
Target uses file io handle system and it doesn't OK.
Then the test fail.
-re "$gdb_prompt $" {
unsupported $msg
}
Target doesn't use file io. The test is not support.
}
Thanks,
Hui
+ pass $msg
+ }
+ -re ".*Fsystem.*$gdb_prompt $" {
+ fail $msg
+ }
+ -re "$gdb_prompt $" {
+ unsupported $msg
+ }
+}
+gdb_test_no_output "set debug remote 0"