[Openais] Re: openais segfault
Mark Haverkamp
markh at osdl.org
Wed Apr 5 14:48:53 PDT 2006
On Wed, 2006-04-05 at 14:39 -0700, Steven Dake wrote:
> Love those bugs that go away with printfs :)
>
> Can you try it without optimization without the printfs. If that works,
> then it is likely an optimization bug. It looks like you are already
> running in debug mode though. So please do the following
>
> rm lcr_ifact.c
> svn udpate lcr_ifact.c
> make (with DEBUG)
> objdump -S lcr_ifact.o
>
> I'll analyze the differences in the compiler output.
cc -O3 -Wall -fomit-frame-pointer -DOPENAIS_LINUX -I../include -g -DDEBUG -c -o lcr_ifact.o lcr_ifact.c
>
> Regards
> -steve
>
--
Mark Haverkamp <markh at osdl.org>
-------------- next part --------------
lcr_ifact.o: file format elf32-i386
Disassembly of section .text:
00000000 <lcr_ifact_release>:
return (0);
}
int lcr_ifact_release (unsigned int handle)
{
0: 83 ec 10 sub $0x10,%esp
3: 8b 44 24 14 mov 0x14(%esp),%eax
struct hdb_handle_database *handle_database,
unsigned int handle,
void **instance)
{
if (handle >= handle_database->handle_count) {
7: 3b 05 0c 00 00 00 cmp 0xc,%eax
d: 72 09 jb 18 <lcr_ifact_release+0x18>
return (-1);
}
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
return (-1);
}
*instance = handle_database->handles[handle].instance;
handle_database->handles[handle].ref_count += 1;
f: b8 ff ff ff ff mov $0xffffffff,%eax
struct lcr_iface_instance *iface_instance;
int res = 0;
res = hdb_handle_get (&lcr_iface_instance_database,
handle, (void *)&iface_instance);
return (res);
if (iface_instance->destructor) {
iface_instance->destructor (iface_instance->context);
}
hdb_handle_put (&lcr_component_instance_database,
iface_instance->component_handle);
hdb_handle_put (&lcr_iface_instance_database, handle);
hdb_handle_destroy (&lcr_iface_instance_database, handle);
return (res);
}
14: 83 c4 10 add $0x10,%esp
17: c3 ret
if (handle >= handle_database->handle_count) {
return (-1);
}
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
18: 8d 04 40 lea (%eax,%eax,2),%eax
1b: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
22: 03 15 10 00 00 00 add 0x10,%edx
28: 83 3a 02 cmpl $0x2,(%edx)
2b: 75 e2 jne f <lcr_ifact_release+0xf>
return (-1);
}
*instance = handle_database->handles[handle].instance;
2d: 8b 42 04 mov 0x4(%edx),%eax
handle_database->handles[handle].ref_count += 1;
30: 83 42 08 01 addl $0x1,0x8(%edx)
34: 89 44 24 0c mov %eax,0xc(%esp)
38: 31 c0 xor %eax,%eax
3a: eb d8 jmp 14 <lcr_ifact_release+0x14>
3c: 8d 74 26 00 lea 0x0(%esi),%esi
00000040 <lcr_select_so>:
40: 83 ec 0c sub $0xc,%esp
43: 89 7c 24 08 mov %edi,0x8(%esp)
47: 8b 7c 24 10 mov 0x10(%esp),%edi
4b: 89 74 24 04 mov %esi,0x4(%esp)
4f: 83 c7 0b add $0xb,%edi
52: 89 3c 24 mov %edi,(%esp)
55: e8 fc ff ff ff call 56 <lcr_select_so+0x16>
5a: 31 d2 xor %edx,%edx
5c: 83 f8 06 cmp $0x6,%eax
5f: 76 17 jbe 78 <lcr_select_so+0x38>
61: fc cld
62: 8d 7c 07 fa lea 0xfffffffa(%edi,%eax,1),%edi
66: be 00 00 00 00 mov $0x0,%esi
6b: b9 07 00 00 00 mov $0x7,%ecx
70: f3 a6 repz cmpsb %es:(%edi),%ds:(%esi)
72: 0f 94 c0 sete %al
75: 0f b6 d0 movzbl %al,%edx
78: 8b 74 24 04 mov 0x4(%esp),%esi
7c: 89 d0 mov %edx,%eax
7e: 8b 7c 24 08 mov 0x8(%esp),%edi
82: 83 c4 0c add $0xc,%esp
85: c3 ret
86: 8d 76 00 lea 0x0(%esi),%esi
89: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
00000090 <lcr_component_register>:
void lcr_component_register (struct lcr_comp *comp)
{
90: 55 push %ebp
91: 57 push %edi
92: 56 push %esi
93: 53 push %ebx
94: 83 ec 2c sub $0x2c,%esp
void *new_handles;
int found = 0;
void *instance;
for (handle = 0; handle < handle_database->handle_count; handle++) {
97: 8b 1d 00 00 00 00 mov 0x0,%ebx
9d: 8b 6c 24 40 mov 0x40(%esp),%ebp
void *new_handles;
int found = 0;
void *instance;
for (handle = 0; handle < handle_database->handle_count; handle++) {
a1: 85 db test %ebx,%ebx
a3: 0f 84 34 01 00 00 je 1dd <lcr_component_register+0x14d>
if (handle_database->handles[handle].state == HDB_HANDLE_STATE_EMPTY) {
a9: 8b 3d 04 00 00 00 mov 0x4,%edi
af: 31 c9 xor %ecx,%ecx
b1: 8b 07 mov (%edi),%eax
b3: 89 fa mov %edi,%edx
b5: 85 c0 test %eax,%eax
b7: 75 11 jne ca <lcr_component_register+0x3a>
b9: e9 2c 01 00 00 jmp 1ea <lcr_component_register+0x15a>
be: 89 f6 mov %esi,%esi
c0: 8b 42 0c mov 0xc(%edx),%eax
c3: 83 c2 0c add $0xc,%edx
c6: 85 c0 test %eax,%eax
c8: 74 2c je f6 <lcr_component_register+0x66>
ca: 83 c1 01 add $0x1,%ecx
cd: 39 cb cmp %ecx,%ebx
cf: 89 ce mov %ecx,%esi
d1: 75 ed jne c0 <lcr_component_register+0x30>
found = 1;
break;
}
}
if (found == 0) {
handle_database->handle_count += 1;
d3: 8d 43 01 lea 0x1(%ebx),%eax
d6: a3 00 00 00 00 mov %eax,0x0
new_handles = (struct hdb_handle *)realloc (handle_database->handles,
db: 8d 04 40 lea (%eax,%eax,2),%eax
de: c1 e0 02 shl $0x2,%eax
e1: 89 44 24 04 mov %eax,0x4(%esp)
e5: 89 3c 24 mov %edi,(%esp)
e8: e8 fc ff ff ff call e9 <lcr_component_register+0x59>
sizeof (struct hdb_handle) * handle_database->handle_count);
if (new_handles == 0) {
ed: 85 c0 test %eax,%eax
ef: 74 51 je 142 <lcr_component_register+0xb2>
return (-1);
}
handle_database->handles = new_handles;
f1: a3 04 00 00 00 mov %eax,0x4
}
instance = (void *)malloc (instance_size);
f6: c7 04 24 10 01 00 00 movl $0x110,(%esp)
fd: e8 fc ff ff ff call fe <lcr_component_register+0x6e>
if (instance == 0) {
102: 85 c0 test %eax,%eax
104: 89 c3 mov %eax,%ebx
106: 74 3a je 142 <lcr_component_register+0xb2>
return (-1);
}
memset (instance, 0, instance_size);
108: c7 44 24 08 10 01 00 movl $0x110,0x8(%esp)
10f: 00
110: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
117: 00
118: 89 04 24 mov %eax,(%esp)
11b: e8 fc ff ff ff call 11c <lcr_component_register+0x8c>
handle_database->handles[handle].state = HDB_HANDLE_STATE_ACTIVE;
120: 8d 04 76 lea (%esi,%esi,2),%eax
123: c1 e0 02 shl $0x2,%eax
126: 03 05 04 00 00 00 add 0x4,%eax
12c: c7 00 02 00 00 00 movl $0x2,(%eax)
handle_database->handles[handle].instance = instance;
handle_database->handles[handle].ref_count = 1;
132: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
139: 89 58 04 mov %ebx,0x4(%eax)
*handle_id_out = handle;
13c: 89 35 18 00 00 00 mov %esi,0x18
struct lcr_component_instance *instance;
hdb_handle_create (&lcr_component_instance_database,
sizeof (struct lcr_component_instance),
&g_component_handle);
hdb_handle_get (&lcr_component_instance_database,
142: a1 18 00 00 00 mov 0x18,%eax
struct hdb_handle_database *handle_database,
unsigned int handle,
void **instance)
{
if (handle >= handle_database->handle_count) {
147: 3b 05 00 00 00 00 cmp 0x0,%eax
14d: 73 15 jae 164 <lcr_component_register+0xd4>
return (-1);
}
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
14f: 8d 04 40 lea (%eax,%eax,2),%eax
152: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
159: 03 15 04 00 00 00 add 0x4,%edx
15f: 83 3a 02 cmpl $0x2,(%edx)
162: 74 6c je 1d0 <lcr_component_register+0x140>
g_component_handle, (void *)&instance);
instance->ifaces = comp->ifaces;
164: 8b 54 24 28 mov 0x28(%esp),%edx
168: 8b 45 00 mov 0x0(%ebp),%eax
instance->iface_count = comp->iface_count;
instance->dl_handle = NULL;
16b: c7 42 08 00 00 00 00 movl $0x0,0x8(%edx)
172: 89 02 mov %eax,(%edx)
174: 8b 45 04 mov 0x4(%ebp),%eax
177: 89 42 04 mov %eax,0x4(%edx)
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
17a: a1 18 00 00 00 mov 0x18,%eax
17f: 8d 04 40 lea (%eax,%eax,2),%eax
182: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
189: 89 da mov %ebx,%edx
18b: 03 15 04 00 00 00 add 0x4,%edx
191: 8b 42 08 mov 0x8(%edx),%eax
194: 83 e8 01 sub $0x1,%eax
assert (handle_database->handles[handle].ref_count >= 0);
197: 83 f8 00 cmp $0x0,%eax
19a: 89 42 08 mov %eax,0x8(%edx)
19d: 7c 52 jl 1f1 <lcr_component_register+0x161>
if (handle_database->handles[handle].ref_count == 0) {
19f: 75 27 jne 1c8 <lcr_component_register+0x138>
free (handle_database->handles[handle].instance);
1a1: 8b 42 04 mov 0x4(%edx),%eax
1a4: 89 04 24 mov %eax,(%esp)
1a7: e8 fc ff ff ff call 1a8 <lcr_component_register+0x118>
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
1ac: 89 d8 mov %ebx,%eax
1ae: 03 05 04 00 00 00 add 0x4,%eax
1b4: c7 00 00 00 00 00 movl $0x0,(%eax)
1ba: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
1c1: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
hdb_handle_put (&lcr_component_instance_database,
g_component_handle);
}
1c8: 83 c4 2c add $0x2c,%esp
1cb: 5b pop %ebx
1cc: 5e pop %esi
1cd: 5f pop %edi
1ce: 5d pop %ebp
1cf: c3 ret
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
return (-1);
}
*instance = handle_database->handles[handle].instance;
1d0: 8b 42 04 mov 0x4(%edx),%eax
handle_database->handles[handle].ref_count += 1;
1d3: 83 42 08 01 addl $0x1,0x8(%edx)
1d7: 89 44 24 28 mov %eax,0x28(%esp)
1db: eb 87 jmp 164 <lcr_component_register+0xd4>
1dd: 8b 3d 04 00 00 00 mov 0x4,%edi
1e3: 31 f6 xor %esi,%esi
1e5: e9 e9 fe ff ff jmp d3 <lcr_component_register+0x43>
void *new_handles;
int found = 0;
void *instance;
for (handle = 0; handle < handle_database->handle_count; handle++) {
1ea: 31 f6 xor %esi,%esi
1ec: e9 05 ff ff ff jmp f6 <lcr_component_register+0x66>
if (handle_database->handles[handle].state == HDB_HANDLE_STATE_EMPTY) {
found = 1;
break;
}
}
if (found == 0) {
handle_database->handle_count += 1;
new_handles = (struct hdb_handle *)realloc (handle_database->handles,
sizeof (struct hdb_handle) * handle_database->handle_count);
if (new_handles == 0) {
return (-1);
}
handle_database->handles = new_handles;
}
instance = (void *)malloc (instance_size);
if (instance == 0) {
return (-1);
}
memset (instance, 0, instance_size);
handle_database->handles[handle].state = HDB_HANDLE_STATE_ACTIVE;
handle_database->handles[handle].instance = instance;
handle_database->handles[handle].ref_count = 1;
*handle_id_out = handle;
return (0);
}
static inline int hdb_handle_get (
struct hdb_handle_database *handle_database,
unsigned int handle,
void **instance)
{
if (handle >= handle_database->handle_count) {
return (-1);
}
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
return (-1);
}
*instance = handle_database->handles[handle].instance;
handle_database->handles[handle].ref_count += 1;
return (0);
}
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
assert (handle_database->handles[handle].ref_count >= 0);
1f1: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
1f8: 00
1f9: c7 44 24 08 90 00 00 movl $0x90,0x8(%esp)
200: 00
201: c7 44 24 04 07 00 00 movl $0x7,0x4(%esp)
208: 00
209: c7 04 24 00 00 00 00 movl $0x0,(%esp)
210: e8 fc ff ff ff call 211 <lcr_component_register+0x181>
215: 8d 74 26 00 lea 0x0(%esi),%esi
219: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
00000220 <lcr_ifact_reference>:
220: 55 push %ebp
221: 57 push %edi
222: 56 push %esi
223: 53 push %ebx
224: 81 ec 3c 06 00 00 sub $0x63c,%esp
22a: 8d 84 24 30 04 00 00 lea 0x430(%esp),%eax
231: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
238: 00
239: 89 04 24 mov %eax,(%esp)
23c: e8 fc ff ff ff call 23d <lcr_ifact_reference+0x1d>
241: 8d 8c 24 30 04 00 00 lea 0x430(%esp),%ecx
248: 8b 01 mov (%ecx),%eax
24a: 83 c1 04 add $0x4,%ecx
24d: 8d 90 ff fe fe fe lea 0xfefefeff(%eax),%edx
253: f7 d0 not %eax
255: 21 c2 and %eax,%edx
257: 81 e2 80 80 80 80 and $0x80808080,%edx
25d: 74 e9 je 248 <lcr_ifact_reference+0x28>
25f: f7 c2 80 80 00 00 test $0x8080,%edx
265: 75 06 jne 26d <lcr_ifact_reference+0x4d>
267: c1 ea 10 shr $0x10,%edx
26a: 83 c1 02 add $0x2,%ecx
26d: 00 d2 add %dl,%dl
26f: 83 d9 03 sbb $0x3,%ecx
272: 66 c7 01 2f 00 movw $0x2f,(%ecx)
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
277: c7 05 08 00 00 00 00 movl $0x0,0x8
27e: 00 00 00
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
281: 8b 15 08 00 00 00 mov 0x8,%edx
287: 39 15 00 00 00 00 cmp %edx,0x0
28d: 89 d6 mov %edx,%esi
28f: 76 43 jbe 2d4 <lcr_ifact_reference+0xb4>
291: 8b 8c 24 30 06 00 00 mov 0x630(%esp),%ecx
298: eb 08 jmp 2a2 <lcr_ifact_reference+0x82>
29a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2a0: 89 f2 mov %esi,%edx
2a2: 3b 15 00 00 00 00 cmp 0x0,%edx
2a8: 73 19 jae 2c3 <lcr_ifact_reference+0xa3>
2aa: 8d 04 52 lea (%edx,%edx,2),%eax
2ad: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
2b4: 03 1d 04 00 00 00 add 0x4,%ebx
2ba: 83 3b 02 cmpl $0x2,(%ebx)
2bd: 0f 84 8a 04 00 00 je 74d <lcr_ifact_reference+0x52d>
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
2c3: 8d 72 01 lea 0x1(%edx),%esi
2c6: 39 35 00 00 00 00 cmp %esi,0x0
2cc: 89 35 08 00 00 00 mov %esi,0x8
2d2: 77 cc ja 2a0 <lcr_ifact_reference+0x80>
2d4: 8d 84 24 34 06 00 00 lea 0x634(%esp),%eax
2db: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
2e2: 00
2e3: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
2ea: 00
2eb: 89 44 24 04 mov %eax,0x4(%esp)
2ef: c7 04 24 18 00 00 00 movl $0x18,(%esp)
2f6: e8 fc ff ff ff call 2f7 <lcr_ifact_reference+0xd7>
2fb: 83 f8 00 cmp $0x0,%eax
2fe: 89 44 24 1c mov %eax,0x1c(%esp)
302: 0f 8c f6 04 00 00 jl 7fe <lcr_ifact_reference+0x5de>
308: 0f 84 6c 01 00 00 je 47a <lcr_ifact_reference+0x25a>
30e: c7 44 24 20 00 00 00 movl $0x0,0x20(%esp)
315: 00
316: 8b 84 24 34 06 00 00 mov 0x634(%esp),%eax
31d: 8d 8c 24 30 04 00 00 lea 0x430(%esp),%ecx
324: 8b 54 24 20 mov 0x20(%esp),%edx
328: 8b 04 90 mov (%eax,%edx,4),%eax
32b: 89 4c 24 08 mov %ecx,0x8(%esp)
32f: c7 44 24 04 33 00 00 movl $0x33,0x4(%esp)
336: 00
337: 83 c0 0b add $0xb,%eax
33a: 89 44 24 0c mov %eax,0xc(%esp)
33e: 8d 44 24 30 lea 0x30(%esp),%eax
342: 89 04 24 mov %eax,(%esp)
345: e8 fc ff ff ff call 346 <lcr_ifact_reference+0x126>
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
34a: c7 05 08 00 00 00 00 movl $0x0,0x8
351: 00 00 00
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
354: 8b 15 08 00 00 00 mov 0x8,%edx
35a: 39 15 00 00 00 00 cmp %edx,0x0
360: 89 d3 mov %edx,%ebx
362: 77 04 ja 368 <lcr_ifact_reference+0x148>
364: eb 34 jmp 39a <lcr_ifact_reference+0x17a>
366: 89 da mov %ebx,%edx
368: 3b 15 00 00 00 00 cmp 0x0,%edx
36e: 73 19 jae 389 <lcr_ifact_reference+0x169>
370: 8d 04 52 lea (%edx,%edx,2),%eax
373: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
37a: 03 0d 04 00 00 00 add 0x4,%ecx
380: 83 39 02 cmpl $0x2,(%ecx)
383: 0f 84 07 01 00 00 je 490 <lcr_ifact_reference+0x270>
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
389: 8d 5a 01 lea 0x1(%edx),%ebx
38c: 39 1d 00 00 00 00 cmp %ebx,0x0
392: 89 1d 08 00 00 00 mov %ebx,0x8
398: 77 cc ja 366 <lcr_ifact_reference+0x146>
39a: 8d 4c 24 30 lea 0x30(%esp),%ecx
39e: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
3a5: 00
3a6: 89 0c 24 mov %ecx,(%esp)
3a9: e8 fc ff ff ff call 3aa <lcr_ifact_reference+0x18a>
3ae: 85 c0 test %eax,%eax
3b0: 89 44 24 14 mov %eax,0x14(%esp)
3b4: 0f 84 6d 04 00 00 je 827 <lcr_ifact_reference+0x607>
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
3ba: c7 05 08 00 00 00 00 movl $0x0,0x8
3c1: 00 00 00
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
3c4: 8b 1d 08 00 00 00 mov 0x8,%ebx
3ca: 39 1d 00 00 00 00 cmp %ebx,0x0
3d0: 89 da mov %ebx,%edx
3d2: 76 41 jbe 415 <lcr_ifact_reference+0x1f5>
3d4: 8b 8c 24 30 06 00 00 mov 0x630(%esp),%ecx
3db: 89 4c 24 10 mov %ecx,0x10(%esp)
3df: eb 02 jmp 3e3 <lcr_ifact_reference+0x1c3>
3e1: 89 da mov %ebx,%edx
3e3: 3b 15 00 00 00 00 cmp 0x0,%edx
3e9: 73 19 jae 404 <lcr_ifact_reference+0x1e4>
3eb: 8d 04 52 lea (%edx,%edx,2),%eax
3ee: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
3f5: 03 0d 04 00 00 00 add 0x4,%ecx
3fb: 83 39 02 cmpl $0x2,(%ecx)
3fe: 0f 84 0a 01 00 00 je 50e <lcr_ifact_reference+0x2ee>
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
404: 8d 5a 01 lea 0x1(%edx),%ebx
407: 39 1d 00 00 00 00 cmp %ebx,0x0
40d: 89 1d 08 00 00 00 mov %ebx,0x8
413: 77 cc ja 3e1 <lcr_ifact_reference+0x1c1>
415: a1 18 00 00 00 mov 0x18,%eax
41a: 83 f8 ff cmp $0xffffffff,%eax
41d: 74 3c je 45b <lcr_ifact_reference+0x23b>
static inline void hdb_handle_destroy (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].state = HDB_HANDLE_STATE_PENDINGREMOVAL;
41f: 8d 04 40 lea (%eax,%eax,2),%eax
422: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
429: a1 04 00 00 00 mov 0x4,%eax
42e: c7 04 18 01 00 00 00 movl $0x1,(%eax,%ebx,1)
435: 89 d8 mov %ebx,%eax
437: 03 05 04 00 00 00 add 0x4,%eax
43d: 83 68 08 01 subl $0x1,0x8(%eax)
441: 83 78 08 00 cmpl $0x0,0x8(%eax)
445: 0f 8c fe 03 00 00 jl 849 <lcr_ifact_reference+0x629>
44b: 0f 84 7a 01 00 00 je 5cb <lcr_ifact_reference+0x3ab>
451: c7 05 18 00 00 00 ff movl $0xffffffff,0x18
458: ff ff ff
45b: 8b 4c 24 14 mov 0x14(%esp),%ecx
45f: 89 0c 24 mov %ecx,(%esp)
462: e8 fc ff ff ff call 463 <lcr_ifact_reference+0x243>
467: 83 44 24 20 01 addl $0x1,0x20(%esp)
46c: 8b 44 24 20 mov 0x20(%esp),%eax
470: 39 44 24 1c cmp %eax,0x1c(%esp)
474: 0f 85 9c fe ff ff jne 316 <lcr_ifact_reference+0xf6>
47a: 81 c4 3c 06 00 00 add $0x63c,%esp
480: b8 ff ff ff ff mov $0xffffffff,%eax
485: 5b pop %ebx
486: 5e pop %esi
487: 5f pop %edi
488: 5d pop %ebp
489: c3 ret
48a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
return (-1);
}
*instance = handle_database->handles[handle].instance;
490: 8b 41 04 mov 0x4(%ecx),%eax
493: 8d 54 24 30 lea 0x30(%esp),%edx
}
*instance = handle_database->handles[handle].instance;
handle_database->handles[handle].ref_count += 1;
497: 83 41 08 01 addl $0x1,0x8(%ecx)
return (0);
}
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
assert (handle_database->handles[handle].ref_count >= 0);
if (handle_database->handles[handle].ref_count == 0) {
free (handle_database->handles[handle].instance);
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
}
}
static inline void hdb_handle_destroy (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].state = HDB_HANDLE_STATE_PENDINGREMOVAL;
hdb_handle_put (handle_database, handle);
}
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
49b: 83 05 08 00 00 00 01 addl $0x1,0x8
4a2: 89 84 24 30 06 00 00 mov %eax,0x630(%esp)
4a9: 83 c0 10 add $0x10,%eax
4ac: 89 54 24 04 mov %edx,0x4(%esp)
4b0: 89 04 24 mov %eax,(%esp)
4b3: e8 fc ff ff ff call 4b4 <lcr_ifact_reference+0x294>
4b8: 85 c0 test %eax,%eax
4ba: 74 ab je 467 <lcr_ifact_reference+0x247>
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
4bc: 8d 04 5b lea (%ebx,%ebx,2),%eax
4bf: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
4c6: 89 d8 mov %ebx,%eax
4c8: 03 05 04 00 00 00 add 0x4,%eax
4ce: 83 68 08 01 subl $0x1,0x8(%eax)
assert (handle_database->handles[handle].ref_count >= 0);
4d2: 83 78 08 00 cmpl $0x0,0x8(%eax)
4d6: 0f 8c 6d 03 00 00 jl 849 <lcr_ifact_reference+0x629>
if (handle_database->handles[handle].ref_count == 0) {
4dc: 0f 85 72 fe ff ff jne 354 <lcr_ifact_reference+0x134>
free (handle_database->handles[handle].instance);
4e2: 8b 40 04 mov 0x4(%eax),%eax
4e5: 89 04 24 mov %eax,(%esp)
4e8: e8 fc ff ff ff call 4e9 <lcr_ifact_reference+0x2c9>
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
4ed: 89 d8 mov %ebx,%eax
4ef: 03 05 04 00 00 00 add 0x4,%eax
4f5: c7 00 00 00 00 00 movl $0x0,(%eax)
4fb: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
502: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
509: e9 46 fe ff ff jmp 354 <lcr_ifact_reference+0x134>
50e: 8b 41 04 mov 0x4(%ecx),%eax
511: 83 41 08 01 addl $0x1,0x8(%ecx)
}
}
static inline void hdb_handle_destroy (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].state = HDB_HANDLE_STATE_PENDINGREMOVAL;
hdb_handle_put (handle_database, handle);
}
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
515: 83 05 08 00 00 00 01 addl $0x1,0x8
51c: 89 84 24 30 06 00 00 mov %eax,0x630(%esp)
523: 8b 44 24 10 mov 0x10(%esp),%eax
527: 8b 50 04 mov 0x4(%eax),%edx
52a: 89 44 24 18 mov %eax,0x18(%esp)
52e: 85 d2 test %edx,%edx
530: 89 54 24 28 mov %edx,0x28(%esp)
534: 7e 43 jle 579 <lcr_ifact_reference+0x359>
536: 8b 28 mov (%eax),%ebp
538: 31 f6 xor %esi,%esi
53a: 31 c0 xor %eax,%eax
53c: 8d 74 26 00 lea 0x0(%esi),%esi
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
540: 89 c7 mov %eax,%edi
542: 8b 84 24 54 06 00 00 mov 0x654(%esp),%eax
549: 89 44 24 04 mov %eax,0x4(%esp)
54d: 8b 04 2f mov (%edi,%ebp,1),%eax
550: 89 04 24 mov %eax,(%esp)
553: e8 fc ff ff ff call 554 <lcr_ifact_reference+0x334>
558: 85 c0 test %eax,%eax
55a: 75 11 jne 56d <lcr_ifact_reference+0x34d>
55c: 8b 94 24 58 06 00 00 mov 0x658(%esp),%edx
563: 3b 54 2f 04 cmp 0x4(%edi,%ebp,1),%edx
567: 0f 84 8a 00 00 00 je 5f7 <lcr_ifact_reference+0x3d7>
56d: 83 c6 01 add $0x1,%esi
570: 3b 74 24 28 cmp 0x28(%esp),%esi
574: 8d 47 24 lea 0x24(%edi),%eax
577: 75 c7 jne 540 <lcr_ifact_reference+0x320>
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
579: 8d 04 5b lea (%ebx,%ebx,2),%eax
57c: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
583: 89 d8 mov %ebx,%eax
585: 03 05 04 00 00 00 add 0x4,%eax
58b: 83 68 08 01 subl $0x1,0x8(%eax)
assert (handle_database->handles[handle].ref_count >= 0);
58f: 83 78 08 00 cmpl $0x0,0x8(%eax)
593: 0f 8c b0 02 00 00 jl 849 <lcr_ifact_reference+0x629>
if (handle_database->handles[handle].ref_count == 0) {
599: 0f 85 25 fe ff ff jne 3c4 <lcr_ifact_reference+0x1a4>
free (handle_database->handles[handle].instance);
59f: 8b 40 04 mov 0x4(%eax),%eax
5a2: 89 04 24 mov %eax,(%esp)
5a5: e8 fc ff ff ff call 5a6 <lcr_ifact_reference+0x386>
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
5aa: 89 d8 mov %ebx,%eax
5ac: 03 05 04 00 00 00 add 0x4,%eax
5b2: c7 00 00 00 00 00 movl $0x0,(%eax)
5b8: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
5bf: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
5c6: e9 f9 fd ff ff jmp 3c4 <lcr_ifact_reference+0x1a4>
5cb: 8b 40 04 mov 0x4(%eax),%eax
5ce: 89 04 24 mov %eax,(%esp)
5d1: e8 fc ff ff ff call 5d2 <lcr_ifact_reference+0x3b2>
5d6: 89 d8 mov %ebx,%eax
5d8: 03 05 04 00 00 00 add 0x4,%eax
5de: c7 00 00 00 00 00 movl $0x0,(%eax)
5e4: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
5eb: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
5f2: e9 5a fe ff ff jmp 451 <lcr_ifact_reference+0x231>
5f7: 8b 54 24 10 mov 0x10(%esp),%edx
5fb: 8d 44 24 30 lea 0x30(%esp),%eax
5ff: 8b 4c 24 14 mov 0x14(%esp),%ecx
603: 89 4a 08 mov %ecx,0x8(%edx)
606: 89 44 24 04 mov %eax,0x4(%esp)
60a: 89 d0 mov %edx,%eax
60c: 83 c0 10 add $0x10,%eax
60f: 89 04 24 mov %eax,(%esp)
612: e8 fc ff ff ff call 613 <lcr_ifact_reference+0x3f3>
617: 8b 54 24 18 mov 0x18(%esp),%edx
61b: 8b 84 24 5c 06 00 00 mov 0x65c(%esp),%eax
622: 8b 0a mov (%edx),%ecx
624: 8b 54 39 20 mov 0x20(%ecx,%edi,1),%edx
628: 89 10 mov %edx,(%eax)
62a: 8b 44 39 18 mov 0x18(%ecx,%edi,1),%eax
62e: 85 c0 test %eax,%eax
630: 74 0c je 63e <lcr_ifact_reference+0x41e>
632: 8b 8c 24 60 06 00 00 mov 0x660(%esp),%ecx
639: 89 0c 24 mov %ecx,(%esp)
63c: ff d0 call *%eax
void *new_handles;
int found = 0;
void *instance;
for (handle = 0; handle < handle_database->handle_count; handle++) {
63e: 8b 1d 0c 00 00 00 mov 0xc,%ebx
644: 85 db test %ebx,%ebx
646: 0f 84 21 02 00 00 je 86d <lcr_ifact_reference+0x64d>
if (handle_database->handles[handle].state == HDB_HANDLE_STATE_EMPTY) {
64c: 8b 2d 10 00 00 00 mov 0x10,%ebp
652: 31 c9 xor %ecx,%ecx
654: 8b 75 00 mov 0x0(%ebp),%esi
657: 89 ea mov %ebp,%edx
659: 85 f6 test %esi,%esi
65b: 75 0f jne 66c <lcr_ifact_reference+0x44c>
65d: e9 18 02 00 00 jmp 87a <lcr_ifact_reference+0x65a>
662: 8b 42 0c mov 0xc(%edx),%eax
665: 83 c2 0c add $0xc,%edx
668: 85 c0 test %eax,%eax
66a: 74 2c je 698 <lcr_ifact_reference+0x478>
66c: 83 c1 01 add $0x1,%ecx
66f: 39 d9 cmp %ebx,%ecx
671: 89 ce mov %ecx,%esi
673: 75 ed jne 662 <lcr_ifact_reference+0x442>
found = 1;
break;
}
}
if (found == 0) {
handle_database->handle_count += 1;
675: 8d 43 01 lea 0x1(%ebx),%eax
678: a3 0c 00 00 00 mov %eax,0xc
new_handles = (struct hdb_handle *)realloc (handle_database->handles,
67d: 8d 04 40 lea (%eax,%eax,2),%eax
680: c1 e0 02 shl $0x2,%eax
683: 89 44 24 04 mov %eax,0x4(%esp)
687: 89 2c 24 mov %ebp,(%esp)
68a: e8 fc ff ff ff call 68b <lcr_ifact_reference+0x46b>
sizeof (struct hdb_handle) * handle_database->handle_count);
if (new_handles == 0) {
68f: 85 c0 test %eax,%eax
691: 74 52 je 6e5 <lcr_ifact_reference+0x4c5>
return (-1);
}
handle_database->handles = new_handles;
693: a3 10 00 00 00 mov %eax,0x10
}
instance = (void *)malloc (instance_size);
698: c7 04 24 0c 00 00 00 movl $0xc,(%esp)
69f: e8 fc ff ff ff call 6a0 <lcr_ifact_reference+0x480>
if (instance == 0) {
6a4: 85 c0 test %eax,%eax
6a6: 89 c1 mov %eax,%ecx
6a8: 74 3b je 6e5 <lcr_ifact_reference+0x4c5>
return (-1);
}
memset (instance, 0, instance_size);
6aa: c7 00 00 00 00 00 movl $0x0,(%eax)
handle_database->handles[handle].state = HDB_HANDLE_STATE_ACTIVE;
6b0: 8d 14 76 lea (%esi,%esi,2),%edx
6b3: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
6ba: c1 e2 02 shl $0x2,%edx
6bd: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
6c4: a1 10 00 00 00 mov 0x10,%eax
6c9: c7 04 10 02 00 00 00 movl $0x2,(%eax,%edx,1)
handle_database->handles[handle].instance = instance;
handle_database->handles[handle].ref_count = 1;
6d0: c7 44 02 08 01 00 00 movl $0x1,0x8(%edx,%eax,1)
6d7: 00
6d8: 89 4c 02 04 mov %ecx,0x4(%edx,%eax,1)
*handle_id_out = handle;
6dc: 8b 84 24 50 06 00 00 mov 0x650(%esp),%eax
6e3: 89 30 mov %esi,(%eax)
6e5: 8b 94 24 50 06 00 00 mov 0x650(%esp),%edx
6ec: 8b 02 mov (%edx),%eax
struct hdb_handle_database *handle_database,
unsigned int handle,
void **instance)
{
if (handle >= handle_database->handle_count) {
6ee: 3b 05 0c 00 00 00 cmp 0xc,%eax
6f4: 72 32 jb 728 <lcr_ifact_reference+0x508>
6f6: 8b 94 24 38 06 00 00 mov 0x638(%esp),%edx
6fd: 8b 8c 24 60 06 00 00 mov 0x660(%esp),%ecx
704: a1 18 00 00 00 mov 0x18,%eax
709: 89 4a 04 mov %ecx,0x4(%edx)
70c: 8b 4c 24 18 mov 0x18(%esp),%ecx
710: 89 02 mov %eax,(%edx)
712: 8b 01 mov (%ecx),%eax
714: 8b 44 38 1c mov 0x1c(%eax,%edi,1),%eax
718: 89 42 08 mov %eax,0x8(%edx)
71b: 31 c0 xor %eax,%eax
71d: 81 c4 3c 06 00 00 add $0x63c,%esp
723: 5b pop %ebx
724: 5e pop %esi
725: 5f pop %edi
726: 5d pop %ebp
727: c3 ret
if (handle >= handle_database->handle_count) {
return (-1);
}
if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
728: 8d 04 40 lea (%eax,%eax,2),%eax
72b: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
732: 03 15 10 00 00 00 add 0x10,%edx
738: 83 3a 02 cmpl $0x2,(%edx)
73b: 75 b9 jne 6f6 <lcr_ifact_reference+0x4d6>
return (-1);
}
*instance = handle_database->handles[handle].instance;
73d: 8b 42 04 mov 0x4(%edx),%eax
handle_database->handles[handle].ref_count += 1;
740: 83 42 08 01 addl $0x1,0x8(%edx)
744: 89 84 24 38 06 00 00 mov %eax,0x638(%esp)
74b: eb a9 jmp 6f6 <lcr_ifact_reference+0x4d6>
74d: 8b 43 04 mov 0x4(%ebx),%eax
750: 83 43 08 01 addl $0x1,0x8(%ebx)
return (0);
}
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
assert (handle_database->handles[handle].ref_count >= 0);
if (handle_database->handles[handle].ref_count == 0) {
free (handle_database->handles[handle].instance);
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
}
}
static inline void hdb_handle_destroy (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].state = HDB_HANDLE_STATE_PENDINGREMOVAL;
hdb_handle_put (handle_database, handle);
}
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
}
static inline int hdb_iterator_next (
struct hdb_handle_database *handle_database,
void **instance,
unsigned int *handle)
{
int res = -1;
while (handle_database->iterator < handle_database->handle_count) {
*handle = handle_database->iterator;
res = hdb_handle_get (
handle_database,
handle_database->iterator,
instance);
handle_database->iterator += 1;
754: 83 05 08 00 00 00 01 addl $0x1,0x8
75b: 89 84 24 30 06 00 00 mov %eax,0x630(%esp)
762: 8b 41 04 mov 0x4(%ecx),%eax
765: 89 4c 24 18 mov %ecx,0x18(%esp)
769: 85 c0 test %eax,%eax
76b: 89 44 24 24 mov %eax,0x24(%esp)
76f: 7e 3f jle 7b0 <lcr_ifact_reference+0x590>
771: 8b 29 mov (%ecx),%ebp
773: 31 db xor %ebx,%ebx
775: 31 c0 xor %eax,%eax
777: 8b 94 24 54 06 00 00 mov 0x654(%esp),%edx
static inline void hdb_iterator_reset (
struct hdb_handle_database *handle_database)
{
handle_database->iterator = 0;
77e: 89 c7 mov %eax,%edi
780: 89 54 24 04 mov %edx,0x4(%esp)
784: 8b 04 28 mov (%eax,%ebp,1),%eax
787: 89 04 24 mov %eax,(%esp)
78a: e8 fc ff ff ff call 78b <lcr_ifact_reference+0x56b>
78f: 85 c0 test %eax,%eax
791: 75 11 jne 7a4 <lcr_ifact_reference+0x584>
793: 8b 8c 24 58 06 00 00 mov 0x658(%esp),%ecx
79a: 3b 4c 2f 04 cmp 0x4(%edi,%ebp,1),%ecx
79e: 0f 84 73 fe ff ff je 617 <lcr_ifact_reference+0x3f7>
7a4: 83 c3 01 add $0x1,%ebx
7a7: 39 5c 24 24 cmp %ebx,0x24(%esp)
7ab: 8d 47 24 lea 0x24(%edi),%eax
7ae: 75 c7 jne 777 <lcr_ifact_reference+0x557>
static inline void hdb_handle_put (
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
7b0: 8d 04 76 lea (%esi,%esi,2),%eax
7b3: 8d 1c 85 00 00 00 00 lea 0x0(,%eax,4),%ebx
7ba: 89 d8 mov %ebx,%eax
7bc: 03 05 04 00 00 00 add 0x4,%eax
7c2: 83 68 08 01 subl $0x1,0x8(%eax)
assert (handle_database->handles[handle].ref_count >= 0);
7c6: 83 78 08 00 cmpl $0x0,0x8(%eax)
7ca: 7c 7d jl 849 <lcr_ifact_reference+0x629>
if (handle_database->handles[handle].ref_count == 0) {
7cc: 0f 85 af fa ff ff jne 281 <lcr_ifact_reference+0x61>
free (handle_database->handles[handle].instance);
7d2: 8b 40 04 mov 0x4(%eax),%eax
7d5: 89 04 24 mov %eax,(%esp)
7d8: e8 fc ff ff ff call 7d9 <lcr_ifact_reference+0x5b9>
memset (&handle_database->handles[handle], 0, sizeof (struct hdb_handle));
7dd: 89 d8 mov %ebx,%eax
7df: 03 05 04 00 00 00 add 0x4,%eax
7e5: c7 00 00 00 00 00 movl $0x0,(%eax)
7eb: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
7f2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
7f9: e9 83 fa ff ff jmp 281 <lcr_ifact_reference+0x61>
7fe: e8 fc ff ff ff call 7ff <lcr_ifact_reference+0x5df>
803: 8b 00 mov (%eax),%eax
805: 89 04 24 mov %eax,(%esp)
808: e8 fc ff ff ff call 809 <lcr_ifact_reference+0x5e9>
80d: c7 04 24 1a 00 00 00 movl $0x1a,(%esp)
814: 89 44 24 04 mov %eax,0x4(%esp)
818: e8 fc ff ff ff call 819 <lcr_ifact_reference+0x5f9>
81d: b8 ff ff ff ff mov $0xffffffff,%eax
822: e9 f6 fe ff ff jmp 71d <lcr_ifact_reference+0x4fd>
827: e8 fc ff ff ff call 828 <lcr_ifact_reference+0x608>
82c: c7 04 24 30 00 00 00 movl $0x30,(%esp)
833: 89 44 24 08 mov %eax,0x8(%esp)
837: 8d 44 24 30 lea 0x30(%esp),%eax
83b: 89 44 24 04 mov %eax,0x4(%esp)
83f: e8 fc ff ff ff call 840 <lcr_ifact_reference+0x620>
844: e9 31 fc ff ff jmp 47a <lcr_ifact_reference+0x25a>
struct hdb_handle_database *handle_database,
unsigned int handle)
{
handle_database->handles[handle].ref_count -= 1;
assert (handle_database->handles[handle].ref_count >= 0);
849: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
850: 00
851: c7 44 24 08 90 00 00 movl $0x90,0x8(%esp)
858: 00
859: c7 44 24 04 07 00 00 movl $0x7,0x4(%esp)
860: 00
861: c7 04 24 00 00 00 00 movl $0x0,(%esp)
868: e8 fc ff ff ff call 869 <lcr_ifact_reference+0x649>
86d: 8b 2d 10 00 00 00 mov 0x10,%ebp
873: 31 f6 xor %esi,%esi
875: e9 fb fd ff ff jmp 675 <lcr_ifact_reference+0x455>
void *new_handles;
int found = 0;
void *instance;
for (handle = 0; handle < handle_database->handle_count; handle++) {
87a: 31 f6 xor %esi,%esi
87c: e9 17 fe ff ff jmp 698 <lcr_ifact_reference+0x478>
More information about the Openais
mailing list