This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4] gdb: kfail for PR14161


On 06/16/2012 03:33 AM, Pedro Alves wrote:
>> > +    # Due to PR gdb/14161, sockets files are not removed when agent exists.
>> > +    if [is_remote target] {
>> > +	foreach match [glob -nocomplain "/tmp/gdb_ust*"] {
>> > +	    remote_file target delete $match
> 
> That's unfortunately not good, because while the "delete" runs on
> the "target", the "glob" is running on the "build" machine (which is usually
> the "host", unless you're doing remote-host testing).
> 
>> > +	}
>> > +    } else {
>> > +	eval file delete [glob "/tmp/gdb_ust*"]
>> > +    }
> This else doesn't work for remote-host testing either.  With remote-
> -host testing, you have expect running on machine A (build), GDB
> running on machine B (host), and that GDB connecting to machine
> C (target).  Usually, either A and B are the same, or B and C are
> the same, though A != B != C is possible.
> 

I am using 'remote_exec target "sh -c \"rm -r $socket_file\""' to
delete them in a unique way.  The reason is explained in the comments.

> Maybe we can avoid the need for globing in the first place, by making
> strace_remove_socket (and whatever other function in the file, if
> necessary), remove the socket file before returning, while they
> still know the inferior's PID?

Yes, at the end of strace_remove_socket, we can delete socket file if
it still exists.  In proc strace_info_marker, I simply force GDB to
detach inferior, so the socket file can be removed as well.

-- 
Yao (éå) 

gdb/testsuite:

2012-06-20  Yao Qi  <yao@codesourcery.com>

	KFAIL for PR14161.
	* gdb.trace/strace.exp (strace_remove_socket): kfail for native.
	Cleanup socket files.
	(strace_info_marker): Detach inferior.
---
 gdb/testsuite/gdb.trace/strace.exp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index d45c66d..587d9b3 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -111,6 +111,9 @@ proc strace_remove_socket { action } {
 
     if { $exists } {
 	fail $test
+	# Since $socket_file is a socket file instead of a regular file, we
+	# can't use 'remote_file target delete $socket_file' here.
+	remote_exec target "sh -c \"rm -r $socket_file\""
     } else {
 	pass $test
     }
@@ -145,6 +148,13 @@ proc strace_info_marker { } { with_test_prefix "info_marker" {
 	    pass "info threads"
 	}
     }
+
+    # GDB detaches inferior so that the socket file can be removed.
+    gdb_test_multiple "detach" "detach" {
+	-re "Detaching .*, process .*${gdb_prompt} $" {
+	    pass "detach"
+	}
+    }
 }}
 
 proc strace_probe_marker { } { with_test_prefix "probe_marker" {
-- 
1.7.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]