Visual studio调试器-监视指针转换
visual studio debugger - watch pointer casting
我有一些丑陋的遗留代码,我试图理解并想要调试。
:
class A{
// some members and functions
// but no virtual ones
};
class B:public A
{
// contains virtual methods
}
class C:public B
{}
// now somewhere there is an array of pointers to A;
A* someList[FixSize];
// and another struct contains a pointer to that someList.
struct T{
A** list;
}t;
someList
的数组元素实际上是C
类型的。由于A
不包含任何虚拟方法,调试器只显示该列表中的A元素,而不提供其子类成员在其树视图。
将list
指针转换为C**
显然不起作用,因为在C
-对象和它的A
部分之间存在偏移。
如果将(C*)(t->list[0])
设置为手表,则调试器显示正确的数据。但是用这种方法检查50个对象不是很方便。
有没有人知道一些聪明的方法来处理这个问题
(C**)t->list,10
正在Visual Studio 2010中进行工作测试。根据您的struct T {} t
定义,它应该是(C**)(t.list),10
相关文章:
- 正在将指针转换为范围
- 如何理解将半精度指针转换为无符号长指针和相关的内存对齐
- C++:Lambda 函数指针转换的用例是什么?
- 如何将 int 指针转换为浮点指针
- 为什么在将 void 指针转换为整数指针时出现分段错误
- 将(N 个字节)无符号字符指针转换为浮点数和双 C++
- 我们可以在不知道其真实类型的情况下将基类指针转换为派生类指针吗?
- C++中数组大小未知的指针转换
- Antlr cpp 运行时 任何错误的指针转换?
- std::flush可以用于将对象指针转换为其封闭数组指针吗
- C 指针转换会导致内存访问冲突
- 模板类实例化中的指针转换无效
- 函数调用歧义(用户定义的转换和 Derived2Base 指针转换)
- 如何将 void(*)() 类型的指针转换为 void*
- 数组到指针转换期间的临时具体化
- 直接为浮点变量分配十六进制整数与通过指针转换分配之间的区别
- 将基类指针转换为派生的类指针
- 应对 std::字符串中的 std::<char>指针转换后的向量
- 在编译时将函数指针转换为 std::uintptr_t
- 将基类指针转换为未知派生类指针