Go to the first, previous, next, last section, table of contents.


Overall Structure

Àüü ±¸Á¶

GDB consists of three major subsystems: user interface, symbol handling (the symbol side), and target system handling (the target side).

GDB´Â 3°³ÀÇ ÁÖ¿ä ÇÏÀ§ ½Ã½ºÅÛÀ¸·Î ÀÌ·ç¾îÁ® ÀÖ´Ù: À¯Àú ÀÎÅÍÆäÀ̽º, ½Éº¼ Çڵ鸵(½Éº¼ ºÎºÐ), ±×¸®°í Ÿ°Ù ½Ã½ºÅÛ Çڵ鸵(Ÿ°Ù ºÎºÐ)

The user interface consists of several actual interfaces, plus supporting code.

À¯Àú ÀÎÅÍÆäÀ̽º´Â ¸î¸î ½ÇÁ¦ÀûÀÎ ÀÎÅÍÆäÀ̽º¿Í Áö¿ø ÄÚµå·Î ÀÌ·ç¾îÁ® ÀÖ´Ù.

The symbol side consists of object file readers, debugging info interpreters, symbol table management, source language expression parsing, type and value printing.

½Éº¼ ºÎºÐÀº °´Ã¼ ÆÄÀÏ ¸®´õ, µð¹ö±ë Á¤º¸ Çؼ®±â, ½Éº¼ ÆÄÀÏ °ü¸®, ¼Ò½º ÆÄÀÏ Ç¥Çö½Ä ÆĽÌ, ŸÀÔ°ú °ª Ãâ·ÂÀ¸·Î ÀÌ·ç¾îÁ® ÀÖ´Ù.

The target side consists of execution control, stack frame analysis, and physical target manipulation.

Ÿ°Ù ºÎºÐÀº ½ÇÇà Á¦¾î, ½ºÅà ÇÁ·¹ÀÓ ºÐ¼® ±×¸®°í ¹°¸®Àû Ÿ°Ù Á¶Á¤·Î ÀÌ·ç¾îÁ® ÀÖ´Ù.

The target side/symbol side division is not formal, and there are a number of exceptions. For instance, core file support involves symbolic elements (the basic core file reader is in BFD) and target elements (it supplies the contents of memory and the values of registers). Instead, this division is useful for understanding how the minor subsystems should fit together.

Ÿ°Ù ºÎºÐ/½Éº¼ºÎºÐ ±¸ºÐÀº Çü½ÄÀûÀÌÁö´Â ¾ÊÀ¸¸ç ¸î°¡Áö ¿¹¿Ü°¡ ÀÖ´Ù. ¿¹¸¦ µé¾î, ÄÚ¾î ÆÄÀÏ Áö¿øÀº ½Éº¼ ¿ä¼Ò(±âº» ÄÚ¾î ÆÄÀÏ ¸®´õ´Â BFD¿¡ ÀÖ´Ù.)¿Í Ÿ°Ù ¿ä¼Ò(¸Þ¸ð¸®ÀÇ ³»¿ë°ú ·¹Áö½ºÅÍÀÇ °ªµéÀ» Á¦°øÇÑ´Ù.)¿Í °ü·ÃÀÌ ÀÖ´Ù. ´ë½Å, ÀÌ·¯ÇÑ ±¸ºÐÀº ÀÛÀº ÇÏÀ§ ½Ã½ºÅÛÀÌ ¾î¿ï¸®´Â ¹æ¹ýÀ» ÀÌÇØÇϴµ¥ À¯¿ëÇÏ´Ù.

The Symbol Side

Symbol ºÎºÐ

The symbolic side of GDB can be thought of as "everything you can do in GDB without having a live program running". For instance, you can look at the types of variables, and evaluate many kinds of expressions.

GDBÀÇ ½Éº¼ ºÎºÐÀº "ÇÁ·Î±×·¥À» µ¹¸®´Â°Í ¾øÀÌ ¿©·¯ºÐÀº GDB³»¿¡¼­ ¸ðµç°ÍÀ» ÇÒ¼ö ÀÖ´Ù"¿Í °°Àº ÀǵµÀϼö ÀÖ´Ù. ¿¹¸¦ µé¾î, º¯¼ö ŸÀÔÀ» º¼¼ö ÀÖÀ¸¸ç ¸¹Àº Á¾·ùÀÇ Ç¥Çö½ÄÀ» Æò°¡ÇÒ¼ö ÀÖ´Ù.

The Target Side

Target ºÎºÐ

The target side of GDB is the "bits and bytes manipulator". Although it may make reference to symbolic info here and there, most of the target side will run with only a stripped executable available--or even no executable at all, in remote debugging cases.

GDBÀÇ Å¸°Ù ºÎºÐÀº "bits¿Í bytes Á¶Á¾ÀÚ"ÀÌ´Ù. ºñ·Ï ¿©±â Àú±â¿¡ ½Éº¼¸¯ Á¤º¸¿¡ ´ëÇÑ ÂüÁ¶¸¦ ¸¸µç´Ù ÇÒÁö¶óµµ, Ÿ°Ù ºÎºÐÀÇ ´ëºÎºÐÀº ½ºÆ®¸³µÈ ½ÇÇà ÆÄÀϸ¸À¸·Î ÀÛµ¿µÈ´Ù.--¶Ç´Â ºñ·Ï ¿ø°Ý µð¹ö±ëÀÇ °æ¿ì¿¡ ½ÇÇà°¡´ÉÇÏÁö ¾ÊÀ» Áö¶óµµ.

Operations such as disassembly, stack frame crawls, and register display, are able to work with no symbolic info at all. In some cases, such as disassembly, GDB will use symbolic info to present addresses relative to symbols rather than as raw numbers, but it will work either way.

¿ª ¾î¼Àºí¸®, ½ºÅà ÇÁ·¹ÀÓ µ¹¾Æ´Ù´Ï±â ±×¸®°í ·¹Áö½ºÅÍ Ãâ·Â°ú °°Àº ÀÛµ¿Àº ½Éº¼¸¯ Á¤º¸ ¾øÀ̵µ ÀÛµ¿µÉ¼ö ÀÖµû. ¿ª ¾î¼Àºí¸® °°Àº ¸î¸î °æ¿ì¿¡, GDB´Â ½Éº¼°ú °ü·ÃµÈ ÁÖ¼Ò¸¦ ³ªÅ¸³»±â À§ÇØ raw ¼öº¸´Ù´Â ½Éº¼¸¯ Á¤º¸¸¦ »ç¿ëÇÒ¼ö ÀÖÀ¸¸ç, µÑÁß ÇÑ ¹æ¹ýÀ¸·Î ÀÛµ¿µÉ¼ö ÀÖ´Ù.

Configurations

¼³Á¤µé

Host refers to attributes of the system where GDB runs. Target refers to the system where the program being debugged executes. In most cases they are the same machine, in which case a third type of Native attributes come into play.

Host´Â GDB°¡ µ¹¾Æ°¡°í ÀÖ´Â ½Ã½ºÅÛÀÇ ¼Ó¼ºÀ» °¡¸®Å²´Ù. TargetÀº µð¹ö±ëµÇ´Â ÇÁ·Î±×·¥ÀÌ ½ÇÇàµÇ°í ÀÖ´Â ½Ã½ºÅÛÀ» °¡¸®Å²´Ù. ´ëºÎºÐÀÇ °æ¿ì, À̰͵éÀº °°Àº ¸ç½ÅÀÌ¸ç ¼¼¹ø° ŸÀÔÀÇ Native ¼Ó¼ºÀÌ Ç÷¹ÀÌ¿¡¼­ ¿Â´Ù.

Defines and include files needed to build on the host are host support. Examples are tty support, system defined types, host byte order, host float format.

È£½ºÆ®¿¡¼­ ºôµåµÉ ÇÊ¿ä°¡ ÀÖ´Â Á¤ÀÇ¿Í include ÆÄÀϵéÀº È£½ºÆ® Áö¿øÀÌ´Ù. ¿¹Á¦µéÀ» tty Áö¿ø, ½Ã½ºÅÛ Á¤ÀÇ Å¸ÀÔ, È£½ºÆ® ¹ÙÀÌÆ® ¼ø¼­, È£½ºÆ® float Çü½ÄÀÌ´Ù.

Defines and information needed to handle the target format are target dependent. Examples are the stack frame format, instruction set, breakpoint instruction, registers, and how to set up and tear down the stack to call a function.

Ÿ°Ù Çü½ÄÀ» ó¸®Çϱâ À§ÇØ ÇÊ¿äÇÑ Á¤ÀÇ¿Í Á¤º¸´Â Ÿ°Ù ÀÇÁ¸ÀûÀÌ´Ù. ¿¹Á¦µéÀº ½ºÅà ÇÁ·¹ÀÓ Çü½Ä, ¸í·É¾î ÁýÇÕ, breakpoint ¸í·É¾î, ·¹Áö½ºÅÍµé ±×¸®°í ¼³Á¤ ¹æ¹ý ±×¸®°í ÇÔ¼ö¸¦ È£ÃâÇÏ´Â ½ºÅà ¾ø¾Ö±âÀÌ´Ù.

Information that is only needed when the host and target are the same, is native dependent. One example is Unix child process support; if the host and target are not the same, doing a fork to start the target process is a bad idea. The various macros needed for finding the registers in the upage, running ptrace, and such are all in the native-dependent files.

È£½ºÆ®¿Í Ÿ°ÙÀÌ °°À»¶§ ÇÊ¿äÇÑ Á¤º¸´Â native ÀÇÁ¸ÀûÀÌ´Ù. ÇÑ ¿¹Á¦´Â Unix ÀÚ½Ä ÇÁ·Î¼¼½º Áö¿øÀÌ´Ù; ¸¸ÀÏ È£½ºÆ®¿Í Ÿ°ÙÀÌ °°Áö ¾Ê´Ù¸é, Ÿ°Ù ÇÁ·Î¼¼½º¸¦ ½ÃÀÛÇϱâ À§ÇØ fork Çϴ°ÍÀº ÁÁÁö ¾ÊÀº »ý°¢ÀÌ´Ù. ´Ù¾çÇÑ ¸ÅÅ©·ÎµéÀÌ upage³» ·¹Áö½ºÅ͸¦ ¹ß°ßÇÏ°í ptrace¸¦ µ¹¸®´Âµ¥ ÇÊ¿äÇÏ¸ç ±×·¯ÇÑ °ÍµéÀº ¸ðµÎ native ÀÇÁ¸Àû ÆÄÀϵ鳻¿¡ ÀÖ´Ù.

Another example of native-dependent code is support for features that are really part of the target environment, but which require #include files that are only available on the host system. Core file handling and setjmp handling are two common cases.

native-dependent codeÀÇ ´Ù¸¥ ¿¹Á¦´Â Ÿ°Ù ȯ°æÀÇ ÀϺκÐÀΠƯ¡µé¿¡ ´ëÇÑ Áö¿øÀÌ´Ù. ±×·¯³ª È£½ºÆ® ½Ã½ºÅÛ¿¡¼­ ÀÌ¿ëÇÒ¼ö ÀÖ´Â #include ÆÄÀÏÀ» ¿ä±¸ÇÑ´Ù. ÄÚ¾î ÆÄÀÏ Çڵ鸵°ú setjmp Çڵ鸵Àº µÎ ÀϹÝÀûÀÎ °æ¿ìÀÌ´Ù.

When you want to make GDB work "native" on a particular machine, you have to include all three kinds of information.

ƯÁ¤ ¸Ó½Å¿¡¼­ GDB°¡ "native"°¡ ÀÛµ¿µÇµµ·Ï GDB¸¦ ¸¸µé±â ¿øÇÑ´Ù¸é, ¿©·¯ºÐÀº ¼¼ Á¾·ùÀÇ Á¤º¸¸¦ ¸ðµÎ Æ÷ÇÔÇØ¾ß ÇÑ´Ù.


Go to the first, previous, next, last section, table of contents.