NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
wingsorc__ has quit [Remote host closed the connection]
PaulFertser has quit [Ping timeout: 264 seconds]
PaulFertser has joined #openocd
wingsorc__ has joined #openocd
wingsorc has quit [Remote host closed the connection]
tsal has quit [Ping timeout: 264 seconds]
tsal has joined #openocd
_franck_ has quit [Quit: Ping timeout (120 seconds)]
_franck_ has joined #openocd
nerozero has joined #openocd
defiant has joined #openocd
Hawk777 has quit [Quit: Leaving.]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
Haohmaru has joined #openocd
<karlp> we don't know, they never really got to anything actionable.
<phr3ak> when I turn on a watchpoint the processing slowing down (few systicks per second). if I delete this watchpoint everything goes back to normal. in the debug log, i see DWT on and off frequently. Cortex-M3 / Ulink2 with CMSIS-DAP
<karlp> in what debug log?
<karlp> do you mean you see openocd turning the watchpoitn on and off repeatedly?
<karlp> are you setting watchpointswith gdb? it's possible it's not getting translated into a "nice" dwt watchpoint?
<phr3ak> i don't know what is nice but it does not do with an other variable so if I select other variable to watch
<phr3ak> I ran openocd with -d
<phr3ak> and I saw that rapidly repetitive DWT on/off messages there.
<karlp> what's the variable?
<karlp> I'm guessing it's somehow not translating into a single dwt entry?
<karlp> how are you measuing this "few systicks per second" ? (just curious)
<karlp> I wouldn't hav ethought tht modifying dwt while running should have mattered anyway, but something's intruding I guess.
<phr3ak> I pressed c, continue, waited a bit, stop, and check a variable that is increased by systick. and there is led blinking in systick ...
<phr3ak> that's how I found out that the system slowed down
<phr3ak> if I deleted the watchpoint then it went back to normal
<phr3ak> then I looked at the debug log, what is the difference if I set watchpoint to the two different variables and I noticed that when the system is slow, a lot of log messages appear...
<phr3ak> both variables are int
<karlp> can you share a debug trace of the "good" variable and the "bad" one?
<karlp> you're obviously seeing a _lot_ of slowdown, if you're seeing it by watching a led blinking.
<karlp> um. is the watchpoint _hitting_ a lot?
<phr3ak> i'm connecting the device and reproduce the issue
<phr3ak> well, so it should
<phr3ak> sorry
<phr3ak> so it is not stopping
<phr3ak> but it should
<phr3ak> i know this variable is changing in this interrupt handler
<phr3ak> this is why I wanted to watch
<phr3ak> but the processing is not stopping while I press ctrl-c in gdb
<phr3ak> while i'm not pressing ctrl-c
<phr3ak> DWT0 0x2007d21c 0x2 0x00006
<phr3ak> is it r/w/x?
<phr3ak> this DWT is cleared and installed again and again
<phr3ak> (this code runs in memory)
<phr3ak> so not from flash
<phr3ak> i'm checking this address but I think it is the code and not the variable itself
<phr3ak> this is the variable's address. so it is correct.
<phr3ak> DWT installed and deleted about 65 events later
<phr3ak> but gdb does not stop
<phr3ak> so the problem seems to be that gdb doesn't stop, even though watchpoint gets a hit
<karlp> please... logs..
<phr3ak> ok how could I send to you
<karlp> paste bin of some sort.
<karlp> include your gdb logs too.
<phr3ak> Found hit watchpoint at 0x2007d21c (WPID: 0)
<phr3ak> but gdb does not stop
<PaulFertser> Hm, as if GDB gets the information but decides to continue instead of stopping..
<karlp> info breaks doesn't have an address in it?
<PaulFertser> What GDB is that? Is that an ARM or multiarch binary? It looks like it's getting confused somehow.
<PaulFertser> And yes, no address is fishy.
<phr3ak> GNU gdb (GNU Tools for ARM Embedded Processors (Arduino build)) 7.6.0.20140228-cvs
<karlp> that's a... _very_ old gdb.
<PaulFertser> Hah, yes, just use the one provided by your distro, the multiarch version.
<phr3ak> same with newer gdb
<phr3ak> it got hit first four times but no more
<phr3ak> there is no address at info break
<phr3ak> is it read write or exec DWT breakpoint?
<phr3ak> it got more hit but the execution is slow
<PaulFertser> phr3ak: what is the variable type?
<phr3ak> int
<PaulFertser> There must be some difference between the times it's hit and GDB is stopped and when it's hit but GDB isn't stopped...
<phr3ak> what should be the type of DWT breakpoint rwx in case if I create it with watch command?
<phr3ak> I would say write only
<phr3ak> but maybe i'm wrong
<phr3ak> so this is a question
<phr3ak> the possible reason for not stopping because the value is not changed, the memory location has been written with the same value as it was previously
<PaulFertser> phr3ak: I think that might be why GDB filters it out, that would kind of explain it.
<phr3ak> the address is empty at info break. is it ok or bug?
<PaulFertser> Feels odd.
wingsorc__ has quit [Ping timeout: 252 seconds]
<phr3ak> what is the name of the other type of breakpoint that is not DWT?
<phr3ak> maybe DWT is software breakpoint the other is hardware breakpoint
<phr3ak> but I'm not sure
<phr3ak> address is missing at info break if the breakpoint is DWT breakpoint
<PaulFertser> phr3ak: no, software breakpoints can't be used as watchpoints.
<PaulFertser> phr3ak: DWT is used for both hardware breakpoints and data watchpoints.
<PaulFertser> phr3ak: when you're running from RAM OpenOCD can use software _breakpoints_.
<phr3ak> it's compilated atm i don't really understand. anyways, when I create breakpoint for code and not for data like break function, then I don't see DWT in log so this is why i think it is something different than DWT, and the address is showing up at info break. If I create watchpoint variable then I don't see the address at info break
<PaulFertser> phr3ak: by default GDB is using software breakpoints for code running from RAM.
<phr3ak> what is software breakpoint exactly? does it replace the original instruction to an instruction that cause Debug exception?
wingsorc has joined #openocd
crabbedhaloablut has quit [Quit: No Ping reply in 180 seconds.]
crabbedhaloablut has joined #openocd
<PaulFertser> phr3ak: exactly
<phr3ak> thanks
<phr3ak> could i turn on timestamp for openocd logging?
<PaulFertser> phr3ak: hm, isn't it there by default? Starting from 0, not rtc.
<PaulFertser> Hm, not in your log.
<PaulFertser> I think it's there after the log counter.
<PaulFertser> "Debug: 76 1132 cmsis_dap_usb_bulk.c:126" <--- 1132 is the timestamp phr3ak
<phr3ak> I'm still investigating why it's slow. I see a big delay here:
<phr3ak> Debug: 98020 625921 gdb_server.c:406 gdb_log_outgoing_packet(): [sam3.cpu] sending packet: $O#4f
<phr3ak> Debug: 98021 626423 gdb_server.c:406 gdb_log_outgoing_packet(): [sam3.cpu] sending packet: $O#4f
<phr3ak> but maybe it is normal
<phr3ak> so the delta time is around 600ms between two watchpoint hit and in normal condition it should be 1ms interval as it is in the systick
nerozero has quit [Ping timeout: 268 seconds]
<karlp> how ar eyou measuring that?
<karlp> you can configure many timers to stop or not stop when debug stops.
<phr3ak> grep watchpoint_hit openocd.log
<phr3ak> small addition the USB connection with ULINK2 is full speed (12M)
<phr3ak> and it is SWD not JTAG
<phr3ak> I measure 100ms if I grep stderr ...
<phr3ak> why does the gdb install and delete watchpoint again and again if that unchanged?
<PaulFertser> phr3ak: you can do "set debug remote 1" in GDB and show that log to GDB devs on their IRC channel, probably they'll tell you why.
<phr3ak> thanks I will check it
Haohmaru has quit []
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
<phr3ak> i just tried it with a x64 gdbserver and no repeating commands
<phr3ak> i can see repeating commands if I add a single watchpoint
<phr3ak> in case of openocd
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 248 seconds]
wingsorc__ has joined #openocd
PsySc0rpi0n has joined #openocd
PaulFertser has quit [Ping timeout: 248 seconds]
PaulFertser has joined #openocd
<phr3ak> I looked at what is happening at the remote protocol level and there is lot of unnecesary message exchange. Instead of reading a memory location and continuing execution, it removes and re-add the same breakpoint, reads all registers twice, reads the inspected memory location four times and so on.
<phr3ak> These redundant and maybe unnecessary message exchanges become more of a problem when one high level, GDB remote protocol request-response message becomes multiple request-respose messages at lower level, causing lot of latency and very slow program execution at the end.
wingsorc has quit [Remote host closed the connection]
<phr3ak> these commands are running again and again after one watchpoint hit:
<karlp> you will see some redunancy, but not all of it is going to be related. (there can always be optimizations, but not all of these are problematic for you)
wingsorc__ has quit [Remote host closed the connection]
wingsorc has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 246 seconds]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
PsySc0rpi0n has joined #openocd
diddly has quit [Read error: Connection reset by peer]
diddly has joined #openocd
jancoow has quit [Read error: Connection reset by peer]
rmann has joined #openocd