================ @@ -3105,102 +3122,184 @@ Status ProcessGDBRemote::DisableBreakpointSite(BreakpointSite *bp_site) { } // Pre-requisite: wp != NULL. -static GDBStoppointType GetGDBStoppointType(Watchpoint *wp) { - assert(wp); - bool watch_read = wp->WatchpointRead(); - bool watch_write = wp->WatchpointWrite(); - bool watch_modify = wp->WatchpointModify(); - - // watch_read, watch_write, watch_modify cannot all be false. - assert((watch_read || watch_write || watch_modify) && - "watch_read, watch_write, watch_modify cannot all be false."); - if (watch_read && (watch_write || watch_modify)) +static GDBStoppointType +GetGDBStoppointType(const WatchpointResourceSP &wp_res_sp) { + assert(wp_res_sp); + bool read, write; + wp_res_sp->GetType(read, write); + + assert((read || write) && "read and write cannot both be false."); + if (read && write) return eWatchpointReadWrite; - else if (watch_read) + else if (read) return eWatchpointRead; - else // Must be watch_write or watch_modify, then. + else return eWatchpointWrite; } -Status ProcessGDBRemote::EnableWatchpoint(Watchpoint *wp, bool notify) { +Status ProcessGDBRemote::EnableWatchpoint(WatchpointSP wp_sp, bool notify) { Status error; - if (wp) { - user_id_t watchID = wp->GetID(); - addr_t addr = wp->GetLoadAddress(); + if (wp_sp) { ---------------- bulbazord wrote:
Since you're already refactoring this part, maybe you could flip the condition and do the error handling up front. It's small, but it saves a level of indentation in an already large code block. https://github.com/llvm/llvm-project/pull/68845 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits