DavidSpickett wrote:

> or do we already have some infra that I can use?

`lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py` is an example 
of that infrastructure. The `threadStopInfo` is where you would insert the 
swbreak hwbreak key.

In fact, if i386 is an architecture where this correction of PC might happen 
(or not) you could just extend that test. The result should be the same whether 
the mock gdbserver returns "swbreak" "hwbreak" or leaves that field out 
completely.

If i386 isn't an architecture where correction would be done, you should be 
able to find some other target xml stubs elsewhere in tests. I don't think this 
test case is i386 specific. It can be tricky because that XML needs to include 
a minimal set of registers before lldb will function, so if in doubt, copy 
paste a working one.

> By the way, do I always need some unit test change to get a PR accepted? In 
> this particular case I do not see a compelling reason to add a new test, 
> though if this is a LLVM development policy then I will start looking into it.

Not 100% of the time but you will always have to justify why it does not have 
tests, or has the sort of tests that it has. This justification is useful for 
auditing code later, it also serves as a guide to anyone trying to reproduce an 
old bug that has no test cases.

https://llvm.org/docs/DeveloperPolicy.html#test-cases is written from the llvm 
perspective but applies to lldb as well 
https://lldb.llvm.org/resources/contributing.html#test-infrastructure.

In this case because no one does lldb -> gdbserver testing within the llvm 
project, so my worry is that this "easy fix" will get forgotten over time and 
someone will remove it as dead code or forget it in a refactoring. This is not 
a case of "if it has no tests it will get deleted" but it will certainly be at 
higher risk.

We have had cases like this before for example, someone fixed a bug handling an 
msp430 simulator and the test for that replays the packets that it sent to lldb 
so we don't have to have the actual simulator to hand.

https://github.com/llvm/llvm-project/pull/102873
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to