On Mon, May 14, 2012 at 9:19 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Mon, May 14, 2012 at 9:16 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
>> Somehow xusb now segfaults sometimes.
>
> BTW, 1.0.11 release never segfaults.

The default xusb is actually a wrapper. So I rebuild xusb with static
library and then run gdb. Here is the result.

mymacmini:example1 xiaofanc$ gcc -I ../libusb
../libusb/.libs/libusb-1.0.a -lobjc -Wl,-framework,IOKit
-Wl,-framework,CoreFoundation -o xusb xusb.c

mymacmini:example1 xiaofanc$ ./xusb -d 04d8:fa2e
Using libusbx v1.0.11.10505

Opening device...
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa000000
[ 0.000070] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.000081] [00000707] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x7fd332e03a48 at 0x0
[ 0.000644] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa100000
[ 0.000795] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.000810] [00000707] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x7fd332e037f8 at 0x7fd332e039b0
[ 0.001345] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa110000
[ 0.188373] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa130000
[ 0.188801] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.188820] [00000707] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x10b30a6c8 at 0x7fd332e03760
[ 0.189309] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa120000
[ 0.190469] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.190488] [00000707] libusbx: info [process_new_device] found device
with address 5 port = 2 parent = 0x10b30a9b8 at 0x7fd332e03760
[ 0.191046] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa113000
[ 0.378711] [00000707] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
[ 0.379490] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa132000
[ 0.380146] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.380161] [00000707] libusbx: info [process_new_device] found device
with address 8 port = 2 parent = 0x7fd3348001e8 at 0x0
[ 0.380600] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa133000
[ 0.381454] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.381472] [00000707] libusbx: info [process_new_device] found device
with address 9 port = 3 parent = 0x7fd332e038b8 at 0x0
[ 0.381967] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa134000
[ 0.382365] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.382379] [00000707] libusbx: info [process_new_device] found device
with address 10 port = 4 parent = 0x7fd332c01a88 at 0x0
[ 0.382811] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa131000
[ 0.383382] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.383408] [00000707] libusbx: info [process_new_device] found device
with address 6 port = 1 parent = 0x7fd332e03568 at 0x0
[ 0.383798] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfd000000
[ 0.383836] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.383854] [00000707] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x7fd332e03628 at 0x0
[ 0.384269] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfd100000
[ 0.384388] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.384402] [00000707] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x7fd332e02838 at 0x7fd332e03590
[ 0.384835] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfd110000
[ 0.531437] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.531472] [00000707] libusbx: info [process_new_device] found device
with address 3 port = 1 parent = 0x10b30ad18 at 0x7fd332e027a0
[ 0.532141] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfd130000
[ 0.532753] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.532782] [00000707] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x10b30a868 at 0x7fd332e027a0
[ 0.534319] [00000707] libusbx: info [darwin_open] device open for access
[ 0.535398] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa000000
[ 0.535449] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.535458] [00000707] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x10b30a6c8 at 0x10b30a7d0
[ 0.535871] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa100000
[ 0.536018] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.536036] [00000707] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x10b30ad18 at 0x10b30a630
[ 0.536454] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa110000
[ 0.722467] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa130000
[ 0.722937] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.722958] [00000707] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x10b30ae48 at 0x10b30ac80
[ 0.723440] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa120000
[ 0.724788] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.724807] [00000707] libusbx: info [process_new_device] found device
with address 5 port = 2 parent = 0x10b30c3f8 at 0x10b30ac80
[ 0.725264] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa113000
[ 0.911809] [00000707] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
[ 0.912805] [00000707] libusbx: info [process_new_device] allocating
new device for location 0xfa132000
[ 0.913693] [00000707] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
Segmentation fault: 11

mymacmini:example1 xiaofanc$ gdb --args ./xusb -d 04d8:fa2e
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for
shared libraries ..... done

(gdb) run
Starting program: /Users/xiaofanc/work/libusbx/libusbx/example1/xusb
-d 04d8:fa2e
Reading symbols for shared libraries ++++................................ done
Using libusbx v1.0.11.10505

Opening device...
Reading symbols for shared libraries . done
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa000000
[ 0.000065] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.000078] [00001307] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x10010b818 at 0x0
[ 0.000533] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa100000
[ 0.000842] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.000856] [00001307] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x10010aa88 at 0x10010b780
[ 0.001307] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa110000
[ 0.189599] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa130000
[ 0.189910] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.189930] [00001307] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x1006004f8 at 0x10010a9f0
[ 0.190440] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa120000
[ 0.191603] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.191623] [00001307] libusbx: info [process_new_device] found device
with address 5 port = 2 parent = 0x100201918 at 0x10010a9f0
[ 0.192027] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa113000
[ 0.378914] [00001307] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
[ 0.379615] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa132000
[ 0.380235] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.380256] [00001307] libusbx: info [process_new_device] found device
with address 8 port = 2 parent = 0x100603158 at 0x0
[ 0.380670] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa133000
[ 0.381732] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.381753] [00001307] libusbx: info [process_new_device] found device
with address 9 port = 3 parent = 0x1006006d8 at 0x0
[ 0.382250] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa134000
[ 0.382608] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.382626] [00001307] libusbx: info [process_new_device] found device
with address 10 port = 4 parent = 0x100603218 at 0x0
[ 0.383075] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa131000
[ 0.383648] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.383675] [00001307] libusbx: info [process_new_device] found device
with address 6 port = 1 parent = 0x100603ad8 at 0x0
[ 0.384049] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfd000000
[ 0.384085] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.384102] [00001307] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x1006032d8 at 0x0
[ 0.384474] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfd100000
[ 0.384648] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.384667] [00001307] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x100600348 at 0x100603240
[ 0.385124] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfd110000
[ 0.533111] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.533138] [00001307] libusbx: info [process_new_device] found device
with address 3 port = 1 parent = 0x100201778 at 0x1006002b0
[ 0.533651] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfd130000
[ 0.534279] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.534306] [00001307] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x10010b958 at 0x1006002b0
[ 0.535674] [00001307] libusbx: info [darwin_open] device open for access
[ 0.536549] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa000000
[ 0.536588] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.536596] [00001307] libusbx: info [process_new_device] found device
with address 1 port = 0 parent = 0x1006006d8 at 0x1006002b0
[ 0.536940] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa100000
[ 0.537144] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.537156] [00001307] libusbx: info [process_new_device] found device
with address 2 port = 1 parent = 0x1006004f8 at 0x100600640
[ 0.537564] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa110000
[ 0.723685] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa130000
[ 0.724047] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.724064] [00001307] libusbx: info [process_new_device] found device
with address 4 port = 3 parent = 0x1006031e8 at 0x100600460
[ 0.724465] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa120000
[ 0.725544] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1
[ 0.725560] [00001307] libusbx: info [process_new_device] found device
with address 5 port = 2 parent = 0x10010b818 at 0x100600460
[ 0.725980] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa113000
[ 0.912034] [00001307] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
[ 0.912793] [00001307] libusbx: info [process_new_device] allocating
new device for location 0xfa132000
[ 0.913785] [00001307] libusbx: info [darwin_check_configuration]
active config: 1, first config: 1

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x000000010000ae96 in process_new_device [inlined] () at
/Users/xiaofanc/work/libusbx/libusbx/libusb/os/darwin_usb.c:767
767           if (parent_priv->location == parent_location) {
(gdb) bt
#0  0x000000010000ae96 in process_new_device [inlined] () at
/Users/xiaofanc/work/libusbx/libusbx/libusb/os/darwin_usb.c:767
#1  0x000000010000ae96 in darwin_get_device_list (ctx=0x7fff5fbff660,
_discdevs=0x7fff5fbff660) at darwin_usb.c:829
#2  0x000000010000227a in libusb_get_device_list (ctx=0x0,
list=0x7fff5fbff6b0) at core.c:603
#3  0x0000000100002d72 in libusb_get_port_path (ctx=0x10010a040,
dev=0x100603a40, path=0x7fff5fbff83f "", path_len=8 '\b') at
core.c:688
#4  0x000000010000d6e2 in test_device ()
#5  0x000000010000e7db in main ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y



-- 
Xiaofan

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to