* Hardware watchpoint for read @ 2012-04-24 13:03 Xin Tong 2012-04-24 13:09 ` Luis Gustavo 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-04-24 13:03 UTC (permalink / raw) To: gdb Hello I am wondering that can gdb insert hardware watch point for read to the watched memory ? can other debugger do that ? is it supported in hardware watchpoint ? Thanks Xin ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 13:03 Hardware watchpoint for read Xin Tong @ 2012-04-24 13:09 ` Luis Gustavo 2012-04-24 13:16 ` Xin Tong 0 siblings, 1 reply; 13+ messages in thread From: Luis Gustavo @ 2012-04-24 13:09 UTC (permalink / raw) To: Xin Tong; +Cc: gdb Hi, On 04/24/2012 10:02 AM, Xin Tong wrote: > Hello > > I am wondering that can gdb insert hardware watch point for read to > the watched memory ? can other debugger do that ? is it supported in > hardware watchpoint ? > > Thanks > > Xin > Read watchpoints are hard to implement as soft-watchpoints, so they're usually implemented as hardware watchpoints. If a debugger knows how to properly set the bits in the hardware, either through ptrace or other means, it can configure a read/write/read-write watchpoint. Depends on hardware support really. Regards, Luis ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 13:09 ` Luis Gustavo @ 2012-04-24 13:16 ` Xin Tong 2012-04-24 13:18 ` Luis Gustavo 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-04-24 13:16 UTC (permalink / raw) To: Gustavo, Luis; +Cc: gdb On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo <luis_gustavo@mentor.com> wrote: > Hi, > > > On 04/24/2012 10:02 AM, Xin Tong wrote: >> >> Hello >> >> I am wondering that can gdb insert hardware watch point for read to >> the watched memory ? can other debugger do that ? is it supported in >> hardware watchpoint ? >> >> Thanks >> >> Xin >> > > Read watchpoints are hard to implement as soft-watchpoints, so they're > usually implemented as hardware watchpoints. software write watchpoint is easier to implement ? do not software watchpoint need to watch all memory accesses (read and write) to a memory location in software ? > > If a debugger knows how to properly set the bits in the hardware, either > through ptrace or other means, it can configure a read/write/read-write > watchpoint. Depends on hardware support really. do you know whether this is supported on the x86 chips ? is thee a way to try this out in gdb ? > > Regards, > Luis ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 13:16 ` Xin Tong @ 2012-04-24 13:18 ` Luis Gustavo 2012-04-24 14:18 ` Xin Tong 0 siblings, 1 reply; 13+ messages in thread From: Luis Gustavo @ 2012-04-24 13:18 UTC (permalink / raw) To: Xin Tong; +Cc: gdb On 04/24/2012 10:15 AM, Xin Tong wrote: > On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> wrote: >> Hi, >> >> >> On 04/24/2012 10:02 AM, Xin Tong wrote: >>> >>> Hello >>> >>> I am wondering that can gdb insert hardware watch point for read to >>> the watched memory ? can other debugger do that ? is it supported in >>> hardware watchpoint ? >>> >>> Thanks >>> >>> Xin >>> >> >> Read watchpoints are hard to implement as soft-watchpoints, so they're >> usually implemented as hardware watchpoints. > > software write watchpoint is easier to implement ? do not software > watchpoint need to watch all memory accesses (read and write) to a > memory location in software ? Writes are "easier" to implemenet due to the fact that they usually change memory contents. Reads don't. > >> >> If a debugger knows how to properly set the bits in the hardware, either >> through ptrace or other means, it can configure a read/write/read-write >> watchpoint. Depends on hardware support really. > > do you know whether this is supported on the x86 chips ? is thee a way > to try this out in gdb ? All those modes should be supported in x86. Try "watch", "rwatch" and "awatch". > >> >> Regards, >> Luis ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 13:18 ` Luis Gustavo @ 2012-04-24 14:18 ` Xin Tong 2012-04-24 14:20 ` Luis Gustavo 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-04-24 14:18 UTC (permalink / raw) To: Gustavo, Luis; +Cc: gdb On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo <luis_gustavo@mentor.com> wrote: > On 04/24/2012 10:15 AM, Xin Tong wrote: >> >> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >> wrote: >>> >>> Hi, >>> >>> >>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>> >>>> >>>> Hello >>>> >>>> I am wondering that can gdb insert hardware watch point for read to >>>> the watched memory ? can other debugger do that ? is it supported in >>>> hardware watchpoint ? >>>> >>>> Thanks >>>> >>>> Xin >>>> >>> >>> Read watchpoints are hard to implement as soft-watchpoints, so they're >>> usually implemented as hardware watchpoints. >> >> >> software write watchpoint is easier to implement ? do not software >> watchpoint need to watch all memory accesses (read and write) to a >> memory location in software ? > > > Writes are "easier" to implemenet due to the fact that they usually change > memory contents. Reads don't. Either way, do not gdb need to instrument every memory accesses if a software watch point is used ? > > >> >>> >>> If a debugger knows how to properly set the bits in the hardware, either >>> through ptrace or other means, it can configure a read/write/read-write >>> watchpoint. Depends on hardware support really. >> >> >> do you know whether this is supported on the x86 chips ? is thee a way >> to try this out in gdb ? > > > All those modes should be supported in x86. Try "watch", "rwatch" and > "awatch". how are hardware watch, rwatch and awatch implemented in gdb. make call to ptrace apis and ptrace apis program some x86 registers through a driver interfaces ? > >> >>> >>> Regards, >>> Luis > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 14:18 ` Xin Tong @ 2012-04-24 14:20 ` Luis Gustavo 2012-04-24 15:06 ` Xin Tong 0 siblings, 1 reply; 13+ messages in thread From: Luis Gustavo @ 2012-04-24 14:20 UTC (permalink / raw) To: Xin Tong; +Cc: gdb On 04/24/2012 11:17 AM, Xin Tong wrote: > On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo<luis_gustavo@mentor.com> wrote: >> On 04/24/2012 10:15 AM, Xin Tong wrote: >>> >>> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >>> wrote: >>>> >>>> Hi, >>>> >>>> >>>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>>> >>>>> >>>>> Hello >>>>> >>>>> I am wondering that can gdb insert hardware watch point for read to >>>>> the watched memory ? can other debugger do that ? is it supported in >>>>> hardware watchpoint ? >>>>> >>>>> Thanks >>>>> >>>>> Xin >>>>> >>>> >>>> Read watchpoints are hard to implement as soft-watchpoints, so they're >>>> usually implemented as hardware watchpoints. >>> >>> >>> software write watchpoint is easier to implement ? do not software >>> watchpoint need to watch all memory accesses (read and write) to a >>> memory location in software ? >> >> >> Writes are "easier" to implemenet due to the fact that they usually change >> memory contents. Reads don't. > > Either way, do not gdb need to instrument every memory accesses if a > software watch point is used ? It does things lazily. It single-steps instruction-by-instruction and checks for change of contents. >> >> >>> >>>> >>>> If a debugger knows how to properly set the bits in the hardware, either >>>> through ptrace or other means, it can configure a read/write/read-write >>>> watchpoint. Depends on hardware support really. >>> >>> >>> do you know whether this is supported on the x86 chips ? is thee a way >>> to try this out in gdb ? >> >> >> All those modes should be supported in x86. Try "watch", "rwatch" and >> "awatch". > > how are hardware watch, rwatch and awatch implemented in gdb. make > call to ptrace apis and ptrace apis program some x86 registers > through a driver interfaces ? > ptrace calls really. GDB's x86 backend knows how to set those bits. >> >>> >>>> >>>> Regards, >>>> Luis >> >> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 14:20 ` Luis Gustavo @ 2012-04-24 15:06 ` Xin Tong 2012-04-24 15:11 ` Luis Gustavo 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-04-24 15:06 UTC (permalink / raw) To: Gustavo, Luis; +Cc: gdb On Tue, Apr 24, 2012 at 10:19 AM, Luis Gustavo <luis_gustavo@mentor.com> wrote: > On 04/24/2012 11:17 AM, Xin Tong wrote: >> >> On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo<luis_gustavo@mentor.com> >> wrote: >>> >>> On 04/24/2012 10:15 AM, Xin Tong wrote: >>>> >>>> >>>> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>> wrote: >>>>> >>>>> >>>>> Hi, >>>>> >>>>> >>>>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>>>> >>>>>> >>>>>> >>>>>> Hello >>>>>> >>>>>> I am wondering that can gdb insert hardware watch point for read to >>>>>> the watched memory ? can other debugger do that ? is it supported in >>>>>> hardware watchpoint ? >>>>>> >>>>>> Thanks >>>>>> >>>>>> Xin >>>>>> >>>>> >>>>> Read watchpoints are hard to implement as soft-watchpoints, so they're >>>>> usually implemented as hardware watchpoints. >>>> >>>> >>>> >>>> software write watchpoint is easier to implement ? do not software >>>> watchpoint need to watch all memory accesses (read and write) to a >>>> memory location in software ? >>> >>> >>> >>> Writes are "easier" to implemenet due to the fact that they usually >>> change >>> memory contents. Reads don't. >> >> >> Either way, do not gdb need to instrument every memory accesses if a >> software watch point is used ? > > > It does things lazily. It single-steps instruction-by-instruction and checks > for change of contents. ok, i see. so it does not dissasmble the instructions. but for read, it may need to disassemble the instructions which makes it harder to implement. > > >>> >>> >>>> >>>>> >>>>> If a debugger knows how to properly set the bits in the hardware, >>>>> either >>>>> through ptrace or other means, it can configure a read/write/read-write >>>>> watchpoint. Depends on hardware support really. >>>> >>>> >>>> >>>> do you know whether this is supported on the x86 chips ? is thee a way >>>> to try this out in gdb ? >>> >>> >>> >>> All those modes should be supported in x86. Try "watch", "rwatch" and >>> "awatch". >> >> >> how are hardware watch, rwatch and awatch implemented in gdb. make >> call to ptrace apis and ptrace apis program some x86 registers >> through a driver interfaces ? >> > > ptrace calls really. GDB's x86 backend knows how to set those bits. > >>> >>>> >>>>> >>>>> Regards, >>>>> Luis >>> >>> >>> > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 15:06 ` Xin Tong @ 2012-04-24 15:11 ` Luis Gustavo 2012-04-25 1:15 ` Xin Tong 0 siblings, 1 reply; 13+ messages in thread From: Luis Gustavo @ 2012-04-24 15:11 UTC (permalink / raw) To: Xin Tong; +Cc: gdb On 04/24/2012 12:06 PM, Xin Tong wrote: > On Tue, Apr 24, 2012 at 10:19 AM, Luis Gustavo<luis_gustavo@mentor.com> wrote: >> On 04/24/2012 11:17 AM, Xin Tong wrote: >>> >>> On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo<luis_gustavo@mentor.com> >>> wrote: >>>> >>>> On 04/24/2012 10:15 AM, Xin Tong wrote: >>>>> >>>>> >>>>> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>>> wrote: >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> >>>>>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> Hello >>>>>>> >>>>>>> I am wondering that can gdb insert hardware watch point for read to >>>>>>> the watched memory ? can other debugger do that ? is it supported in >>>>>>> hardware watchpoint ? >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> Xin >>>>>>> >>>>>> >>>>>> Read watchpoints are hard to implement as soft-watchpoints, so they're >>>>>> usually implemented as hardware watchpoints. >>>>> >>>>> >>>>> >>>>> software write watchpoint is easier to implement ? do not software >>>>> watchpoint need to watch all memory accesses (read and write) to a >>>>> memory location in software ? >>>> >>>> >>>> >>>> Writes are "easier" to implemenet due to the fact that they usually >>>> change >>>> memory contents. Reads don't. >>> >>> >>> Either way, do not gdb need to instrument every memory accesses if a >>> software watch point is used ? >> >> >> It does things lazily. It single-steps instruction-by-instruction and checks >> for change of contents. > > ok, i see. so it does not dissasmble the instructions. but for read, > it may need to disassemble the instructions which makes it harder to > implement. Yes, this is the problem with read watchpoints implemented as software watchpoints. It's hard to determine a trigger without making it painfully slow, and the debugger needs knowledge about the arch's instructions. >> >> >>>> >>>> >>>>> >>>>>> >>>>>> If a debugger knows how to properly set the bits in the hardware, >>>>>> either >>>>>> through ptrace or other means, it can configure a read/write/read-write >>>>>> watchpoint. Depends on hardware support really. >>>>> >>>>> >>>>> >>>>> do you know whether this is supported on the x86 chips ? is thee a way >>>>> to try this out in gdb ? >>>> >>>> >>>> >>>> All those modes should be supported in x86. Try "watch", "rwatch" and >>>> "awatch". >>> >>> >>> how are hardware watch, rwatch and awatch implemented in gdb. make >>> call to ptrace apis and ptrace apis program some x86 registers >>> through a driver interfaces ? >>> >> >> ptrace calls really. GDB's x86 backend knows how to set those bits. >> >>>> >>>>> >>>>>> >>>>>> Regards, >>>>>> Luis >>>> >>>> >>>> >> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-24 15:11 ` Luis Gustavo @ 2012-04-25 1:15 ` Xin Tong 2012-04-25 11:51 ` Luis Gustavo 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-04-25 1:15 UTC (permalink / raw) To: Gustavo, Luis; +Cc: gdb On Tue, Apr 24, 2012 at 11:11 AM, Luis Gustavo <luis_gustavo@mentor.com> wrote: > On 04/24/2012 12:06 PM, Xin Tong wrote: >> >> On Tue, Apr 24, 2012 at 10:19 AM, Luis Gustavo<luis_gustavo@mentor.com> >> wrote: >>> >>> On 04/24/2012 11:17 AM, Xin Tong wrote: >>>> >>>> >>>> On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>> wrote: >>>>> >>>>> >>>>> On 04/24/2012 10:15 AM, Xin Tong wrote: >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>>>> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> >>>>>>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Hello >>>>>>>> >>>>>>>> I am wondering that can gdb insert hardware watch point for read to >>>>>>>> the watched memory ? can other debugger do that ? is it supported in >>>>>>>> hardware watchpoint ? >>>>>>>> >>>>>>>> Thanks >>>>>>>> >>>>>>>> Xin >>>>>>>> >>>>>>> >>>>>>> Read watchpoints are hard to implement as soft-watchpoints, so >>>>>>> they're >>>>>>> usually implemented as hardware watchpoints. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> software write watchpoint is easier to implement ? do not software >>>>>> watchpoint need to watch all memory accesses (read and write) to a >>>>>> memory location in software ? >>>>> >>>>> >>>>> >>>>> >>>>> Writes are "easier" to implemenet due to the fact that they usually >>>>> change >>>>> memory contents. Reads don't. >>>> >>>> >>>> >>>> Either way, do not gdb need to instrument every memory accesses if a >>>> software watch point is used ? >>> >>> >>> >>> It does things lazily. It single-steps instruction-by-instruction and >>> checks >>> for change of contents. >> >> >> ok, i see. so it does not dissasmble the instructions. but for read, >> it may need to disassemble the instructions which makes it harder to >> implement. > > > Yes, this is the problem with read watchpoints implemented as software > watchpoints. It's hard to determine a trigger without making it painfully > slow, and the debugger needs knowledge about the arch's instructions. > > >>> >>> >>>>> >>>>> >>>>>> >>>>>>> >>>>>>> If a debugger knows how to properly set the bits in the hardware, >>>>>>> either >>>>>>> through ptrace or other means, it can configure a >>>>>>> read/write/read-write >>>>>>> watchpoint. Depends on hardware support really. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> do you know whether this is supported on the x86 chips ? is thee a way >>>>>> to try this out in gdb ? >>>>> >>>>> >>>>> >>>>> >>>>> All those modes should be supported in x86. Try "watch", "rwatch" and >>>>> "awatch". >>>> >>>> >>>> >>>> how are hardware watch, rwatch and awatch implemented in gdb. make >>>> call to ptrace apis and ptrace apis program some x86 registers >>>> through a driver interfaces ? >>>> >>> >>> ptrace calls really. GDB's x86 backend knows how to set those bits. what are the performance penalties of having a watchpoint on a memory location in the state of the art x86 processor. Because it might be implemented with a parallel circuitry in the processor, my guess is that it could be cheap. Xin >>> >>>>> >>>>>> >>>>>>> >>>>>>> Regards, >>>>>>> Luis >>>>> >>>>> >>>>> >>>>> >>> > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-25 1:15 ` Xin Tong @ 2012-04-25 11:51 ` Luis Gustavo 2012-05-03 19:19 ` Philippe Waroquiers 0 siblings, 1 reply; 13+ messages in thread From: Luis Gustavo @ 2012-04-25 11:51 UTC (permalink / raw) To: Xin Tong; +Cc: gdb On 04/24/2012 10:15 PM, Xin Tong wrote: > On Tue, Apr 24, 2012 at 11:11 AM, Luis Gustavo<luis_gustavo@mentor.com> wrote: >> On 04/24/2012 12:06 PM, Xin Tong wrote: >>> >>> On Tue, Apr 24, 2012 at 10:19 AM, Luis Gustavo<luis_gustavo@mentor.com> >>> wrote: >>>> >>>> On 04/24/2012 11:17 AM, Xin Tong wrote: >>>>> >>>>> >>>>> On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>>> wrote: >>>>>> >>>>>> >>>>>> On 04/24/2012 10:15 AM, Xin Tong wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo<luis_gustavo@mentor.com> >>>>>>> wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> >>>>>>>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Hello >>>>>>>>> >>>>>>>>> I am wondering that can gdb insert hardware watch point for read to >>>>>>>>> the watched memory ? can other debugger do that ? is it supported in >>>>>>>>> hardware watchpoint ? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> Xin >>>>>>>>> >>>>>>>> >>>>>>>> Read watchpoints are hard to implement as soft-watchpoints, so >>>>>>>> they're >>>>>>>> usually implemented as hardware watchpoints. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> software write watchpoint is easier to implement ? do not software >>>>>>> watchpoint need to watch all memory accesses (read and write) to a >>>>>>> memory location in software ? >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Writes are "easier" to implemenet due to the fact that they usually >>>>>> change >>>>>> memory contents. Reads don't. >>>>> >>>>> >>>>> >>>>> Either way, do not gdb need to instrument every memory accesses if a >>>>> software watch point is used ? >>>> >>>> >>>> >>>> It does things lazily. It single-steps instruction-by-instruction and >>>> checks >>>> for change of contents. >>> >>> >>> ok, i see. so it does not dissasmble the instructions. but for read, >>> it may need to disassemble the instructions which makes it harder to >>> implement. >> >> >> Yes, this is the problem with read watchpoints implemented as software >> watchpoints. It's hard to determine a trigger without making it painfully >> slow, and the debugger needs knowledge about the arch's instructions. >> >> >>>> >>>> >>>>>> >>>>>> >>>>>>> >>>>>>>> >>>>>>>> If a debugger knows how to properly set the bits in the hardware, >>>>>>>> either >>>>>>>> through ptrace or other means, it can configure a >>>>>>>> read/write/read-write >>>>>>>> watchpoint. Depends on hardware support really. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> do you know whether this is supported on the x86 chips ? is thee a way >>>>>>> to try this out in gdb ? >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> All those modes should be supported in x86. Try "watch", "rwatch" and >>>>>> "awatch". >>>>> >>>>> >>>>> >>>>> how are hardware watch, rwatch and awatch implemented in gdb. make >>>>> call to ptrace apis and ptrace apis program some x86 registers >>>>> through a driver interfaces ? >>>>> >>>> >>>> ptrace calls really. GDB's x86 backend knows how to set those bits. > > what are the performance penalties of having a watchpoint on a memory > location in the state of the art x86 processor. Because it might be > implemented with a parallel circuitry in the processor, my guess is > that it could be cheap. Do you mean a hardware watchpoint? It's hard to say for sure without looking at the processors inner workings, but the penalty is probably very small. When the conditions are satisfied, a TRAP will be generated and it will get through to the debugger via the kernel. Suppose we issue a continue command... For the debugger, the inferior will run uninterrupted while the hardware watchpoint is active. This is not the case with software watchpoints, as the debugger will be constantly touching the inferior while it runs. > > Xin > >>>> >>>>>> >>>>>>> >>>>>>>> >>>>>>>> Regards, >>>>>>>> Luis >>>>>> >>>>>> >>>>>> >>>>>> >>>> >> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-04-25 11:51 ` Luis Gustavo @ 2012-05-03 19:19 ` Philippe Waroquiers 2012-05-03 19:41 ` Xin Tong 0 siblings, 1 reply; 13+ messages in thread From: Philippe Waroquiers @ 2012-05-03 19:19 UTC (permalink / raw) To: Gustavo, Luis, Xin Tong; +Cc: gdb >> what are the performance penalties of having a watchpoint on a memory >> location in the state of the art x86 processor. Because it might be >> implemented with a parallel circuitry in the processor, my guess is >> that it could be cheap. > > Do you mean a hardware watchpoint? It's hard to say for sure without > looking at the processors inner workings, but the penalty is probably > very small. > > When the conditions are satisfied, a TRAP will be generated and it will > get through to the debugger via the kernel. > > Suppose we issue a continue command... For the debugger, the inferior > will run uninterrupted while the hardware watchpoint is active. > > This is not the case with software watchpoints, as the debugger will be > constantly touching the inferior while it runs. Which makes software watchpoints extremely slow, while hardware watchpoints have limitations (e.g. in nr or size). Note that the Valgrind gdbserver (in 3.7.0) provides "unlimited simulated hw watchpoints" : these are slower than real hw watchpoints, but "only" suffer from the Valgrind slowdown. Philippe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-05-03 19:19 ` Philippe Waroquiers @ 2012-05-03 19:41 ` Xin Tong 2012-05-03 21:18 ` Philippe Waroquiers 0 siblings, 1 reply; 13+ messages in thread From: Xin Tong @ 2012-05-03 19:41 UTC (permalink / raw) To: Philippe Waroquiers; +Cc: Gustavo, Luis, gdb On Thu, May 3, 2012 at 3:19 PM, Philippe Waroquiers <philippe.waroquiers@skynet.be> wrote: >>> what are the performance penalties of having a watchpoint on a memory >>> location in the state of the art x86 processor. Because it might be >>> implemented with a parallel circuitry in the processor, my guess is >>> that it could be cheap. >> >> >> Do you mean a hardware watchpoint? It's hard to say for sure without >> looking at the processors inner workings, but the penalty is probably very >> small. >> >> When the conditions are satisfied, a TRAP will be generated and it will >> get through to the debugger via the kernel. >> >> Suppose we issue a continue command... For the debugger, the inferior will >> run uninterrupted while the hardware watchpoint is active. >> >> This is not the case with software watchpoints, as the debugger will be >> constantly touching the inferior while it runs. > > Which makes software watchpoints extremely slow, while hardware > watchpoints have limitations (e.g. in nr or size). > Note that the Valgrind gdbserver (in 3.7.0) provides "unlimited simulated > hw watchpoints" : these are slower than real hw watchpoints, but "only" > suffer from the Valgrind slowdown. > > Philippe > The breakpoint instructions (int 3 on x86) are inserted in the translation process ? Xin ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Hardware watchpoint for read 2012-05-03 19:41 ` Xin Tong @ 2012-05-03 21:18 ` Philippe Waroquiers 0 siblings, 0 replies; 13+ messages in thread From: Philippe Waroquiers @ 2012-05-03 21:18 UTC (permalink / raw) To: Xin Tong; +Cc: Gustavo, Luis, gdb On Thu, 2012-05-03 at 15:41 -0400, Xin Tong wrote: > The breakpoint instructions (int 3 on x86) are inserted in the > translation process ? Valgrind gdbserver implements breakpoints during code translation by inserting calls to a Valgrind "helper" procedure. You can use a Valgrind gdbserver monitor command to inspect the translation: v.translate <addr> [<traceflags>] : debug translation of <addr> with <traceflags> (default traceflags 0b00100000 : show after instrumentation) An additional flag 0b100000000 allows to show gdbserver instrumentation read/write/access watchpoints are implemented on top of memcheck "addressability" V bits. memcheck is the only Valgrind tool that implements watchpoints. Philippe ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-05-03 21:18 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-24 13:03 Hardware watchpoint for read Xin Tong 2012-04-24 13:09 ` Luis Gustavo 2012-04-24 13:16 ` Xin Tong 2012-04-24 13:18 ` Luis Gustavo 2012-04-24 14:18 ` Xin Tong 2012-04-24 14:20 ` Luis Gustavo 2012-04-24 15:06 ` Xin Tong 2012-04-24 15:11 ` Luis Gustavo 2012-04-25 1:15 ` Xin Tong 2012-04-25 11:51 ` Luis Gustavo 2012-05-03 19:19 ` Philippe Waroquiers 2012-05-03 19:41 ` Xin Tong 2012-05-03 21:18 ` Philippe Waroquiers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).