On Wed, 2007-02-07 at 18:16 -0700, David Wortham wrote:
> Thanks Nick for the response.
>
> I looked up how to use gdb very quickly. I found out that the segfault is
> happening at the same place I suspected.
>
> As I suspected, the lines causing the segfault are similar to:
>
Argh, can you _please_ post the real code? I hate to have to guess
whether errors are errors or just typos ...
> // dir_cfg contains mostly ints
> struct intContainer
> {
> int x
> } intContainer;
>
> /* ... later... in the merge function */
> static void* dir_cfg_merge_function (apr_pool_t* the_pool, void*
> the_parent_dir_cfg, void* the_sub_dir_cfg)
> {
> intContainer* merged_dir_cfg = apr_pcalloc(p, 1*sizeof(intContainer));
>
Where does 'p' come from?
> int y = 1;
> merged_dir_cfg->x = y; // this line causes a segfault... why?
You never checked the return value of apr_pcalloc ... iff it's null you
trigger a segfault.
(Side note: the headers aren't too clear about the return value in case
of failures ....).
There's a debugging version of apr_pcalloc - that should help you debug
your module.
HTH Ralf Mattes
> // this line would also segfault:
> memcpy(, , 1*sizeof(int));
> return merged_dir_cfg;
> }
>
>
>
> I still can't figure out what the issue is. Is there any way to tell if the
> apr_pcalloc is failing?
>
>
>
> On 2/7/07, Nick Kew <[EMAIL PROTECTED]> wrote:
> >
> >
> > On 8 Feb 2007, at 00:46, David Wortham wrote:
> >
> > >
> > > I am testing on LINUX, and that's where my whitescreens are showing up
> > > (haven't started cross-platform testing yet). I have encountered
> > > them in
> > > the past and they culprit has always been a segfault.
> > > I suspected a segfault-like error at the end of startup causing the
> > > whitescreens, but I don't yet have a way to verify this. Also, I
> > > don't know
> > > where in my code the segfault could have occurred (unless the memory
> > > allocation request was denied).
> >
> > Run it with -X under gdb. Do whatever it is that causes the segfault.
> > Then get a backtrace from gdb.
> >
> > --
> > Nick Kew
> >