Re: [PATCH v3 1/5] gdb: make the remote target track its own thread resume state

Sebastian Huber
2021-01-18T10:36:20Z

On 18/01/2021 07:04, Simon Marchi wrote:

> On 2021-01-18 12:16 a.m., Sebastian Huber wrote:
>> Hello Simon,
>>
>> On 08/01/2021 05:17, Simon Marchi via Gdb-patches wrote:
>>> +/* From the remote target's point of view, each thread is in one of these three
>>> +   states.  */
>>> +enum class resume_state
>>> +{
>>> +  /* Not resumed - we haven't been asked to resume this thread.  */
>>> +  NOT_RESUMED,
>>> +
>>> +  /* We have been asked to resume this thread, but haven't sent a vCont action
>>> +     for it yet.  We'll need to consider it next time commit_resume is
>>> +     called.  */
>>> +  RESUMED_PENDING_VCONT,
>>> +
>>> +  /* We have been asked to resume this thread, and we have sent a vCont action
>>> +     for it.  */
>>> +  RESUMED,
>>> +};
>> there could be a problem with this "enum class" on CentOS 7.9:
>>
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:1157:38: error: 'resume_state' is not a class, namespace, or enumeration
>>    enum resume_state m_resume_state = resume_state::NOT_RESUMED;
>>                                       ^
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c: In member function 'void remote_thread_info::set_not_resumed()':
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:1115:22: error: 'resume_state' is not a class, namespace, or enumeration
>>      m_resume_state = resume_state::NOT_RESUMED;
>>                       ^
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c: In member function 'void remote_thread_info::set_resumed_pending_vcont(bool, gdb_signal)':
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:1121:22: error: 'resume_state' is not a class, namespace, or enumeration
>>      m_resume_state = resume_state::RESUMED_PENDING_VCONT;
>>                       ^
>> In file included from ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/../gdbsupport/gdb_string_view.h:49:0,
>>                  from ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/../gdbsupport/common-utils.h:46,
>>                  from ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/../gdbsupport/common-defs.h:125,
>>                  from ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/defs.h:28,
>>                  from ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:22:
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c: In member function 'const resumed_pending_vcont_info& remote_thread_info::resumed_pending_vcont_info() const':
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:1132:35: error: 'resume_state' is not a class, namespace, or enumeration
>>      gdb_assert (m_resume_state == resume_state::RESUMED_PENDING_VCONT);
>>                                    ^
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/../gdbsupport/gdb_assert.h:35:13: note: in definition of macro 'gdb_assert'
>>    ((void) ((expr) ? 0 :                                                       \
>>              ^
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c: In member function 'void remote_thread_info::set_resumed()':
>> ../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:1140:22: error: 'resume_state' is not a class, namespace, or enumeration
>>      m_resume_state = resume_state::RESUMED;
>>                       ^
>>
> Huh, maybe it gets confused because there's a method named "remote_state"
> as well? Does it work if you rename the method to something else?

Thanks for the hint, I will have a look at it, but it may take a while.

I noticed another issue on nios2-rtems built on openSUSE:

../../sourceware-mirror-binutils-gdb-edf0f28/gdb/remote.c:7820:
internal-error: ptid_t
remote_target::select_thread_for_ambiguous_stop_reply(const
target_waitstatus*): Assertion `first_resumed_thread != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

It worked with the GDB commit 4180301.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: