1. A method for debugging in a computer system a function in an application upon function exit, the method comprising pausing execution of the application on entering a function, the function being part of the application under execution; determining a location of a variable stored in a stack, the location corresponding to the function exit of the function in the application, wherein the variable chosen can be read by a central processing unit before the function exits; inserting a watchpoint on the variable stored in the stack, wherein the watchpoint is inserted via using the single watchpoint register of the one CPU further without requiring a user to manually identify each of a plurality of function exits of the function, the watchpoint instructs the central processing unit to pause execution of the application on encountering the variable chosen on the stack, such that the execution of the application is paused upon the function exit of the function in the application, the watchpoint being a per-CPU breakpoint mechanism, the watchpoint visible to just one CPU of the computer system executing a thread of the application requiring tracing, and not any other CPU of the computer system, the watchpoint being inserted via using a single watchpoint register of the one CPU regardless of a number of function exits including the function exit within the function; and resuming normal execution of the application.