[cfe-dev] Easier debugging with Visual Studio Visualizers

Nikola Smiljanic popizdeh at gmail.com
Tue Jul 26 10:06:38 PDT 2011


On Mon, Jul 25, 2011 at 9:48 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> Could you turn these instructions into a patch against
>
>        http://clang.llvm.org/hacking.html#debugging



Here's a patch. You might want to change the beginning to include the full
path to clangVisualizers.txt. I would've done this myself but I have no idea
where will this file end up inside the source tree :)

Added visualizer for StringRef (assumes null terminated string which I know
isn't the case always, but I don't think there's a way around this)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110726/e895fd42/attachment.html>
-------------- next part --------------

[Visualizer]

llvm::SmallVector<*,*>{
	preview (
		#(
			"[",
			($T1*)$e.EndX - ($T1*)$e.BeginX,
			"](",
			#array(
				expr: (($T1*)$e.BeginX)[$i],
				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
			),
			")"
		)
	)

	children (
		#(
			#([size] : ($T1*)$e.EndX - ($T1*)$e.BeginX),
			#([capacity] : ($T1*)$e.CapacityX - ($T1*)$e.BeginX),
			#array(
				expr: (($T1*)$e.BeginX)[$i],
				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
			)
		)
	)
}

llvm::StringRef{
	preview ([$e.Data,s])
	stringview ([$e.Data,sb])

	children (
		#(
			#([size] : $e.Length),
			#array(expr: $e.Data[$i], size: $e.Length)
		)
	)
}

clang::Token{
	preview((clang::tok::TokenKind)(int)$e.Kind)
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hacking.html.patch
Type: application/octet-stream
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110726/e895fd42/attachment.obj>


More information about the cfe-dev mailing list