[PATCH master + gdb-10-branch] gdb: fix getting range of flexible array member in Python

Simon Marchi simon.marchi@polymtl.ca
Thu Apr 22 19:47:33 GMT 2021


On 2021-04-22 3:40 p.m., Luis Machado wrote:
> Hi Simon,
> 
> On 4/22/21 4:07 PM, Simon Marchi via Gdb-patches wrote:
>> On 2021-04-22 1:50 p.m., Andrew Burgess wrote:
>>>> diff --git a/gdb/testsuite/gdb.python/flexible-array-member.c b/gdb/testsuite/gdb.python/flexible-array-member.c
>>>> new file mode 100644
>>>> index 000000000000..79815e2d38e0
>>>> --- /dev/null
>>>> +++ b/gdb/testsuite/gdb.python/flexible-array-member.c
>>>> @@ -0,0 +1,70 @@
>>>> +/* This testcase is part of GDB, the GNU debugger.
>>>> +
>>>> +   Copyright 2020-2021 Free Software Foundation, Inc.
>>>
>>> In this file and the .exp the date range is 2020-2021, is this
>>> correct?
>>
>> Since I copied it from gdb.base/flexible-array-member.c, it should
>> retain the original copyright date.
>>
>>> Otherwise, looks good.
>>
>> Thanks, pushed to both branches!
>>
>> Simon
>>
> 
> I notice this test being executed without python support. I think we need this guard:
> 
> # Skip all tests if Python scripting is not enabled.
> if { [skip_python_tests] } { continue }

You're right, thanks for noticing.  I pushed the patch below in the two
branches:

>From a87caa6d523e573ab71694233a7501c6b5b5b9f7 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Thu, 22 Apr 2021 15:45:34 -0400
Subject: [PATCH] gdb/testsuite: add Python support check in
 gdb.python/flexible-array-member.exp

We don't want to execute this test if Python support is not compiled in
GDB, add the necessary check.

gdb/testsuite/ChangeLog:

	* gdb.python/flexible-array-member.exp: Add check for Python
	support.

Change-Id: I853b937d2a193a0bb216566bef1a35354264b1c5
---
 gdb/testsuite/ChangeLog                            | 5 +++++
 gdb/testsuite/gdb.python/flexible-array-member.exp | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9730658299bf..266645bd6ad6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-22  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* gdb.python/flexible-array-member.exp: Add check for Python
+	support.
+
 2021-04-22  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	PR gdb/27757
diff --git a/gdb/testsuite/gdb.python/flexible-array-member.exp b/gdb/testsuite/gdb.python/flexible-array-member.exp
index 3739c9a9e5c0..349670cb7e72 100644
--- a/gdb/testsuite/gdb.python/flexible-array-member.exp
+++ b/gdb/testsuite/gdb.python/flexible-array-member.exp
@@ -22,6 +22,9 @@ if { [prepare_for_testing "failed to prepare" \
     return
 }
 
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
 if { ![runto break_here] } {
     untested "could not run to break_here"
     return
-- 
2.30.1



More information about the Gdb-patches mailing list