게임을 구현함에 따라 조금씩 프로그램이 길어졌습니다. 제 4장에서는 기능의 일부를 별개의 메소드로 분할하는 방법으로 프로그램을 읽기 쉽게 할 수 있었습니다. 여기서는 프로그램을 읽기 쉽고 관리하기 쉽게 하기 위해 클래스를 만들어 봅니다.
Dice 클래스를 만들어 보자.
이 장에서는 주사위를 의미하는 클래스를 만들어봅니다. "클래스를 만든다"라고 하면 불안해 할지도 모릅니다만, 어렵지 않으니 도전해봅시다.
우선 클래스에 대해서 복습해 봅시다. 클래스라는 것은 "데이터를 조작하는 명령을 준비해놓은 도구함"과 같은 것으로 필드, 컨스트럭터, 프로퍼티, 메소드, 이벤트라는 멤버를 가지고 있습니다. 클래스를 만들 때에는 어떠한 멤버를 만들것인가를 설계할 필요가 있습니다. 이번에는 다음과 같은 멤버를 가진 클래스를 작성합니다.
(중략)
필드라는 것은 클래스 속의 데이터를 말합니다. 이번은 _number라는 int형 변수를 선언합니다. 클래스 속에서만 액세스 가능하고 클래스 밖에서는 액세스 할 수 없습니다. 변수명에 언더스코어(_)를 붙이고 있는 것은 이 후에 선얼할 프로퍼티명과 중복되지 않도록 하기 위함입니다.
컨스트럭터라는 것은 gcnew()로 클래스를 인스턴스화 할 때 움직이는 메소드입니다. 다시말해 초기화 전용의 메소드입니다. 이번에는 Dice()라는 초기화와 Dice(int형 인수)라는 초기화 2개를 작성합니다. 전자의 방법으로 초기화하면 최초의 주사위 값은 1이 되고, 후자의 방법으로 초기화한 경우 인수의 값이 주사위 값으로 설정됩니다.
프로퍼티는 클래스의 데이터를 의미합니다만, 실제로는 필드의 값을 넣고빼는 역할을 하고 있습니다. 필드에 값을 설정하는 set용 Number프로퍼티와 필드의 값을 취득하는 get용 Number 프로퍼티를 만듭니다.
메소드는 클래스로의 명령으로 이번에는 주사위의 값을 랜덤으로 변화시키는 Shake()라는 명령을 작성합니다.
이벤트는 클래스에서 발생한 변경등의 통지를 하는 장치입니다. 이번에는 구현하지 않습니다.
또 마지막으로 주의할 것이 1개의 클래스를 만들기 위해서는 2개의 파일이 필요하다는 것입니다. 1개는 헤더 파일이고, 하나는 소스 파일입니다.
클래스를 사용해 보자 ------------------- 제 1장에서는 오브젝트 지향의 메리트는 "클래스 속의 프로그램을 몰라도 사용방법만 이해하면 그 기능을 이용할 수 있다"고 설명했습니다. 그 예로 "쉐프에게 재료를 넘기고 조리의 방법을 지시하는 것으로 요리를 만들 수 있다"고 설명했습니다. 여기서 다시 쉐프의 예로 클래스를 이용하는 순서에 대해서 설명합니다.
용어-- 클래스의 멤버 클래스는 프로퍼티와 메소드만이 아니라 필드, 컨스트럭터, 이벤트등의 조합으로도 구성됩니다. 그리고, 이것들 모두를 모아 클래스 멤버라 부릅니다. 또 필드와 컨스트럭터에 대해서는 5장에서 설명합니다.
클래스를 사용하는데에는 다음 3개의 포인트가 중요합니다. 1) 인스턴스화 2)프로퍼티의 설정과 참조 3)메소드의 실행
우선 클래스를 사용하려면 인스턴스라는 실체를 생성할 필요가 있습니다. 이것을 인스턴스화라 합니다. 클래스는 어디까지나 설계도이므로 인스턴스화에 의해 사용할 수 있게 됩니다. 쉐프라는 직함으로는 요리를 만들 수 없으며 쉐프를 고용하는(인스턴스화) 것으로 요리를 만들 수 있게 됩니다. 또, 클래스의 특징은 인스턴스마다 데이터를 가지고 있다는 것입니다. 클래스가 가진 데이터를 프로퍼티라 부릅니다. 쉐프 클래스를 2명 인스턴스화 하면 2종류의 다른 재료를 프로퍼티로 설정할 수 있습니다. 마지막으로 데이터를 조작하는 클래스의 명령인 메소드를 실행합니다. 쉐프의 예를 들자면 고기를 가진 쉐프에 "구워주세요"라고 명령하고, 채소를 가진 쉐프에게 "스프를 만들어주세요"라고 명령합니다. 이렇게 클래스를 이용하려면 "쉐프를 채용해(인스턴스화) 개별의 재료를 건네고(프로퍼티), 지시를 내리는(메소드)" 순서로 실행합니다. 그러면 실제 게임에서 클래스를 인스턴스화 해보겠습니다.
(중략)
코드 해설
여기서 난수를 발생할 수 있는 Random클래스를 사용합니다. 난수란 말 그대로 제멋대로 수를 내는 것입니다.
1] Random^ randomDice;
Random 클래스를 randomDice란 이름의 변수로 선언합니다. 이렇게 클래스의 변수를 선언할 때, 다음의 구문을 사용합니다.
클래스명^ 변수명;
int형등의 기본형 변수와 다르게 클래스 명 뒤에 "^"이라는 매니지코드의 클래스 인스턴스 영역을 나타내는 기호를 습니다. 이기호는 캐럿 또는 햇기호라 불립니다. 이렇게 인스턴스를 격납하는 변수를 선언할 때 이 기호를 사용합니다.
2] randomDice = gcnew Random();
클래스를 사용하려면 인스턴스화라는 초기화가 필요합니다. gcnew라는 키워드를 사용해 인스턴스화 하는 클래스의 이름을 지정합니다. 클래스에 따라서는 이름 뒤에 인수를 지정할 수 있습니다. 여기서는 Random 클래스를 지정하고 있기 때문에 Random 클래스라는 설게도에 근거해 randomDice가 인스턴스화됩니다.
변수명 = gcnew 클래스명();
3] int diceNumber; diceNumber = randomDice->Next(1,7);
주사위의 눈을 격납하기위해 int형 diceNumber란 변수를 선언하고 Random 클래스의 Next메소드를 부르고 있습니다. 이 Next메소드에는 1과 1이라는 인수를 부여합니다. 그 결과 1이상 7미만(1~6)의 난수가 발생되어 diceNumber에 격납됩니다. 여기서는 메소드로부터 게산된 결과를 얻고있다는 걸 주목해 주세요. 이것을 메소드의 반환값이라고 합니다. 여기서는 Next메소드가 1~6의 숫자를 반환값으로 생성합니다.
4] Debug.... (중략)
힌트 (중략) 치형과 참조형 ------------ .NET Framework의 매니지코드에서는 변수의 형에 치형과 참조형의 2종류가 있습니다. int, bool, float와 같은 기본형과 헬프를 볼 대에 "구조체: value class"라 정의 되어있는 형은 치형입니다. 이것 이외의 클래스 (Random과 String등)의 "클래스:ref class"라 정의 되어있는 형은 참조형입니다. 또, 치형과 참조형에스는 몇개의 다른 점이 있습니다. 치형은 그 변수의 값을 직접 격납하는 것에 반해, 참조형은 실체로의 참조를 격납합니다. 치형은 초기화에 초기값이 설정됩니다만, 참조형은 초기화시에 Null이 설정됩니다. 또, 대입할 때 치형은 그대로 값이 대입됩니다만, 참조형은 값이 아니 참조 정보(어드레스)가 대입됩니다. 참조형의 변수를 사용할 경우에는 이런 것을 이해해둘 필요가 있습니다.
macro list -- List all the macros defined using the `macro define' command
macro undef -- Remove the definition of the C/C++ preprocessor macro with the given name
maintenance agent -- Translate an expression into remote agent bytecode
maintenance check-symtabs -- Check consistency of psymtabs and symtabs
maintenance cplus -- C++ maintenance commands
maintenance demangle -- Demangle a C++/ObjC mangled name
maintenance deprecate -- Deprecate a command
maintenance dump-me -- Get fatal error; make debugger dump its core
maintenance dump-packets -- Print the packet log buffer
maintenance i386-prologue-parser -- Run the i386 prologue analyzer on a function
maintenance info -- Commands for showing internal info about the program being debugged
maintenance internal-error -- Give GDB an internal error
maintenance internal-warning -- Give GDB an internal warning
maintenance interval -- Set the report of low-level interval timers
maintenance list-kexts -- List kexts loaded by the kernel (when kernel debugging)
maintenance packet -- Send an arbitrary packet to a remote target
maintenance print -- Maintenance command for printing GDB internal state
maintenance report-interval -- Report the summary values for all the low-level interval timers
maintenance set -- Set GDB internal variables used by the GDB maintainer
maintenance sharedlibrary -- Commands for internal sharedlibrary manipulation
maintenance show -- Show GDB internal variables used by the GDB maintainer
maintenance show-debug-regs -- Set whether to show variables that mirror the x86 debug registers
maintenance space -- Set the display of space usage
maintenance time -- Set the display of time usage
maintenance translate-address -- Translate a section name and address to a symbol
maintenance undeprecate -- Undeprecate a command
compare-sections -- Compare section data on target to the exec file
complete -- List the completions for the rest of the line as a command
create-checkpoint -- Create a checkpoint
load-plugin -- Usage: load-plugin <plugin>
monitor -- Send a command to the remote monitor (remote targets only)
now -- Go to latest original execution line
redo -- Forward to next checkpoint
remote -- Send a command to the remote monitor
rollback -- Roll back to a checkpoint
stop -- There is no `stop' command
undo -- Back to last checkpoint
update -- Re-read current state information from inferior
overlay auto -- Enable automatic overlay debugging
overlay list-overlays -- List mappings of overlay sections
overlay load-target -- Read the overlay mapping state from the target
overlay manual -- Enable overlay debugging
overlay map-overlay -- Assert that an overlay section is mapped
overlay off -- Disable overlay debugging
overlay unmap-overlay -- Assert that an overlay section is unmapped
advance -- Continue the program up to the given location (same form as args for break command)
attach -- Attach to a process or file outside of GDB
continue -- Continue program being debugged
detach -- Detach a process or file previously attached
disconnect -- Disconnect from a target
finish -- Execute until selected stack frame returns
handle -- Specify how to handle a signal
interrupt -- Interrupt the execution of the debugged program
jump -- Continue program being debugged at specified line or address
kdp-detach -- Reset a (possibly disconnected) remote Mac OS X kernel
kdp-kernelversion -- Print the version of a remote Mac OS X kernel
kdp-reattach -- Re-attach to a (possibly connected) remote Mac OS X kernel
kdp-reboot -- Reboot a connected remote Mac OS X kernel
kill -- Kill execution of program being debugged
next -- Step program
nexti -- Step one instruction
run -- Start debugged program
sharedlibrary -- Commands for shared library manipulation
signal -- Continue program giving it signal specified by the argument
start -- Run the debugged program until the beginning of the main procedure
step -- Step program until it reaches a different source line
stepi -- Step one instruction exactly
sym-dump -- Print the contents of the specified SYM-format symbol file
target -- Connect to a target machine or process
thread -- Use this command to switch between threads
until -- Execute until the program reaches a source line greater than the current
set annotate -- Set annotation_level
set architecture -- Set architecture of target
set args -- Set argument list to give program being debugged when it is started
set auto-raise-load-levels -- Set if GDB should raise the symbol loading level on all frames found in backtraces
set auto-solib-add -- Set autoloading of shared library symbols
set backtrace -- Set backtrace specific variables
set breakpoint -- Breakpoint specific settings
set call-po-at-unsafe-times -- Set whether to override the check for potentially unsafe situations before calling print-object
set can-use-hw-watchpoints -- Set debugger's willingness to use watchpoint hardware
set case-sensitive -- Set case sensitivity in name search
set charset -- Set the host and target character sets
set check -- Set the status of the type/range checker
set checkpointing -- Set automatic creation of checkpoints
set coerce-float-to-double -- Set coercion of floats to doubles when calling functions
set complaints -- Set max number of complaints about incorrect symbols
set confirm -- Set whether to confirm potentially dangerous operations
set cp-abi -- Set the ABI used for inspecting C++ objects
set darwin_kernel-debug-level -- Set level of verbosity for Darwin Kernel debugging information
set dcache-linesize-power -- Set the power for the cache line size
set debug -- Generic command for setting gdb debugging flags
set debug-file-directory -- Set the directory where separate debug symbols are searched for
set debugvarobj -- Set varobj debugging
set demangle-style -- Set the current C++ demangling style
set disable-aslr -- Set if GDB should disable shared library address randomization
set disable-inferior-function-calls -- Set disabling of gdb from running calls in the debugee's context
set disassembly-flavor -- Set the disassembly flavor
set disassembly-name-length -- Set the maximum length of characters to print in the symbol name in disassembly output
set download-write-size -- Set the write size used when downloading a program
set editing -- Set editing of command lines as they are typed
set endian -- Set endianness of target
set environment -- Set environment variable value to give the program
set exception-catch-type-regexp -- Set exception regexp
set exception-throw-type-regexp -- Set throw regexp
set exec-argv0 -- Set the value of argv[0] to be passed to the target executable
set exec-done-display -- Set notification of completion for asynchronous execution commands
set exec-pathname -- Set the pathname to be used to start the target executable
set extension-language -- Set mapping between filename extension and source language
set follow-fork-mode -- Set debugger response to a program call of fork or vfork
set forking-checkpoints -- Set forking to create checkpoints
set function-end-absolute -- Set if N_FUN end-of-function symbols use absolute addresses on non-GCC files
set gnutarget -- (Set the current BFD target
set height -- Set number of lines gdb thinks are in a page
set history -- Generic command for setting command history parameters
set host-charset -- Set the host character set
set inferior-auto-start-cfm -- Set if GDB should enable debugging of CFM shared libraries
set inferior-auto-start-dyld -- Set if GDB should enable debugging of dyld shared libraries
set inferior-bind-exception-port -- Set if GDB should bind the task exception port
set inferior-ptrace -- Set if GDB should attach to the subprocess using ptrace ()
set inferior-ptrace-on-attach -- Set if GDB should attach to the subprocess using ptrace ()
set inferior-tty -- Set terminal for future runs of program being debugged
set inform-optimized -- Set gdb informing you when you are debugging optimized code
set inlined-stepping -- Set the ability to maneuver through inlined function calls as if they were normal calls
set input-radix -- Set default input radix for entering numbers
set interpreter -- Set the interpreter for gdb
set kdp-debug-level -- Set level of verbosity for KDP debugging information
set kdp-default-host-type -- Set CPU type to be used for hosts providing incorrect information (powerpc/ia32)
set kdp-default-port -- Set default UDP port on which to attempt to contact KDP
set kdp-exception-sequence-number -- Set current sequence number for KDP exception transactions
set kdp-retries -- Set number of UDP retries for (non-exception) KDP transactions
set kdp-sequence-number -- Set current sequence number for KDP transactions
set kdp-timeout -- Set UDP timeout in milliseconds for (non-exception) KDP transactions
set kext-symbol-file-path -- Set the directory where kextutil-generated sym files are searched for
set language -- Set the current source language
set let-po-run-all-threads -- Set whether po should run all threads if it can't safely run only the current thread
set listsize -- Set number of source lines gdb will list by default
set locate-dsym -- Set locate dSYM files using the DebugSymbols framework
set logging -- Set logging options
set lookup-objc-class -- Set whether we should attempt to lookup Obj-C classes when we resolve symbols
set mach-o-process-exports -- Set if GDB should process indirect function stub symbols from object files
set max-checkpoints -- Set the maximum number of checkpoints allowed (-1 == unlimited)
set max-user-call-depth -- Set the max call depth for user-defined commands
set mi-show-protections -- Set whether to show "public"
set mi-timings-enabled -- Set whether timing information is displayed for mi commands
set minimal-signal-handling -- Set whether we run with a minimal signal handling set
set mmap-string-tables -- Set if GDB should use mmap() to read STABS info
set mmap-symbol-files -- Set if GDB should use mmap() to read from external symbol files
set objc-class-method-limit -- Set the maximum number of class methods we scan before deciding we are looking at an uninitialized object
set objc-exceptions-interrupt-hand-call-fns -- Set whether hitting an ObjC exception throw interrupts a function called by hand from the debugger
set objc-non-blocking-mode -- Set whether all inferior function calls should use the objc non-blocking mode
set objc-version -- Set the current Objc runtime version
set opaque-type-resolution -- Set resolution of opaque struct/class/union types (if set before loading symbols)
set os -- Set operating system
set osabi -- Set OS ABI of target
set output-radix -- Set default output radix for printing of values
set overload-resolution -- Set overload resolution in evaluating C++ functions
set pagination -- Set state of pagination
set pathname-substitutions -- Set string substitutions to be used when searching for source files
set print -- Generic command for setting how things print
set prompt -- Set gdb's prompt
set radix -- Set default input and output number radices
set read-type-psyms -- Set if we should create partial symbols for types
set remote -- Remote protocol specific variables
set remoteaddresssize -- Set the maximum size of the address (in bits) in a memory packet
set remotebaud -- Set baud rate for remote serial I/O
set remotebreak -- Set whether to send break if interrupted
set remotecache -- Set cache use for remote targets
set remotedevice -- Set device for remote serial I/O
set remotelogbase -- Set numerical base for remote session logging
set remotelogfile -- Set filename for remote session recording
set remotetimeout -- Set timeout limit to wait for target to respond
set remotewritesize -- Set the maximum number of bytes per memory write packet (deprecated)
set restore -- Set restore specific command settings
set scheduler-locking -- Set mode for locking scheduler during execution
set serial -- Set default serial/parallel port configuration
set sharedlibrary -- Generic command for setting shlib settings
set shlib-path-substitutions -- Set path substitutions to be used when loading shared libraries
set show_breakpoint_hit_counts -- Set if GDB should show breakpoint hit counts
set solib-absolute-prefix -- Set prefix for loading absolute shared library symbol files
set solib-search-path -- Set the search path for loading non-absolute shared library symbol files
set start-with-shell -- Set if GDB should use shell to invoke inferior (performs argument expansion in shell)
set step-mode -- Set mode of the step operation
set stop-on-solib-events -- Set stopping for shared library events
set struct-convention -- Set the convention for returning small structs
set subsystem-checkpointing -- Set checkpointing of subsystems
set symbol-reloading -- Set dynamic symbol table reloading multiple times in one run
set target-charset -- Set the target character set
set target-function-call-timeout -- Set a timeout for gdb issued function calls in the target program
set trust-readonly-sections -- Set mode for reading from readonly sections
set unwindonsignal -- Set unwinding of stack if a signal is received while in a call dummy
set use-array-stride -- Set if GDB should honor the 'stride' parameter of array types
set use-eh-frame-info -- Set if GDB should use the EH frame/DWARF CFI information to backtrace
set variable -- Evaluate expression EXP and assign result to variable VAR
set varobj-print-object -- Set varobj to construct children using the most specific class type
set varobj-runs-all-threads -- Set to run all threads when evaluating varobjs
set verbose -- Set verbosity
set watchdog -- Set watchdog timer
set width -- Set number of characters gdb thinks are in a line
set write -- Set writing into executable and core files
sharedlibrary add-symbol-file -- Add a symbol file
sharedlibrary apply-load-rules -- Apply the current load-rules to the existing shared library state
sharedlibrary cache-symfile -- Generate persistent caches of symbol files for a specified executable
sharedlibrary cache-symfiles -- Generate persistent caches of symbol files for the current executable state
sharedlibrary remove-symbol-file -- Remove a symbol file
sharedlibrary section-info -- Get the section info for a library (given by the index from "info sharedlibrary")
sharedlibrary set-load-state -- Set the load level of a library (given by the index from "info sharedlibrary")
sharedlibrary update -- Process all pending DYLD events
show annotate -- Show annotation_level
show architecture -- Show architecture of target
show args -- Show argument list to give program being debugged when it is started
show auto-raise-load-levels -- Show if GDB should raise the symbol loading level on all frames found in backtraces
show auto-solib-add -- Show autoloading of shared library symbols
show backtrace -- Show backtrace specific variables
show breakpoint -- Breakpoint specific settings
show call-po-at-unsafe-times -- Show whether to override the check for potentially unsafe situations before calling print-object
show can-use-hw-watchpoints -- Show debugger's willingness to use watchpoint hardware
show case-sensitive -- Show case sensitivity in name search
show charset -- Show the host and target character sets
show check -- Show the status of the type/range checker
show checkpointing -- Show automatic creation of checkpoints
show coerce-float-to-double -- Show coercion of floats to doubles when calling functions
show commands -- Show the history of commands you typed
show complaints -- Show max number of complaints about incorrect symbols
show confirm -- Show whether to confirm potentially dangerous operations
show convenience -- Debugger convenience ("$foo") variables
show copying -- Conditions for redistributing copies of GDB
show cp-abi -- Show the ABI used for inspecting C++ objects
show darwin_kernel-debug-level -- Show level of verbosity for Darwin Kernel debugging information
show dcache-linesize-power -- Show the power for the cache line size
show debug -- Generic command for showing gdb debugging flags
show debug-file-directory -- Show the directory where separate debug symbols are searched for
show debugvarobj -- Show varobj debugging
show demangle-style -- Show the current C++ demangling style
show directories -- Current search path for finding source files
show disable-aslr -- Show if GDB should disable shared library address randomization
show disable-inferior-function-calls -- Show disabling of gdb from running calls in the debugee's context
show disassembly-flavor -- Show the disassembly flavor
show disassembly-name-length -- Show the maximum length of characters to print in the symbol name in disassembly output
show download-write-size -- Show the write size used when downloading a program
show editing -- Show editing of command lines as they are typed
show endian -- Show endianness of target
show environment -- The environment to give the program
show exception-catch-type-regexp -- Show exception regexp
show exception-throw-type-regexp -- Show throw regexp
show exec-argv0 -- X
show exec-done-display -- Show notification of completion for asynchronous execution commands
show exec-pathname -- Show the pathname to be used to start the target executable
show extension-language -- Show mapping between filename extension and source language
show follow-fork-mode -- Show debugger response to a program call of fork or vfork
show forking-checkpoints -- Show forking to create checkpoints
show function-end-absolute -- Show if N_FUN end-of-function symbols use absolute addresses on non-GCC files
show gnutarget -- Show the current BFD target
show height -- Show number of lines gdb thinks are in a page
show history -- Generic command for showing command history parameters
show host-charset -- Show the host character set
show inferior-auto-start-cfm -- Show if GDB should enable debugging of CFM shared libraries
show inferior-auto-start-dyld -- Show if GDB should enable debugging of dyld shared libraries
show inferior-bind-exception-port -- Show if GDB should bind the task exception port
show inferior-ptrace -- Show if GDB should attach to the subprocess using ptrace ()
show inferior-ptrace-on-attach -- Show if GDB should attach to the subprocess using ptrace ()
show inferior-tty -- Show terminal for future runs of program being debugged
show inform-optimized -- Show gdb informing you when you are debugging optimized code
show inlined-stepping -- Show the ability to maneuver through inlined function calls as if they were normal calls
show input-radix -- Show default input radix for entering numbers
show interpreter -- Show the interpreter for gdb
show kdp-debug-level -- Show level of verbosity for KDP debugging information
show kdp-default-host-type -- Show CPU type to be used for hosts providing incorrect information (powerpc/ia32)
show kdp-default-port -- Show default UDP port on which to attempt to contact KDP
show kdp-exception-sequence-number -- Show current sequence number for KDP exception transactions
show kdp-retries -- Show number of UDP retries for (non-exception) KDP transactions
show kdp-sequence-number -- Show current sequence number for KDP transactions
show kdp-timeout -- Show UDP timeout in milliseconds for (non-exception) KDP transactions
show kext-symbol-file-path -- Show the directory where kextutil-generated sym files are searched for
show language -- Show the current source language
show let-po-run-all-threads -- Show whether po should run all threads if it can't safely run only the current thread
show listsize -- Show number of source lines gdb will list by default
show locate-dsym -- Show locate dSYM files using the DebugSymbols framework
show logging -- Show logging options
show lookup-objc-class -- Show whether we should attempt to lookup Obj-C classes when we resolve symbols
show mach-o-process-exports -- Show if GDB should process indirect function stub symbols from object files
show max-checkpoints -- Show the maximum number of checkpoints allowed (-1 == unlimited)
show max-user-call-depth -- Show the max call depth for user-defined commands
show mi-show-protections -- Show whether to show "public"
show mi-timings-enabled -- Show whether timing information is displayed for mi commands
show minimal-signal-handling -- Show whether we run with a minimal signal handling set
show mmap-string-tables -- Show if GDB should use mmap() to read STABS info
show mmap-symbol-files -- Show if GDB should use mmap() to read from external symbol files
show objc-class-method-limit -- Show the maximum number of class methods we scan before deciding we are looking at an uninitialized object
show objc-exceptions-interrupt-hand-call-fns -- Show whether hitting an ObjC exception throw interrupts a function called by hand from the debugger
show objc-non-blocking-mode -- Show whether all inferior function calls should use the objc non-blocking mode
show objc-version -- Show the current Objc runtime version
show opaque-type-resolution -- Show resolution of opaque struct/class/union types (if set before loading symbols)
show os -- Show operating system
show osabi -- Show OS ABI of target
show output-radix -- Show default output radix for printing of values
show overload-resolution -- Show overload resolution in evaluating C++ functions
show pagination -- Show state of pagination
show pathname-substitutions -- Show string substitutions to be used when searching for source files
show paths -- Current search path for finding object files
show print -- Generic command for showing print settings
show prompt -- Show gdb's prompt
show radix -- Show the default input and output number radices
show read-type-psyms -- Show if we should create partial symbols for types
show remote -- Remote protocol specific variables
show remoteaddresssize -- Show the maximum size of the address (in bits) in a memory packet
show remotebaud -- Show baud rate for remote serial I/O
show remotebreak -- Show whether to send break if interrupted
show remotecache -- Show cache use for remote targets
show remotedevice -- Show device for remote serial I/O
show remotelogbase -- Show numerical base for remote session logging
show remotelogfile -- Show filename for remote session recording
show remotetimeout -- Show timeout limit to wait for target to respond
show remotewritesize -- Show the maximum number of bytes per memory write packet (deprecated)
show restore -- Show current restore specific command settings
show scheduler-locking -- Show mode for locking scheduler during execution
show serial -- Show default serial/parallel port configuration
show sharedlibrary -- Generic command for showing shlib settings
show shlib-path-substitutions -- Show path substitutions to be used when loading shared libraries
show show_breakpoint_hit_counts -- Set if GDB should show breakpoint hit counts
show solib-absolute-prefix -- Show prefix for loading absolute shared library symbol files
show solib-search-path -- Show the search path for loading non-absolute shared library symbol files
show start-with-shell -- Show if GDB should use shell to invoke inferior (performs argument expansion in shell)
show step-mode -- Show mode of the step operation
show stop-on-solib-events -- Show stopping for shared library events
show struct-convention -- Show the convention for returning small structs
show subsystem-checkpointing -- Show checkpointing of subsystems
show symbol-reloading -- Show dynamic symbol table reloading multiple times in one run
show target-charset -- Show the target character set
show target-function-call-timeout -- Show the timeout for gdb issued function calls in the target program
show trust-readonly-sections -- Show mode for reading from readonly sections
show unwindonsignal -- Show unwinding of stack if a signal is received while in a call dummy
show use-array-stride -- Show if GDB should honor the 'stride' parameter of array types
show use-eh-frame-info -- Show if GDB should use the EH frame/DWARF CFI information to backtrace
show user -- Show definitions of user defined commands
show values -- Elements of value history around item number IDX (or last ten)
show varobj-print-object -- Abc
show varobj-runs-all-threads -- Set to run all threads when evaluating varobjs
show verbose -- Show verbosity
show version -- Show what version of GDB this is
show warranty -- Various kinds of warranty you do not have
show watchdog -- Show watchdog timer
show width -- Show number of characters gdb thinks are in a line
show write -- Show writing into executable and core files
backtrace -- Print backtrace of all stack frames
bt -- Print backtrace of all stack frames
down -- Select and print stack frame called by this one
frame -- Select and print a stack frame
return -- Make selected stack frame return to its caller
select-frame -- Select a stack frame without printing anything
up -- Select and print stack frame that called this one
info -- Generic command for showing things about the program being debugged
macro -- Prefix for commands dealing with C preprocessor macros
show -- Generic command for showing things about the debugger
apropos -- Search for commands matching a REGEXP
define -- Define a new command name
document -- Document a user-defined command
dont-repeat -- Don't repeat this command
down-silently -- Same as the `down' command
echo -- Print a constant string
help -- Print list of commands
if -- Execute nested commands once IF the conditional expression is non zero
interpreter-exec -- Execute a command in an interpreter
make -- Run the ``make'' program using the rest of the line as arguments
open -- Open the named source file in an application determined by LaunchServices
overlay -- Commands for debugging overlays
quit -- Exit gdb
shell -- Execute the rest of the line as a shell command
source -- Read commands from a file named FILE
up-silently -- Same as the `up' command
while -- Execute nested commands WHILE the conditional expression is non zero
target async -- Use a remote computer via a serial line
target child -- Unix child process (started by the "run" command)
target core-macho -- Use a core file as a target
target darwin-kernel -- Debug a running Darwin kernel; use 'attach' to begin
target exec -- Use an executable file as a target
target extended-async -- Use a remote computer via a serial line
target extended-remote -- Use a remote computer via a serial line
target macos-child -- Mac OS X child process (started by the "run" command)
target macos-exec -- Mac OS X executable
target remote -- Use a remote computer via a serial line
target remote-kdp -- Remotely debug a Mac OS X system using KDP
target remote-macosx -- Connect to a remote macosx device with shared library support using remote target
target remote-mobile -- Connect to a remote mobile device
tfind end -- Synonym for 'none'
tfind line -- Select a trace frame by source line
tfind none -- De-select any trace frame and resume 'live' debugging
tfind outside -- Select a trace frame whose PC is outside the given range
tfind pc -- Select a trace frame by PC
tfind range -- Select a trace frame whose PC is in the given range
tfind start -- Select the first trace frame in the trace buffer
tfind tracepoint -- Select a trace frame by tracepoint number
thread apply -- Apply a command to a list of threads
thread dont-suspend-while-stepping -- Usage: on|off <THREAD ID>|-port <EXPR>Toggle whether to not suspend this thread while single stepping the target on or off
thread resume -- Decrement the suspend count of a thread
thread suspend -- Increment the suspend count of a thread
actions -- Specify the actions to be taken at a tracepoint
collect -- Specify one or more data items to be collected at a tracepoint
end -- Ends a list of commands or actions
passcount -- Set the passcount for a tracepoint
save-tracepoints -- Save current tracepoint definitions as a script
tdump -- Print everything collected at the current tracepoint
tfind -- Select a trace frame;
trace -- Set a tracepoint at a specified line or function or address
tstart -- Start trace data collection
tstatus -- Display the status of the current trace data collection
tstop -- Stop trace data collection
while-stepping -- Specify single-stepping behavior at a tracepoint
unset environment -- Cancel environment variable VAR for the program
Usage: mdutil -pEsa -i (on|off) volume ... Utility to manage Spotlight indexes. -pPublish metadata. -i (on|off)Turn indexing on or off. -EErase and rebuild index. -sPrint indexing status. -aApply command to all volumes. -vDisplay verbose information. NOTE: Run as owner for network homes, otherwise run as root.
검색해보면
sudo mduitl -E /
로 하라고 나오는데, 살짝 맛간 경우는 상관없지만 아예 꺼져있는 경우는 안 먹는다.
그때는 다음과 같이 써준다.
sudo mdutil -i on / 이렇게 하면 /(시스템 루트)의 인덱싱을 on한다. 위와 합치면
애플 스토어에서 구입한다면야 언제나 신품이 오겠지만, 한 푼이라도 아끼고자 옥션등의 쇼핑몰에서 구입하면 미리 받아둔 제품을 발송해준다. 뭐, 하드웨어야 계속 신제품이 들어오므로 큰 문제가 없지만 애플캐어의 경우 한참 지난 재고가 오는 경우가 있다.
만약 구형 애플캐어 (안의 등록 코드가 모두 숫자로 된 것)를 받았다면 등록시 구매 증명을 요구하는 경우가 있다.
이때 다음의 자료를 준비하자.
1. 영수증 : 아래와 같은 오픈 마켓 영수증은 구매 증명이 안 된다. 애플에서 원하는 건 "공식지정 판매처"의 영수증이다. 옥션이나 쥐마켓 같은 곳은 "공식 판매처"가 아니므로 그 안에서 실제로 판 업체에게 "등록용 영수증"을 발급해달라고 한다.
다음과 같은 오픈마켓의 영수증은 인정되질 않는다.
즉 아래와 같은 영수증이 필요하다. 여기에는 구매일, 공식 판매처명, 구매 품목, 총 구매가격이 모두 나와있다.
2. 애플 캐어 시리얼 넘버 : 박스 밑을 살펴보면 바코드와 함께 등록코드 말고 시리얼 넘버가 있다. 이것을 스캔 받거나 디카로 찍어 준비해둔다.
3. 이 둘을 등록 시 첨부한다. 외국에서 대처하기 때문에 영수증의 정보를 잘못 파악해 만약 옥션등으로 앞쪽에 나와있다고 거절하는 경우가 있는데 이때는 그냥 무조건 애플 코리아 고객 지원센터에 전화를 한다. 거절 시 온 메일에 보면 Case ID : 라고 되어있는 숫자가 있는데, 이걸 불러주면 알아서 검색하고 답을 찾아준다. 만약 추가로 팩스를 보냈는데도 엉뚱한 답이 온다면 다시 전화를 걸어 영수증을 그쪽(애플 코리아)으로 보내줄테니 대신 처리해달라고 요청한다. 그러면 그쪽에서 처리해줄 것이다.
애플 코리아가 국내에서 모든 고객지원을 담당한다면 발생하지 않는 일이겠지만, 외국에서 관리하고 한국에선 서포트 정도 하는 모양으로 뭔가 원활한 소통이 안 될 경우가 있다. 그래서인지 그런 면에 대해서는 미안해하고, 매우 친절하게 대응해준다. 사실 그런 불편함이 없는 게 최고겠지만 일단 문제가 발생했다면 애플 코리아의 지원을 최대한 요청해 이용하도록 한다.
애플 개발자 등록을 하고 개발자 프로그램을 구입한 뒤 액티베이션 시킬 때 보류되는 경우가 많은 모양이다. 이때 문제로 지적되는 것 중의 하나가 "구매자"정보와 "카드 소지자" 정보가 다르다는 것이다.
그러므로, Apple ID와 Developer Program구입자의 정보를 통일시키는 작업을 먼저하고 구매를 한다면 피해갈 수 있을 것으로 보인다. 보통 카드에 나온 소지인 정보는 영어로 되어있으므로, Apple ID 가입시 한국 홈페이지에서 한국어가 먹힌다고 한국어로 적거나 하지말고 영어로 모든 정보를 적을 것. 그리고, 개발자 등록을 끝내고 구매할 때 배송처 정보 등도 모두 영어로 주소를 적고, 이름도 신용카드에 나온 이름과 동일하게 영어로 적어놓는다면 이것으로 잠시 등록 보류되는 일은 피할 수 있을 것으로 보인다.
만약, 보류가 되었다면 보류 화면에 나온 번호를 잘 기록해두고, 그 번호로 도움 페이지에서 어떻게 해야할지 문의를 하면 답이온다. 여기서 한국어를 지원해달라고 해놓으면 한국어 담당자가 메일을 보내주므로 일단 영어를 못쓰겠으면 콩글리쉬로라도 도움을 요청하라. 참고로 답은 바로 바로 오지 않고 하루에서 이틀정도 걸려 답이 온다.
CM1017을 사용하다 보니 점점 색조가 엉망이 되는 현상을 보였다. 이런 현상이 나타나는 것은 사용환경에 따라 다르겠지만 내 CM1017에 눈에 띄게 나타난 것은 약 2년이 지난 후였다. 이에 HP사에 문의를 했지만, 매뉴얼적인 답변만 온다.
과거 출력물과 이상 발생 후 출력물
"메뉴에서 컬러 캘리브레이션을 여러번 해주면 해결 될 것이다."
누가 안해보고 그런 문의를 했을 것 같나? 6시간 넘게 캘리브레이션 해보고 색이 좀 비슷해진다 싶어서 자고 일어났더니 도루묵 되어 문의한 것이다. 거기에 친절한 한마디.
"AS기간이 지났으므로 자세한 건 유료 서비스를 받아라"
아니 구입시의 모든 토너가 50%가량 남아있을 정도로 사용량도 적은 가정용 레이저 프린터가 스스로 뻗으셨는데 이게 무슨 소린가? 마침 HP 프린터 카페가 있어 거기에 질문을 올렸다. 각종 상황에 대한 출력물들과 설명을 자세하게 해서 장문의 글을 써놓았다. 그랬더니 마지 못해서 답글 달아주듯 관리자가 "알아보고 알려주겠다"라고 답글을 써놓았다.
알아보고 알려주기는 개뿔, 7월 5일 질문을 올리고 7월 9일 답글이 달린 이글은 지금까지 알아보고 있는 중인가보다. 모범답안(?)이라면 뻔하지 않은가. 운영진 교체가 있었고(실제로 그렇다) 서로 전달이 제대로 안 된 것 같다. 라고 답하겠지.
안그래도 Windows7 네이티브 드라이버를 지원해주지 않고 Vista 호환모드로 돌리는지라 CM1015처럼 USB로밖에 스캐너를 쓰지 못하고 있는데, 점점 열받는 대응이다. 드라이버를 호환성 모드로 설치하면 네트워크 인식 부분에서 더이상 진행하질 않는다. (CM1017은 CM1015에 네트워크 프린터로 동작하는 기능과 잡다한 메모리카드리더기 액정 화면을 붙인 제품이다. 즉, USB로만 연결하라는 것은 CM1015보다 더 비싸게 네트워크 기능이 필요해서 샀는데 그걸 포기하란 얘기다.) 그때 Win7 드라이버는 언제 나오냐는 문의도 친절하게 마무리했다. "더 이상의 지원은 유료다"
각설하고, 이런 찐따같은 색으로 쓸 순 없으니 인터넷을 뒤지기 시작했다. 각종 검색에 검색을 더한 결과 HP CM1015/1017은 Canon사의 레이저 엔진을 사용한 제품이며. 이 엔진의 밀폐성이 떨어져 각종 이물질이 내부로 유입된다는 것이다. 그로 인해서 시간이 지남에 따라 각종 먼지, 분진 등이 내부에 쌓이고 반사정도가 차이나게 되는 것이다. (HP는 공식적으로 공지하지 않고 있는 것으로 알고있다.)
즉, 매번 답변을 받는 소프트웨어적인 컬러 캘리브레이션으로는 해결할 수 없는 하드웨어적인 문제란 것이다.
어차피 AS기간도 지났고 해서 직접 손보기로 했다.
D-SLR의 촬상소자도 청소해봤는데 이거라고 못할쏘나.
하우징을 벗기고, 하나하나 나사를 풀렀다. 뒷쪽 DC 컨트롤러와 포매터 보드 쪽을 뽑고 문제의 레이저 스캐너를 뜯어냈다. 그리고 뚜껑을 열고 안을 살펴봤다.
역시, 맨 밑의 거울이 뿌옇다.
이것 때문에 전체적인 색의 균형이 무너지고 엉망이 된 것이었다.
센서 클리닝액을 이용해서 천천히 거울을 닦아줬다. 렌즈도 닦아주고 다른 거울들도 다 닦아줬다. 그리고 재조립. 조립은 분해의 역순.
그리고 파워 온.
51.21 Error
앗, 그런데 동작을 않는 것이었다. 검색해보니 레이저 스캔쪽 하드웨어 이상이란다.
뭐가 문제였을까? 하나 하나 다시 점검해봤다. 내부에 레이저 스캔쪽으로 연결되는 플랫케이블을 잊었다.
붉은 원 안의 넓찍한 케이블
두개를 다시 연결해주고, 재조립.
파워를 넣자 초기화 과정을 거치고 반기는 토너 잔량 표시.
성공이다.
이전에 복사해놓은 잡지 표지를 다시 복사해보기로 했다.
문제 있을 때 / 청소 직후 / 청소 후 캘리브레이션
이렇게 차이가 난다.
이런 고질적인 하드웨어 설계 미스로 인한 문제는 "리콜"해줘야 정상이 아닐까? 또, 이 문제에 대해선 기간에 상관없이 무상 청소에 대한 공지를 올려놓는 게 정상이 아닐까?
CM1015/1017은 Windows 7드라이버를 지원해주지 않은 것으로 악명을 떨치고 있는데다 하드웨어까지 불량인 제품이었다.
90년대 레이저젯 3 시절의 기억을 떠올리고 부모님이 편히 쓰시라고 구입해놓은 CM1017. 하지만 실망이 이만저만 큰 게 아니었다.
과연 다음 레이저 프린터를 구입한다면 난 HP를 또 선택할 것인가? 정말 어느 누구라도 거부할 수 없을 정도의 매력을 가진 제품을 내놓지 않는 이상, 아마도 우선 대상에서 HP는 지워놓을 것 같다.
드레멜 웍스테이션을 시작으로 스트리퍼, 각종 줄 등을 추가로 들였다. 사실 줄은 대략 형태 잡는 가공용이니 비싼 거나 싼 거나 몇 번 쓰고 버리는 건 마찬가진지라, 다이소에서 싸게 샀다. 에칭용 분말과 에칭액 처리제, 동판, 그리고 공구 외에 플라모델 키트와, 피그마 피규어도 들였다.
얼마전 자전거를 타다 전원 연결하려고 연결해놓은 커넥터 부분을 가격하는 바람에 케이블쪽 커넥터가 부러지는 일이 있었다. 다행이 다른 것으로 연결해도 전원이 들어가길래 안심하고 있었는데... 문제는 USB 연결쪽이 끊어졌는지 PC와 연결을 할 수 없는 문제가 발생했다.
그냥 쓰는 거라면 상관없지만, 맵피나, 아이나비를 업글하고 인증받으려면 PDA가 PC에 물려야하니 난감했다. 그렇다고 뜯고 USB선을 따내서 직접 연결해줄 수도 없고... 고민하던 차에 PDA내장 싱크에 IrDA로 연결하는 옵션이 있는 걸 알게되었다. 바로 IrDA동글을 구해서 테스트.
OK.
문제없이 연결되었다. 어차피 엄청난 데이터를 옮길 것도 아니고, 인증하는 정도라면 시간도 그렇고 직접 연결하지 않아도 되니 더 편하게 된 것 같다.