2012-09-19 3 views
7

Objective-C 프로그램을 디버그하려고하는데, unsigned long long 변수를 16 진수로 인쇄해야합니다. lldb 디버거를 사용하고 있습니다. (lldb) 16 진수로 부호있는 long long을 인쇄하십시오.

진수로 short을 인쇄하려면

, you can use this :

(lldb) type format add --format hex short 
(lldb) print bit 
(short) $11 = 0x0000 

그러나, 나는 그것이 unsigned long long 작동 할 수 없습니다.

// failed attempts: 
(lldb) type format add --format hex (unsigned long long) 
(lldb) type format add --format hex unsigned long long 
(lldb) type format add --format hex unsigned decimal 
(lldb) type format add --format hex long long 
(lldb) type format add --format hex long 
(lldb) type format add --format hex int 

시뮬레이터에서 iOS 앱을 실행하고 있는데 차이가있는 경우. 이 typedef unsigned long long BigInt 나에게 아이디어를 준,

(lldb) type format add --format hex A 

다음

// ObjC code 
typedef int A; 

:

답변

7

형식 add에서는 형식 이름이 단일 단어로 간주되므로 여러 단어 인 경우 인수를 인용해야합니다. 예 :

2 { 
    3  unsigned long long a = 10; 
-> 4  a += 5; 
    5  return a; 
    6 } 
(lldb) type form add -f h "unsigned long long" 
(lldb) p a 
(unsigned long long) $0 = 0x000000000000000a 
(lldb) 
1

document의 나머지 부분을 읽은 후, 나는 이런 식으로 뭔가를 할 수 있습니다 발견

// ObjC code 
typedef unsigned long long BigInt; 

(lldb) type format add --format hex BigInt 

매력처럼 작동합니다.

24

형식 문자를 사용할 수 있습니다. GDB의 문서 링크가 (너무 LLDB 작동) : http://www.delorie.com/gnu/docs/gdb/gdb_55.html

(lldb) p a 
(unsigned long long) $0 = 10 
(lldb) p/x a 
(unsigned long long) $1 = 0x000000000000000a 
+2

주 GDB는'p'와'/ x' 사이에 공간을 허용하는 반면, lldb은 GDB에서 작동 x'하지, 그래서'P/않는다는 것을, 하지만 lldb에서는 'p/x'가되어야합니다. –

관련 문제