[v5,0/2] Make sure autoload happens before notifying Python side in new_objfile event

Message ID 20210426145340.493597-1-simon.marchi@polymtl.ca
Headers show
Series
  • Make sure autoload happens before notifying Python side in new_objfile event
Related show

Message

Simon Marchi via Gdb-patches April 26, 2021, 2:53 p.m.
This is a new version of Michael Weghorn's patchset here:

https://sourceware.org/pipermail/gdb-patches/2021-April/178069.html

I rebased it after merging my "set debug observer" changes.

In addition to just rebasing, I made many style fixes here and there.  I
also did some changes in the test to use some more recent GDB testsuite
idioms (that you would miss if you copied an older test, and that I
wouldn't expect a new-ish contributor to know).

I also changed the test to make it work for the native-gdbserver board.
Previously, the test checked the output of the "run" command.  This
doesn't work for native-gdbserver, because GDB is connected using the
"remote" protocol, which doesn't support running.  Instead, I made the
new_objfile handler set a global variable if everything looks good.  We
then check the global variable value in the test.

Michael, can you please take a look and check it is still ok with you?

Michael Weghorn (2):
  gdbsupport: allow to specify dependencies between observers
  gdb: do autoload before notifying Python side in new_objfile event

 gdb/auto-load.c                               |   9 +-
 gdb/auto-load.h                               |   8 ++
 gdb/python/py-inferior.c                      |   7 +-
 ...tty-printers-in-newobjfile-event.so-gdb.py |  43 +++++++
 ...pretty-printers-in-newobjfile-event-lib.cc |  28 +++++
 ...-pretty-printers-in-newobjfile-event-lib.h |  31 +++++
 ...retty-printers-in-newobjfile-event-main.cc |  27 +++++
 ...ed-pretty-printers-in-newobjfile-event.exp |  85 +++++++++++++
 ...ded-pretty-printers-in-newobjfile-event.py |  50 ++++++++
 gdb/unittests/observable-selftests.c          | 112 ++++++++++++++++++
 gdbsupport/observable.h                       | 111 ++++++++++++++---
 11 files changed, 492 insertions(+), 19 deletions(-)
 create mode 100644 gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py
 create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc
 create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h
 create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc
 create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
 create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py

-- 
2.30.1

Comments

Simon Marchi via Gdb-patches April 26, 2021, 8:05 p.m. | #1
Hi Simon,

On 26/04/2021 16.53, Simon Marchi wrote:
> This is a new version of Michael Weghorn's patchset here:

> 

> https://sourceware.org/pipermail/gdb-patches/2021-April/178069.html

> 

> I rebased it after merging my "set debug observer" changes.

> 

> In addition to just rebasing, I made many style fixes here and there.  I

> also did some changes in the test to use some more recent GDB testsuite

> idioms (that you would miss if you copied an older test, and that I

> wouldn't expect a new-ish contributor to know).

> 

> I also changed the test to make it work for the native-gdbserver board.

> Previously, the test checked the output of the "run" command.  This

> doesn't work for native-gdbserver, because GDB is connected using the

> "remote" protocol, which doesn't support running.  Instead, I made the

> new_objfile handler set a global variable if everything looks good.  We

> then check the global variable value in the test.


A big thanks for doing all of this!

> 

> Michael, can you please take a look and check it is still ok with you?


Yes, that looks good (and better than before your changes).
I just found a potential typo in the first commit message and two 
comments in the test that have not been updated to the fact that the 
handler now sets a global variable instead of generating output.

Thanks again,
Michael
Simon Marchi via Gdb-patches April 27, 2021, 3:23 p.m. | #2
On 2021-04-26 4:05 p.m., Michael Weghorn wrote:
> Hi Simon,

> 

> On 26/04/2021 16.53, Simon Marchi wrote:

>> This is a new version of Michael Weghorn's patchset here:

>>

>> https://sourceware.org/pipermail/gdb-patches/2021-April/178069.html

>>

>> I rebased it after merging my "set debug observer" changes.

>>

>> In addition to just rebasing, I made many style fixes here and there.  I

>> also did some changes in the test to use some more recent GDB testsuite

>> idioms (that you would miss if you copied an older test, and that I

>> wouldn't expect a new-ish contributor to know).

>>

>> I also changed the test to make it work for the native-gdbserver board.

>> Previously, the test checked the output of the "run" command.  This

>> doesn't work for native-gdbserver, because GDB is connected using the

>> "remote" protocol, which doesn't support running.  Instead, I made the

>> new_objfile handler set a global variable if everything looks good.  We

>> then check the global variable value in the test.

> 

> A big thanks for doing all of this!

> 

>>

>> Michael, can you please take a look and check it is still ok with you?

> 

> Yes, that looks good (and better than before your changes).

> I just found a potential typo in the first commit message and two comments in the test that have not been updated to the fact that the handler now sets a global variable instead of generating output.

> 

> Thanks again,

> Michael

> 


Thanks both, I've now pushed the patches.

Simon