[FYI/pushed v4 08/25] Thread options & clone events (Linux GDBserver)

Tom Tromey tromey@adacore.com
Wed Feb 7 18:06:33 GMT 2024


>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> -  if (aarch64_any_set_debug_regs_state (state, true))
>> +  if (state == nullptr || aarch64_any_set_debug_regs_state (state, true))
>> DR_MARK_ALL_CHANGED (info->dr_changed_wp, aarch64_num_wp_regs);

Simon> I don't really understand all of this, but I'm wondering if the
Simon> condition should be:

Simon>   if (state != nullptr && aarch64_any_set_debug_regs_state (state, ...))

Simon> If we have no existing aarch64_debug_reg_state, do we really need to
Simon> mark the breakpoints as needing to be updated?

I wasn't sure but I followed what I understood x86 to do, see
nat/x86-linux.c:lwp_set_debug_registers_changed.

Simon> Here, aarch64_debug_process_state is an unordered_map<pid_t,
Simon> aarch64_debug_reg_state> , meaning that if pid isn't currently in the
Simon> map, a default aarch64_debug_reg_state will be constructed (is it going
Simon> to be initialized properly?).

Simon> So we end up with two different semantics for the two versions of the
Simon> function, which might become a source of confusion later.

Yeah, I don't know the answer here.  I personally don't find it super
confusing, or at least not any more than the way that gdb and gdbserver
randomly do things differently already.

Tom


More information about the Gdb-patches mailing list