break-interp.exp, and attaching with no file loaded

Pedro Alves palves@redhat.com
Fri Feb 10 15:59:00 GMT 2012


On 01/27/2012 10:52 PM, Jan Kratochvil wrote:
> Hi Pedro,
> 
> On Fri, 27 Jan 2012 20:37:22 +0100, Pedro Alves wrote:
>> The testfile contains tests where gdb attaches to a process without
>> loading a file, and so with extend-remote gdbserver, given that gdb can't figure
>> out automatically what was the executable, things fall apart.
> 
> But this is a bug of the extended mode.  It should be fixed in the future.

Yeah.  gdb.base/attach.exp has a couple tests specific for this (which FAIL),
so I think it's okay to remove the need for that feature from other tests.
I recall that on e.g., OpenBSD, there's just no way to get at a process's
executable, so it's not just remote targets that miss this feature.

>> Jan, is there a reason the test can't be changed to always have gdb load the
>> executable?
> 
> But it is a different bug than what break-interp.exp is testing so I am fine
> with this change.

Exactly.  Great.

>> --- a/gdb/testsuite/gdb.base/break-interp.exp
>> +++ b/gdb/testsuite/gdb.base/break-interp.exp
> [...]
>> @@ -336,7 +340,8 @@ proc test_attach {file displacement {relink_args ""}} {
>>      }
>>
>>      if {$relink_args == ""} {
>> -	test_attach_gdb "" $pid $displacement "attach"
>> +	global exec
>> +	test_attach_gdb $exec $pid $displacement "attach"
> 
> if {$file != ""} in test_attach_gdb is now redundant and should be removed.

Done.

> 
> 
>>      } else {
>>  	# These could be rather passed as arguments.
>>  	global exec interp_saved interp
>> @@ -447,6 +452,8 @@ proc test_ld {file ifmain trynosym displacement} {
>>      # Test no (error) message has been printed by `exec-file'.
>>      set escapedfile [string_to_regexp $file]
>>      gdb_test "exec-file $file" "exec-file $escapedfile" "load"
>> +    # Needs abstraction
> 
> Missing final dot (.) of the comment.

I'll try to think about fixing this hack some other way.  I've dropped it
for now.

>> +    gdb_test "set remote exec-file $file" "exec-file $escapedfile" "remote load"
>>
>>      if $ifmain {
>>  	reach "_dl_debug_state" run $displacement
> 
> 
> OK this way.

Thanks!  I'm checking it in, like below.

> 
> Thanks, the extended mode runs great,

Great.

-- 
Pedro Alves

2012-02-10  Pedro Alves  <palves@redhat.com>

	* gdb.base/break-interp.exp (test_attach_gdb): Assume $file is
	always non-empty.
	(test_attach): Always pass $exec to test_attach_gdb.
---

 gdb/testsuite/gdb.base/break-interp.exp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 04b5eab..575e8f0 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -262,9 +262,7 @@ proc test_attach_gdb {file pid displacement prefix} {
     # Print the "PIE (Position Independent Executable) displacement" message.
     gdb_test_no_output "set verbose on"

-    if {$file != ""} {
-	gdb_test "file $file" "Reading symbols from .*done\\." "file"
-    }
+    gdb_test "file $file" "Reading symbols from .*done\\." "file"

     set test "attach"
     gdb_test_multiple "attach $pid" $test {
@@ -308,6 +306,7 @@ proc test_attach_gdb {file pid displacement prefix} {

 proc test_attach {file displacement {relink_args ""}} {
     global board_info
+    global exec

     gdb_exit

@@ -336,10 +335,10 @@ proc test_attach {file displacement {relink_args ""}} {
     }

     if {$relink_args == ""} {
-	test_attach_gdb "" $pid $displacement "attach"
+	test_attach_gdb $exec $pid $displacement "attach"
     } else {
 	# These could be rather passed as arguments.
-	global exec interp_saved interp
+	global interp_saved interp

 	foreach relink {YES NO} {
 	    # Formerly this test was testing only prelinking of $EXEC.  As the



More information about the Gdb-patches mailing list