FW: Seg fault when initializing default MIB context

James Brokenbek jbrokenbek____celion.com
Tue Apr 8 20:11:22 CEST 2003


Thanks for your continued attention in regard to this problem.  I have
additional data that may be useful for a diagnosis.

The following is an excerpt from my debugging session on the
dynamic_tables example.  I've determined that the delete[] call in the
OctetStr destructor is failing:

###############################################################

Breakpoint 1, OctetStr::~OctetStr (this=0x8134080, __in_chrg=135484492)
at octet.cpp:173
173       if (smival.value.string.ptr) delete []
smival.value.string.ptr;
(gdb) where
#0  OctetStr::~OctetStr (this=0x8134080, __in_chrg=135484492) at
octet.cpp:173
#1  0x8106840 in Agentpp::OidList<Agentpp::MibContext>::add
(this=0x8134070, item=0x8135440) at ../include/List.h:717
#2  0x805db5f in Agentpp::Mib::Mib (this=0x8134070) at mib.cpp:2645
#3  0x804a2ad in main (argc=1, argv=0xbfbffa74) at agent.cpp:357
(gdb) l
168
169     //=============[ destructor
]=========================================
170     OctetStr::~OctetStr()
171     {
172       // if not empty, free it up
173       if (smival.value.string.ptr) delete []
smival.value.string.ptr;
174       if (output_buffer)           delete [] output_buffer;
175     }
176
177
(gdb) s
agent in free(): warning: junk pointer, too low to make sense.
174       if (output_buffer)           delete [] output_buffer;
(gdb) s
SnmpSyntax::~SnmpSyntax (this=0x8134080, __in_chrg=135484492) at
./include/smival.h:145
145       virtual ~SnmpSyntax() {};
(gdb) s
145       virtual ~SnmpSyntax() {};
(gdb) s
OctetStr::~OctetStr (this=0x8134080, __in_chrg=135484492) at
octet.cpp:175
175     }
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x810684b in Agentpp::OidList<Agentpp::MibContext>::add (this=0x8134070,
item=0x8135440) at ../include/List.h:717
717                     (*content)[item->key()] = (void*)item;
(gdb)  

###############################################################

Noting the message from free(), I think perhaps the failed delete is
somehow trashing the stack; I'm still trying to characterize that.  The
behavior is identical on my agent and on the atm_mib example, too.

Any insight would be gratefully received.

James Brokenbek

> -----Original Message-----
> From: James Brokenbek 
> Sent: Tuesday, April 08, 2003 9:32 AM
> To: agentpp-dl____agentpp.com
> Subject: Seg fault when initializing default MIB context
> 
> 
> I share Mr. Coco's sentiment from his message this weekend: 
> time to broadcast my ignorance.
> 
> Problem: After compiling my own simple v3.5.10c Agent++ agent 
> and two of the example agents, I find that each one of the 
> three seg faults on line 717 of "List.h" when called from 
> "mib.cpp" line 2645, which is the addition of the default 
> context inside a Mib object's default constructor.  The list 
> object's "this" pointer ends up being invalid (0x1, if you're 
> curious).
> 
> Background:  Platform is x86 FreeBSD v4.3.  Compiler is gcc 
> v2.95.3.  Flags are "-D__unix -DGCC -Dsun -D_NO_THREADS 
> -D_NO_SNMPv3".  I also removed "-lpthreads" from each Makefile.
> 
> Now, this is so consistent that I assume I must be committing 
> some common, simple mistake in the build process, but 
> searching the list archive hasn't yielded any insight.  Could 
> someone please point out the error of my ways?
> 
> Gratefully,
> 
> James Brokenbek
> Celion Networks
> Richardson, TX USA
> 



More information about the AGENTPP mailing list