Presenter:Mike Taulty
Debugging is a whole lot easier with symbol files (PDBs). This session looks at how Visual Studio 2005 works with symbol files and how you can set up your own symbol servers.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
Hello and welcome to this MSDN Nugget session 1 in a series of short sessions were then 10 minutes or so illustrating key concepts and technologies within visual studio net frameworks and the net languages minus Mike Tolkien I work in the developer and platform group in Microsoft and UK and in this particular session is one of a series living around debugging and I wanted to talk about breakpoints in code and also new feature into the vital trace points which is strongly linked roster breakpoints okay so let s go ahead and build a simple application to set in breakpoints and so did a visual studio Hamilton family project and will take a Windows application should be fine and will simply go ahead and drop a button onto the form in time honoured fashion and will put into a panic button
Minute 1
That make it slightly more interesting f show have so we don t improve his sessions and symbols as you want to go and look at the differences between the womanly skills and symbols are a lot of those of the sessions about preparing to deploy but she really got symbols and source code we can go ahead and we can just use the mouse pointer to go out and celebrate points for the application and odyssey when we get to that point in the code were going to hit a breakpoint under and stop something I haven t desired very after a breakpoint and actually when were already here we can do all kinds of fun things I can run the cursor we can set the next statements would remove the instruction pointer somewhere outside his go ahead and having shown this message what s on screen to those the message rocks which were ahead of the instruction pointer back there and say about there again and show that has rocked again and get advice at all as Gazza fancied your to do in debugger
Minute 2
And about once a week ago and didn t they do this and the breakpoint in this way similarly can go to break points window and we can just go out there and you break controversy just when you break point here like a function in my case this is going to be form one but in one_click out of okay that s about it was a break point on the function instead of visiting Santa things before and then regardless really of whether we have of source code or symbols or not with net code we can always separate points in functions so we can use that same mechanism which is used forgotten one click to separate fires in net framework codes we catch a separate to message box of show Sir Geoffrey district breakpoints reckon you breakpoint and will go from message box top show and you can see that that breakpoint gets set and even over all the overloads message box to
Minute 3
Go and get breakpoints on them as well to touch you have an abridgement if you like on there on every message Show function and if we take that one away from it to just save lovers can run was see that once again and press the button form we still get a break point in message Show at it albeit with tussles with us on the left disassembly and are even within here we can go ahead and then if we were doing unmanaged debugging of it in next you going we actually accept breakpoints anywhere within this just by clicking here and setting a break point to figures show that a second that is not debugging and switch debugging motor next managed in unmanaged letters will grab properties here and change it next to his switch on unmanaged debugging their diversified account is to be the same trek
Minute 4
Then the go ahead press at the anti Syrian break point and that is what Shogun elegance that records all over this function on the disassembly who wanted to stuff your kind of thing that you can debugging you can do that anywhere within any code any time be closer to break quite just by pointing at the disassembly just do it and finish up on the if we are doing next debugging and debugging managed code as well as managed to build we can have separate points in functions again as long as we got symbolic information follows let s is identify whether functions live so as is an example of that we could onset a break point in the real message box function so the way we were going to their ears assesses a separate hear from you and run this code and then we get to that particular location but a look models we talked about this in another session
Minute 5
And don t got is make sure that I ve got symbolic information for the user 32 deal ulcer healed and that it is gone at symbols and with government and symbols and play second asset break point but say in the real message box function inside of user 32 and died in and you break point here so go ahead and set about 20 message box W explain the syntax in a second and then I said as on the language because it s not written into sharp if the okay that we should seriously run from here and then click the button on the screen we get a break point gain at user 32 at the message box function and you see the call stack if we can see that someone should have regarded book windows shows that we are dealing in user 32 dll figures about rising totally done Alan as long as we got symbolic information for an hour they say is wedded this message box W splat
Minute 6
Dixie income from them to get that name from well essentially and I haven t another function will be called that is what W because it takes a wide character string as last won the one thing the 16 hour decoration is really are a factor of the number of parameters and size parameters to message box that is so in this particular case are coming up the documentation of a message box and down worked out that lead number multiplied by the size of the parameters function without a 16 buys a matter of the 60s come from now in theory in visual studio 2005 there is a commander I should go to execute in the immediate window here are any system and here excellent and I should be able to issue this as there are X user 32 message box star and that should give needless symbols were out in force in the builder and it is right at the
Minute 7
And that s not working and they will be working in a bill by the time we get to it at a later preview or CRT so bear that in mind that it s not working quite at this moment so whereas it is anti gun and working out by reading the documentation of the message box now going back to regular managed to break little else can we do these things while we so that we can stick a brave underlined the distressing is now looking the margin that two lines of code on the on the same line if you like a week as a separate point on Oso by just clicking here and consider breakpoint and there is a break with their thighs are 32 break points and remove that ornaments that one again this night a week ago that Isis is more than one thing actually going on on the line analytically breakpoint in place as a number of different things you can do by discussing the right mouse than you going to breakpoint weekend set faces a condition so if some condition is true or
Minute 8
And condition has changed so fresh as if we were to say here perhaps so for instance try articles 10210 of them at that sale of a 10 message boxes on screen what we could do with a break point here that would only hear it so company condition unless it says I is bigger than three and anything wrong on this code was delivered onto the message boxes is so irregular there is so 123 and now a vinegar break point is that a conditional breakpoint and if we do say that condition away from second was that it account to remove that some of her condition and the more we can do other things we can do seems uncertain hit counts it has hit the breakpoint itself to count how many times is fired to
Minute 9
Ear we can say at the Mulroy sang a break every time we hit this line but we can break them when they can reach a certain value at a multiple of a certain valuable weather is greater than equal so here we could say we want to hear it where it is greater than equal to two analysts are suggesting I is fondest wishes monitoring the breakpoint itself again and everyone is now when this runs we get the first to Kompas the first break point he would have us message box okay and then the second time the breakpoint gets hit there are of course we land in the breakpoint is hit hit counter to now on that particular breakpoint now it also go and set filters on break points if we take whether it can from minute that s just always break we can set filters so that some changes you conceded we can restrict when we won this breakpoint to fire based on a
Minute 10
Which machine ready by the non process identifies remember we can debug multiple processors at the same time or thread identifiers to breathe easily to see this would be to have a multithreaded example and we were not looking at one White House let s make one of those in the second giving we can do it and which again is new in 2005 instead when sprayed on it is here reacted to want to stop in the debugger we just want to print a message to the people is that when there is it by default if this is not print down the function and the thread identifying the thread name we can also have it print out some value of our own as we got I hear so less of that sort of thing down value of eye is different out why there is well beginning the registry not natural to complete about it and never going to continue execution to avoid only do this is very content and a little diamond over him becomes a tradepoint and will notice if we run the code then
Minute 11
So the message boxes and if you look in the background at the debuggers Apple window you ll notice that done here are tracing messages coming out can see that we are in a particular function you can see the thread identifier and you can see his value of eyes to three for files or to what you can do with the Straits Times is effectively interfacing code and debug time so he forgot to put in tracing code into your application then the debuggers can step in and help you and this is very useful fuddy duddy scenarios where you re in a looked like this or a Windows messaging or something like that we d that you want to stop every time your envelope you just want to get information printed out fighting his 14th goal to do the most is that I can explore that than filter from here and will do it by producing a multithreaded example rather than one looking and but like a new project and the disco with a simple
Minute 12
Until application and what we will do is just make up the threads and some function for them to run in Athens have a function here and will bring a system not threading and will make up the threads start those both running and then we ll just sitting around and do nothing so and it out later this is what we ll do is to find something to the console and I will have are sometimes sleep shortages red dots on the front lets that over a second mother to win either multithreaded application which is built that then that let s will look what happened to visit a breakpoint on out what on
Minute 13
Is one of code here and with strong run and of course derive the breakpoint and we keep arriving at the break point and we will arrive at for quite a while sipping a second of the time and we can use the French window to workout in which thread were actually running it that it highlighted here and if we just a single step will see that as we go along figures make this so that it doesn t hide itself we receive it were a threat to us it for a moment as we stepped we moved to another thread and then we step removed to another thread and so on slip with switching between those two thread and it might be the rudest one is breakpoint execute on one particular thread so we could go and add a filter to this breakpoint and as you can see it we did so well in thread ID is equal to 2064 then we want to break if we run now with F5 you see the
Minute 14
We are only now breaking up to six for a longer breaking a beautiful treaty for it to manage the filter that down and by thread ID or if you were to name your thread so perhaps in this case let s go and done give thread one and name a squad thread one as district to inane school threat to and appear rather than rising hopes to console that s all right then thread current thread name to the council and then if we run again will receive the go ahead and hit breakpoint things to the filter unsolicited filter where the foreign policy that most of us residents now start hitting a breakpoint is at the moment we re answering three 770 this time I m switching to 2980 and so on some switching back to forward again so let s go as
Minute 15
To break the only thread one fulfil to this down now so is there only one thread name 1 and now it finds that seven were only 90 outbreak point on thread one down here 3772 slightly meaningless phrases is generally pretty good practice in graduate with a great threat it is held in lots of ways within the debugger and for instance here you can see which thread you re actually on has a proper name on it which is a great way of identifying what you go to that everything is those filters and of course similarly in the way that we are filtering by thread name on thread ID we can also filter by process ID and machine name and so on and even combine those clauses together fortunate really fancy so just as a quick recap here were every scene or looked as a
Minute 16
Breakpoint with that assessing them plan within source code with that assessment within disassembly if you re doing a knowledge debugging we look to have a commitment condition all set to hit count with Harry could be filtering and we also carry to turn a breakpoint into a trace point which is a new thing within 2005 in order to get messages printed from code without having to go out like she altered the code in order to insert additional tracing into it like a powerful features built to do that at the good time rather than having to crack open the code and rebuild it and are redeployed to do that just to finish up here what can you do if you want its more information on visual studio 2005 world as a whole amnesty and develop the centre advert and was the end Microsoft com PS2 thousand and five at a duty bound grab a copy of one of the express editions of usually 2005 so in the current beta to form there about MSDN Microsoft com express and you can just download the singular and
Minute 17
Register anything like that scrap them straight away or if the specifically want to talk and assess your feedback on an assassin then feel free to drop me a mail and Antarctic Microsoft comalt get back to you other that they give the tuning in and there was unit
Click here to go to original video page
Thursday, July 24, 2008
Video: Preparation - Locating and Managing Symbol Files
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment