tags:

views:

120

answers:

3

Hi, I won't post any code, because there is too much that could be relevant. But When I run my program it prints

Internal Bad Op Name!
: Success

Anybody even know what that means? I'm using g++ to compile my code and nowhere in my code do I cout anything even remotely close to something like that. I don't know where it's coming from. Also, any suggestions as to figure out where in the code it's coming from, maybe using gdb somehow to do that?

Thanks!

+3  A: 

It's not a message I've seen, and Googling for it doesn't show anything obviously related.

You can identify where it comes from by stepping through the program with gdb until the message appears. Alternatively, one can sprinkle some timing delays, "I am here" statements, or input prompts to discover suspect portions of the logic.


< < < (edit) > > >

To use gdb, first be sure to compile and link with debug symbols. With either gcc or g++, just add -g to the command line. It's also often helpful to eliminate any compiler optimizations since those can sometimes make stepping through the program non-intuitive.

[wally@lf ~]$ gdb program
GNU gdb Fedora (6.8-32.fc10)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x8048c3c: file rtpsim.cpp, line 30.
(gdb) run
Starting program: ~/program 

Breakpoint 1, main () at rtpsim.cpp:30
30      rtp_io (&obj, INIT_CYCLE);
(gdb) next
31      printf ("- - - - - init complete - - - - -\n");
(gdb)     <---- pressed "enter" to repeat last command
- - - - - init complete - - - - -
33      for (int j = 0;  j < 10;  ++j)
(gdb) 
35          sleep (1);
(gdb) 
36          rtp_io (&obj, SCAN_CYCLE);
(gdb) 
37          printf ("- - - - - scan %d complete - - - - -\n", j+1);
  ...
wallyk
I know, it's very weird, google turned up nothing for me either. How do I step through a program with gdb?
Silmaril89
I've added a sample stepping through gdb. Use `next` to execute statements (and skip calling into functions), use `step` to step into functions.
wallyk
Thank you very much, doing that I located the line that was causing the problem.
Silmaril89
+1  A: 

What libraries and what platform are you using? No C++ compiler I know of (certainly not GCC) introduces output to your program except before aborting.

Edit: maybe easier than backtracking or finding references, use grep -a to find that string in all your sources and library binaries.

Potatoswatter
I'm using ubuntu 9.10. gcc version 4.4.1. I'm also generating some C using flex and bison. And any libraries are just standard c or c++ libraries, nothing unusual.
Silmaril89
@Silmaril: Well, that certainly sounds like something flex or bison might print, but the lack of a google hit makes me rather suspect your flex/bison sources. Did you grep them?
Potatoswatter
I haven't. I'm not sure where the sources are stored though.
Silmaril89
You said that flex and bison generates code for you. Grep on that generated codt, that might help.
petersohn
tried that, not in there
Silmaril89
+1  A: 

To debug the program with GDB, first make sure that it is compiled with the -g flag. Then type gdb your-program-name into the command line. GDB is a command based debugger. To get started, type help. Or, there are graphical debugging tools, like xxgdb (though for this, it is a good thing to understand basic gdb commands), ddd, kdbg (KDE based), Eclipse (it is not very straightforward to configure if you want to use your own makefile) etc.

petersohn