Greg (S), this one's for you, if you agree:
The requirement to initialize file handles to NULL before passing them
to apr_open() just bit me again, for probably the twentieth time. I
spent an hour debugging it, because it manifested as a trashing of
saved registers, one of which happened to contain the return addr for
main(). This was a bit frustrating. :-)
When this topic came up on here once before, you mentioned that a few
other APR maintainers felt the same way, and that there was a
possibility the interface to apr_open() would be changed.
Is this still possible? I have a feeling this is going to keep
hitting us over and over, and I doubt (?) anyone out there really
depends on being able to pass non-null handles in.
-K
Enjoy this excerpt from my GDB session over the phone with JimB
helping:
(gdb) break main.c:main
Breakpoint 1 at 0x80499b6: file main.c, line 199.
Breakpoint 2 at 0x8049b06: file main.c, line 234.
(gdb) run checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Linux thread target has modified Unknown signal handling
Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
(gdb) info frame
Stack level 0, frame at 0xbffff8ec:
eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
called by frame at 0xbffff928
source language c.
Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
Locals at 0xbffff8ec, Previous frame's sp is 0x0
Saved registers:
ebp at 0xbffff8ec, eip at 0xbffff8f0
(gdb) c
Continuing.
Breakpoint 2, main (argc=134748700, argv=0x0) at main.c:234
(gdb) info frame
Stack level 0, frame at 0xbffff8ec:
eip = 0x8049b06 in main (main.c:234); saved eip 0xffffffff
called by frame at 0x808195c
source language c.
Arglist at 0xbffff8ec, args: argc=134748700, argv=0x0
Locals at 0xbffff8ec, Previous frame's sp is 0x0
Saved registers:
ebp at 0xbffff8ec, eip at 0xbffff8f0
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Linux thread target has restored Unknown signal handling
Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Linux thread target has modified Unknown signal handling
Linux thread target has modified Unknown signal handling
Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
(gdb) info frame
Stack level 0, frame at 0xbffff8ec:
eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
called by frame at 0xbffff928
source language c.
Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
Locals at 0xbffff8ec, Previous frame's sp is 0x0
Saved registers:
ebp at 0xbffff8ec, eip at 0xbffff8f0
(gdb) display/a *(long *)0xbffff8f0
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
at checkout.c:130
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x5
(gdb) n
*** output flushed ***
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Linux thread target has restored Unknown signal handling
Linux thread target has restored Unknown signal handling
Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Linux thread target has modified Unknown signal handling
Linux thread target has modified Unknown signal handling
Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
at checkout.c:130
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
1: /a *(long *) 3221223664 = 0x5
(gdb) p apr_err
$1 = 0
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Linux thread target has restored Unknown signal handling
Linux thread target has restored Unknown signal handling
Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Linux thread target has modified Unknown signal handling
Linux thread target has modified Unknown signal handling
Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) info frame
Stack level 0, frame at 0xbffff8ec:
eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
called by frame at 0xbffff928
source language c.
Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
Locals at 0xbffff8ec, Previous frame's sp is 0x0
Saved registers:
ebp at 0xbffff8ec, eip at
(gdb) display/a *(long *)0xbffff8f0
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
at checkout.c:130
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
apr_open (new=0xbffff8b0,
fname=0x80819cc "../libsvn_wc/tests/checkout-1.delta", flag=5, perm=4095,
cont=0x808195c) at open.c:83
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
2: /a *(long *) 3221223664 = 0xffffffff
1: /a *(long *) 3221223664 = 0xffffffff
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Linux thread target has restored Unknown signal handling
Linux thread target has restored Unknown signal handling
Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
Linux thread target has modified Unknown signal handling
Linux thread target has modified Unknown signal handling
Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) info frame
Stack level 0, frame at 0xbffff8ec:
eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
called by frame at 0xbffff928
source language c.
Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
Locals at 0xbffff8ec, Previous frame's sp is 0x0
Saved registers:
ebp at 0xbffff8ec, eip at 0xbffff8f0
(gdb) display/a *(long *)0xbffff8f0
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
at checkout.c:130
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) s
apr_open (new=0xbffff8b0,
fname=0x80819cc "../libsvn_wc/tests/checkout-1.delta", flag=5, perm=4095,
cont=0x808195c) at open.c:83
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) n
3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
(gdb) The program is running. Exit anyway? (y or n) y
Linux thread target has restored Unknown signal handling
Linux thread target has restored Unknown signal handling
Debugger finished
Received on Sat Oct 21 14:36:10 2006