Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hello,
I am returning to WinDbg after a 10-15 year break so pardon me for the basic question. I do know the size of systemHandles.size() = 7. How can I see that in Windbg Watch Window? thanks
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Kernel Debugging | 13-17 May 2024 | Live, Online |
Developing Minifilters | 1-5 Apr 2024 | Live, Online |
Internals & Software Drivers | 11-15 Mar 2024 | Live, Online |
Writing WDF Drivers | 26 Feb - 1 Mar 2024 | Live, Online |
Comments
@pgv i think there is a mail from me that is stuck in some queue
@santosh_kumar std::vector->size() is a function i dont think watch windows can evaluate function results
it can only typecast a memory location
you can do dx systemHandles.size() using the new natvis expression evaluator it will provide you the vector size
0:000> dv
g1 = { size=5 }
0:000> ?? g1
class std::vector<int,std::allocator >
+0x000 _Mypair : std::_Compressed_pair<std::allocator,std::_Vector_val<std::_Simple_types >,1>
0:000> dx g1.size() <<<<<<<<<<<<<<<<<
g1.size() : 5 <<<<<<<<<<<<<<<<<<<
0:000> dx -r 9 g1
g1 : { size=5 } [Type: std::vector<int,std::allocator >]
[] [Type: std::vector<int,std::allocator >]
[capacity] : 6
[allocator] : allocator [Type: std::_Compressed_pair<std::allocator,std::_Vector_val<std::_Simple_types >,1>]
[] [Type: std::_Compressed_pair<std::allocator,std::_Vector_val<std::_Simple_types >,1>]
[0] : 1 [Type: int]
[1] : 2 [Type: int]
[2] : 3 [Type: int]
[3] : 4 [Type: int]
[4] : 5 [Type: int]
check this stack overflow post
the other day i was mucking around with some vectors in windbg and i happened
to unassemble the vector::size() function
looking at the disassembly and the crt src for the same function
i happened to realize that you can set a transparent expression in the watch window to look at the vector::size()
here is the disassembly of size() function for a vector in question
and the relevent src code from crt sources
so basically if you set a watch expression like
systemHandles._Mypair._Myval2._Mylast - systemHandles._Mypair._Myval2._Myfirst
windbg will resolve the size() in the watch window (it will do the pointer arithmetic and display the actual size if you are wondering
how address x - address y each being 8 bytes wide result in 5