Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix gdb.mi/mi-file.exp for stubs.
@ 2006-12-13 22:41 Pedro Alves
  2006-12-13 23:26 ` [PATCH 2] " Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2006-12-13 22:41 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

Hi all,

There is a comment on mi-file.exp that says:

    # get the path and absolute path to the current executable
    #
    # In gdb 6.2 (at least), the default line number is set by
    # select_source_symtab to the first line of "main" minus
    # the value of "lines_to_list" (which defaults to 10) plus one.
    # --chastain 2004-08-13

That won't work for remote stubs.

The attached patch adds a call to mi_run_to_main with the following comment:

  # When debugging a stub, we can't depend on the current file
  # being the default file set by select_source_symtab.
  # When the gdb host connects to the stub, the stub will already be
  # running the target program stopped at a function
  # that probably isn't the one with main. We force
  # the file with main to be the current, so the following tests work.

Please review and commit.

Cheers,
Pedro Alves

---

2006-12-13  Pedro Alves  <pedro_alves@portugalmail.pt>

       * gdb.mi/mi-file.exp: Call mi_run_to_main if use_gdb_stub is set.


[-- Attachment #2: mi-file.exp.diff --]
[-- Type: text/plain, Size: 916 bytes --]

Index: mi-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-file.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-file.exp
--- mi-file.exp	12 Sep 2006 20:11:42 -0000	1.7
+++ mi-file.exp	13 Dec 2006 22:34:53 -0000
@@ -45,6 +45,18 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
+if [target_info exists use_gdb_stub] {
+
+  # When debugging a stub, we can't depend on the current file
+  # being the default file set by select_source_symtab.
+  # When the gdb host connects to the stub, the stub will already be
+  # running the target program stopped at a function 
+  # that probably isn't the one with main. We force
+  # the file with main to be the current, so the following tests work.
+
+  mi_run_to_main
+}
+
 proc test_file_list_exec_source_file {} {
     global srcfile
     global srcdir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2] Fix gdb.mi/mi-file.exp for stubs.
  2006-12-13 22:41 [PATCH] Fix gdb.mi/mi-file.exp for stubs Pedro Alves
@ 2006-12-13 23:26 ` Pedro Alves
  2006-12-14  9:59   ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2006-12-13 23:26 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

Pedro Alves escreveu:
> Hi all,
>
> There is a comment on mi-file.exp that says:
>
>    # get the path and absolute path to the current executable
>    #
>    # In gdb 6.2 (at least), the default line number is set by
>    # select_source_symtab to the first line of "main" minus
>    # the value of "lines_to_list" (which defaults to 10) plus one.
>    # --chastain 2004-08-13
>
> That won't work for remote stubs.
>
> The attached patch adds a call to mi_run_to_main with the following 
> comment:
>
>  # When debugging a stub, we can't depend on the current file
>  # being the default file set by select_source_symtab.
>  # When the gdb host connects to the stub, the stub will already be
>  # running the target program stopped at a function
>  # that probably isn't the one with main. We force
>  # the file with main to be the current, so the following tests work.
>
I withdraw this patch.  It doesn't fix anything...  I misread the 
testresults.  Sorry for the noise.

Instead, I propose skipping the test when running the testsuite against 
a stub.
Also, the mi2-file.exp test has the same problem.

Please find a new patch attached, review and commit.

Cheers,
Pedro Alves

---

2006-12-13  Pedro Alves  <pedro_alves@portugalmail.pt>

      * gdb.mi/mi-file.exp: Skip test if use_gdb_stub is set.
      * gdb.mi/mi2-file.exp: Likewise.


[-- Attachment #2: mi-files.exp.diff --]
[-- Type: text/plain, Size: 1624 bytes --]

Index: mi-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-file.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-file.exp
--- mi-file.exp	12 Sep 2006 20:11:42 -0000	1.7
+++ mi-file.exp	13 Dec 2006 23:21:31 -0000
@@ -25,6 +25,18 @@
 # but to verify the correct output response to MI operations.
 #
 
+if [target_info exists use_gdb_stub] {
+
+  # When debugging a stub, we can't depend on the current file
+  # being the default file set by select_source_symtab.
+  # When the gdb host connects to the stub, the stub will already be
+  # running the target program stopped at a function 
+  # that probably isn't the one with main.
+
+  verbose "Skipping mi-file.exp."
+  continue
+}
+
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
Index: mi2-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-file.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi2-file.exp
--- mi2-file.exp	10 Aug 2006 05:27:21 -0000	1.7
+++ mi2-file.exp	13 Dec 2006 23:21:31 -0000
@@ -25,6 +25,18 @@
 # but to verify the correct output response to MI operations.
 #
 
+if [target_info exists use_gdb_stub] {
+
+  # When debugging a stub, we can't depend on the current file
+  # being the default file set by select_source_symtab.
+  # When the gdb host connects to the stub, the stub will already be
+  # running the target program stopped at a function 
+  # that probably isn't the one with main.
+
+  verbose "Skipping mi-file.exp."
+  continue
+}
+
 load_lib mi-support.exp
 set MIFLAGS "-i=mi2"
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2] Fix gdb.mi/mi-file.exp for stubs.
  2006-12-13 23:26 ` [PATCH 2] " Pedro Alves
@ 2006-12-14  9:59   ` Pedro Alves
  2007-01-04 20:37     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2006-12-14  9:59 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1636 bytes --]

Pedro Alves escreveu:
> Pedro Alves escreveu:
>> Hi all,
>>
>> There is a comment on mi-file.exp that says:
>>
>>    # get the path and absolute path to the current executable
>>    #
>>    # In gdb 6.2 (at least), the default line number is set by
>>    # select_source_symtab to the first line of "main" minus
>>    # the value of "lines_to_list" (which defaults to 10) plus one.
>>    # --chastain 2004-08-13
>>
>> That won't work for remote stubs.
>>
>> The attached patch adds a call to mi_run_to_main with the following 
>> comment:
>>
>>  # When debugging a stub, we can't depend on the current file
>>  # being the default file set by select_source_symtab.
>>  # When the gdb host connects to the stub, the stub will already be
>>  # running the target program stopped at a function
>>  # that probably isn't the one with main. We force
>>  # the file with main to be the current, so the following tests work.
>>
> I withdraw this patch.  It doesn't fix anything...  I misread the 
> testresults.  Sorry for the noise.
> 
> Instead, I propose skipping the test when running the testsuite against 
> a stub.
> Also, the mi2-file.exp test has the same problem.
> 

This version doesn't skip the test and also passes on stubs.
It does that by calling mi_gdb_file_cmd instead of mi_gdb_load.
Since it doesn't connect to the target, the default file is still the
the current one.

Please find a new patch attached, review and commit.

Cheers,
Pedro Alves

---

2006-12-14  Pedro Alves  <pedro_alves@portugalmail.pt>

       * gdb.mi/mi-file.exp: Use mi_gdb_file_cmd instead of mi_gdb_load.
       * gdb.mi/mi2-file.exp: Likewise.




[-- Attachment #2: mi-files.exp.diff --]
[-- Type: text/plain, Size: 1066 bytes --]

Index: mi-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-file.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-file.exp
--- mi-file.exp	12 Sep 2006 20:11:42 -0000	1.7
+++ mi-file.exp	14 Dec 2006 09:54:32 -0000
@@ -43,7 +43,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/
 
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_gdb_file_cmd ${binfile}
 
 proc test_file_list_exec_source_file {} {
     global srcfile
Index: mi2-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-file.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi2-file.exp
--- mi2-file.exp	10 Aug 2006 05:27:21 -0000	1.7
+++ mi2-file.exp	14 Dec 2006 09:54:32 -0000
@@ -43,7 +43,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/
 
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
+mi_gdb_file_cmd ${binfile}
 
 proc test_file_list_exec_source_file {} {
     global srcfile


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2] Fix gdb.mi/mi-file.exp for stubs.
  2006-12-14  9:59   ` Pedro Alves
@ 2007-01-04 20:37     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-01-04 20:37 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Thu, Dec 14, 2006 at 09:58:30AM +0000, Pedro Alves wrote:
> 2006-12-14  Pedro Alves  <pedro_alves@portugalmail.pt>
> 
>       * gdb.mi/mi-file.exp: Use mi_gdb_file_cmd instead of mi_gdb_load.
>       * gdb.mi/mi2-file.exp: Likewise.

OK, thanks.  I committed it.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-04 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-13 22:41 [PATCH] Fix gdb.mi/mi-file.exp for stubs Pedro Alves
2006-12-13 23:26 ` [PATCH 2] " Pedro Alves
2006-12-14  9:59   ` Pedro Alves
2007-01-04 20:37     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox