Translate debug-instructinos-macos.md in korean

This commit is contained in:
arus 2016-09-23 10:31:12 +09:00
parent f5694daeb7
commit 99e256f461

View file

@ -5,33 +5,32 @@
> >
> 문서의 번역이 완료되면 이 틀을 삭제해주세요. > 문서의 번역이 완료되면 이 틀을 삭제해주세요.
# Debugging on macOS # macOS 에서 디버깅하기
If you experience crashes or issues in Electron that you believe are not caused 만약 작성한 Javascript 애플리케이션이 아닌 Electron 자체의 크래시나 문제를
by your JavaScript application, but instead by Electron itself, debugging can 경험하고 있다면, 네이티브/C++ 디버깅에 익숙하지 않은 개발자는 디버깅이 약간
be a little bit tricky, especially for developers not used to native/C++ 까다로울 수 있습니다. 그렇다 해도, lldb, Electron 소스 코드가 중단점을 통해
debugging. However, using lldb, and the Electron source code, it is fairly easy 순차적으로 쉽게 디버깅할 수 있느 환경을 제공합니다.
to enable step-through debugging with breakpoints inside Electron's source code.
## Requirements ## 요구사항
* **A debug build of Electron**: The easiest way is usually building it * **Electron의 디버그 빌드**: 가장 쉬운 방법은 보통 [macOS용 빌드 설명서]
yourself, using the tools and prerequisites listed in the (buildinstruction-osx.md)에 명시된 요구 사항과 툴을 사용하여 스스로 빌드하는
[build instructions for macOS](build-instructions-osx.md). While you can 것입니다. 물론 직접 다운로드 받은 Electron 바이너리에도 디버거 연결 및
easily attach to and debug Electron as you can download it directly, you will 디버깅을 사용할 수 있지만, 실질적으로 디버깅이 까다롭게 고도의 최적화가
find that it is heavily optimized, making debugging substantially more 되어있음을 발견하게 될 것입니다: 인라인화, 꼬리 호출, 이외 여러 가지 생소한
difficult: The debugger will not be able to show you the content of all 최적화가 적용되어 디버거가 모든 변수와 실행 경로를 정상적으로 표시할 수
variables and the execution path can seem strange because of inlining, 없습니다.
tail calls, and other compiler optimizations.
* **Xcode**: In addition to Xcode, also install the Xcode command line tools. * **Xcode**: Xcode 뿐만 아니라, Xcode 명령 줄 도구를 설치합니다. 이것은 LLDB,
They include LLDB, the default debugger in Xcode on Mac OS X. It supports macOS Xcode 의 기본 디버거를 포함합니다. 그것은 데스크톱과 iOS 기기와
debugging C, Objective-C and C++ on the desktop and iOS devices and simulator. 시뮬레이터에서 C, Objective-C, C++ 디버깅을 지원합니다.
## Attaching to and Debugging Electron ## Electron에 디버거 연결하고 디버깅하기
디버깅 작업을 시작하려면, Terminal 을 열고 디버그 빌드 상태의 Electron 을
전달하여 `lldb` 를 시작합니다.
To start a debugging session, open up Terminal and start `lldb`, passing a debug
build of Electron as a parameter.
```bash ```bash
$ lldb ./out/D/Electron.app $ lldb ./out/D/Electron.app
@ -39,33 +38,33 @@ $ lldb ./out/D/Electron.app
Current executable set to './out/D/Electron.app' (x86_64). Current executable set to './out/D/Electron.app' (x86_64).
``` ```
### Setting Breakpoints ### 중단점 설정
LLDB is a powerful tool and supports multiple strategies for code inspection. For LLDB 는 강력한 도구이며 코드 검사를 위한 다양한 전략을 제공합니다. 간단히
this basic introduction, let's assume that you're calling a command from JavaScript 소개하자면, JavaScript 에서 올바르지 않은 명령을 호출한다고 가정합시다 - 당신은
that isn't behaving correctly - so you'd like to break on that command's C++ 명령의 C++ 부분에서 멈추길 원하며 그것은 Electron 소스 내에 있습니다.
counterpart inside the Electron source.
Relevant code files can be found in `./atom/` as well as in Brightray, found in 관련 코드는 `./atom/` 에서 찾을 수 있으며 마찬가지로 Brightray 도
`./vendor/brightray/browser` and `./vendor/brightray/common`. If you're hardcore, `./vendor/brightray/browser``./vendor/brightray/common` 에서 찾을 수
you can also debug Chromium directly, which is obviously found in `chromium_src`. 있습니다. 당신이 열정적이라면, Chromium 을 직접 디버깅할 수 있으며,
`chromium_src` 에서 찾을 수 있습니다.
Let's assume that you want to debug `app.setName()`, which is defined in `browser.cc` app.setName() 을 디버깅한다고 가정합시다, 이것은 browser.cc 에
as `Browser::SetName()`. Set the breakpoint using the `breakpoint` command, specifying Browser::SetName() 으로 정의되어있습니다. breakpoint 명령으로 멀추려는 파일과
file and line to break on: 줄을 명시하여 중단점을 설정합시다:
```bash ```bash
(lldb) breakpoint set --file browser.cc --line 117 (lldb) breakpoint set --file browser.cc --line 117
Breakpoint 1: where = Electron Framework``atom::Browser::SetName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 20 at browser.cc:118, address = 0x000000000015fdb4 Breakpoint 1: where = Electron Framework``atom::Browser::SetName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 20 at browser.cc:118, address = 0x000000000015fdb4
``` ```
Then, start Electron: 그리고 Electron 을 시작하세요:
```bash ```bash
(lldb) run (lldb) run
``` ```
The app will immediately be paused, since Electron sets the app's name on launch: Electron 이 시작시에 앱의 이름을 설정하기때문에, 앱은 즉시 중지됩니다:
```bash ```bash
(lldb) run (lldb) run
@ -83,8 +82,8 @@ Process 25244 stopped
(lldb) (lldb)
``` ```
To show the arguments and local variables for the current frame, run `frame variable` (or `fr v`), 현재 매개변수와 지역 변수를 보기위해, `frame variable` (또는 `fr v`) 를
which will show you that the app is currently setting the name to "Electron". 실행하면, 현재 앱 이름이 "Electron" 인 것을 불 수 있습니다.
```bash ```bash
(lldb) frame variable (lldb) frame variable
@ -94,9 +93,9 @@ which will show you that the app is currently setting the name to "Electron".
} }
``` ```
To do a source level single step in the currently selected thread, execute `step` (or `s`). 현재 선택된 쓰레드에서 소스 수준 한단계를 실행하기위해, `step` (또는 `s`) 를
This would take you into into `name_override_.empty()`. To proceed and do a step over, 실행하세요. `name_override_.empty()` 로 들어가게 됩니다. 스텝 오버 실행은,
run `next` (or `n`). `next` (또는 `n`) 을 실행하세요.
```bash ```bash
(lldb) step (lldb) step
@ -112,20 +111,21 @@ Process 25244 stopped
122 return badge_count_; 122 return badge_count_;
``` ```
To finish debugging at this point, run `process continue`. You can also continue until a certain 디버깅을 끝내려면, `process continue` 를 실행하세요. 또한 쓰레드에서 실행 줄
line is hit in this thread (`thread until 100`). This command will run the thread in the current 수를 지정할 수 있습니다 (`thread until 100`). 이 명령은 현재 프레임에서 100 줄에
frame till it reaches line 100 in this frame or stops if it leaves the current frame. 도달하거나 현재 프레임을 나가려고 할 떄 까지 쓰레드를 실행합니다.
Now, if you open up Electron's developer tools and call `setName`, you will once again hit the 이제, Electron 의 개발자 도구를 열고 `setName` 을 호출하면, 다시 중단점을 만날
breakpoint. 것 입니다.
### Further Reading ### 더 읽을거리
LLDB is a powerful tool with a great documentation. To learn more about it, consider LLDB 는 훌륭한 문서가 있는 강력한 도구입니다. 더 학습하기 위해,
Apple's debugging documentation, for instance the [LLDB Command Structure Reference][lldb-command-structure] [LLDB 명령 구조 참고][lldb-command-structure] 와
or the introduction to [Using LLDB as a Standalone Debugger][lldb-standalone]. [LLDB 를 독립 실행 디버거로 사용하기][lldb-standalone] 같은 애플의 디버깅
문서를 고려하세요.
You can also check out LLDB's fantastic [manual and tutorial][lldb-tutorial], which LLDB 의 환상적인 [설명서와 학습서][lldb-tutorial] 를 확인할 수 있습니다.
will explain more complex debugging scenarios. 그것은 더 복잡한 디버깅 시나리오를 설명합니다.
[lldb-command-structure]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2 [lldb-command-structure]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2
[lldb-standalone]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html [lldb-standalone]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html