1
0
mirror of https://github.com/golang/go synced 2024-10-05 02:31:21 -06:00
go/src
Russ Cox a4a1fadfa2 cmd/ld: make lldb happy with Mach-O 6.out files
Apparently all the __DWARF sections need addresses
even though they are marked as "do not load from disk".
Continue the address numbering from the data segment.

With this change:

g% lldb helloworld
Current executable set to 'helloworld' (x86_64).
(lldb) b main.main
Breakpoint 1: where = helloworld`main.main + 25 at helloworld.go:12, address = 0x0000000000002019
(lldb) r
Process 68509 launched: '/Users/rsc/g/go/src/cmd/6l/helloworld' (x86_64)
1 location added to breakpoint 1
(lldb)
Process 68509 stopped
* thread #1: tid = 0x8b7a27, 0x0000000000002019 helloworld`main.main + 25 at helloworld.go:12, stop reason = breakpoint 1.2
    frame #0: 0x0000000000002019 helloworld`main.main + 25 at helloworld.go:12
   9   	package main
   10
   11  	func main() {
-> 12  		print("hello, world\n")
   13  	}
(lldb) bt
* thread #1: tid = 0x8b7a27, 0x0000000000002019 helloworld`main.main + 25 at helloworld.go:12, stop reason = breakpoint 1.2
  * frame #0: 0x0000000000002019 helloworld`main.main + 25 at helloworld.go:12
(lldb) disas
helloworld`main.main at helloworld.go:11:
   0x2000:  movq   %gs:0x8a0, %rcx
   0x2009:  cmpq   (%rcx), %rsp
   0x200c:  ja     0x2015                    ; main.main + 21 at helloworld.go:11
   0x200e:  callq  0x20da0                   ; runtime.morestack00_noctxt at atomic_amd64x.c:28
   0x2013:  jmp    0x2000                    ; main.main at helloworld.go:11
   0x2015:  subq   $0x10, %rsp
-> 0x2019:  leaq   0x2c2e0, %rbx
   0x2021:  leaq   (%rsp), %rbp
   0x2025:  movq   %rbp, %rdi
   0x2028:  movq   %rbx, %rsi
   0x202b:  movsq
   0x202d:  movsq
   0x202f:  callq  0x10300                   ; runtime.printstring at compiler.go:1
   0x2034:  addq   $0x10, %rsp
   0x2038:  ret
   0x2039:  addb   %al, (%rax)
   0x203b:  addb   %al, (%rax)
   0x203d:  addb   %al, (%rax)
(lldb) quit
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
g%

Fixes #7070.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/93510043
2014-05-20 11:35:20 -04:00
..
cmd cmd/ld: make lldb happy with Mach-O 6.out files 2014-05-20 11:35:20 -04:00
lib9 lib9: restore argv0 initialization code. 2014-04-21 00:08:39 -04:00
libbio libbio: add casts to eliminate -Wconversion warning 2014-04-14 09:36:47 -07:00
liblink liblink: fix field tracking 2014-05-20 00:30:58 -04:00
pkg runtime: switch default stack size back to 8kB 2014-05-20 00:30:46 -04:00
all.bash
all.bat
all.rc
clean.bash
clean.bat
clean.rc
make.bash make.bash: if CC is not set, and gcc doesn't exist, try clang/clang++. 2014-04-29 00:32:16 -04:00
make.bat
Make.dist
make.rc lib9: enable on Plan 9 2014-02-13 20:06:41 +01:00
race.bash race.bash,race.bat: unset GOROOT_FINAL during tests 2014-05-07 16:34:21 +10:00
race.bat race.bash,race.bat: unset GOROOT_FINAL during tests 2014-05-07 16:34:21 +10:00
run.bash run.bash: skip -static cgo test if -static linking isn't possible. 2014-04-29 14:43:10 -04:00
run.bat run.bash: explain why we set GOMAXPROCS for runtime test 2014-03-06 13:16:14 +04:00
run.rc run.bash: explain why we set GOMAXPROCS for runtime test 2014-03-06 13:16:14 +04:00
sudo.bash