_CrtSetAllocHook함수를 이용하면 쉽게 측정이 가능하다. 아래와 같이 구현하면 AllocHook이 메모리관련 함수가 호출될때마다 호출된다.

#include <crtdbg.h>

 

#define nNoMansLandSize 4

 

typedef struct _CrtMemBlockHeader

{

        struct _CrtMemBlockHeader * pBlockHeaderNext;

        struct _CrtMemBlockHeader * pBlockHeaderPrev;

        char *                      szFileName;

        int                         nLine;

#ifdef _WIN64

        /* These items are reversed on Win64 to eliminate gaps in the struct

        * and ensure that sizeof(struct)%16 == 0, so 16-byte alignment is

        * maintained in the debug heap.

        */

        int                         nBlockUse;

        size_t                      nDataSize;

#else  /* _WIN64 */

        size_t                      nDataSize;

        int                         nBlockUse;

#endif  /* _WIN64 */

        long                        lRequest;

        unsigned char               gap[nNoMansLandSize];

        /* followed by:

        *  unsigned char           data[nDataSize];

        *  unsigned char           anotherGap[nNoMansLandSize];

        */

} _CrtMemBlockHeader;

 

#define pbData(pblock) ((unsigned char *)((_CrtMemBlockHeader *)pblock + 1))

#define pHdr(pbData) (((_CrtMemBlockHeader *)pbData)-1)

 

FILE* g_hfileLog = NULL;

 

int AllocHook(int nAllocType, void *pvData, size_t nSize, int nBlockUse,

                         long lRequest, const unsigned char * szFileName, int nLine)

{

        static size_t sizeAlloc = 0;

        _CrtMemBlockHeader *pHead;

       

        if ( nBlockUse == _CRT_BLOCK )

               return true;

 

        switch (nAllocType)

        {

        case _HOOK_ALLOC:

               sizeAlloc += nSize;

               fprintf(g_hfileLog, "ALLOC\t%d\n", sizeAlloc);

               break;

        case _HOOK_REALLOC:

               break;

        case _HOOK_FREE:             

               pHead = pHdr(pvData);

               sizeAlloc -= pHead->nDataSize;

               fprintf(g_hfileLog, "FREE\t%d\n", sizeAlloc);

               break;

        }

       

        return true;

}

 

int main(int argc, char** argv)

{

        g_hfileLog = fopen("log.txt", "w+");

        fprintf(g_hfileLog, "Start\n");

 

        _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

        _CrtSetAllocHook(AllocHook);

 

 

        fclose(g_hfileLog);

        return 0;

}
저작자 표시 비영리
Posted by NOP 트랙백 0 : 댓글 0
아래의 링크를 보면 xcode에서 Makefile을 이용한 빌드 방법이 소개 되어있다.
http://developer.apple.com/DOCUMENTATION/Porting/Conceptual/PortingUnix/preparing/chapter_3_section_4.html

설명된 내용과 같이 “External Target”과 “New Custom Executable”을 추가하면 무리없이 빌드가 가능하다. 그러나 디버깅시에는 디버깅 심볼을 추가함에도 Break point를 추가해도 Pause되지 않는다. 이런 경우에는 Preferences에서 Symbol Loading Options의 Load symbols lazily 옵션을 끄면 디버깅 할 수 있다.


하지만 Obj-C를 사용하는 것이 아니라면  그냥 Xcode를 사용하는 것 보다는 Eclipse를 사용하는 것이 더 편하다;;

Posted by NOP 트랙백 0 : 댓글 0

Apple iPhone NDA 포기

2008/10/02 09:48 from iPhone

We have decided to drop the non-disclosure agreement (NDA) for released iPhone software.

We put the NDA in place because the iPhone OS includes many Apple inventions and innovations that we would like to protect, so that others don’t steal our work. It has happened before. While we have filed for hundreds of patents on iPhone technology, the NDA added yet another level of protection. We put it in place as one more way to help protect the iPhone from being ripped off by others.

However, the NDA has created too much of a burden on developers, authors and others interested in helping further the iPhone’s success, so we are dropping it for released software. Developers will receive a new agreement without an NDA covering released software within a week or so. Please note that unreleased software and features will remain under NDA until they are released.

Thanks to everyone who provided us constructive feedback on this matter.

애플이 공식적으로 iPhone의 NDA를 해제하기로 결정했다. 그 간 공식적으로 내부적으로 분석된 내용에 대해서 출판이 불가했다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
TAG iphone, NDA
Posted by NOP 트랙백 0 : 댓글 0

Cocos2D

2008/09/01 23:42 from iPhone
cocos2d is a framework for building 2D games, demos, and other graphical/interactive applications.

cocos2d
http://www.cocos2d.org/
cocos2d-iphone http://code.google.com/p/cocos2d-iphone/
Posted by NOP 트랙백 0 : 댓글 0
iPhoneDev에서 공식적으로 배포하기전 자신의 블로그에서 PwnageTool 2.0을 공개했다.

Thanks for waiting :)

Here you go.

We’ll be releasing a more official announcement soon, but we wanted to get the tool out there. We sincerely hope you enjoy using it as much as we enjoyed making it :)

Update 1: Just to clear up some confusion over what this actually does: yes, it jailbreaks and unlocks older iPhones, and jailbreaks iPhone 3Gs and iPod Touches. We only support the 2.0 firmwares.

Update 2: It looks like there aren’t enough TCP ports on that server, so _BigBoss_ has generously offered to mirror it.

Update 3: If you get Error 1600 from iTunes, try: mkdir “~/Library/iTunes/Device Support” ;  if that directory already exists, remove any files in it.  Then re-run PwnageTool. 

이로 2.0 Firmware도 Jailbreak가 되었다. 앞으로도 AppStore와 비공식 루트(Install.app)가 공존할 가능성은 있어보인다.

 
이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by NOP 트랙백 0 : 댓글 0

LNK 4099 에러관련

2008/06/25 11:58 from WinCE

CE타겟을 빌드시 다음 에러가 발생하는 경우가 있다.

Warning 1 warning LNK4099: PDB 'libbmtd.pdb' was not found with 'C:\Program Files\Microsoft Visual Studio 8\VC\ce\lib\ARMV4I\LIBCMTD.lib' or at 'c:\Local Development\Visual C# 2005 Projects\StatusMWS\SCCECamera\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug\libbmtd.pdb'; linking object as if no debug info LIBCMTD.lib

Warning 2 warning LNK4099: PDB 'libbmtd.pdb' was not found with 'C:\Program Files\Microsoft Visual Studio 8\VC\ce\lib\ARMV4I\LIBCMTD.lib' or at 'c:\Local Development\Visual C# 2005 Projects\StatusMWS\SCCECamera\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug\libbmtd.pdb'; linking object as if no debug info LIBCMTD.lib

이 에러는 링크 옵션 ignore으로 제거되지 않는다.


아래의 내용을 확인해보면 Unignorable Warnings중 하나 이기 때문이다.

http://www.geoffchappell.com/studies/msvc/link/link/options/ignore.htm

LINK /IGNORE

This option directs LINK to ignore the specified warnings.

Syntax

/ignore:warning[[,warning]...]

At least one argument is required. All arguments must be numbers between 4000 and 4999 inclusive. It is a fatal error (LNK1147) if any argument does not evaluate satisfactorily.

The /ignore option is for the command line only. It is not valid as a directive in an object file.

Behaviour

In general, each of the specified warnings gets registered to be ignored. This means that should it occur, for whatever reason in whatever circumstances subsequent to the processing of this option, there will be no warning message and neither will its occurrence be treated as an error if the /wx option is active.

Unignorable Warnings

Some warning numbers are apparently too important to ignore:

LNK4017
%S statement not supported for the target platform

LNK4033
converting object format from OMF to COFF

LNK4044
unrecognized option '/%S'; ignored

LNK4062
'%S' not compatible with '%S' target machine; option ignored

LNK4075
ignoring '/%S' due to '/%S' specification

LNK4086
entrypoint '%S' is not __stdcall with 12 bytes of arguments; image may not run

LNK4088
image being generated due to /FORCE option; image may not run

LNK4099
PDB '%S' was not found with '%S' or at '%S'; linking object as if no debug info

LNK4105
no argument specified with option '/%S'; ignoring option

LNK4224
%S is no longer supported; ignored

LNK4228
'/%S' invalid for a DLL; ignored

LNK4229
invalid directive '/%S' encountered; ignored

To specify any of these in a /ignore option is not an error and brings no complaint. The specification is just not acted on. Should the specified warning ever occur, a warning message will still be displayed, and if the /wx option is active, the warning will still be promoted to an error.

Coding Error

As an aside, whichever of Microsoft’s programmers is currently in charge of LINK.EXE may care to note a small, presently inconsequential, coding error in the function that registers a warning number to be ignored. The unignorable warning numbers are defined as an array, with 12 members. In the loop that checks whether a warning number is in this array (and therefore not to be registered), the loop index presently runs to 48, i.e., to the sizeof the relevant array rather than to the number of elements in that array.

Not Quite Unignorable Warnings

For some warning numbers, specification in a /ignore option is accepted but not necessarily acted upon. Should the warning occur while the /wx option is not active, then the warning message is still displayed, but if the /wx option is active, then the warning is ignored. It is as if the warning is thought important enough to override an attempt at ignoring it, but not if the user has put too high a price on unignored warnings.

The following warning numbers are affected:

4200, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4219, 4231 and 4237

but note that 4208 can also occur in circumstances such that it is ignored independently of /wx.

Implicitly Ignored Warnings

There is presently one case of a warning being set to be ignored without the corresponding /ignore option being given explicitly. A side-effect of /subsystem:xbox is that warning 4078 gets registered internally as an ignored warning.

Comment

For who knows what reason, this obviously convenient switch is apparently undocumented. A corresponding switch for the compiler, /wd, has long been documented, as has a pragma for use in source code.

Though the /ignore switch may be undocumented, Microsoft has used it in the master makefiles for DDKs as far back as for NT 4.0. The warnings that Microsoft has found it necessary, or at least convenient, to disable in at least some cases when building device drivers over several DDK versions are:

LNK4001
no object files specified; libraries used

LNK4010
invalid version number %S; default version assumed

LNK4037
'%S' does not exist; ignored

LNK4039
section '%S' specified with /SECTION option does not exist

LNK4044
unrecognized option '/%S'; ignored

LNK4065
'%S' cannot be ordered; ignored

LNK4070
/OUT:%S directive in .EXP differs from output filename '%S'; ignoring directive

LNK4078
multiple '%S' sections found with different attributes (%08X)

LNK4087
CONSTANT keyword is obsolete; use DATA

LNK4088
image being generated due to /FORCE option; image may not run

LNK4089
all references to '%S' discarded by /OPT:REF

LNK4096
/BASE value '0x%X' is invalid for Windows 95 and Windows 98; image may not run

LNK4108
/ALIGN specified without /DRIVER or /VXD; image may not run

LNK4198
base key '%S' not found - using default

LNK4218
non-native module found; restarting link with /LTCG

LNK4221
no public symbols found; archive member will be inaccessible

LNK4235
/LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance

물론 위와 같은 에러의 경우에는 아래 URL에서 설명된 것 처럼 Code generation의 Buffer Security Check를 끄면 Warring이 사라지지만 Buffer overflow 체크 기능도 같이 사라진다.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=189726&SiteID=1

Posted by NOP 트랙백 0 : 댓글 0

이번에 Apple에서 iPhone SDK Beta 3를 공개했다. 릴리즈 노트를 확인하면 대부분 버그 픽스가 많은데 가장 놀라운 점은 시뮬레이터 상에서 한글 입력이 된다는 점이다. 모양은 이쁘지 않지만 공식적으로 Apple에서 한글 지원한다는데 의미가 있을 것 같다.


  

이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by NOP 트랙백 0 : 댓글 0

어제(4월 3일) PwnageTool이 배포 되었다.

이미 미리 공개된 동영상을 통해 확인되었지만 사용방법은 간단하다. ipsw파일만 재생성 후에 iTure으로 복구시키기만 하면 된다. 현재 2.0 Beta Firmware까지 적용이 가능하다. 현재 2.0 Beta로 업로딩 한다고 하더라도 Installer.app 아이콘은 볼 수 없다. 아직 2.0 버전은 지원하지 않기 때문이다. 이 외에도 기타 프로그램은 호환이 안되며 최소한 재컴파일 후에 가능하리라고 생각된다.

다행히 PwnageTool로 재생성된 Firmware에는 OpenSSH는 설치되어 루트로의 접근은 가능하다. 하지만 아쉽게도 XCode를 통해 단말로의 접근은 불가능하다. 코드 사이닝 문제로 생각되며 이 부분은 더 확인을 해봐야 할 것 같다.

PwnageTool
http://ipp.iphwn.org/PwnageTool_1.0.zip


PwnageTool 사용방법은 다음과 같다.
PwnageTool OSX Usage Guide PWN It
http://www.modmyifone.com/wiki/index.php/PwnageTool_OSX_Usage_Guide_PWN_It
PwnageTool OSX Firmware 2.0 Beta Guide Create IPSW
http://www.modmyifone.com/wiki/index.php/PwnageTool_OSX_Firmware_2.0_Beta_Guide_Create_IPSW

이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by NOP 트랙백 0 : 댓글 0

iPhone DevTeam 해체?

2008/04/01 10:19 from iPhone

iPhone DevTeam은 새로운 펌웨어 크랙 방식으로 Pwange tool을 소개했었고 3월 말 발표하기로 약속했다. 진행 사항이 궁금하여 사이트를 방문한 결과 아래와 같은 내용을 확인할 수 있었다.



간단한 요약하면 이 바닥에서 물러나고 그간 개발했던 관련툴과 공개하기로 약속했던 Pwnage Tool 역시 외부 공개를 하지 않겠다는 내용이다. 현재 IRC체널에서는 이와 관련된 질문을 거부하고 있다.

ZiPhone 개발자도 2.0출시 전까지 해당툴을 공개하지 않기로 한 것을 보면 어떤 외압이나 딜이 있지 않았을까?
만우절 농담이길...다. =ㅁ=

현재 재확인 결과 다음과 같은 그림으로 변경됐다. 낚였다;;

사용자 삽입 이미지

이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by NOP 트랙백 0 : 댓글 1

사용자 삽입 이미지
 

iPhone SDK가 새로 릴리즈 됐다. 인터페이스 빌더가 추가된 것이 주 변경사항이며 아직은 베타 수준이라 완벽하지는 않은 것 같다. 빌드 타겟의 버전도 1.2에서 2.0으로 변경되었고 시뮬레이터도 Aspen Simulrator에서 iPhone Simulrator로 변경되었다.

Interface Builder 3.1 Beta 2 Release Notes

http://developer.apple.com/iphone/library/releasenotes/DeveloperTools/RN-InterfaceBuilder/index.html

Beta 1 to Beta 2 API Delta

https://developer.apple.com/iphone/library/releasenotes/Miscellaneous/RN-iPhoneBetaAPIDiffs/index.html

이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by NOP 트랙백 0 : 댓글 0