]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 285773,285775,285776:
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 12 Nov 2015 22:45:51 +0000 (22:45 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 12 Nov 2015 22:45:51 +0000 (22:45 +0000)
commita8dfe0218f5dc407206b8fab906ce77cad145b0c
tree4c6c11e1fed1ad4f8cca85f9135fadae35c74d91
parent858a61a8a38ebd20f3a89d1f62b489d122c355e6
MFC 285773,285775,285776:
Various fixes for stack unwinding in DDB on x86.

285773:
Remove some dead code from DDB's amd64 stack unwinder.

The amd64 port copied some code from i386 to fetch function arguments and
display them in backtraces. However, it was commented out and can't easily
be implemented since the function arguments are passed in
registers rather than on the stack in amd64. Remove it in preparation for
some bug fixes in this area.

285775:
Improve stack unwinding on i386 and amd64 after an IP fault.

If we can't find a symbol corresponding to the faulting instruction, assume
that the previously-executed function is a call and attempt to find the
calling function using the return address on the stack. Otherwise we end
up associating the last stack frame with the current call, which is
incorrect and causes the unwinder to skip printing of the calling function,
resulting in a confusing backtrace.

285776:
Let the unwinder handle faults during function prologues or epilogues.

The i386 and amd64 DDB stack unwinders contain code to detect and handle
the case where the first frame is not completely set up or torn down. This
code was accidentally unused however, since db_backtrace() was never called
with a non-NULL trap frame. This change fixes that.

Also remove get_rsp() from the amd64 code. It appears to have come from
i386, which needs to take into account whether the exception triggered a
CPL switch, since SS:ESP is only pushed onto the stack if so. On amd64,
SS:RSP is pushed regardless, so get_rsp() was doing the wrong thing for
kernel-mode exceptions. As a result, we can also remove custom print
functions for these registers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@290730 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/amd64/amd64/db_trace.c
sys/i386/i386/db_trace.c