Is ddb(4) over a USB-to-Serial port possible?
Oliver Pinter
oliver.pinter at hardenedbsd.org
Thu Nov 23 22:34:42 UTC 2017
On Thursday, November 23, 2017, Hans Petter Selasky <hps at selasky.org> wrote:
> On 11/23/17 16:59, Julian Elischer wrote:
>
>> On 22/11/17 4:33 pm, Hans Petter Selasky wrote:
>>
>>> On 11/22/17 08:40, Julian Elischer wrote:
>>>
>>>> On 22/11/17 3:08 pm, Farhan Khan wrote:
>>>>
>>>>> Hi all
>>>>>
>>>>> I am reading here in section "10.5, On-Line Kernel Debugging User
>>>>> Remote GDB" that you can run ddb(4) over a serial cable. I am interested in
>>>>> setting this up.
>>>>>
>>>>> My development box does not have a serial port (however, I do see a
>>>>> uart0 device in the kernel messages), so I attached a USB serial port
>>>>> attached to a machine with a serial port. The device uses the uslcom(4)
>>>>> driver and is listed as "Silicon Labs CP2102 USB to UART Bridge
>>>>> Controller". When I enter ddb and enter "gdb" I receive the error "The
>>>>> remote GDB backend could not be selected."
>>>>>
>>>>> The hint.uart.0.port in /boot/device.hints is still set to 0x3F8,
>>>>> which corresponds to the aforementioned kernel messages. I am not certain
>>>>> if this is the same port as the USB-based serial port. Does this feature
>>>>> work over USB?
>>>>>
>>>>> Thanks,
>>>>> Farhan Khan
>>>>> _______________________________________________
>>>>> freebsd-hackers at freebsd.org mailing list
>>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>>>>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@
>>>>> freebsd.org"
>>>>>
>>>>> generally speaking the answer is no, unless the device is emulated
>>>> using SMI or some other mechanism that is independent of FreeBSD.
>>>>
>>>> uart0 is not the device on the USB but a hardware device at 3F8,
>>>> regardless of whether it actually exists. Since the USB stack is not really
>>>> functional when in the debugger, it can not be used to communicate with the
>>>> debugger.
>>>>
>>>> I find a better answer is to fire up the test machine under bhyve, in
>>>> which case its console is accessible through any stream session. (e.g.
>>>> ssh)..
>>>>
>>>>
>>> Hi,
>>>
>>> There is another setting for this:
>>>
>>> Try setting cons_baud and cons_unit below. USB serial supports polling
>>> from the debugger after panic.
>>>
>>> hw.usb.ucom.cons_baud: 9600
>>> hw.usb.ucom.cons_subunit: 0
>>> hw.usb.ucom.cons_unit: -1
>>> hw.usb.ucom.debug: 0
>>> hw.usb.ucom.pps_mode: 0
>>>
>>> wow.. I will need to try this when I have the appropriate setup.
>> is this in the kenv? is it in loader.conf or sysctl.conf?
>>
>>
> Hi,
>
> /boot/loader.conf
>
> or
>
> kenv
>
> or
>
> sysctl
>
> Before attaching the device.
Could we somehow change these after attached device? Ergo could we setup
two USB context, one for normal operation and one for the debugger?
>
> --HPS
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
More information about the freebsd-hackers
mailing list