Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ Programming ➜ General ➜ GDB oddity

GDB oddity

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Greven   Canada  (835 posts)  Bio
Date Sun 10 Oct 2004 09:51 PM (UTC)

Amended on Sun 10 Oct 2004 09:53 PM (UTC) by Greven

Message
Working in GDB trying to figure something out, here is the code
                for (timer = ch->first_timer; timer; timer = timer_next)
                {
                        int       sn;
                        timer_next = timer->next;

				        for (sn = 0; sn < top_sn; sn++)
                            if ( *skill_table[sn]->skill_fun == timer->do_fun )
                                break;

                        if ( sn == top_sn )
                            bug("Null skill for fast engineer");

                        if (--timer->count <= 0
                            || (!IS_NPC(ch) && skill_table[sn]->guild == ENGINEERING_ABILITY
                                && IS_SET(ch->pcdata->flags,PCFLAG_FASTENGINEER) ))
                        {
                                if (timer->type == TIMER_DO_FUN)
                                {
                                        int       tempsub;

                                        tempsub = ch->substate;
                                        ch->substate = timer->value;
                                        (timer->do_fun) (ch, "");
                                        if (char_died(ch))
                                                break;
                                        ch->substate = tempsub;
                                }
                                extract_timer(ch, timer);
                        }
                }
Its quite clear that sn is defined, however...
Quote:
(gdb) bt
#0 0x40161ac1 in kill () from /lib/libc.so.6
#1 0x401616eb in raise () from /lib/libc.so.6
#2 0x40163127 in abort () from /lib/libc.so.6
#3 0x080bcde2 in SegVio (signum=11) at comm.c:503
#4 <signal handler called>
#5 0x080e2b04 in violence_update() () at fight.c:262
#6 0x0818b8c4 in update_handler() () at update.c:3148
#7 0x080bd313 in game_loop() () at comm.c:823
#8 0x080bcb6a in main (argc=8, argv=0xbffff1b4) at comm.c:362
#9 0x4014dd06 in __libc_start_main () from /lib/libc.so.6
(gdb) frame 5
#5 0x080e2b04 in violence_update() () at fight.c:262
262 if (--timer->count <= 0
Current language: auto; currently c++
(gdb) print sn
No symbol "sn" in current context.
(gdb)
I would assume that GDB cannot access sn because its of where its defined. Is this normal for GDB, I've never noticed this before.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sun 10 Oct 2004 10:00 PM (UTC)
Message
Hrm. Do 'list' in frame 5. Whats it display?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #2 on Sun 10 Oct 2004 10:24 PM (UTC)
Message
The actual bug in the code is not the issue, I was just curious as to why it wouldn't print sn.

If your curious though:
257                                                                     break;
258
259                                                     if ( sn == top_sn )
260                                                             bug("Null skill for fast engineer");
261
262                             if (--timer->count <= 0
263                                 || (!IS_NPC(ch) && skill_table[sn]->guild == ENGINEERING_ABILITY
264                                     && IS_SET(ch->pcdata->flags,PCFLAG_FASTENGINEER) ))
265                             {
266                                     if (timer->type == TIMER_DO_FUN)

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sun 10 Oct 2004 10:28 PM (UTC)
Message
I know. Just wanted to make sure gdb wasn't having troubles, and wouldn't display all the lines. Or if it wasn't in the loop. I think its just the way gdb acts. You'll have to set a breakpoint, probably.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 11 Oct 2004 07:04 AM (UTC)
Message
Quote:

#5 0x080e2b04 in violence_update() () at fight.c:262
262 if (--timer->count <= 0
Current language: auto; currently c++


This puzzles me. You are debugging a .c file but it says the language is c++. This might cause confusion because of C++ name mangling.

Maybe type "set language c" and try again.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #5 on Mon 11 Oct 2004 07:08 AM (UTC)

Amended on Mon 11 Oct 2004 07:09 AM (UTC) by Greven

Message
Yeah, that was it, I was able print sn, didn't think it would make a difference.

I'm compiling in c++ for the stricter compile rules, thats why its set to c++.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,958 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.