Timo Reimann wrote:
>
> Hi all,
>
> in order to get to know better how things in ns-2 work and where to start
> placing my own implementation, I'd like to use gdb and the tcl debugger
> and step through the initialisation process of ns-2 one by one.
>
> Despite many attempts of doing this, gdb keeps refusing to decent into
> function calls using the "step" command but just rushes to the end of the
> program. I've searched for answers to this problem in the mailing-list
> archives which basically claim that one just needs to enable debugging
> info to do this.
>
> So what I did was this: I modified the install script and added
> "--enable-debug" to the OTcl, Tclcl, ns, and nam build processes and
> "--enable-symbols" to tcl and tk. I re-compiled over and over without
> success as gdb would continue doing what I do not want it to do.
>
> Here's a gdb output excerpt:
>
> ~/sa/ns2/ns-allinone/ns-2.30$ gdb ns
> [legal stuff]
> This GDB was configured as "i486-linux-gnu"...Using host libthread_db
> library "/lib/tls/i686/cmov/libthread_db.so.1".
>
> (gdb) list main
> 60       *
> 61
> *----------------------------------------------------------------------
> 62       */
> 63
> 64      int
> 65      main(int argc, char **argv)
> 66      {
> 67          Tcl_Main(argc, argv, Tcl_AppInit);
> 68          return 0;                   /* Needed only to prevent compiler
> warning. */
> 69      }
> (gdb) b main
> Breakpoint 1 at 0x804d161: file common/tclAppInit.cc, line 67.
> (gdb) run "~/sa/ns2/ns-allinone-2.30/scenarios/testing/example3.tcl"
> Starting program: /home/<my user name>/sa/ns2/ns-allinone-2.30/ns-2.30/ns
> "/home/<my user name>/ns2/ns-allinone-2.30/scenarios/testing/example3.tcl"
>
> Breakpoint 1, main (argc=2, argv=0xbfdd1254) at common/tclAppInit.cc:67
> 67          Tcl_Main(argc, argv, Tcl_AppInit);
> (gdb) s
>
> Program exited normally.
> (gdb)
>
> As far as I can see, I've succeeded in adding debugging symbols since I
> can use the "list" command to see where I'm at in the code.  Prior to
> inserting all the debugging switches, it would give an error.
>
> To make sure, I've also compiled and incorporated tcl-debug-2.0 into ns-2
> which verifiably works but did not affect gdb's behaviour.
>
> In addition, I've cleared my PATH environment variable to only include the
> ns-2-specific paths and used full pathnames for everything else (like gdb)
> because I suspected my globally installed copy of tk to interfer in this
> matter. This wasn't true, however.
>
> When I step through the code using stepi (instruction-level stepping) I
> can perfectly see all function calls including instruction pointer
> arithmetics. This seems to derive from machine-level code, however, and
> therefore isn't very useful to me.
>
> At this point, I'm really lost. I believe the list archive postings on
> this issue are not more recent than 2003 so I suppose it's just me having
> this problem but I absolutely cannot see what else to do.
>
> I'm using ns-2 allinone-2.30, gdb 6.4.90-debian, and gcc 4.1.2 under
> Ubuntu 6.10 (Edgy Eft).
>
> Glad for any help!
>
>
> Cheers,
>
> --Timo
>
>


Reply via email to