How to change breakpoint length in lldb using remote debugging? Error: 14 sending the breakpoint request

I am using lldb (version: 12.0.0) and openOCD (version: 0.11.0-rc2) for remote debugging but I struggle in setting breakpoints. When I connect and set a breakpoint by:

target create example
target modules load --file example -s 0x80000000
gdb-remote localhost:3333
breakpoint set -f example -l34

I receive a warning from lldb and still no breakpoint has been set:

warning: failed to set breakpoint site at 0x800001ea for breakpoint 1.1: error: 14 sending the breakpoint request
Breakpoint 1: where = example`foo() + 50 at, address = 0x800001ea

OpenOCD is receiving a packet ‘Z0,800001ea,0’ which seems to be the problem because openOCD needs to know if it is a 4 Byte or a 2 Byte (normal or compressed) instruction to set a breakpoint the right way:

Debug: 465 2741 gdb_server.c:3272 gdb_input_inner(): received packet: 'Z0,800001ea,0'
Debug: 466 2741 gdb_server.c:1662 gdb_breakpoint_watchpoint_packet(): [riscv.cpu]
Debug: 467 2741 riscv.c:696 riscv_add_breakpoint(): [0] @0x800001ea
Error: 468 2741 riscv.c:701 riscv_add_breakpoint(): Invalid breakpoint length 0
Error: 469 2741 breakpoints.c:94 breakpoint_add_internal(): can't add breakpoint: unknown reason
Debug: 470 2741 gdb_server.c:1422 gdb_error(): Reporting -4 to GDB as generic error

Is there a way to tell lldb which instructions (compressed or normal) the remote target uses or is there a other way to set the length of breakpoints?
Thanks in advance for your help!

In lldb, the Platform class implements GetSoftwareBreakpointTrapOpcode, which tells lldb the size of the breakpoint trap to use given the address of the breakpoint. If the return is not 0, lldb sends the size along with the Z packet. It looks like PlatformDarwin is the only one that does anything with this, however.

From what I can tell, the other systems deal with this by having the NativeProcess class fixe the opcode themselves, but those classes are only used in lldb-server, so they won’t help when talking to a non-lldb-server stub.

There isn’t a way to say “set a 4 byte breakpoint here” - that wouldn’t be a great way to do this since lldb should be able to figure it out w/o help. From what I can tell, the best way to make this work if for the general PlatformRemoteGDBServer would have to be taught to figure this out.

Or, of course, OpenOCD might be able to figure this out on its end, but I don’t know enough about OpenOCD to know whether that’s possible or not.

Thanks for your help, so if I am using a non-lldb-server stub and a not-Darwin platform it won’t work because from the lldb side there is no feature implemented to solve this? (except there is a openOCD side solution)