Re: init_agent() crashing

rosy <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAMcwpM67w5Om51ycGAssiB_23z8c06Ad70xKf5N6zsfTJECCKg@mail.gmail.com>
Hi Anand,

Thanks for your reply. Actually by debugging the code what I am
finding is that..its crashing inside the name_hash(..) func..while
executing line

hash += tolower((unsigned char)(*cp));

I was assuming, there is some problem with my cross compiler..but when
I just wrote a simple program with toLower..its working fine. Since I
am totally new to SNMp so not getting any idea where how to proceed
next.
So any suggestion/guide will be appreciated.

Thanks in advance !


00296
00297 struct tok {
00298     const char     *name;       /* token name */
00299     int             len;        /* length not counting nul */
00300     int             token;      /* value */
00301     int             hash;       /* hash of name */
00302     struct tok     *next;       /* pointer to next in hash table */
00303 };
00304
00305
00306 static struct tok tokens[] = {
00307     {"obsolete", sizeof("obsolete") - 1, OBSOLETE}
00308     ,......
              }

static int
00706 name_hash(const char *name)
00707 {
00708     int             hash = 0;
00709     const char     *cp;
00710
00711     if (!name)
00712         return 0;
00713     for (cp = name; *cp; cp++)
00714         hash += tolower((unsigned char)(*cp));
00715     return (hash);
00716 }
00717
00718 void
00719 netsnmp_init_mib_internals(void)
00720 {
00721     register struct tok *tp;
00722     register int    b, i;
00723     int             max_modc;
00724
00725     if (tree_head)
00726         return;
00727
00728     /*
00729      * Set up hash list of pre-defined tokens
00730      */
00731     memset(buckets, 0, sizeof(buckets));
00732     for (tp = tokens; tp->name; tp++) {
00733         tp->hash = name_hash(tp->name);
00734         b = BUCKET(tp->hash);
00735         if (buckets[b])
00736             tp->next = buckets[b];      /* BUG ??? */
00737         buckets[b] = tp;
00738     }



On Wed, Feb 8, 2012 at 6:30 AM, anand anand <[email protected]> wrote:
>
> If you have debug enabled snmpd and its library  ( built with -g ,
> which I think is by default ) then is it possible to run your app
> using gdb or some kind  of debugger.. You can print the stack Trace to
> find out the reason of the crash. That should be the starting point...
>
>
>
>
> On 2/6/12, rosy <[email protected]> wrote:
> > Hi Bart,
> >
> > Thanks for your reply. But no core file is getting generated here.  I also
> > increase the  the size of coredump by using the command "ulimit -c
> > unlimited" . But still I do n't see any core file.
> > So would you please let me know why I am not getting the same or what I
> > have to do generate the core file.
> >
> > Thanks in advance..
> >
> > On Mon, Feb 6, 2012 at 10:27 PM, Bart Van Assche <[email protected]> wrote:
> >
> >> On Mon, Feb 6, 2012 at 12:24 PM, rosy <[email protected]> wrote:
> >> > I am using the net-snmp5.4.2.1 version for one of my application (
> >> >    mipsisa32r2 architecture ). But its crashing at init_agent(..). So
> >> would
> >> >    you please let me know what may be the possible reason for this.
> >>
> >> The first step is to find out the cause of the crash. You can obtain a
> >> call stack by analyzing a core dump generated on the embedded system
> >> with a cross-compiled gdb or by using gdb's remote debugging facility.
> >>
> >> Bart.
> >>
> >

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.