fix for gdb.python/python.exp

Message ID 8e312f83e2394322f7a22e0d7a4a0b06fa2fcd59.camel@us.ibm.com
State New
Headers show
Series
  • fix for gdb.python/python.exp
Related show

Commit Message

will schmidt via Gdb-patches July 21, 2021, 5:20 p.m.
GDB maintainers:

This patch fixes a simple typo in the test.  Variable uses need to have
a $ prefix on the variable. This patch fixes a missing $.  

This is probably considered obvious but thought it best to let people
check it out.

This patch was tested on Power 9 and Intel without any regression errors.

Please let me know if it is acceptable.

                            Carl Love

--------------------------------------------------------------------

Fix missing $ on use of the variable line.

gdb/testsuite/ChangeLog
2021-07-20  Carl Love  <cel@us.ibm.com>

	* gdb.python/python.exp (gdb_test python print): Add $ to variable
	line.
---
 gdb/testsuite/gdb.python/python.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

Andrew Burgess July 21, 2021, 5:41 p.m. | #1
* Carl Love via Gdb-patches <gdb-patches@sourceware.org> [2021-07-21 10:20:57 -0700]:

> 

> 

> 

> GDB maintainers:

> 

> This patch fixes a simple typo in the test.  Variable uses need to have

> a $ prefix on the variable. This patch fixes a missing $.  

> 

> This is probably considered obvious but thought it best to let people

> check it out.

> 

> This patch was tested on Power 9 and Intel without any regression errors.

> 

> Please let me know if it is acceptable.

> 

>                             Carl Love

> 

> --------------------------------------------------------------------

> 

> Fix missing $ on use of the variable line.

> 

> gdb/testsuite/ChangeLog

> 2021-07-20  Carl Love  <cel@us.ibm.com>

> 

> 	* gdb.python/python.exp (gdb_test python print): Add $ to variable

> 	line.

> ---

>  gdb/testsuite/gdb.python/python.exp | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp

> index d9fd60f3dd4..a4d1ae295e3 100644

> --- a/gdb/testsuite/gdb.python/python.exp

> +++ b/gdb/testsuite/gdb.python/python.exp

> @@ -501,7 +501,7 @@ gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line == line

>  gdb_py_test_silent_cmd "step" "Step into func2" 1

>  gdb_py_test_silent_cmd "up" "Step out of func2" 1

>  

> -gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True" "test find_pc_line with resume address"

> +gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > $line)" "True" "test find_pc_line with resume address"


I'm confused!

The 'line' variable is a Python variable, set a couple of lines
further up the .exp file:

  gdb_py_test_silent_cmd "python line = gdb.selected_frame().find_sal().line" "Get line number of func2 call site" 1

Any Python variables don't need a '$'.  In fact, when I apply this
patch the test no longer passes for me...

What am I missing here?

Thanks,
Andrew
will schmidt via Gdb-patches July 21, 2021, 6:33 p.m. | #2
Andrew:

On Wed, 2021-07-21 at 18:41 +0100, Andrew Burgess wrote:
> > -gdb_test "python print

> > (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True"

> > "test find_pc_line with resume address"

> > +gdb_test "python print

> > (gdb.find_pc_line(gdb.selected_frame().pc()).line > $line)" "True"

> > "test find_pc_line with resume address"

> 

> I'm confused!

> 

> The 'line' variable is a Python variable, set a couple of lines

> further up the .exp file:

> 

>   gdb_py_test_silent_cmd "python line =

> gdb.selected_frame().find_sal().line" "Get line number of func2 call

> site" 1

> 

> Any Python variables don't need a '$'.  In fact, when I apply this

> patch the test no longer passes for me...

> 

> What am I missing here?


Looks like my bad.  Yea, the change makes the original failure go away.
Looks like it is because I broke the python.  I didn't see in the log
that I had created the additional failure, just saw that the original
failure went away.   My appologies.

I will go work on this test some more to fix the test.  

Please ignore this patch.

                          Carl

Patch

diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index d9fd60f3dd4..a4d1ae295e3 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -501,7 +501,7 @@  gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line == line
 gdb_py_test_silent_cmd "step" "Step into func2" 1
 gdb_py_test_silent_cmd "up" "Step out of func2" 1
 
-gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True" "test find_pc_line with resume address"
+gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > $line)" "True" "test find_pc_line with resume address"
 
 gdb_test_no_output "set variable \$cvar1 = 23" "set convenience variable"
 gdb_test "python print(gdb.convenience_variable('cvar1'))" "23"