Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c3e54f09
Commit
c3e54f09
authored
Apr 13, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: better trace for fault due to nil pointer call
R=r CC=golang-dev
https://golang.org/cl/854048
parent
03526597
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
20 deletions
+72
-20
src/pkg/runtime/darwin/386/signal.c
src/pkg/runtime/darwin/386/signal.c
+11
-3
src/pkg/runtime/darwin/amd64/signal.c
src/pkg/runtime/darwin/amd64/signal.c
+12
-4
src/pkg/runtime/freebsd/386/signal.c
src/pkg/runtime/freebsd/386/signal.c
+11
-3
src/pkg/runtime/freebsd/amd64/signal.c
src/pkg/runtime/freebsd/amd64/signal.c
+11
-3
src/pkg/runtime/linux/386/signal.c
src/pkg/runtime/linux/386/signal.c
+11
-3
src/pkg/runtime/linux/amd64/signal.c
src/pkg/runtime/linux/amd64/signal.c
+11
-3
src/pkg/runtime/linux/arm/signal.c
src/pkg/runtime/linux/arm/signal.c
+5
-1
No files found.
src/pkg/runtime/darwin/386/signal.c
View file @
c3e54f09
...
...
@@ -66,10 +66,18 @@ sighandler(int32 sig, Siginfo *info, void *context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
(
uintptr
)
info
->
si_addr
;
// Only push sigpanic if r->eip != 0.
// If r->eip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
eip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
esp
;
*--
sp
=
r
->
eip
;
r
->
eip
=
(
uintptr
)
sigpanic
;
r
->
esp
=
(
uintptr
)
sp
;
}
r
->
eip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/darwin/amd64/signal.c
View file @
c3e54f09
...
...
@@ -75,10 +75,18 @@ sighandler(int32 sig, Siginfo *info, void *context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
(
uintptr
)
info
->
si_addr
;
// Only push sigpanic if r->rip != 0.
// If r->rip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
rip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
rsp
;
*--
sp
=
r
->
rip
;
r
->
rip
=
(
uintptr
)
sigpanic
;
r
->
rsp
=
(
uintptr
)
sp
;
}
r
->
rip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/freebsd/386/signal.c
View file @
c3e54f09
...
...
@@ -64,10 +64,18 @@ sighandler(int32 sig, Siginfo* info, void* context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
(
uintptr
)
info
->
si_addr
;
// Only push sigpanic if r->mc_eip != 0.
// If r->mc_eip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
mc_eip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
mc_esp
;
*--
sp
=
r
->
mc_eip
;
r
->
mc_eip
=
(
uintptr
)
sigpanic
;
r
->
mc_esp
=
(
uintptr
)
sp
;
}
r
->
mc_eip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/freebsd/amd64/signal.c
View file @
c3e54f09
...
...
@@ -72,10 +72,18 @@ sighandler(int32 sig, Siginfo* info, void* context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
(
uintptr
)
info
->
si_addr
;
// Only push sigpanic if r->mc_rip != 0.
// If r->mc_rip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
mc_rip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
mc_rsp
;
*--
sp
=
r
->
mc_rip
;
r
->
mc_rip
=
(
uintptr
)
sigpanic
;
r
->
mc_rsp
=
(
uintptr
)
sp
;
}
r
->
mc_rip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/linux/386/signal.c
View file @
c3e54f09
...
...
@@ -61,10 +61,18 @@ sighandler(int32 sig, Siginfo* info, void* context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
((
uintptr
*
)
info
)[
3
];
// Only push sigpanic if r->eip != 0.
// If r->eip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
eip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
esp
;
*--
sp
=
r
->
eip
;
r
->
eip
=
(
uintptr
)
sigpanic
;
r
->
esp
=
(
uintptr
)
sp
;
}
r
->
eip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/linux/amd64/signal.c
View file @
c3e54f09
...
...
@@ -71,10 +71,18 @@ sighandler(int32 sig, Siginfo* info, void* context)
gp
->
sigcode0
=
info
->
si_code
;
gp
->
sigcode1
=
((
uintptr
*
)
info
)[
2
];
// Only push sigpanic if r->rip != 0.
// If r->rip == 0, probably panicked because of a
// call to a nil func. Not pushing that onto sp will
// make the trace look like a call to sigpanic instead.
// (Otherwise the trace will end at sigpanic and we
// won't get to see who faulted.)
if
(
r
->
rip
!=
0
)
{
sp
=
(
uintptr
*
)
r
->
rsp
;
*--
sp
=
r
->
rip
;
r
->
rip
=
(
uintptr
)
sigpanic
;
r
->
rsp
=
(
uintptr
)
sp
;
}
r
->
rip
=
(
uintptr
)
sigpanic
;
return
;
}
...
...
src/pkg/runtime/linux/arm/signal.c
View file @
c3e54f09
...
...
@@ -70,6 +70,10 @@ sighandler(int32 sig, Siginfo *info, void *context)
// If this is a leaf function, we do smash LR,
// but we're not going back there anyway.
// Don't bother smashing if r->arm_pc is 0,
// which is probably a call to a nil func: the
// old link register is more useful in the stack trace.
if
(
r
->
arm_pc
!=
0
)
r
->
arm_lr
=
r
->
arm_pc
;
r
->
arm_pc
=
(
uintptr
)
sigpanic
;
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment