gdb print设置技巧,离线查看复杂结构体和数组变量内容,展开多层嵌套的结构体的方法

1. gdb模式下,可以用help set print查看常见的命令

复制代码
List of set print subcommands:

set print address -- Set printing of addresses.
set print array -- Set pretty formatting of arrays.
set print array-indexes -- Set printing of array indexes.
set print asm-demangle -- Set demangling of C++/ObjC names in disassembly listings.
set print demangle -- Set demangling of encoded C++/ObjC names when displaying symbols.
set print elements -- Set limit on string chars or array elements to print.
set print entry-values -- Set printing of function arguments at function entry.
set print finish -- Set whether `finish' prints the return value.
set print frame-arguments -- Set printing of non-scalar frame arguments.
set print frame-info -- Set printing of frame information.
set print inferior-events -- Set printing of inferior events (such as inferior start and exit).
set print max-depth -- Set maximum print depth for nested structures, unions and arrays.
set print max-symbolic-offset -- Set the largest offset that will be printed in <SYMBOL+1234> form.
set print null-stop -- Set printing of char arrays to stop at first null char.
set print object -- Set printing of C++ virtual function tables.
set print pascal_static-members -- Set printing of pascal static members.
set print pretty -- Set pretty formatting of structures.
set print raw-frame-arguments -- Set whether to print frame arguments in raw form.
set print raw-values -- Set whether to print values in raw form.
set print repeats -- Set threshold for repeated print elements.
set print sevenbit-strings -- Set printing of 8-bit characters in strings as \nnn.
set print static-members -- Set printing of C++ static members.
set print symbol -- Set printing of symbol names when printing pointers.
set print symbol-filename -- Set printing of source filename and line number with <SYMBOL>.
set print symbol-loading -- Set printing of symbol loading messages.
set print thread-events -- Set printing of thread events (such as thread start and exit).
set print type -- Generic command for setting how types print.
set print union -- Set printing of unions interior to structures.
set print vtbl -- Set printing of C++ virtual function tables.

2. 常用的设置

复制代码
# 美化打印,便于阅读
set pagination off  /*显示长的内容,不要打断*/
set print pretty on /*结构体漂亮显示*/
set print array on  /*数组按列的方式显示*/
set print array-indexes on  /*数组加上下标
set print max-depth  4    /*设置结构体的最大打印深度*/

3. 不需要板子,不需要烧录。只要有elf文件,就可以用gdb来进行代码分析。非常的强大方便。

案例1:用gdb打印usb配置描述符的内容

cherryusb的uac/uvc配置描述符,用宏定义了,嵌套了多层宏,非常难以展开,看出其真实的内容是什么。

常用的方法是让代码运行,然后用printf的方法来查看。

其实不用这样,更简单的方式,是直接用arm-none-eabi-gdb对elf文件进行调试,直接print这个结构体变量(全局变量)。

首先用gdb调试elf文件

复制代码
arm-none-eabi-gdb rt-thread.elf

cherryusb的video_static_mjpeg_template.c例子中的这么一个复杂的配置描述符

c 复制代码
static const uint8_t config_descriptor[] = {
    USB_CONFIG_DESCRIPTOR_INIT(USB_VIDEO_DESC_SIZ, 0x02, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER),
    //VIDEO_VC_DESCRIPTOR_INIT(0x00, VIDEO_INT_EP, 0x0100, VIDEO_VC_TERMINAL_LEN, 48000000, 0x02),
    VIDEO_VC_NOEP_DESCRIPTOR_INIT(0x00, VIDEO_INT_EP, 0x0100, VIDEO_VC_TERMINAL_LEN, 48000000, 0x02),
    VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x00, 0x00),
    VIDEO_VS_INPUT_HEADER_DESCRIPTOR_INIT(0x01, VS_HEADER_SIZ, VIDEO_IN_EP, 0x00),
    VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_INIT(0x01, 0x01),
    VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, DBVAL(INTERVAL), 0x01, DBVAL(INTERVAL)),
    VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x01, 0x01),
    /* 1.2.2.2 Standard VideoStream Isochronous Video Data Endpoint Descriptor */
    USB_ENDPOINT_DESCRIPTOR_INIT(VIDEO_IN_EP, 0x05, VIDEO_PACKET_SIZE, 0x01)
};

在gdb中打印config_descriptor,如果不做print格式设置,打印效果如下

复制代码
(gdb) p/x config_descriptor
$1 = {0x9, 0x2, 0x9e, 0x0, 0x2, 0x1, 0x0, 0x80, 0x32, 0x8, 0xb, 0x0, 0x2, 0xe, 0x3, 0x0, 0x0, 0x9, 0x4, 0x0, 0x0, 0x0, 0xe, 0x1, 0x0, 0x2, 0xd, 0x24, 0x1, 0x0, 0x1, 0x34, 0x0, 0x0, 0x6c,
  0xdc, 0x2, 0x1, 0x1, 0x12, 0x24, 0x2, 0x1, 0x1, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0xc, 0x24, 0x5, 0x2, 0x1, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x9, 0x24,
  0x3, 0x3, 0x1, 0x1, 0x0, 0x2, 0x0, 0x9, 0x4, 0x1, 0x0, 0x0, 0xe, 0x2, 0x0, 0x0, 0xe, 0x24, 0x1, 0x1, 0x37, 0x0, 0x81, 0x0, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0xb, 0x24, 0x6, 0x1, 0x1, 0x0,
  0x1, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x24, 0x7, 0x1, 0x0, 0x80, 0x2, 0xe0, 0x1, 0x0, 0x0, 0xca, 0x8, 0x0, 0x0, 0xca, 0x8, 0x0, 0x60, 0x9, 0x0, 0x15, 0x16, 0x5, 0x0, 0x1, 0x15, 0x16, 0x5, 0x0,
  0x9, 0x4, 0x1, 0x1, 0x1, 0xe, 0x2, 0x0, 0x0, 0x7, 0x5, 0x81, 0x5, 0xfc, 0x3, 0x1}

输入如下设置,主要针对array数组的显示:

复制代码
set pagination off  /*显示长的内容,不要打断*/
set print array on  /*数组按列的方式显示*/
set print array-indexes on  /*数组加上下标

做了以上print设置后, 在gdb中打印config_descriptor,效果如下:

复制代码
(gdb) p/x config_descriptor              
$22 = {                                  
  [0x0] = 0x9,                           
  [0x1] = 0x2,                           
  [0x2] = 0x9e,                          
  [0x3] = 0x0,                           
  [0x4] = 0x2,                           
  [0x5] = 0x1,                           
  [0x6] = 0x0,                           
  [0x7] = 0x80,                          
  [0x8] = 0x32,                          
  [0x9] = 0x8,                           
  [0xa] = 0xb,                           
  [0xb] = 0x0,                           
  [0xc] = 0x2,                           
  [0xd] = 0xe,                           
  [0xe] = 0x3,                           
  [0xf] = 0x0,                           
  [0x10] = 0x0,                          
  [0x11] = 0x9,                          
  [0x12] = 0x4,                          
  [0x13] = 0x0,                          
  [0x14] = 0x0,                          
  [0x15] = 0x0,                          
  [0x16] = 0xe,                          
  [0x17] = 0x1,                          
  [0x18] = 0x0,                          
  [0x19] = 0x2,                          
  [0x1a] = 0xd,                          
  [0x1b] = 0x24,                         
  [0x1c] = 0x1,                          
  [0x1d] = 0x0,                          
  [0x1e] = 0x1,                          
  [0x1f] = 0x34,                         
  [0x20] = 0x0,                          
  [0x21] = 0x0,                          
  [0x22] = 0x6c,                         
  [0x23] = 0xdc,                         
  [0x24] = 0x2,                          
  [0x25] = 0x1,                          
  [0x26] = 0x1,                          
  [0x27] = 0x12,                         
  [0x28] = 0x24,                         
  [0x29] = 0x2,                          
  [0x2a] = 0x1,                          
  [0x2b] = 0x1,                          
  [0x2c] = 0x2,                          
  [0x2d] = 0x0,                          
  [0x2e] = 0x0,                          
  [0x2f] = 0x0,                          
  [0x30] = 0x0,                          
  [0x31] = 0x0,                          
  [0x32] = 0x0,                          
  [0x33] = 0x0,                          
  [0x34] = 0x0,                          
  [0x35] = 0x3,                          
  [0x36] = 0x0,                          
  [0x37] = 0x0,                          
  [0x38] = 0x0,                          
  [0x39] = 0xc,                          
  [0x3a] = 0x24,                         
  [0x3b] = 0x5,                          
  [0x3c] = 0x2,                          
  [0x3d] = 0x1,                          
  [0x3e] = 0x0,                          
  [0x3f] = 0x0,                          
  [0x40] = 0x2,                          
  [0x41] = 0x0,                          
  [0x42] = 0x0,                          
  [0x43] = 0x0,                          
  [0x44] = 0x0,                          
  [0x45] = 0x9,                          
  [0x46] = 0x24,                         
  [0x47] = 0x3,                          
  [0x48] = 0x3,                          
  [0x49] = 0x1,                          
  [0x4a] = 0x1,                          
  [0x4b] = 0x0,                          
  [0x4c] = 0x2,                          
  [0x4d] = 0x0,                          
  [0x4e] = 0x9,                          
  [0x4f] = 0x4,                          
  [0x50] = 0x1,                          
  [0x51] = 0x0,                          
  [0x52] = 0x0,                          
  [0x53] = 0xe,                          
  [0x54] = 0x2,                          
  [0x55] = 0x0,                          
  [0x56] = 0x0,                          
  [0x57] = 0xe,                          
  [0x58] = 0x24,                         
  [0x59] = 0x1,                          
  [0x5a] = 0x1,                          
  [0x5b] = 0x37,                         
  [0x5c] = 0x0,                          
  [0x5d] = 0x81,                         
  [0x5e] = 0x0,                          
  [0x5f] = 0x3,                          
  [0x60] = 0x0,                          
  [0x61] = 0x0,                          
  [0x62] = 0x0,                          
  [0x63] = 0x1,                          
  [0x64] = 0x0,                          
  [0x65] = 0xb,                          
  [0x66] = 0x24,                         
  [0x67] = 0x6,                          
  [0x68] = 0x1,                          
  [0x69] = 0x1,                          
  [0x6a] = 0x0,                          
  [0x6b] = 0x1,                          
  [0x6c] = 0x0,                          
  [0x6d] = 0x0,                          
  [0x6e] = 0x0,                          
  [0x6f] = 0x0,                          
  [0x70] = 0x1e,                         
  [0x71] = 0x24,                         
  [0x72] = 0x7,                          
  [0x73] = 0x1,                          
  [0x74] = 0x0,                          
  [0x75] = 0x80,                         
  [0x76] = 0x2,                          
  [0x77] = 0xe0,                         
  [0x78] = 0x1,                          
  [0x79] = 0x0,                          
  [0x7a] = 0x0,                          
  [0x7b] = 0xca,                         
  [0x7c] = 0x8,                          
  [0x7d] = 0x0,                          
  [0x7e] = 0x0,                          
  [0x7f] = 0xca,                         
  [0x80] = 0x8,                          
  [0x81] = 0x0,                          
  [0x82] = 0x60,                         
  [0x83] = 0x9,                          
  [0x84] = 0x0,                          
  [0x85] = 0x15,                         
  [0x86] = 0x16,                         
  [0x87] = 0x5,                          
  [0x88] = 0x0,                          
  [0x89] = 0x1,                          
  [0x8a] = 0x15,                         
  [0x8b] = 0x16,                         
  [0x8c] = 0x5,                          
  [0x8d] = 0x0,                          
  [0x8e] = 0x9,                          
  [0x8f] = 0x4,                          
  [0x90] = 0x1,                          
  [0x91] = 0x1,                          
  [0x92] = 0x1,                          
  [0x93] = 0xe,                          
  [0x94] = 0x2,                          
  [0x95] = 0x0,                          
  [0x96] = 0x0,                          
  [0x97] = 0x7,                          
  [0x98] = 0x5,                          
  [0x99] = 0x81,                         
  [0x9a] = 0x5,                          
  [0x9b] = 0xfc,                         
  [0x9c] = 0x3,                          
  [0x9d] = 0x1                           
}                                        
(gdb)                                    

案例2:用gdb打印复杂结构体,从而完全展开结构体

cherryusb中存在许多非常复杂,嵌套层次非常深的结构体。比如usbh_core中的struct usbh_bus嵌套层次高达9层,很容易把人绕晕。通过gdb打印复杂结构体,可以完全展开结构体,从而清晰的看到结构体的嵌套层次关系。

首先针对结构体进行设置:

复制代码
set pagination off  /*显示长的内容,不要打断*/
set print pretty on /*结构体漂亮显示*/
set print max-depth  4    /*设置结构体的最大打印深度*/

其次通过i variables,可以显示出各个源文件中的所有的全局变量。比如下面列举了一部分显示结果:

复制代码
File rt-thread\components\drivers\usb\cherryusb\class\video\usbd_video.c:
36:     struct usbd_video_priv g_usbd_video[1];

File rt-thread\components\drivers\usb\cherryusb\core\usbd_core.c:
35:     const char desc_array[18][64];
116:    struct usbd_core_priv g_usbd_core[1];
118:    struct usbd_bus g_usbdev_bus[1];

File rt-thread\components\drivers\usb\cherryusb\core\usbh_core.c:
20:     uint8_t ep0_request_buffer[1][512];
18:     usb_slist_t g_bus_head;
21:     struct usb_setup_packet g_setup_buffer[1][2][4];
23:     struct usbh_bus g_usbhost_bus[1];
15:     struct usbh_class_info *usbh_class_info_table_begin;
16:     struct usbh_class_info *usbh_class_info_table_end;

可以看到,在usbh_core.c中,有一个全局结构体数组变量struct usbh_bus g_usbhost_bus[1],正是我们需要的。

我们用p/x g_usbhost_bus[0]打印这个结构体。

  • 首先设置打印层次为3,效果如下

    (gdb) set print max-depth 3
    (gdb) p/x g_usbhost_bus[0]
    $23 = {
    list = {
    next = 0x0
    },
    busid = 0x0,
    hcd = {
    reg_base = 0x0,
    hcd_id = 0x0,
    roothub_intbuf = {
    [0x0] = 0x0,
    [0x1] = 0x0
    },
    roothub = {
    connected = 0x0,
    is_roothub = 0x0,
    index = 0x0,
    hub_addr = 0x0,
    speed = 0x0,
    nports = 0x0,
    powerdelay = 0x0,
    tt_think = 0x0,
    ismtt = 0x0,
    hub_desc = {...},
    hub_ss_desc = {...},
    child = {...},
    parent = 0x0,
    bus = 0x0,
    intin = 0x0,
    intin_urb = {...},
    int_buffer = 0x0,
    int_timer = 0x0
    }
    },
    devgen = {
    next = 0x0,
    alloctab = {
    [0x0] = 0x0,
    [0x1] = 0x0,
    [0x2] = 0x0,
    [0x3] = 0x0
    }
    },
    hub_thread = 0x0,
    hub_mq = 0x0
    }

  • 再设置打印层次为4,效果如下

    (gdb) set print max-depth 4
    (gdb) p/x g_usbhost_bus[0]
    $24 = {
    list = {
    next = 0x0
    },
    busid = 0x0,
    hcd = {
    reg_base = 0x0,
    hcd_id = 0x0,
    roothub_intbuf = {
    [0x0] = 0x0,
    [0x1] = 0x0
    },
    roothub = {
    connected = 0x0,
    is_roothub = 0x0,
    index = 0x0,
    hub_addr = 0x0,
    speed = 0x0,
    nports = 0x0,
    powerdelay = 0x0,
    tt_think = 0x0,
    ismtt = 0x0,
    hub_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    DeviceRemovable = 0x0,
    PortPwrCtrlMask = 0x0
    },
    hub_ss_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    bHubHdrDecLat = 0x0,
    wHubDelay = 0x0,
    DeviceRemovable = 0x0
    },
    child = {
    [0x0] = {...},
    [0x1] = {...},
    [0x2] = {...},
    [0x3] = {...}
    },
    parent = 0x0,
    bus = 0x0,
    intin = 0x0,
    intin_urb = {
    list = {...},
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = {...}
    },
    int_buffer = 0x0,
    int_timer = 0x0
    }
    },
    devgen = {
    next = 0x0,
    alloctab = {
    [0x0] = 0x0,
    [0x1] = 0x0,
    [0x2] = 0x0,
    [0x3] = 0x0
    }
    },
    hub_thread = 0x0,
    hub_mq = 0x0
    }

  • 再设置打印层次为5,效果如下

    (gdb) set print max-depth 5
    (gdb) p/x g_usbhost_bus[0]
    $25 = {
    list = {
    next = 0x0
    },
    busid = 0x0,
    hcd = {
    reg_base = 0x0,
    hcd_id = 0x0,
    roothub_intbuf = {
    [0x0] = 0x0,
    [0x1] = 0x0
    },
    roothub = {
    connected = 0x0,
    is_roothub = 0x0,
    index = 0x0,
    hub_addr = 0x0,
    speed = 0x0,
    nports = 0x0,
    powerdelay = 0x0,
    tt_think = 0x0,
    ismtt = 0x0,
    hub_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    DeviceRemovable = 0x0,
    PortPwrCtrlMask = 0x0
    },
    hub_ss_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    bHubHdrDecLat = 0x0,
    wHubDelay = 0x0,
    DeviceRemovable = 0x0
    },
    child = {
    [0x0] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {...},
    config = {...},
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {...},
    ep0_urb = {...},
    mutex = 0x0
    },
    [0x1] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {...},
    config = {...},
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {...},
    ep0_urb = {...},
    mutex = 0x0
    },
    [0x2] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {...},
    config = {...},
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {...},
    ep0_urb = {...},
    mutex = 0x0
    },
    [0x3] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {...},
    config = {...},
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {...},
    ep0_urb = {...},
    mutex = 0x0
    }
    },
    parent = 0x0,
    bus = 0x0,
    intin = 0x0,
    intin_urb = {
    list = {
    next = 0x0
    },
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = 0x24009ae8 <g_usbhost_bus+11084>
    },
    int_buffer = 0x0,
    int_timer = 0x0
    }
    },
    devgen = {
    next = 0x0,
    alloctab = {
    [0x0] = 0x0,
    [0x1] = 0x0,
    [0x2] = 0x0,
    [0x3] = 0x0
    }
    },
    hub_thread = 0x0,
    hub_mq = 0x0
    }

  • 再设置打印层次为6,效果如下

    (gdb) set print max-depth 6
    (gdb) p/x g_usbhost_bus[0]
    $26 = {
    list = {
    next = 0x0
    },
    busid = 0x0,
    hcd = {
    reg_base = 0x0,
    hcd_id = 0x0,
    roothub_intbuf = {
    [0x0] = 0x0,
    [0x1] = 0x0
    },
    roothub = {
    connected = 0x0,
    is_roothub = 0x0,
    index = 0x0,
    hub_addr = 0x0,
    speed = 0x0,
    nports = 0x0,
    powerdelay = 0x0,
    tt_think = 0x0,
    ismtt = 0x0,
    hub_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    DeviceRemovable = 0x0,
    PortPwrCtrlMask = 0x0
    },
    hub_ss_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bNbrPorts = 0x0,
    wHubCharacteristics = 0x0,
    bPwrOn2PwrGood = 0x0,
    bHubContrCurrent = 0x0,
    bHubHdrDecLat = 0x0,
    wHubDelay = 0x0,
    DeviceRemovable = 0x0
    },
    child = {
    [0x0] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bcdUSB = 0x0,
    bDeviceClass = 0x0,
    bDeviceSubClass = 0x0,
    bDeviceProtocol = 0x0,
    bMaxPacketSize0 = 0x0,
    idVendor = 0x0,
    idProduct = 0x0,
    bcdDevice = 0x0,
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    bNumConfigurations = 0x0
    },
    config = {
    config_desc = {...},
    intf = {...}
    },
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bEndpointAddress = 0x0,
    bmAttributes = 0x0,
    wMaxPacketSize = 0x0,
    bInterval = 0x0
    },
    ep0_urb = {
    list = {...},
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = {...}
    },
    mutex = 0x0
    },
    [0x1] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bcdUSB = 0x0,
    bDeviceClass = 0x0,
    bDeviceSubClass = 0x0,
    bDeviceProtocol = 0x0,
    bMaxPacketSize0 = 0x0,
    idVendor = 0x0,
    idProduct = 0x0,
    bcdDevice = 0x0,
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    bNumConfigurations = 0x0
    },
    config = {
    config_desc = {...},
    intf = {...}
    },
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bEndpointAddress = 0x0,
    bmAttributes = 0x0,
    wMaxPacketSize = 0x0,
    bInterval = 0x0
    },
    ep0_urb = {
    list = {...},
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = {...}
    },
    mutex = 0x0
    },
    [0x2] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bcdUSB = 0x0,
    bDeviceClass = 0x0,
    bDeviceSubClass = 0x0,
    bDeviceProtocol = 0x0,
    bMaxPacketSize0 = 0x0,
    idVendor = 0x0,
    idProduct = 0x0,
    bcdDevice = 0x0,
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    bNumConfigurations = 0x0
    },
    config = {
    config_desc = {...},
    intf = {...}
    },
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bEndpointAddress = 0x0,
    bmAttributes = 0x0,
    wMaxPacketSize = 0x0,
    bInterval = 0x0
    },
    ep0_urb = {
    list = {...},
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = {...}
    },
    mutex = 0x0
    },
    [0x3] = {
    connected = 0x0,
    port = 0x0,
    dev_addr = 0x0,
    speed = 0x0,
    depth = 0x0,
    route = 0x0,
    slot_id = 0x0,
    device_desc = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bcdUSB = 0x0,
    bDeviceClass = 0x0,
    bDeviceSubClass = 0x0,
    bDeviceProtocol = 0x0,
    bMaxPacketSize0 = 0x0,
    idVendor = 0x0,
    idProduct = 0x0,
    bcdDevice = 0x0,
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    bNumConfigurations = 0x0
    },
    config = {
    config_desc = {...},
    intf = {...}
    },
    iManufacturer = 0x0,
    iProduct = 0x0,
    iSerialNumber = 0x0,
    raw_config_desc = 0x0,
    setup = 0x0,
    parent = 0x0,
    self = 0x0,
    bus = 0x0,
    ep0 = {
    bLength = 0x0,
    bDescriptorType = 0x0,
    bEndpointAddress = 0x0,
    bmAttributes = 0x0,
    wMaxPacketSize = 0x0,
    bInterval = 0x0
    },
    ep0_urb = {
    list = {...},
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = {...}
    },
    mutex = 0x0
    }
    },
    parent = 0x0,
    bus = 0x0,
    intin = 0x0,
    intin_urb = {
    list = {
    next = 0x0
    },
    hcpriv = 0x0,
    hport = 0x0,
    ep = 0x0,
    data_toggle = 0x0,
    interval = 0x0,
    setup = 0x0,
    transfer_buffer = 0x0,
    transfer_buffer_length = 0x0,
    transfer_flags = 0x0,
    actual_length = 0x0,
    timeout = 0x0,
    errorcode = 0x0,
    num_of_iso_packets = 0x0,
    start_frame = 0x0,
    complete = 0x0,
    arg = 0x0,
    iso_packet = 0x24009ae8 <g_usbhost_bus+11084>
    },
    int_buffer = 0x0,
    int_timer = 0x0
    }
    },
    devgen = {
    next = 0x0,
    alloctab = {
    [0x0] = 0x0,
    [0x1] = 0x0,
    [0x2] = 0x0,
    [0x3] = 0x0
    }
    },
    hub_thread = 0x0,
    hub_mq = 0x0
    }

相关推荐
瓦特what?3 分钟前
C + +
c语言·开发语言·c++·经验分享·笔记·算法·程序员创富
字节高级特工15 分钟前
线程互斥锁:守护临界区的关键
linux·运维·服务器·c语言
刃神太酷啦1 小时前
C++ 容器适配器与核心数据结构精解:栈、队列、deque 底层实现与实战应用----《Hello C++ Wrold!》(17)--(C/C++)
java·c语言·数据结构·c++·qt·算法·leetcode
Geehy极海半导体1 小时前
基于极海APM32E030的智能手表设计(上):健康监测与GPS定位功能实现
单片机·嵌入式硬件·物联网
brave and determined2 小时前
硬件-音频学习DAY1——音箱材料选择:密度板为何完胜实木
嵌入式硬件·音乐·硬件设计·电子设计·音响材料·音频设计·音响设计
遇见尚硅谷2 小时前
挑战指针题
c语言·数据结构·算法
金色光环3 小时前
stm32/gd32驱动DAC8830
stm32·单片机·嵌入式硬件·dg32
用户6120414922134 小时前
C语言做的科学转换计算器
c语言·c++·后端
李永奉4 小时前
STM32-驱动OLED显示屏使用SPI(软件模拟时序)实现
stm32·单片机·嵌入式硬件