<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Also google "gdb cheat sheet" for some helpful command overview
PDFs.<br>
<br>
If you cannot use "make monitor" or had the module disconnected from
USB when the crash occurred, you can attach gdb to the crashed
module like this:<br>
<br>
<tt>xtensa-esp32-elf-gdb -ex "set serial baud 115200" -ex "target
remote /dev/ttyUSB0" -ex interrupt build/ovms3.elf </tt><br>
<br>
(replace the device by your USB serial device, path is relative to
Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3)<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 22.11.2017 um 23:10 schrieb Geir
Øyvind Vælidalo:<br>
</div>
<blockquote type="cite"
cite="mid:134683D3-0244-40FE-8B0B-EE738412694A@validalo.net">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Thanks a lot, Steve! Great explanation :-)
<div class=""><br class="">
</div>
<div class="">I’m using Mac, so please send the binary and
library. </div>
<div class=""><br class="">
</div>
<div class="">Best regards,</div>
<div class="">Geir</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">22. nov. 2017 kl. 23:03 skrev Stephen Casner
<<a href="mailto:casner@acm.org" class=""
moz-do-not-send="true">casner@acm.org</a>>:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">On Wed, 22 Nov 2017, Geir ?yvind V?lidalo
wrote:<br class="">
<br class="">
<blockquote type="cite" class="">I see some of your are
talking about gdb-stub, but I have never used<br
class="">
gbd and need some help.<br class="">
How do I debug? What options do I have?<br class="">
</blockquote>
<br class="">
Happy to help with that. To use the gdb-stub you change
the parameter<br class="">
in menuconfig / Component Config / ESP32-specific /
Panic handler<br class="">
behavior / Invoke GDBStub.<br class="">
<br class="">
When the crash occurs, you'll be presented with a
"gdb>" command<br class="">
prompt. You can find references for "gdb commands"
online. Here is<br class="">
one: <a
href="http://www.yolinux.com/TUTORIALS/GDB-Commands.html"
class="" moz-do-not-send="true">http://www.yolinux.com/TUTORIALS/GDB-Commands.html</a><br
class="">
<br class="">
The first command I would expect you will want is "bt"
which displays<br class="">
a stack backtrace telling in which function each call is
made,<br class="">
including the source line number. The frames on the
stack are<br class="">
numbered; you can give the command "frame N" where N is
a frame number<br class="">
to change to the context of that frame, since the lowest
one might not<br class="">
be the place where things started to go wrong.<br
class="">
<br class="">
When you're at the right frame, you can use the "print"
command to<br class="">
look at the value of variables. If variable foo is a
pointer, you can<br class="">
say "print *foo" to display the contents of the object
foo points to.<br class="">
In many cases this will be enough to figure out the
problem. I also<br class="">
use the "x" command to examine memory by address in
various ways.<br class="">
<br class="">
You can also use the "list" command to see a few lines
of source code<br class="">
around the point in the code referenced by that stack
frame. Usually<br class="">
I just look at my source in a separate window.<br
class="">
<br class="">
When using gdb on a real computer you can set
breakpoints before<br class="">
starting the program, but I have not learned whether
that is possible<br class="">
to do with the ESP32.<br class="">
<br class="">
As I mentioned in one of the emails, if you are running
on a Mac you<br class="">
should use the gdb binary that I made which references
the newer<br class="">
libiconv library in order to avoid gdb getting stuck in
an infinite<br class="">
loop. If so, let me know and I'll send the binary and
library to you.<br class="">
If you are running on a different platform, you should
check to see<br class="">
what version of libiconv DLL (Windows) or shared library
(Linux) is<br class="">
referenced. On my Mac the new one is 9.0.0 vs. 7.0.0.
The old one is<br class="">
usable, but you have to be careful not to give any
command that might<br class="">
result in gdb tryinging to display a variable value that
has non-ASCII<br class="">
chars.<br class="">
<br class="">
-- Steve<br
class="">
_______________________________________________<br
class="">
OvmsDev mailing list<br class="">
<a href="mailto:OvmsDev@lists.teslaclub.hk" class=""
moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
class="">
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="160">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
</body>
</html>