I want to setup a breakpoint in WinDbg if an access violation happens for a pointer. Is there a way to setup that breakpoint?
By default, WinDbg should already break on first and second chance exceptions of that type. If it doesn't, you must have made a different setting once and then saved that into a workspace which is now loaded. Typical candidate would be the user default
workspace.
You can change the setting in Debug / Event Filters ...
menu or with the commands
sxe av; *** Enable first chance and second chance exceptions (usually a good choice)
sxd av; *** Enable second chance exceptions
sxr; *** Reset all exception filters to default
Another option would be to delete the WinDbg workspaces Registry key at
HKCU\Software\Microsoft\Windbg\Workspaces
while WinDbg is not running. Note that there might be several workspaces deleted. Don't do that if you have put effort in setting up your workspaces. However, in that case I doubt you would have forgotten about the accesss violation setting.