[lldb-dev] Serial port support in LLDB

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Fri Oct 8 02:06:50 PDT 2021


On 06/10/2021 14:59, Michał Górny wrote:
> On Wed, 2021-10-06 at 14:32 +0200, Pavel Labath wrote:
>> Let me try to make a counterproposal.
>>
>> Since the serial parameters are a property of a specific connection, and
>> one could theoretically have be debugging multiple processes with
>> different connection parameters, having a (global) setting for them does
>> not seem ideal. And since lldb already has a history of using made up
>> urls (unix-connect://, tcp://), I am wondering if we couldn't/shouldn't
>> invent a new url scheme for this. So like instead of file:///dev/ttyS0,
>> one would use a new scheme (say serial:// to connect), and we would
>> somehow encode the connection parameters into the url. For example, this
>> could look something like
>>     serial://[PARODD,STOP1,B19200]/dev/ttyS0
>> This connection string could be passed to both lldb and lldb-server
>> without any new arguments. Implementation-wise this url could be
>> detected at a fairly high level, and would cause us to instantiate a new
>> class which would handle the serial connection.
> 
> I don't have a strong opinion either way.  I suppose this would be
> a little easier to implement, though I'd prefer using something more
> classically URL-ish, i.e.:
> 
>    serial:///dev/ttyS0?baud=115200&parity=odd...
> 
> or:
> 
>    serial:///dev/ttyS0,baud=115200,parity=odd...
> 
> I suppose it would prevent weird paths but I don't think we need to
> account for weird paths for ttys (and if we did, we should probably
> urlencode them anyway).
> 

The the full-url version (with ? and &). I'm sure you've noticed this 
already, but for the sake of others, let me just mention that we already 
have a TODO to support a syntax like this.


More information about the lldb-dev mailing list