Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary literal #1

Closed
wants to merge 4 commits into from
Closed

Binary literal #1

wants to merge 4 commits into from

Conversation

AlekSi
Copy link
Owner

@AlekSi AlekSi commented Jan 4, 2017

No description provided.

AlekSi pushed a commit that referenced this pull request May 1, 2018
If the vetted function supplies zero arguments, previously you would
get an error message like this:

    Printf format %v reads arg #1, but call has only 0 args

"has only 0 args" is an odd construction, and "has 0 args" sounds
better. Getting rid of "only" in all cases simplifies the code and
reads just as well.

Change-Id: I4706dfe4a75f13bf4db9c0650e459ca676710752
Reviewed-on: https://go-review.googlesource.com/109457
Run-TryBot: Kevin Burke <kev@inburke.com>
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
AlekSi pushed a commit that referenced this pull request May 1, 2018
CL 93658 moved stack trace printing inside a systemstack call to
sidestep complexity in case the runtime is in a inconsistent state.

Unfortunately, debuggers generating backtraces for a Go panic
will be confused and come up with a technical correct but useless
stack. This CL moves just the crash performing - typically a SIGABRT
signal - outside the systemstack call to improve backtraces.

Unfortunately, the crash function now needs to be marked nosplit and
that triggers the no split stackoverflow check. To work around that,
split fatalpanic in two: fatalthrow for runtime.throw and fatalpanic for
runtime.gopanic. Only Go panics really needs crashes on the right stack
and there is enough stack for gopanic.

Example program:

package main

import "runtime/debug"

func main() {
	debug.SetTraceback("crash")
	crash()
}

func crash() {
	panic("panic!")
}

Before:
(lldb) bt
* thread #1, name = 'simple', stop reason = signal SIGABRT
  * frame #0: 0x000000000044ffe4 simple`runtime.raise at <autogenerated>:1
    frame #1: 0x0000000000438cfb simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424
    frame golang#2: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525
    frame golang#3: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
    frame golang#4: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
    frame golang#5: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
    frame golang#6: 0x000000000042a980 simple at proc.go:1094
    frame golang#7: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525
    frame golang#8: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
    frame golang#9: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
    frame golang#10: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
    frame golang#11: 0x000000000042a980 simple at proc.go:1094
    frame golang#12: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758
    frame golang#13: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
    frame golang#14: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1
    frame golang#15: 0x000000000042a980 simple at proc.go:1094
    frame golang#16: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657
    frame golang#17: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1

After:
(lldb) bt
* thread golang#7, stop reason = signal SIGABRT
  * frame #0: 0x0000000000450024 simple`runtime.raise at <autogenerated>:1
    frame #1: 0x0000000000438d1b simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424
    frame golang#2: 0x0000000000438ee9 simple`runtime.crash at signal_unix.go:525
    frame golang#3: 0x00000000004264e3 simple`runtime.fatalpanic(msgs=<unavailable>) at panic.go:664
    frame golang#4: 0x0000000000425f1b simple`runtime.gopanic(e=<unavailable>) at panic.go:537
    frame golang#5: 0x0000000000470c62 simple`main.crash at simple.go:11
    frame golang#6: 0x0000000000470c00 simple`main.main at simple.go:6
    frame golang#7: 0x0000000000427be7 simple`runtime.main at proc.go:198
    frame golang#8: 0x000000000044ef91 simple`runtime.goexit at <autogenerated>:1

Updates golang#22716

Change-Id: Ib5fa35c13662c1dac2f1eac8b59c4a5824b98d92
Reviewed-on: https://go-review.googlesource.com/110065
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
@AlekSi AlekSi closed this Aug 25, 2021
@AlekSi AlekSi deleted the binary-literal branch August 25, 2021 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant