GDB uses a number of debugging-specific algorithms. They are often not very complicated, but get lost in the thicket of special cases and real-world issues. This chapter describes the basic algorithms and mentions some of the specific target definitions that they use.
GDB´Â ÇÑ°³ÀÇ µð¹ö±ë-ƯÁ¤ ¾Ë°í¸®ÁòÀ» »ç¿ëÇÑ´Ù. ¾Ë°í¸®ÁòÀÌ º¹ÀâÇÏÁö´Â ¾ÊÁö¸¸, ƯÁ¤ °æ¿ì¿Í ½ÇÁ¦ ¼¼°èÀÇ À̽´µé°ú ºñ½ÁÇÏ°Ô ³°¨ÇÏ´Ù. ÀÌÀåÀº ±âº» ¾Ë°í¸®ÁòÀ» ±â¼úÇÏ°í »ç¿ëÇϴ ƯÁ¤ Ÿ°Ù Á¤ÀǵéÀ» ¾ð±ÞÇÑ´Ù.
A frame is a construct that GDB uses to keep track of calling and called functions.
ÇÁ·¹ÀÓÀº GDB°¡ È£Ãâ ¹ßÀÚÃë¿Í È£Ãâ ÇÔ¼ö¸¦ À¯ÁöÇϱâ À§ÇØ »ç¿ëÇÒ·Á°í »ý¼ºÇÑ´Ù.
FRAME_FP
in the machine description has no meaning to the
machine-independent part of GDB, except that it is used when
setting up a new frame from scratch, as follows:
¸Ó½Å ¼³¸í¼³» FRAME_FP
Àº ´ÙÀ½ ó·³ ½ºÅ©·¡Ä¡¿¡¼ »õ ÇÁ·¹ÀÓÀ» ¼³Á¤ÇÒ¶§
»ç¿ëµÇ´Â°ÍÀ» Á¦¿ÜÇÏ°í GDBÀÇ ±â°è-µ¶¸³ÀûÀÎ ºÎºÐ¿¡ ¾Æ¹«·± Àǹ̵µ °¡ÁöÁö ¾Ê´Â´Ù.
create_new_frame (read_register (FP_REGNUM), read_pc ()));
Other than that, all the meaning imparted to FP_REGNUM
is
imparted by the machine-dependent code. So, FP_REGNUM
can have
any value that is convenient for the code that creates new frames.
(create_new_frame
calls INIT_EXTRA_FRAME_INFO
if it is
defined; that is where you should use the FP_REGNUM
value, if
your frames are nonstandard.)
±×°Í ¿Ü¿¡, FP_REGNUM
¿¡ ¾Ë¸®´Â ¸ðµç Àǹ̴ ¸Ó½Å ÀÇÁ¸ÀûÀÎ Äڵ尡
¾Ë·ÁÁØ´Ù. ±×·¡¼, FP_REGNUM
´Â »õ ÇÁ·¹ÀÓÀ» ¸¸µå´Â Äڵ忡 Æí¸®ÇÑ ¾î¶² °ªÀ»
°¡Áú¼ö ÀÖ´Ù. (¸¸ÀÏ Á¤ÀǵǾî ÀÖ´Ù¸é, create_new_frame
´Â INIT_EXTRA_FRAME_INFO
À» È£ÃâÇÑ´Ù; ¸¸ÀÏ ¿©·¯ºÐÀÇ ÇÁ·¹ÀÓÀÌ Ç¥ÁØÀÌ ¾Æ´Ï¶ó¸é, FP_REGNUM
°ªÀ» »ç¿ëÇØ¾ß ÇÑ´Ù.)
Given a GDB frame, define FRAME_CHAIN
to determine the
address of the calling function's frame. This will be used to create
a new GDB frame struct, and then INIT_EXTRA_FRAME_INFO
and INIT_FRAME_PC
will be called for the new frame.
È£Ãâ ÇÔ¼öÀÇ ÇÁ·¹ÀÓ ÁÖ¼Ò¸¦ °áÁ¤Çϱâ À§ÇØ FRAME_CHAIN
¸¦ Á¤ÀÇÇÏ°í
GDB ÇÁ·¹ÀÓÀ» ÁØ´Ù.
ÀÌ°ÍÀº »õ GDB ÇÁ·¹ÀÓ ±¸Á¶¸¦ ¸¸µå´Âµ¥ »ç¿ëµÇ¸ç INIT_EXTRA_FRAME_INFO
¿Í INIT_FRAME_PC
´Â »õ ÇÁ·¹ÀÓÀ» À§ÇØ È£ÃâµÉ¼ö ÀÖ´Ù.
In general, a breakpoint is a user-designated location in the program where the user wants to regain control if program execution ever reaches that location.
ÀϹÝÀûÀ¸·Î, breakpoint´Â ¸¸ÀÏ ÇÁ·Î±×·¥ ½ÇÇàÀÌ ±× À§Ä¡¿¡ ´Ý´Â´Ù¸é Á¦¾î¸¦ º¹±ÍÇÏ±æ ¿øÇÏ´Â ÇÁ·Î±×·¥³» »ç¿ëÀÚ Á¤ÀÇ À§Ä¡ÀÌ´Ù.
There are two main ways to implement breakpoints; either as "hardware" breakpoints or as "software" breakpoints.
breakpoint¸¦ ¼öÇàÇÏ´Â 2°¡Áö ÁÖ¿ä ¹æ¹ýÀÌ ÀÖ´Ù; "hardware" breakpoint³ª "software" breakpoint
Hardware breakpoints are sometimes available as a builtin debugging features with some chips. Typically these work by having dedicated register into which the breakpoint address may be stored. If the PC (shorthand for program counter) ever matches a value in a breakpoint registers, the CPU raises an exception and reports it to GDB.
Hardware breakapoint´Â ÀϺΠĨ³» ³»Àå µð¹ö±ë Ư¡À¸·Î½á ÀÌ¿ëµÈ´Ù. ÀüÇüÀûÀ¸·Î À̰͵éÀº breakpoint°¡ ÀúÀåµÇ´Â °÷ÀÇ ·¹Áö½ºÅ͸¦ °¡Áö°í ÀÛµ¿µÈ´Ù. ¸¸ÀÏ PC(program counter)°¡ brekapoint ·¹Áö½ºÅͳ» °ª°ú ÀÏÄ¡ÇÑ´Ù¸é, CPU´Â ¿¹¿Ü°¡ ÀϾ°í GDB¿¡°Ô ÀÌ°ÍÀ» ¾Ë¸°´Ù.
Another possibility is when an emulator is in use; many emulators include circuitry that watches the address lines coming out from the processor, and force it to stop if the address matches a breakpoint's address.
´Ù¸¥ °¡´É¼ºÀº ¿¡¹Ä·¹ÀÌÅÍ°¡ »ç¿ëµÉ¶§ÀÌ´Ù; ¸¹Àº ¿¡¹Ä·¹ÀÌÅ͵éÀº ÇÁ·Î¼¼¼¿¡¼ ³ª¿À´Â ÁÖ¼Ò ¶óÀÎÀ» °Ë»çÇÏ´Â circuitry¸¦ Æ÷ÇÔÇϸç, ¸¸ÀÏ ÁÖ¼Ò°¡ breakpoint ÁÖ¼Ò¿Í ÀÏÄ¡ÇÑ´Ù¸é ¸ØÃßµµ·Ï ÇÑ´Ù.
A third possibility is that the target already has the ability to do breakpoints somehow; for instance, a ROM monitor may do its own software breakpoints. So although these are not literally "hardware breakpoints", from GDB's point of view they work the same; GDB need not do nothing more than set the breakpoint and wait for something to happen.
¼¼¹ø° °¡´É¼ºÀº Ÿ°ÙÀÌ ÀÌ¹Ì ¾î¶»°Ôµç brekapiont¸¦ ÇÒ¼ö ÀÖ´Â ´É·ÂÀ» °¡Áö°í ÀÖ´Â °ÍÀÌ´Ù.; ¿¹¸¦ µé¾î, ROM ¸ð´ÏÅÍ´Â ÀÚ½ÅÀÇ software breakpoint¸¦ °¡Áö°í ÀÖ´Ù. ±×·¡¼ ºñ·Ï À̰͵éÀÌ "hardware breakpoint"ÀÌ ¾ø´ÙÇÒÁö¶óµµ, GDB °üÁ¡¿¡¼´Â °°Àº°ÍÀ¸·Î ÀÛµ¿ÇÑ´Ù.; GDB´Â breakpoint¸¦ ¼³Á¤ÇÏ°í ¹«¾ùÀÌ ÀϾ±æ ±â´Ù¸®´Â°Í ¿Ü¿¡´Â ¾Æ¹«°Íµµ ÇÒ ÇÊ¿ä°¡ ¾ø´Ù.
Since they depend on hardware resources, hardware breakpoints may be limited in number; when the user asks for more, GDB will start trying to set software breakpoints. (On some architectures, notably the 32-bit x86 platforms, GDB cannot alsways know whether there's enough hardware resources to insert all the hardware breakpoints and watchpoints. On those platforms, GDB prints an error message only when the program being debugged is continued.)
breakpoint°¡ Çϵå¿þ¾î ÀÚ¿ø¿¡ ÀÇÁ¸Çϱ⠶§¹®¿¡, hardware breakpoint´Â ¼ö°¡ Á¦ÇѵǾî ÀÖ´Ù; »ç¿ëÀÚ°¡ ´õ ¿ä±¸ÇÒ¶§, GDB´Â software breakpoint ¼³Á¤À» ½ÃµµÇÑ´Ù. (¸î¸î ¾ÆÅ°ÅØÃÄ¿¡¼, ƯÈ÷ 32-bit x86 Ç÷¹Æû¿¡¼, GDB´Â ¸ðµç hardware breakpoint¿Í watchpoint¸¦ ³ÖÀ» Á¤µµ·Î ÃæºÐÇÑ hardware ÀÚ¿øÀÌ ÀÖ´ÂÁö¸¦ ¾ËÁö ¸øÇÑ´Ù. À̵é Ç÷¿Æû¿¡¼, GDB´Â µð¹ö±ëµÇ´Â ÇÁ·Î±×·¥ÀÌ °è¼Ó µÉ¶§¸¸ ¿¡·¯ ¸Þ¼¼Áö¸¦ Ãâ·ÂÇÑ´Ù.)
Software breakpoints require GDB to do somewhat more work. The basic theory is that GDB will replace a program instruction with a trap, illegal divide, or some other instruction that will cause an exception, and then when it's encountered, GDB will take the exception and stop the program. When the user says to continue, GDB will restore the original instruction, single-step, re-insert the trap, and continue on.
Software breakpoint´Â ¾î¶µç DB°¡ ´õ ÀÛµ¿Çϵµ·Ï ¿ä±¸ÇÑ´Ù. ±âº» ÀÌ·ÐÀº GDB´Â trap, ºÒ¹ýÀûÀÎ ³ª´©±â, ¶Ç´Â ¿¹¿Ü¸¦ ¾ß±âÇÒ¼ö ÀÖ´Â ÀϺΠ´Ù¸¥ ¸í·É¾î¸¦ °¡Áø ÇÁ·Î±×·¥ ¸í·É¾î·Î ´ëüÇÒ¼ö ÀÖ´Ù´Â °ÍÀÌ´Ù. ±×¸®°í ¸¸³µÀ»¶§, GDB´Â ¿¹¿Ü¸¦ °¡Áö°í ÇÁ·Î±×·¥À» ¸ØÃá´Ù. »ç¿ëÀÚ°¡ continue¸¦ ÇÒ¶§, GDB´Â ¿ø·¡ ¸í··¾î¸¦ ÀçÀúÀåÇÏ°í, single-step, trapÀÇ Àç »ðÀÔ ±×¸®°í °è¼ÓÇÑ´Ù.
Since it literally overwrites the program being tested, the program area must be writeable, so this technique won't work on programs in ROM. It can also distort the behavior of programs that examine themselves, although such a situation would be highly unusual.
±ÛÀÚ ±×´ë·Î Å×½ºÆ®µÇ´Â ÇÁ·Î±×·¥À» µ¤¾î ¾²±â¶§¹®¿¡, ÇÁ·Î±×·¥¿µ¿ªÀº ¾²±â °¡´ÉÀ̾î¾ß ÇÏ´Ù. ±×·¡¼ ÀÌ ±â¼úÀº ROM¿¡ ÀÖ´Â ÇÁ·Î±×·¥¿¡¼´Â ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù. ºñ·Ï ±×·¯ÇÑ »óȲÀÌ ¸Å¿ì µå¹°´ÙÇÒÁö¶óµµ, ±×°ÍµéÀ» °Ë»çÇÏ´Â ÇÁ·Î±×·¥ÀÇ ÇൿÀ» À߸øµÇ°Ô ÇÒ¼ö ÀÖ´Ù.
Also, the software breakpoint instruction should be the smallest size of instruction, so it doesn't overwrite an instruction that might be a jump target, and cause disaster when the program jumps into the middle of the breakpoint instruction. (Strictly speaking, the breakpoint must be no larger than the smallest interval between instructions that may be jump targets; perhaps there is an architecture where only even-numbered instructions may jumped to.) Note that it's possible for an instruction set not to have any instructions usable for a software breakpoint, although in practice only the ARC has failed to define such an instruction.
¶ÇÇÑ, software breakpoint ¸í·É¾î´Â ¸í·É¾îÀÇ Å©±â°¡ ¸Å¿ì À۾ƾ߸¸ ÇÑ´Ù. ±×·¡¼ Ÿ°ÙÀ¸·Î Á¡ÇÁÇÒ ¸í·É¾î¸¦ µ¤¾î ¾²Áö ¾Ê¾Æ¾ß ÇÑ´Ù. ÇÁ·Î±×·¥ÀÌ breakpoint ¸í·É¾îÀÇ Áß°£À¸·Î Á¡ÇÁµÇ¸é ¹®Á¦Á¡ÀÌ ¹ß»ýÇÑ´Ù. (¾ö°ÝÈ÷ ¸»Çؼ, breakpoint´Â Ÿ°ÙÀ¸·Î Á¡ÇÁÇÒ ¸í·É¾î »çÀÌÀÇ °¡Àå ÀÛÀº ³»ºÎº¸´Ù Ä¿¼´Â ¾ÈµÈ´Ù.;¾Æ¸¶ ¿©±â¿¡´Â ´ÜÁö ¦¼ö ¸í·É¾îµé¸¸ÀÌ Á¡ÇÁÇÏ´Â ¾ÆÅ°ÅØÃÄ°¡ ÀÖ´Ù.) ºñ·Ï ½ÇÁ¦ÀûÀ¸·Î ARC°¡ ±×·± ¸í·É¾î¸¦ Á¤ÀÇÇϴµ¥ ½ÇÆÐÇÑ´Ù ÇÒÁö¶óµµ, software breakpoint¿¡ À¯¿ëÇÑ ¾î¶² ¸í·É¾î¸¦ °¡ÁöÁö ¾Ê´Â ¸í·É¾î ÁýÇÕÀÌ °¡´ÉÇÏ´Ù´Â Á¡¿¡ ÁÖÀÇÇضó.
The basic definition of the software breakpoint is the macro
BREAKPOINT
.
software breakponitÀÇ ±âº» Á¤ÀÇ´Â ¸ÅÅ©·Î BREAKPOINT
ÀÌ´Ù.
Basic breakpoint object handling is in `breakpoint.c'. However, much of the interesting breakpoint action is in `infrun.c'. ±âº» breakpoint °´Ã¼ Çڵ鸵Àº `breakpoint.c'¿¡¼ ÇÑ´Ù. ±×·¯³ª Èï¹ÌÀÖ´Â breakpoint ÇൿÀÇ ´ëºÎºÐÀº `infrun.c'¿¡¼ ÇÑ´Ù.
GDB has support for figuring out that the target is doing a
longjmp
and for stopping at the target of the jump, if we are
stepping. This is done with a few specialized internal breakpoints,
which are visible in the output of the `maint info breakpoint'
command.
GDB´Â Ÿ°ÙÀÌ longjmp
¸¦ ÇÏ°í ¸¸ÀÏ stepping ÇÑ´Ù¸é, Á¡ÇÁÇÑ Å¸°Ù¿¡¼
¸ØÃßµµ·Ï Çϴ°ÍÀ» Áö¿øÇÑ´Ù.
ÀÌ°ÍÀº ¸î¸î Ưº°ÇÑ ³»ºÎ breakpoint¿Í ÇÔ²² Çϸç, ÀÌ°ÍÀº `maint info breakpoint' ¸í·É¾î Ãâ·ÂÀ¸·Î º¼¼ö ÀÖ´Ù.
To make this work, you need to define a macro called
GET_LONGJMP_TARGET
, which will examine the jmp_buf
structure and extract the longjmp target address. Since jmp_buf
is target specific, you will need to define it in the appropriate
`tm-target.h' file. Look in `tm-sun4os4.h' and
`sparc-tdep.c' for examples of how to do this.
ÀÌ ÀÛµ¿À» Çϵµ·Ï Çϱâ À§ÇØ, ¿©·¯ºÐÀº GET_LONGJMP_TARGET
¶ó ºÒ¸®´Â
¸ÅÅ©·Î¸¦ Á¤ÀÇÇØ¾ß Çϸç, ÀÌ°ÍÀº jmp_buf
±¸Á¶¸¦ °Ë»çÇÖ°í longjmp target
ÁÖ¼Ò¸¦ ¾Ë¾Æ³½´Ù. jmp_buf
°¡ Ÿ°Ù ÀÇÁ¸ÀûÀ̱⶧¹®¿¡, ¿©·¯ºÐÀº Àû´çÇÑ
`tm-target.h' ÆÄÀÏ¿¡ ÀÌ°ÍÀ» Á¤ÀÇÇØ¾ß ÇÑ´Ù.
ÀÌ°ÍÀ» ÇÏ´Â ¹æ¹ý¿¡ ´ëÇÑ ¿¹¸¦ À§ÇØ `tm-sun4os4.h'°ú `sparc-tdep.c'¸¦ º¸¾Æ¶ó.
Watchpoints are a special kind of breakpoints (see section Algorithms) which break when data is accessed rather than when some instruction is executed. When you have data which changes without your knowing what code does that, watchpoints are the silver bullet to hunt down and kill such bugs.
Watchpoint´Â ÀϺΠ¸í·É¾î°¡ ½ÇÇàµÇ´Â°ÅÀÌ¿Ü µ¥ÀÌÅÍ°¡ Á¢±ÙµÉ¶§ breakÇϴ Ưº°ÇÑ Á¾·ùÀÇ breakpointÀÌ´Ù. ¿©·¯ºÐÀÌ Äڵ尡 ÇÏ´ÂÀÏÀÌ ¹«¾ùÀÎÁö¿¡ ´ëÇØ ¾ËÁö ¸øÇÏ°í º¯°æµÈ µ¥ÀÌÅ͸¦ °¡Áö°í ÀÖ´Ù¸é, watchpiont´Â ¦i¾Æ°¡¼ ±×·¯ÇÑ ¹ö±×¸¦ Á×ÀδÙ.
Watchpoints can be either hardware-assisted or not; the latter type is known as "software watchpoints." GDB always uses hardware-assisted watchpoints if they are available, and falls back on software watchpoints otherwise. Typical situations where GDB will use software watchpoints are:
Watchpoints´Â Çϵå¿þ¾î-º¸Á¶À̰ųª ¾Æ´Ò¼ö ÀÖ´Ù.; ³ªÁß Å¸ÀÔÀº "software watchpoints"ÀÌ´Ù. ÀÌ¿ëÇÒ¼ö ÀÖ´Ù¸é, GDB´Â Ç×»ó Çϵå¿þ¾î-º¸Á¶ watchpoint¸¦ »ç¿ëÇÏ¸ç ±×·¸Áö ¾ÊÀ¸¸é software watchpoint¸¦ »ç¿ëÇÑ´Ù. GDB°¡ software watchpoint¸¦ »ç¿ëÇÏ´Â ÀüÇüÀûÀÎ »óȲµéÀº ´ÙÀ½°ú °°´Ù:
°Ë»çÇÒ·Á´Â ¸Þ¸ð¸® ¿µ¿ªÀÌ hardware watchpoint°¡ Áö¿øÇÏ´Â °Íº¸´Ù Å©´Ù. ¿¹¸¦ µé¾î, °¢ x86 debug register´Â 4¹ÙÀÌÆ®ÀÇ ¸Þ¸ð¸®¸¦ °Ë»çÇÒ¼ö ÀÖ´Ù. ±×·¡¼ 16¹ÙÀÌÆ® ÀÌ»óÀÎ Å©±âÀÇ µ¥ÀÌÅÍ ±¸Á¶¸¦ º¼·Á°í ½ÃµµÇÒ·Á¸é GDB°¡ software watchpoint¸¦ »ç¿ëÇϵµ·Ï ÇØ¾ß ÇÑ´Ù.
°Ë»çÇÒ·Á´Â Ç¥Çö½Ä °ªÀº ·¹Áö½ºÅÍ(¸Þ¸ð¸®¿Í ¹Ý´ë·Î)³» µ¥ÀÌÅÍ¿¡ ÀÇÁ¸ÇÑ´Ù.
³Ê¹« ¸¹Àº ´Ù¸¥ watchpoint°¡ ¿ä±¸µÉ¶§.(¸î¸î ¾ÆÅ°ÅØÃÄ¿¡¼, ÀÌ »óȲÀº µð¹ö±×µÇ´Â ÇÁ·Î±×·¥ÀÌ ´Ù½Ã ½ÃÀÛÇÒ¶§±îÁö´Â ¹ß°ßµÉ¼ö ¾ø´Ù.) x86 debug register´Â hardware breakpoint¿Í watchpoint¸¦ À§ÇØ »ç¿ëµÈ´Ù. ±×·¡¼ ³Ê¹« ¸¹Àº hardware breakpoint ¼³Á¤Àº watchpoint »ðÀÔÀÌ ½ÇÆÐÇϵµ·Ï ÇÒ¼ö ÀÖ´Ù.
¾î¶² hardware-º¸Á¶ watchpointµéµµ Ÿ°Ù ¼öÇà¿¡¼ Á¦°øµÇÁö ¾Ê´Â´Ù.
Software watchpoints are very slow, since GDB needs to single-step the program being debugged and test the value of the watched expression(s) after each instruction. The rest of this section is mostly irrelevant for software watchpoints.
Software watchpoint´Â ¸Å¿ì ´À¸®´Ù. ¿Ö³ÄÇϸé GDB´Â µð¹ö±ëµÇ´Â ÇÁ·Î±×·¥À» ´ÜÀÏ-stepÇÒ ÇÊ¿ä°¡ ÀÖ°í °¢ ¸í·É¾î ÈÄ °Ë»çÇÒ·Á´Â Ç¥Çö½ÄÀÇ °ªÀ» °Ë»çÇÏ¿©¾ß Çϱ⠶§¹®ÀÌ´Ù. ÀÌ ¼½¼ÇÀÇ ³ª¸ÓÁö´Â ´ëºÎºÐ software watchpoint¿Í´Â °ü·ÃÀÌ ¾ø´Ù.
GDB uses several macros and primitives to support hardware watchpoints:
GDB´Â hardware watchpoint¸¦ Áö¿øÇϱâ À§ÇØ ¸î¸î ¸ÅÅ©·Î¿Í primitive¸¦ »ç¿ëÇÑ´Ù.
TARGET_HAS_HARDWARE_WATCHPOINTS
TARGET_CAN_USE_HARDWARE_WATCHPOINT (type, count, other)
¼³Á¤ °¡´ÉÇÑ Å¸ÀÔ typeÀÇ hardware watchpointÀÇ ¼ö¸¦ ¹ÝȯÇÑ´Ù. ¸¸ÀÏ ÀÌ Å¸ÀÔÀÇ count watchpoint°¡ ¼³Á¤µÉ¼ö ÀÖ´Ù¸é °ªÀº ¾ç¼ö, ÀÌ Å¸ÀÔÀÇ watchpoint ¼³Á¤ÀÌ Áö¿øµÇÁö ¾Ê´Â´Ù¸é 0, ±×¸®°í count°¡ ¼³Á¤µÉ¼ö Àִ ŸÀÔ typeÀÇ ÃÖ´ë watchpoint ¼ö ÀÌ»óÀÌ¸é °ªÀº À½¼öÀÌ´Ù. ¸¸ÀÏ ´Ù¸¥ ŸÀÔÀÇ watchpoint°¡ ÇöÀç enableµÇ¾ú´Ù¸é other´Â 0ÀÌ ¾Æ´Ï´Ù.
TARGET_REGION_OK_FOR_HW_WATCHPOINT (addr, len)
¸¸ÀÏ hardware watchpoint°¡ ÁÖ¼Ò°¡ addrÀÌ°í ±æÀÌ°¡ ¹ÙÀÌÆ®·Î lenÀÎ ¿µ¿ªÀ» º¸±â À§ÇØ »ç¿ëµÈ´Ù¸é 0ÀÌ ¾Æ´Ñ °ªÀÌ ¹ÝȯµÈ´Ù.
TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (size)
TARGET_REGION_OK_FOR_HW_WATCHPOINT
is not
defined.
¸¸ÀÏ hardware watchpoint°¡ Å©±â°¡ sizeÀÎ ¿µ¿ªÀ» º¸±â À§ÇØ »ç¿ëµÉ¼ö ÀÖ´Ù¸é
0ÀÌ ¾Æ´Ñ °ªÀÌ ¹ÝȯµÈ´Ù. GDB´Â TARGET_REGION_OK_FOR_HW_WATCHPOINT
°¡ Á¤ÀǵǾî
ÀÖÁö ¾Ê´Â °æ¿ì, fall-backó·³ ÀÌ ¸ÅÅ©·Î¸¦ »ç¿ëÇÑ´Ù.
TARGET_DISABLE_HW_WATCHPOINTS (pid)
pid·Î ½Äº°µÇ´Â ÇÁ·Î¼¼½º³» watchpoint¸¦ disable½ÃŲ´Ù. ¿¹¸¦ µé¾î, ÀÌ°ÍÀº Ç÷§Æû³» hardware watchpoint¸¦ ¼öÇàÇÏ´Â ÆäÀÌÁö-·¹º§ ¸Þ¸ð¸® º¸È£¸¦ disable, enable Çϵµ·Ï ÀÛµ¿À» Á¦°øÇÏ´Â HP-UX¿¡¼ »ç¿ëµÈ´Ù.
TARGET_ENABLE_HW_WATCHPOINTS (pid)
pid·Î ½Äº°µÇ´Â ÇÁ·Î¼¼½º³» watchpoint¸¦ enable½ÃŲ´Ù. ¿¹¸¦ µé¾î, ÀÌ°ÍÀº Ç÷§Æû³» hardware watchpoiont¸¦ ¼öÇàÇÏ´Â ÆäÀÌÁö-·¹º§ ¸Þ¸ð¸® º¸È£¸¦ disable, enable Çϵµ·Ï ÀÛµ¿À» Á¦°øÇÏ´Â HP-UX¿¡¼ »ç¿ëµÈ´Ù.
TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT (pid,start,len)
¸î¸î ÁÖ¼Ò´Â °Ë»çÇϱâ À§ÇØ Çϵå¿þ¾î¸¦ »ç¿ëÇϱ⿡ ¾Ë¸ÂÁö ¾Ê°Å³ª ¾îµå·¹½ÌµÈ °´Ã¼°¡ ¿µ¿ª ¿Ü¿¡ ÀÖÀ»¶§ ÀÌÇØÇϱ⠾î·Æ´Ù. ±×·¯¹Ç·Î hardware watchpoint·Î °Ë»çÇؼ´Â ¾ÈµÈ´Ù. ¸î¸î Ÿ°Ù¿¡¼, ÀÌ°ÍÀº ½É°¢ÇÑ ¼º´É ¹®Á¦¸¦ ¾ß±âÇϸç, ¿ì¸®´Â Á¤±Ô watchpoint¸¦ »ç¿ëÇÏ°í ´Ù¸¥ À§Ä¡¸¦ À§ÇØ hardware watchpoint(°¡´ÉÇÑ Á¤È®ÇÑ)¸¦ ÀúÀåÇÑ´Ù.
target_insert_watchpoint (addr, len, type)
target_remove_watchpoint (addr, len, type)
target_hw_bp_type
,
defined by `breakpoint.h' as follows:
len ¹ÙÀÌÆ®¸¦ À§ÇØ, addr¿¡¼ ½ÃÀÛÇÏ´Â hardware watchpoint¸¦
»ðÀÔÇϰųª Á¦°ÅÇضó. typeÀº watchpoint ŸÀÔÀ̸ç, ³ª¿µÈ µ¥ÀÌÅÍ Å¸ÀÔ target_hw_bp_type
Áß °¡´ÉÇÑ °ªµéÁß ÇϳªÀ̸ç, ´ÙÀ½ ó·³ `breakpoint.h'¿¡
Á¤ÀǵǾî ÀÖ´Ù.
enum target_hw_bp_type { hw_write = 0, /* Common (write) HW watchpoint */ hw_read = 1, /* Read HW watchpoint */ hw_access = 2, /* Access (read or write) HW watchpoint */ hw_execute = 3 /* Execute HW breakpoint */ };These two macros should return 0 for success, non-zero for failure.
ÀÌµé µÎ ¸ÅÅ©·Î´Â ¼º°ø½Ã 0À», ½ÇÆнà 0ÀÌ ¾Æ´Ñ °ªÀ» ¹ÝȯÇØ¾ß ÇÑ´Ù.
target_remove_hw_breakpoint (addr, shadow)
target_insert_hw_breakpoint (addr, shadow)
ÁÖ¼Ò addr¿¡ hardware-Áö¿ø breakpoint¸¦ »ðÀÔÇϰųª Á¦°ÅÇضó. ¼º°ø½Ã 0À» ¹ÝȯÇÏ°í, ½ÇÆнà 0ÀÌ ¾Æ´Ñ °ªÀ» ¹ÝȯÇضó. shadow´Â watchpoint°¡ »ðÀÔµÈ °÷ÀÇ ¹ÙÀÌÆ®ÀÇ ½ÇÁ¦ ³»¿ëÀÌ´Ù.; ÀϹÝÀûÀ¸·Î hardware breakpoint°¡ »ç¿ëµÉ¶§ À¯È¿ÇÏÁö ¾ÊÁö¸¸, ´Ù¸¥ ÄÚµåµéÀÌ ÀÌµé °ªÀ» °ÇµéÁö ¾Ê±â ¶§¹®¿¡, À§ µÎ ¸ÅÅ©·ÎÀÇ ¼öÇàÀº ³»ºÎ ¸ñÀûÀ» À§ÇØ »ç¿ëµÉ¼ö ÀÖ´Ù.
target_stopped_data_address ()
¸¸ÀÏ ¾Æ·¡¿¡ Æ®¸®°ÅÇÒ ¸î¸î watchpoint°¡ ÀÖ´Ù¸é, ÇØ´ç watchpoint¿Í °ü·ÃµÈ ÁÖ¼Ò¸¦ ¹ÝȯÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é, 0À» ¹ÝȯÇÑ´Ù.
DECR_PC_AFTER_HW_BREAK
DECR_PC_AFTER_HW_BREAK
after a hardware break-point. This
overrides the value of DECR_PC_AFTER_BREAK
when a breakpoint
that breaks is a hardware-assisted breakpoint.
Á¤ÀǵǾú´Ù¸é, GDB´Â hardware ÁßÁöÁ¡ ÈÄ DECR_PC_AFTER_HW_BREAK
°ª¿¡ ÀÇÇØ
program counter¸¦ ÁÙÀδÙ. ÁßÁöÇÏ´Â breakpoint°¡ hardware-º¸Á¶ breakpointÀ϶§ DECR_PC_AFTER_BREAK
°ªÀ» ¿À¹ö¶óÀ̵ùÇÑ´Ù.
HAVE_STEPPABLE_WATCHPOINT
0ÀÌ ¾Æ´Ñ °ªÀ¸·Î Á¤ÀǵǾú´Ù¸é, watchpoint¸¦ ±× À§·Î stepÇÏ´Â °ÍÀ» disableÇÒ ÇÊ¿ä°¡ ¾ø´Ù.
HAVE_NONSTEPPABLE_WATCHPOINT
¸¸ÀÏ 0ÀÌ ¾Æ´Ñ °ªÀ¸·Î Á¤ÀǵǾú´Ù¸é, GDB´Â ±× À§ ³»ºÎ·Î stepÇϱâ À§ÇØ watchpoint¸¦ disable ÇØ¾ß ÇÑ´Ù.
HAVE_CONTINUABLE_WATCHPOINT
¸¸ÀÏ 0ÀÌ ¾Æ´Ñ °ªÀ¸·Î Á¤ÀǵǾú´Ù¸é, ÀÌ°ÍÀº watchpoint°¡ È÷Æ®µÈÈÄ ÇÏÀ§·Î continueÇϴ°ÍÀÌ °¡´ÉÇÏ´Ù.
CANNOT_STEP_HW_WATCHPOINTS
¸¸ÀÏ 0ÀÌ ¾Æ´Ñ °ªÀ¸·Î Á¤ÀǵǾú´Ù¸é, GDB´Â ÇÏÀ§·Î stepÇϱâ Àü¿¡ ¸ðµç watchpoint¸¦ Á¦°ÅÇÑ´Ù.
STOPPED_BY_WATCHPOINT (wait_status)
struct target_waitstatus
, defined by `target.h'.
watchpoint·Î ¸ØÃß¾ú´Ù¸é 0ÀÌ ¾Æ´Ñ °ªÀ» ¹ÝȯÇÑ´Ù. wait_status´Â ŸÀÔ struct target_waitstatus
À̸ç, `target.h'¿¡ Á¤ÀǵǾî ÀÖ´Ù.
The 32-bit Intel x86 (a.k.a. ia32) processors feature special debug registers designed to facilitate debugging. GDB provides a generic library of functions that x86-based ports can use to implement support for watchpoints and hardware-assisted breakpoints. This subsection documents the x86 watchpoint facilities in GDB.
32-bit Intel x86 (a.k.a. ia32) ÇÁ·Î¼¼¼´Â µð¹ö±ëÀ» ÆíÇÏ°Ô ÇÒ¼ö ÀÖµµ·Ï µðÀÚÀÎµÈ Æ¯º°ÇÑ µð¹ö±ë ·¹Áö½ºÅ͵éÀÌ ÀÖ´Ù. GDB´Â x86-±â¹Ý Æ÷Æ®´Â watchpoint¿Í hardware-º¸Á¶ breakpoint Áö¿øÀ» Çϱâ À§ÇØ »ç¿ëµÉ¼ö ÀÖ´Â ÀÏ¹Ý ¶óÀ̺귯¸® ÇÔ¼öµéÀ» Á¦°øÇÑ´Ù. ÀÌ ÇÏÀ§ ¼½¼ÇÀº GDB¿¡¼ Æí¸®ÇÏ°Ô ÀÌ¿ëÇÒ¼ö ÀÖ´Â x86 watchpoint¿¡ ´ëÇÑ ¹®¼µéÀÌ´Ù.
To use the generic x86 watchpoint support, a port should do the following:
ÀÏ¹Ý x86 watchpoint Áö¿øÀ» »ç¿ëÇϱâ À§ÇØ, Æ÷Æ®´Â ´ÙÀ½À» ÇØ¾ß ÇÑ´Ù:
I386_USE_GENERIC_WATCHPOINTS
somewhere in the
target-dependent headers.
Ÿ°Ù-ÀÇÁ¸ÀûÀÎ Çì´õ¿¡ ¸ÅÅ©·Î I386_USE_GENERIC_WATCHPOINTS
¸¦ Á¤ÀÇÇضó.
I386_USE_GENERIC_WATCHPOINTS
.
I386_USE_GENERIC_WATCHPOINTS
Á¤ÀÇÈÄ¿¡ `config/i386/nm-i386.h'
Çì´õ ÆÄÀÏÀ» Æ÷ÇÔÇضó.
NATDEPFILES
(see section Native Debugging) or
TDEPFILES
(see section Target Architecture Definition).
`i386-nat.o'¸¦ Make º¯¼ö °ª NATDEPFILES
(Native Debugging ¼½¼ÇÀ» ÂüÁ¶Çضó.)À̳ª TDEPFILES
(Target Architecture Definition ¼½¼ÇÀ» ÂüÁ¶Çضó.)¿¡ Ãß°¡Çضó.
I386_DR_LOW_*
macros described
below. Typically, each macro should call a target-specific function
which does the real work.
¾Æ·¡ ¼³¸íÇÑ I386_DR_LOW_*
¸ÅÅ©·Î¸¦ À§ÇÑ ¼öÇàÀ» Á¦°øÇÑ´Ù. ÀüÇüÀûÀ¸·Î,
°¢ ¸ÅÅ©·Î´Â ½ÇÁ¦ ÀÛ¾÷À» Çϴ Ÿ°Ù¿¡ ÀÇÁ¸ÀûÀÎ ÇÔ¼ö¸¦ È£ÃâÇØ¾ß ÇÑ´Ù.
The x86 watchpoint support works by maintaining mirror images of the debug registers. Values are copied between the mirror images and the real debug registers via a set of macros which each target needs to provide:
x86 watchpoint´Â µð¹ö±× ·¹Áö½ºÅÍÀÇ ¹Ì·¯(mirror) À̹ÌÁö¸¦ À¯ÁöÇÏ¿© ÀÛ¾÷À» Áö¿øÇÑ´Ù. °ªµéÀº °¢ Ÿ°ÙÀÌ Á¦°øµÉ ÇÊ¿ä°¡ ÀÖ´Â ¸ÅÅ©·Î ÁýÇÕÀ» ÅëÇؼ ¹Ì·¯ À̹ÌÁö¿Í ½ÇÁ¦ µð¹ö±× ·¹Áö½ºÅÍ »çÀÌ¿¡ º¹»çµÈ´Ù.
I386_DR_LOW_SET_CONTROL (val)
I386_DR_LOW_SET_ADDR (idx, addr)
I386_DR_LOW_RESET_ADDR (idx)
I386_DR_LOW_GET_STATUS
I386_DR_LOW_GET_STATUS
, so as to support per-thread status
register values.
Debug Status (DR6) ·¹Áö½ºÅÍÀÇ °ªÀ» ¹ÝȯÇÑ´Ù. ÀÌ °ªÀº ¾²·¹µå´ç »óÅ ·¹Áö½ºÅÍ °ªµéÀ» Áö¿øÇϱâ À§ÇØ I386_DR_LOW_GET_STATUS
¿¡ ÀÇÇØ ¹ÝȯµÈÈÄ Áï½Ã »ç¿ëµÈ´Ù.
For each one of the 4 debug registers (whose indices are from 0 to 3) that store addresses, a reference count is maintained by GDB, to allow sharing of debug registers by several watchpoints. This allows users to define several watchpoints that watch the same expression, but with different conditions and/or commands, without wasting debug registers which are in short supply. GDB maintains the reference counts internally, targets don't have to do anything to use this feature.
4°³ÀÇ µð¹ö±× ·¹Áö½ºÅÍ(0¿¡¼ 3À¸·Î À妽ºµÈ´Ù.)µé °¢°¢Àº ÁÖ¼ÒµéÀ» ÀúÀåÇϸç, ÂüÁ¶ Ä«¿ìÅÍ(reference count)´Â ¸î¸î watchpoint¿¡ ÀÇÇÑ µð¹ö±× ·¹Áö½ºÅ͵éÀÇ °øÀ¯¸¦ Çã¿ëÇϱâ À§ÇØ GDB¿¡ ÀÇÇØ À¯ÁöµÈ´Ù. ÀÌ°ÍÀº °°Àº Ç¥Çö½ÄÀ» °Ë»çÇÏ´Â ¸î¸î watchpoint ¸¦ Á¤ÀÇÇϵµ·Ï »ç¿ëÀÚ¿¡°Ô Çã¿ëÇÑ´Ù. ±×·¯³ª ´Ù¸¥ Á¶°Ç and/or ¸í·É¾î¿Í, µð¹ö±× ·¹Áö½ºÅ͸¦ ³¶ºñÇÏ´Â °Í ¾øÀÌ. GDB´Â ³»ºÎÀûÀ¸·Î ÂüÁ¶ Ä«¿îÅ͸¦ À¯ÁöÇϸç, Ÿ°ÙÀº ÀÌ Æ¯Â¡À» »ç¿ëÇÒ ¾î¶² °Íµµ °¡Áö°í ÀÖÁö ¾Ê´Ù.
The x86 debug registers can each watch a region that is 1, 2, or 4 bytes long. The ia32 architecture requires that each watched region be appropriately aligned: 2-byte region on 2-byte boundary, 4-byte region on 4-byte boundary. However, the x86 watchpoint support in GDB can watch unaligned regions and regions larger than 4 bytes (up to 16 bytes) by allocating several debug registers to watch a single region. This allocation of several registers per a watched region is also done automatically without target code intervention.
x86 debug ·¹Áö½ºÅÍ´Â °¢ 1, 2 ¶Ç´Â 4¹ÙÀÌÆ® longÀÎ ¿µ¿ªÀ» °Ë»çÇÒ¼ö ÀÖ´Ù. ia32 ¾ÆÅ°ÅØÃÄ´Â °¢ °Ë»ç ¿µ¿ªÀº ÀûÀýÇÑ Á¤·ÄÀÌ ¿ä±¸µÈ´Ù: 2-byte °æ°è¿¡ 2-byte ¿µ¿ª, 4-byte °æ°è¿¡ 4-byte ¿µ¿ª. ±×·¯³ª, GDB¿¡¼ Áö¿øÇÏ´Â x86 watchpointÀº Á¤·ÄµÇÁö ¾ÊÀº ¿µ¿ª°ú ´ÜÀÏ ¿µ¿ªÀ» °Ë»çÇϱâ À§ÇØ ¸î¸î µð¹ö±× ·¹Áö½ºÅ͵éÀ» ÇÒ´çÇÏ¿© 4¹ÙÀÌÆ®(16 ¹ÙÀÌÆ®±îÁö) º¸´Ù Å« ¿µ¿ªÀ» °Ë»çÇÒ¼ö ÀÖ´Ù. °Ë»ç ¿µ¿ª´ç ¸î¸î ·¹Áö½ºÅÍ ÇÒ´çÀº Ÿ°Ù ÄÚµå ÁßÀç ¾øÀÌ ÀÚµ¿ÀûÀ¸·Î ÇàÇØÁø´Ù.
The generic x86 watchpoint support provides the following API for the GDB's application code:
ÀÏ¹Ý x86 watchpoint´Â GDB ÀÀ¿ëÇÁ·Î±×·¥ Äڵ带 À§ÇØ ´ÙÀ½ API¸¦ Á¦°øÇÑ´Ù.:
i386_region_ok_for_watchpoint (addr, len)
TARGET_REGION_OK_FOR_HW_WATCHPOINT
is set to call
this function. It counts the number of debug registers required to
watch a given region, and returns a non-zero value if that number is
less than 4, the number of debug registers available to x86
processors.
¸ÅÅ©·Î TARGET_REGION_OK_FOR_HW_WATCHPOINT
´Â ÀÌ ÇÔ¼ö¸¦ È£ÃâÇϱâ À§ÇØ ¼³Á¤ÇÑ´Ù.
ÁÖ¿©Áø ¿µ¿ªÀÇ °Ë»ç¸¦ ¿ä±¸ÇÏ´Â µð¹ö±× ·¹Áö½ºÅÍÀÇ ¼ö¸¦ ¼¼°í ¸¸ÀÏ x86 ÇÁ·Î¼¼¼°¡ ÀÌ¿ëÇÒ¼ö ÀÖ´Â
µð¹ö±× ·¹Áö½ºÅÍÀÇ ¼ö°¡ 4º¸´Ù ÀÛ´Ù¸é 0ÀÌ ¾Æ´Ñ °ªÀ» ¹ÝȯÇÑ´Ù.
i386_stopped_data_address (void)
STOPPED_BY_WATCHPOINT
and
target_stopped_data_address
are set to call this function. The
argument passed to STOPPED_BY_WATCHPOINT
is ignored. This
function examines the breakpoint condition bits in the DR6 Debug
Status register, as returned by the I386_DR_LOW_GET_STATUS
macro, and returns the address associated with the first bit that is
set in DR6.
¸ÅÅ©·Î STOPPED_BY_WATCHPOINT
°ú target_stopped_data_address
´Â
ÀÌ ÇÔ¼ö È£ÃâÀ» À§ÇØ ¼³Á¤ÇÑ´Ù. STOPPED_BY_WATCHPOINT
¿¡ Àü´ÞµÇ´Â ÀÎÀÚ´Â ¹«½ÃµÈ´Ù.
ÀÌ ÇÔ¼ö´Â I386_DR_LOW_GET_STATUS
¸ÅÅ©·Î°¡ ¹ÝȯÇÏ´Â DR6 Debug Status ·¹Áö½ºÅͳ»
breakpoint Á¶°Ç ºñÆ®¸¦ °Ë»çÇϸç DR6³» ¼³Á¤µÈ ù ºñÆ®¿Í °ü·ÃµÈ ÁÖ¼Ò¸¦ ¹ÝȯÇÑ´Ù.
i386_insert_watchpoint (addr, len, type)
i386_remove_watchpoint (addr, len, type)
target_insert_watchpoint
and target_remove_watchpoint
are set to call these functions. i386_insert_watchpoint
first
looks for a debug register which is already set to watch the same
region for the same access types; if found, it just increments the
reference count of that debug register, thus implementing debug
register sharing between watchpoints. If no such register is found,
the function looks for a vacant debug register, sets its mirrorred
value to addr, sets the mirrorred value of DR7 Debug Control
register as appropriate for the len and type parameters,
and then passes the new values of the debug register and DR7 to the
inferior by calling I386_DR_LOW_SET_ADDR
and
I386_DR_LOW_SET_CONTROL
. If more than one debug register is
required to cover the given region, the above process is repeated for
each debug register.
i386_remove_watchpoint
does the opposite: it resets the address
in the mirrorred value of the debug register and its read/write and
length bits in the mirrorred value of DR7, then passes these new
values to the inferior via I386_DR_LOW_RESET_ADDR
and
I386_DR_LOW_SET_CONTROL
. If a register is shared by several
watchpoints, each time a i386_remove_watchpoint
is called, it
decrements the reference count, and only calls
I386_DR_LOW_RESET_ADDR
and I386_DR_LOW_SET_CONTROL
when
the count goes to zero.
watchpoint¸¦ »ðÀÔÇÏ°í Á¦°ÅÇÑ´Ù. ¸ÅÅ©·Î target_insert_watchpoint
¿Í target_remove_watchpoint
´Â À̵é ÇÔ¼ö¸¦ È£ÃâÇϱâ À§ÇØ ¼³Á¤ÇÑ´Ù. i386_insert_watchpoint
´Â ¿ì¼± °°Àº Á¢¼Ó ŸÀÔÀ» À§ÇØ °°Àº ¿µ¿ªÀ» °Ë»çÇϵµ·Ï ÀÌ¹Ì ¼³Á¤µÈ µð¹ö±× ·¹Áö½ºÅ͸¦ ã´Â´Ù.;
¸¸ÀÏ ¹Ý°ßµÈ´Ù¸é, µð¹ö±× ·¹Áö½ºÅÍÀÇ ÂüÁ¶ ¼ö¸¦ Áõ°¡½ÃÅ°°í, watchpoint »çÀÌ¿¡ °øÀ¯µÇ´Â
µð¹ö±× ·¹Áö½ºÅ͸¦ ¼öÇàÇÑ´Ù. ¸¸ÀÏ ±×·± ·¹Áö½ºÅÍ°¡ ¹ß°ßµÇÁö ¾Ê´Â´Ù¸é, ÇÔ¼ö´Â ºó µð¹ö±× ·¹Áö½ºÅ͸¦
ã°í ¹Ì·¯µÈ °ªÀ» addr·Î ¼³Á¤ÇÏ°í, len¿Í type ÆĶó¹ÌÅÍ¿¡
ÀûÀýÇÏ°Ô DR7 Debug Control ·¹Áö½ºÅÍÀÇ °ªÀ» ¼³Á¤ÇÏ°í µð¹ö±× ·¹Áö½ºÅÍ¿Í DR7ÀÇ »õ °ªÀ»
I386_DR_LOW_SET_ADDR
¿Í I386_DR_LOW_SET_CONTROL
¸¦ È£ÃâÇÏ¿©
ÇÏÀ§·Î ´øÁø´Ù. ¸¸ÀÏ ÇÑ°³ ÀÌ»óÀÇ µð¹ö±× ·¹Áö½ºÅÍ°¡ ÁÖ¾îÁø ¿µ¿ªÀ» Ä¿¹öÇϱâ À§ÇØ ¿ä±¸µÈ´Ù¸é,
À§ ÇÁ·Î¼¼½º´Â °¢ µð¹ö±× ·¹Áö½ºÅ͸¦ ¹Ýº¹ÇÑ´Ù.
i386_remove_watchpoint
Àº ¹Ý´ë·Î ÇÑ´Ù.;ÀÌ°ÍÀº µð¹ö±× ·¹Áö½ºÅÍÀÇ ¹Ý¿µ °ª³»
ÁÖ¼Ò¿Í Àбâ/¾²±â ±×¸®°í DR7ÀÇ ¹Ý¿µ°ª³» ±æÀÌ bits¸¦ ¸®¼ÂÇÏ°í ÀÌµé »õ·Î¿î °ªÀ» I386_DR_LOW_RESET_ADDR
¿Í I386_DR_LOW_SET_CONTROL
¸¦ ÅëÇØ ÇÏÀ§·Î Àü´ÞÇÑ´Ù.
¸¸ÀÏ ·¹Áö½ºÅÍ°¡ ¸î¸î watchpoint¿¡ ÀÇÇØ °øÀ¯µÈ´Ù¸é, ¸Å¹ø i386_remove_watchpoint
°¡ È£ÃâµÇ¸ç, ÂüÁ¶ ¼ö¸¦ ÁÙÀÌ°í Ä«¿îÆ®°¡ 0À϶§ I386_DR_LOW_RESET_ADDR
¿Í I386_DR_LOW_SET_CONTROL
¸¦ È£ÃâÇÑ´Ù.
i386_insert_hw_breakpoint (addr, shadow
i386_remove_hw_breakpoint (addr, shadow)
target_insert_hw_breakpoint
and
target_remove_hw_breakpoint
are set to call these functions.
These functions work like i386_insert_watchpoint
and
i386_remove_watchpoint
, respectively, except that they set up
the debug registers to watch instruction execution, and each
hardware-assisted breakpoint always requires exactly one debug
register.
À̵é ÇÔ¼ö´Â hardware-º¸Á¶ breakpoint¸¦ »ðÀÔÇÏ°í Á¦°ÅÇÑ´Ù.
¸ÅÅ©·Î I386_DR_LOW_SET_CONTROL
¿Í target_remove_hw_breakpoint
´Â
À̵é ÇÔ¼ö¸¦ È£ÃâÇϱâ À§ÇØ ¼³Á¤ÇÑ´Ù. À̵é ÇÔ¼ö´Â ¸í·É¾î ½ÇÇàÀ» º¸±â À§ÇØ µð¹ö±× ·¹Áö½ºÅ͸¦
¼³Á¤ÇÏ°í °¢ hardware-º¸Á¶ breakpoint´Â Ç×»ó ÇÑ°³ÀÇ µð¹ö±× ·¹Áö½ºÅ͸¦ ¿ä±¸ÇѴٴ°ÍÀ» Á¦¿ÜÇÏ°í
i386_insert_watchpoint
¿Í i386_remove_watchpoint
ó·³ ÀÛµ¿ÇÑ´Ù.
i386_stopped_by_hwbp (void)
i386_stopped_data_address
, except that it doesn't return the
address whose watchpoint triggered.
ÀÌ ÇÔ¼ö´Â ¸¸ÀÏ ³»ºÎ¿¡ ÀϺΠwatchpoint³ª Æ®¸®°ÅµÇ´Â hardware breakpoint°¡ ÀÖ´Ù¸é 0ÀÌ ¾Æ´Ñ °ªÀ»
¹ÝȯÇÑ´Ù. ÀÌ°ÍÀº Æ®¸®°ÅµÇ´Â watchpointÀÇ ÁÖ¼Ò¸¦ ¹ÝȯÇÏÁö ¾Ê´Â´Ù´Â°ÍÀ» Á¦¿ÜÇÏ°í
i386_stopped_data_address
¿Í °°°Ô ÀÛµ¿ÇÑ´Ù.
i386_cleanup_dregs (void)
ÀÌ ÇÔ¼ö´Â ÂüÁ¶ ¼ö, ÁÖ¼Ò, µð¹ö±× ·¹Áö½ºÅÍÀÇ ¹Ý¿µ À̹ÌÁö³» Á¦¾î ºñÆ®¸¦ ¸ðµÎ Áö¿î´Ù. ÀÌ°ÍÀº ³»ºÎ ÇÁ·Î¼¼½º³» ½ÇÁ¦ µð¹ö±× ·¹Áö½ºÅÍ¿¡ ¿µÇâÀ» ÁÖÁö ¾Ê´Â´Ù.
Notes:
enum target_hw_bp_type
doesn't even have an enumeration for I/O
watchpoints, this feature is not yet available to GDB running
on x86.
x86 ÇÁ·Î¼¼¼´Â I/O Àб⠶Ǵ ¾²±â¿¡¼ watchpoint ¼³Á¤À» Áö¿øÇÑ´Ù.
±×·¯³ª, ¾î¶² Ÿ°Ùµµ ÀÌ°Í(March 2001)À» Áö¿øÇÏÁö ¾Ê±â ¶§¹®¿¡, ±×¸®°í enum target_hw_bp_type
´Â I/O watchpoint¸¦ À§ÇØ ¿°Å¸¦ °¡ÁöÁö ¾Ê±â ¶§¹®¿¡, ÀÌ Æ¯Â¡Àº x86¿¡¼ µ¹¾Æ°¡´Â
GDB¿¡¼ ¾ÆÁ÷ ÀÌ¿ëÇÒ¼ö ¾ø´Ù.
x86 ÇÁ·Î¼¼¼´Â ÇöÀç task¸¸À» À§ÇØ Áö¿ªÀûÀ¸·Î³ª Àüü task¸¦ À§ÇØ Àü¿ªÀûÀ¸·Î watchpoint¸¦ enableÇÒ¼ö ÀÖ´Ù. °¢ µð¹ö±× ·¹Áö½ºÅ͸¦ À§ÇØ, °ü·Ã ÁÖ¼Ò°¡ Áö¿ªÀûÀ¸·Î º¸¿©Áö´ÂÁö Àü¿ªÀûÀ¸·Î º¸¿©Áö´ÂÁö¸¦ °áÁ¤ÇÏ´Â DR7 Debug Control ·¹Áö½ºÅͳ» ºñÆ®°¡ ÀÖ´Ù. GDB¿¡¼ Áö¿øÇÏ´Â x86 watchpointÀÇ ÇöÀç ¼öÇàÀº Ç×»ó Áö¿ªÀûÀ¸·Î enableµÇµµ·Ï watchpoint¸¦ ¼³Á¤ÇÑ´Ù. ¿Ö³ÄÇϸé Àü¿ª watchpoint´Â ±â¹Ý OS¿Í »óÃæµÇ°í ¾Æ¸¶µµ ¸¹Àº Ç÷§Æû¿¡¼ ÀÌ¿ëÇÒ¼ö ¾ø±â ¶§¹®ÀÌ´Ù.
Go to the first, previous, next, last section, table of contents.