2010-07-15 6 views
2

전역 네임 스페이스에 정의 된 사용자 정의 클래스 객체의 stl 벡터가 있습니다 (예, 악의, 알고 있습니다). 이제이 벡터의 특정 요소에 대한 (public) 멤버 변수의 가능한 변경 사항을 모니터링하기 위해 gdb에 감시 점을 설정하려고합니다. 다음과 같이하십시오 :gdb를 통해 stl 벡터의 내용보기

watch custom_namespace::vec[123].aVariable 

이렇게하면 gdb (Ubuntu Lucid의 버전 7.1)가 segfaults입니다. 다른 방법이 있습니까? 이것이 가능합니까? 이 (gdb manual에서) 귀하의 경우에 적용되는 경우

+0

해당 변수의 유형은 무엇입니까? –

+0

구문에 관계없이 segfault로 이어지지 않아야합니다. 이 문제를 gdb 메일 링리스트에보고 했습니까? 그들은 당신을 도우며 버그를 고칠 수도 있습니다. – ereOn

+0

변수 자체는 double 유형입니다. 벡터는 주로 double, int 및 bool 값을 묶는 클래스의 객체를 포함합니다. 거기에 멋진 아무것도. 아니요, 아직 gdb-list를 확인하지 않았습니다. 실제로 저는 ddd를 사용합니다. 먼저 독립형 gdb로 확인해야합니다. – janitor048

답변

2

은 참조 :

Sometimes, gdb cannot set a hardware watchpoint because the data type of the watched expression is wider than what a hardware watchpoint on the target machine can handle. For example, some systems can only watch regions that are up to 4 bytes wide; on such systems you cannot set hardware watchpoints for an expression that yields a double-precision floating-point number (which is typically 8 bytes wide). As a work-around, it might be possible to break the large region into a series of smaller ones and watch them with separate watchpoints.


(int*)에 주소를 전송 해 봅니다. 그것은 여전히 ​​세그 폴트인가?

또한 STL vector은 내부 버퍼를 확장해야 할 경우 콘텐츠를 이동하므로 개체가 감시 점 아래에서 "도난 당할"수 있습니다.