public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
@ 2022-06-07 19:54 Bruno Larsen
  2022-06-21 12:46 ` [PING][PATCH] " Bruno Larsen
  2022-06-30 14:26 ` [PATCH] " Andrew Burgess
  0 siblings, 2 replies; 5+ messages in thread
From: Bruno Larsen @ 2022-06-07 19:54 UTC (permalink / raw)
  To: gdb-patches

When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
only tested objects allocated on the stack. This commit adds a couple of
dynamic allocations and tests if GDB can stop in it as well.
---

This was inspired by an outstanding patch in Fedora's GDB tree. I'm not
sure if it is different enough to warrant testing, but I don't think it
would hurt either.

---
 gdb/testsuite/gdb.cp/mb-ctor.cc  |  6 ++++++
 gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc
index c54b4fece48..faa59f16459 100644
--- a/gdb/testsuite/gdb.cp/mb-ctor.cc
+++ b/gdb/testsuite/gdb.cp/mb-ctor.cc
@@ -64,5 +64,11 @@ int main()
      DeeplyDerived's ctor.  */
   DeeplyDerived dd(15);
 
+  Derived *dyn_d = new Derived (24);
+  DeeplyDerived *dyn_dd = new DeeplyDerived (42);
+
+  delete dyn_d;
+  delete dyn_dd;
+
   return 0;
 }
diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
index cf22be9caa8..4b445635205 100644
--- a/gdb/testsuite/gdb.cp/mb-ctor.exp
+++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
@@ -59,6 +59,22 @@ gdb_test "continue" \
 
 gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here"
 
+gdb_test "continue" \
+    ".*Breakpoint.*Derived.*i=24.*" \
+    "run to breakpoint 1 dynamic v1"
+
+gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here"
+
+gdb_test "continue" \
+    ".*Breakpoint.*Derived.*i=42.*" \
+    "run to breakpoint 1 dynamic v2"
+
+gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here"
+
+gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1"
+
+gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2"
+
 gdb_test "continue" \
     ".*Breakpoint.*~Derived.*" \
     "run to breakpoint 3 v1"
-- 
2.31.1


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

* [PING][PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
  2022-06-07 19:54 [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation Bruno Larsen
@ 2022-06-21 12:46 ` Bruno Larsen
  2022-06-28 18:48   ` [PINGv2][PATCH] " Bruno Larsen
  2022-06-30 14:26 ` [PATCH] " Andrew Burgess
  1 sibling, 1 reply; 5+ messages in thread
From: Bruno Larsen @ 2022-06-21 12:46 UTC (permalink / raw)
  To: gdb-patches

ping!

Cheers!
Bruno Larsen

On 6/7/22 16:54, Bruno Larsen wrote:
> When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
> only tested objects allocated on the stack. This commit adds a couple of
> dynamic allocations and tests if GDB can stop in it as well.
> ---
> 
> This was inspired by an outstanding patch in Fedora's GDB tree. I'm not
> sure if it is different enough to warrant testing, but I don't think it
> would hurt either.
> 
> ---
>   gdb/testsuite/gdb.cp/mb-ctor.cc  |  6 ++++++
>   gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++
>   2 files changed, 22 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc
> index c54b4fece48..faa59f16459 100644
> --- a/gdb/testsuite/gdb.cp/mb-ctor.cc
> +++ b/gdb/testsuite/gdb.cp/mb-ctor.cc
> @@ -64,5 +64,11 @@ int main()
>        DeeplyDerived's ctor.  */
>     DeeplyDerived dd(15);
>   
> +  Derived *dyn_d = new Derived (24);
> +  DeeplyDerived *dyn_dd = new DeeplyDerived (42);
> +
> +  delete dyn_d;
> +  delete dyn_dd;
> +
>     return 0;
>   }
> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
> index cf22be9caa8..4b445635205 100644
> --- a/gdb/testsuite/gdb.cp/mb-ctor.exp
> +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
> @@ -59,6 +59,22 @@ gdb_test "continue" \
>   
>   gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here"
>   
> +gdb_test "continue" \
> +    ".*Breakpoint.*Derived.*i=24.*" \
> +    "run to breakpoint 1 dynamic v1"
> +
> +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here"
> +
> +gdb_test "continue" \
> +    ".*Breakpoint.*Derived.*i=42.*" \
> +    "run to breakpoint 1 dynamic v2"
> +
> +gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here"
> +
> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1"
> +
> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2"
> +
>   gdb_test "continue" \
>       ".*Breakpoint.*~Derived.*" \
>       "run to breakpoint 3 v1"


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

* [PINGv2][PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
  2022-06-21 12:46 ` [PING][PATCH] " Bruno Larsen
@ 2022-06-28 18:48   ` Bruno Larsen
  0 siblings, 0 replies; 5+ messages in thread
From: Bruno Larsen @ 2022-06-28 18:48 UTC (permalink / raw)
  To: gdb-patches

ping!

Cheers!
Bruno Larsen

On 6/21/22 09:46, Bruno Larsen wrote:
> ping!
> 
> Cheers!
> Bruno Larsen
> 
> On 6/7/22 16:54, Bruno Larsen wrote:
>> When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
>> only tested objects allocated on the stack. This commit adds a couple of
>> dynamic allocations and tests if GDB can stop in it as well.
>> ---
>>
>> This was inspired by an outstanding patch in Fedora's GDB tree. I'm not
>> sure if it is different enough to warrant testing, but I don't think it
>> would hurt either.
>>
>> ---
>>   gdb/testsuite/gdb.cp/mb-ctor.cc  |  6 ++++++
>>   gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++
>>   2 files changed, 22 insertions(+)
>>
>> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc
>> index c54b4fece48..faa59f16459 100644
>> --- a/gdb/testsuite/gdb.cp/mb-ctor.cc
>> +++ b/gdb/testsuite/gdb.cp/mb-ctor.cc
>> @@ -64,5 +64,11 @@ int main()
>>        DeeplyDerived's ctor.  */
>>     DeeplyDerived dd(15);
>> +  Derived *dyn_d = new Derived (24);
>> +  DeeplyDerived *dyn_dd = new DeeplyDerived (42);
>> +
>> +  delete dyn_d;
>> +  delete dyn_dd;
>> +
>>     return 0;
>>   }
>> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
>> index cf22be9caa8..4b445635205 100644
>> --- a/gdb/testsuite/gdb.cp/mb-ctor.exp
>> +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
>> @@ -59,6 +59,22 @@ gdb_test "continue" \
>>   gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here"
>> +gdb_test "continue" \
>> +    ".*Breakpoint.*Derived.*i=24.*" \
>> +    "run to breakpoint 1 dynamic v1"
>> +
>> +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here"
>> +
>> +gdb_test "continue" \
>> +    ".*Breakpoint.*Derived.*i=42.*" \
>> +    "run to breakpoint 1 dynamic v2"
>> +
>> +gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here"
>> +
>> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1"
>> +
>> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2"
>> +
>>   gdb_test "continue" \
>>       ".*Breakpoint.*~Derived.*" \
>>       "run to breakpoint 3 v1"
> 


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

* Re: [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
  2022-06-07 19:54 [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation Bruno Larsen
  2022-06-21 12:46 ` [PING][PATCH] " Bruno Larsen
@ 2022-06-30 14:26 ` Andrew Burgess
  2022-06-30 17:14   ` Bruno Larsen
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Burgess @ 2022-06-30 14:26 UTC (permalink / raw)
  To: Bruno Larsen, gdb-patches

Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:

> When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
> only tested objects allocated on the stack. This commit adds a couple of
> dynamic allocations and tests if GDB can stop in it as well.
> ---
>
> This was inspired by an outstanding patch in Fedora's GDB tree. I'm not
> sure if it is different enough to warrant testing, but I don't think it
> would hurt either.

I agree that it can't hurt to include this additional testing.  The
patch looks good, with a minor nit fixed...

>
> ---
>  gdb/testsuite/gdb.cp/mb-ctor.cc  |  6 ++++++
>  gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc
> index c54b4fece48..faa59f16459 100644
> --- a/gdb/testsuite/gdb.cp/mb-ctor.cc
> +++ b/gdb/testsuite/gdb.cp/mb-ctor.cc
> @@ -64,5 +64,11 @@ int main()
>       DeeplyDerived's ctor.  */
>    DeeplyDerived dd(15);
>  
> +  Derived *dyn_d = new Derived (24);
> +  DeeplyDerived *dyn_dd = new DeeplyDerived (42);
> +
> +  delete dyn_d;
> +  delete dyn_dd;
> +
>    return 0;
>  }
> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
> index cf22be9caa8..4b445635205 100644
> --- a/gdb/testsuite/gdb.cp/mb-ctor.exp
> +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
> @@ -59,6 +59,22 @@ gdb_test "continue" \
>  
>  gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here"
>  
> +gdb_test "continue" \
> +    ".*Breakpoint.*Derived.*i=24.*" \
> +    "run to breakpoint 1 dynamic v1"
> +
> +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here"

This line is too long, and can be split like:

  gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" \
      ".* breakpoint here"

> +
> +gdb_test "continue" \
> +    ".*Breakpoint.*Derived.*i=42.*" \
> +    "run to breakpoint 1 dynamic v2"
> +
> +gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here"

And again here.

With those fixed, please feel free to apply this patch.

Thanks,
Andrew

> +
> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1"
> +
> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2"
> +
>  gdb_test "continue" \
>      ".*Breakpoint.*~Derived.*" \
>      "run to breakpoint 3 v1"
> -- 
> 2.31.1


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

* Re: [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
  2022-06-30 14:26 ` [PATCH] " Andrew Burgess
@ 2022-06-30 17:14   ` Bruno Larsen
  0 siblings, 0 replies; 5+ messages in thread
From: Bruno Larsen @ 2022-06-30 17:14 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

thanks, pushed!

Cheers!
Bruno Larsen

On 6/30/22 11:26, Andrew Burgess wrote:
> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
>> only tested objects allocated on the stack. This commit adds a couple of
>> dynamic allocations and tests if GDB can stop in it as well.
>> ---
>>
>> This was inspired by an outstanding patch in Fedora's GDB tree. I'm not
>> sure if it is different enough to warrant testing, but I don't think it
>> would hurt either.
> 
> I agree that it can't hurt to include this additional testing.  The
> patch looks good, with a minor nit fixed...
> 
>>
>> ---
>>   gdb/testsuite/gdb.cp/mb-ctor.cc  |  6 ++++++
>>   gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++
>>   2 files changed, 22 insertions(+)
>>
>> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc
>> index c54b4fece48..faa59f16459 100644
>> --- a/gdb/testsuite/gdb.cp/mb-ctor.cc
>> +++ b/gdb/testsuite/gdb.cp/mb-ctor.cc
>> @@ -64,5 +64,11 @@ int main()
>>        DeeplyDerived's ctor.  */
>>     DeeplyDerived dd(15);
>>   
>> +  Derived *dyn_d = new Derived (24);
>> +  DeeplyDerived *dyn_dd = new DeeplyDerived (42);
>> +
>> +  delete dyn_d;
>> +  delete dyn_dd;
>> +
>>     return 0;
>>   }
>> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
>> index cf22be9caa8..4b445635205 100644
>> --- a/gdb/testsuite/gdb.cp/mb-ctor.exp
>> +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
>> @@ -59,6 +59,22 @@ gdb_test "continue" \
>>   
>>   gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here"
>>   
>> +gdb_test "continue" \
>> +    ".*Breakpoint.*Derived.*i=24.*" \
>> +    "run to breakpoint 1 dynamic v1"
>> +
>> +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here"
> 
> This line is too long, and can be split like:
> 
>    gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" \
>        ".* breakpoint here"
> 
>> +
>> +gdb_test "continue" \
>> +    ".*Breakpoint.*Derived.*i=42.*" \
>> +    "run to breakpoint 1 dynamic v2"
>> +
>> +gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here"
> 
> And again here.
> 
> With those fixed, please feel free to apply this patch.
> 
> Thanks,
> Andrew
> 
>> +
>> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1"
>> +
>> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2"
>> +
>>   gdb_test "continue" \
>>       ".*Breakpoint.*~Derived.*" \
>>       "run to breakpoint 3 v1"
>> -- 
>> 2.31.1
> 


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

end of thread, other threads:[~2022-06-30 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 19:54 [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation Bruno Larsen
2022-06-21 12:46 ` [PING][PATCH] " Bruno Larsen
2022-06-28 18:48   ` [PINGv2][PATCH] " Bruno Larsen
2022-06-30 14:26 ` [PATCH] " Andrew Burgess
2022-06-30 17:14   ` Bruno Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).