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

Simon Marchi via Gdb-patches
2021-01-18T06:04:30Z

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?

Simon