[lldb-dev] Problem with watchpoints

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Fri Sep 9 10:28:00 PDT 2016


> On Sep 8, 2016, at 4:47 PM, Ted Woodward via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> I recently discovered a problem with watchpoints talking to the Hexagon simulator:
>  
> (lldb) w s e 0x1000
> error: Watchpoint creation failed (addr=0x1000, size=4).
> error: Target supports (0) hardware watchpoint slots.
>  
>  
> It seems that lldb now sends a qWatchpointSupportInfo packet. But this packet isn’t defined in lldb-gdb-remote.txt.
>  
> Looking at the code, it expects to get back a pair “num:#”. If it doesn’t it returns 0. The caller will report the above error if the number returned is 0. So if qWatchpointSupportInfo isn’t supported, lldb can’t set a watchpoint.
>  
>  
> What is the definition of the response to qWatchpointSupportInfo? Is the the number of supported watchpoints, or the number of available watchpoints? If it’s supported, then CheckIfWatchpointsExhausted won’t really check if the watchpoints are exhausted. If it’s available, then a return of 0 doesn’t let us aggregate watchpoints – a 4 byte watchpoint at 0x1000 and one at 0x1004 could be one going from 0x1000-0x1007.

The person that checked this in no longer is working on LLDB and it has been like this since May 2012. It should return the total number of supported watchpoints. 
>  
> Wouldn’t it be better to try to set the watchpoint, then report a failure if we get an error back from the remote server?

It is kind of nice to know that you can't set watchpoints because they aren't supported since we can provide a nicer message than "E98 returned from GDB server". Errors in GDB remote protocol are a horrible mess and they don't mean anything. So any clearer we can be about this, the better, so we should keep the qWatchpointSupportInfo packet IMHO. I am fine with us modifying the GDBRemoteCommunicationClient to try and send this packet and if it comes back as unimplemented (response of $#00), you can set the num supported hardware watchpoints to UINT32_MAX. We should document that this means we don't know how many hardware watchpoints are supported, but it should then allow us to set hardware watchpoints if the GDB server doesn't support this packet. 

Watchpoints definitely need some work as they were done quickly by someone that is no longer around and they could use some TLC. 

>  
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
>  
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list