[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: OpenLDAP dumps core (on SMP system) (ITS#1319)
I'll this debugging code to HEAD. Thanks.
At 09:05 AM 2001-09-07, choeger@suse.de wrote:
>--- ldap/servers/slapd/back-ldbm/idl.c Sun Jul 22 04:28:29 2001
>+++ ldap.SuSE/servers/slapd/back-ldbm/idl.c Fri Sep 7 16:54:54 2001
>@@ -45,6 +45,21 @@
> ch_free( cont->dptr );
> }
>
>+#ifdef LDBM_DEBUG_IDL
>+static void check_idl(ID_BLOCK *idl)
>+{
>+ int i;
>+ ID_BLOCK last;
>+
>+ if (ID_BLOCK_INDIRECT(idl) || ID_BLOCK_ALLIDS(idl) || ID_BLOCK_NIDS(idl) <= 1)
>+ return;
>+
>+ last = ID_BLOCK_ID(idl, 0);
>+ for (i = 1; i < ID_BLOCK_NIDS(idl); last = ID_BLOCK_ID(idl, i), i++)
>+ assert (last < ID_BLOCK_ID(idl, i));
>+}
>+#endif
>+
> /* Allocate an ID_BLOCK with room for nids ids */
> ID_BLOCK *
> idl_alloc( unsigned int nids )
>@@ -210,6 +225,10 @@
> }
> free( (char *) tmp );
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(idl);
>+#endif
>+
> Debug( LDAP_DEBUG_TRACE, "<= idl_fetch %ld ids (%ld max)\n",
> ID_BLOCK_NIDS(idl), ID_BLOCK_NMAX(idl), 0 );
> return( idl );
>@@ -229,6 +248,10 @@
> Datum data;
> struct ldbminfo *li = (struct ldbminfo *) be->be_private;
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(idl);
>+#endif
>+
> ldbm_datum_init( data );
>
> /* Debug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
>@@ -293,6 +316,11 @@
> (char *) &ID_BLOCK_ID(b, nr),
> nl * sizeof(ID) );
> ID_BLOCK_NIDS(*left) = nl + (nr == 0 ? 0 : 1);
>+
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(*right);
>+ check_idl(*left);
>+#endif
> }
>
>
>@@ -703,6 +731,10 @@
> '\0',
> (ID_BLOCK_NMAX(*idl) - ID_BLOCK_NIDS(*idl)) * sizeof(ID) );
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(*idl);
>+#endif
>+
> return( i == 0 ? 1 : 0 ); /* inserted - first id changed or not */
> }
>
>@@ -837,6 +869,10 @@
> (char *) idl,
> (ID_BLOCK_NMAX(idl) + ID_BLOCK_IDS_OFFSET) * sizeof(ID) );
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(new);
>+#endif
>+
> return( new );
> }
>
>@@ -874,6 +910,11 @@
>
> n = idl_dup( idl_min( a, b ) );
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(a);
>+ check_idl(b);
>+#endif
>+
> for ( ni = 0, ai = 0, bi = 0; ai < ID_BLOCK_NIDS(a); ai++ ) {
> for ( ;
> bi < ID_BLOCK_NIDS(b) && ID_BLOCK_ID(b, bi) < ID_BLOCK_ID(a, ai);
>@@ -897,6 +938,10 @@
> }
> ID_BLOCK_NIDS(n) = ni;
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(n);
>+#endif
>+
> return( n );
> }
>
>@@ -924,6 +969,11 @@
> return( idl_allids( be ) );
> }
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(a);
>+ check_idl(b);
>+#endif
>+
> if ( ID_BLOCK_NIDS(b) < ID_BLOCK_NIDS(a) ) {
> n = a;
> a = b;
>@@ -956,6 +1006,10 @@
> }
> ID_BLOCK_NIDS(n) = ni;
>
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(n);
>+#endif
>+
> return( n );
> }
>
>@@ -1032,6 +1086,10 @@
> ID_BLOCK_ID(n, ni++) = ID_BLOCK_ID(a, ai);
> }
> ID_BLOCK_NIDS(n) = ni;
>+
>+#ifdef LDBM_DEBUG_IDL
>+ check_idl(n);
>+#endif
>
> return( n );
> }