Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Custom Watch Script Pluggins
duncanka:
--- Quote from: mandrav on January 27, 2006, 05:51:51 pm ---
--- Quote from: Game_Ender on January 27, 2006, 05:39:12 pm ---That is very cool, awesome job Mandrav. That looks like it is clean and should be pretty independent. But like mentioned above, when you are doing some complicated like STL vectors and such you might have to use library specific names, is there some way to for script to detect what compiler you are using so it can react accordingly?
--- End quote ---
My tests with std::vector show that there is no other way than using vector._M_impl._M_start to access its elements, which binds the script to a specific compiler implementation (gcc-3.4.4 in this case).
--- End quote ---
Why can't you just use operator[] for STL vectors? I had no problem accessing vector elements using this syntax in my watches, even if the element I was referencing did not exist (i.e. accessing v[5] didn't cause an access violation even when v only had 1 element allocated).
mandrav:
--- Quote from: duncanka on January 27, 2006, 09:13:57 pm ---Why can't you just use operator[] for STL vectors? I had no problem accessing vector elements using this syntax in my watches, even if the element I was referencing did not exist (i.e. accessing v[5] didn't cause an access violation even when v only had 1 element allocated).
--- End quote ---
This is partly true. You see, adding a watch on one vector element is possible with operator[]. But trying to watch a series of vector elements as an array, it doesn't work. You can't do the following, for example (v is a vector), to watch the first 100 elements:
--- Code: ---output v[0]@100
--- End code ---
duncanka:
--- Quote from: mandrav on January 27, 2006, 09:45:04 pm ---
--- Quote from: duncanka on January 27, 2006, 09:13:57 pm ---Why can't you just use operator[] for STL vectors? I had no problem accessing vector elements using this syntax in my watches, even if the element I was referencing did not exist (i.e. accessing v[5] didn't cause an access violation even when v only had 1 element allocated).
--- End quote ---
This is partly true. You see, adding a watch on one vector element is possible with operator[]. But trying to watch a series of vector elements as an array, it doesn't work. You can't do the following, for example (v is a vector), to watch the first 100 elements:
--- Code: ---output v[0]@100
--- End code ---
--- End quote ---
Granted, but even so, wouldn't it be far easier to write a script that just asks GDB for multiple elements using standard operators than to start trying to make a different script for each STL implementation? I guess this would require multiple commands to GDB, but I would think that that would still be simpler to implement. (Maybe have the Evaluate_<type> functions place their results in a wxArrayString, instead of a wxString?)
mandrav:
--- Quote from: duncanka on January 27, 2006, 10:15:18 pm ---Granted, but even so, wouldn't it be far easier to write a script that just asks GDB for multiple elements using standard operators than to start trying to make a different script for each STL implementation? I guess this would require multiple commands to GDB, but I would think that that would still be simpler to implement. (Maybe have the Evaluate_<type> functions place their results in a wxArrayString, instead of a wxString?)
--- End quote ---
I don't know what this means, performance-wise. I guess I will run some tests and we 'll see.
rickg22:
Yes, but doesn't operator[] actually ADD elements for STL maps?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version