Steve Biederman
Steve Biederman

Reputation: 11

gdb "Invalid binary operation on numbers"

At work, while debugging our program with gdb, it sometimes repsonds to a simple "next" command with "Invalid binary operation on numbers". Mighty annoying. Googling finds absolutely no hints. It is C++, so perhaps that has something inside gdb confused in some way; I have no clue.

Anyone?

(I can't get formatting to work right as a comment, so I'm adding to this area)

257       SingleBitBusMap::const_iterator sbb = fSingleBitBusMap.find(constituents.first.c_str());
(gdb) next
Invalid binary operation on numbers.
(gdb)

fSingleBitBusMap is a std::map
constituents is a std::pair
constituents.first is a std::string
and, after it says "Invalid binary operation on numbers", "bt" gives me this as the ENTIRE backtrace:

(gdb) bt
#0  0x000000000040fb40 in std::string::c_str ()
(gdb) 

though, doing "tbreak +1" and "cont" and then "bt" does once again get me a valid traceback.

Upvotes: 0

Views: 422

Answers (1)

Employed Russian
Employed Russian

Reputation: 213957

The only way I can think of that this could happen: you have some active display which requires GDB to evaluate some expression every time it stops, and that expression can't be evaluated, yielding Invalid binary operation on numbers error.

Use info display to see current "auto display" expressions.

Upvotes: 1

Related Questions