Implement GDB Xmethods for std::vector and std::unique_ptr.
This patch implements a helper for defining Xmethods simply and example
Xmethod implementations of useful functions on std::vector and
std::unique_ptr which are normally inlined and cannot be invoked.
This expediates debugging code, you don't have to remember which
internal data members represent the vector contents or unique_ptr
pointer value.
For example, before:
(rr) p ignore
$1 = std::__1::unique_ptr<base::AutoReset<bool>> = 0x30f6a6b22ac0 => {scoped_variable_ = 0x30f6a6987880, original_value_ = false}
(rr) p ignore.get()
Cannot evaluate function -- may be inlined
(rr) p *ignore
Could not find operator*.
(rr) p ignore->original_value_
Could not find operator->.
(rr) p layers
$2 = std::__1::vector (length=8, capacity=8) = {0x30f6a665a3a0}
(rr) p layers.size()
Cannot evaluate function -- may be inlined
(rr) p layers[0]
Could not find operator[].
After:
(rr) p ignore
$1 = std::__1::unique_ptr<base::AutoReset<bool>> = 0x30f6a6b22ac0 => {scoped_variable_ = 0x30f6a6987880, original_value_ = false}
(rr) p ignore.get()
$2 = (base::AutoReset<bool> *) 0x30f6a6b22ac0
(rr) p *ignore
$3 = {scoped_variable_ = 0x30f6a6987880, original_value_ = false}
(rr) p ignore->original_value_
$4 = false
(rr) p layers
$5 = std::__1::vector (length=8, capacity=8) = {0x30f6a665a3a0}
(rr) p layers.size()
$6 = 1
(rr) p layers[0]
$7 = (cc::FakePictureLayerImpl *) 0x30f6a665a3a0
Bug: None
Change-Id: Ia4b7495ca29568844d1e1c75ce6bcb3f1d8ba98e
Reviewed-on: https://chromium-review.googlesource.com/c/1302697
Commit-Queue: Robert Flack <flackr@chromium.org>
Reviewed-by:
Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605328}
Showing
Please register or sign in to comment