Author Topic: Custom Watch Script Pluggins  (Read 38180 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Custom Watch Script Pluggins
« Reply #45 on: January 30, 2006, 05:37:13 pm »
Luckily not, std::vector would be quite inefficient if it did. operator[] is not bounds-checked in release build (it may throw an error in debug build), so working with a std::vector offers the same performance as an old-style C array. It is just more comfortable.

EDIT:
Hey wait a second... did you say map? :lol:
I could swear I read vector... anyway: STL maps are not supposed to do that, but wxHashMap does.
« Last Edit: January 30, 2006, 05:40:30 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline duncanka

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Custom Watch Script Pluggins
« Reply #46 on: January 31, 2006, 01:33:34 am »
EDIT:
Hey wait a second... did you say map? :lol:
I could swear I read vector... anyway: STL maps are not supposed to do that, but wxHashMap does.
Actually, according the specifications in Mark Nelson's STL book, operator[] does insert the element in an STL map, although it does not for an STL vector.  If the operator makes people nervous, though, the command to GDB could always just use vector::at().
I'm pretty sure you can also use and dereference iterators in GDB, though, so even for a map, it might be possible to write a compiler-independent script that steps through each map element using iterators - it would presumably ask GDB for (*(iter + element#) ).first and (*(iter + element#) ).second, then combine the two into a single string, for each map element.  Although this would probably take a serious toll in terms of performance, to send and process all these GDB commands and output.
Mandrav, any results on performance using such multiple GDB commands?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Custom Watch Script Pluggins
« Reply #47 on: January 31, 2006, 08:39:45 am »
Quote
Mandrav, any results on performance using such multiple GDB commands?

Yes, expect an update today :)
Actually I tested it with vectors and it's almost instantaneous for about 30 elements. I have added "start from" and "count" for array types anyway so the user can watch only the items of interest without sacrificing performance...
Be patient!
This bug will be fixed soon...