1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/gdb/tests/test-Root-null.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,20 @@ 1.4 +# Test printing roots that refer to NULL pointers. 1.5 + 1.6 +# Since mozilla.prettyprinters.Pointer declines to create pretty-printers 1.7 +# for null pointers, GDB built-in printing code ends up handling them. But 1.8 +# as of 2012-11, GDB suppresses printing pointers in replacement values: 1.9 +# see: http://sourceware.org/ml/gdb/2012-11/msg00055.html 1.10 +# 1.11 +# Thus, if the pretty-printer for JS::Rooted simply returns the referent as 1.12 +# a replacement value (which seems reasonable enough, if you want the 1.13 +# pretty-printer to be completely transparent), and the referent is a null 1.14 +# pointer, it prints as nothing at all. 1.15 +# 1.16 +# This test ensures that the JS::Rooted pretty-printer doesn't make that 1.17 +# mistake. 1.18 + 1.19 +gdb.execute('set print address on') 1.20 + 1.21 +run_fragment('Root.null') 1.22 + 1.23 +assert_pretty('null', '0x0')