Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

40 Zeilen
1.2 KiB

  1. // Copyright 2018 Google Inc. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package main
  15. import "fmt"
  16. func main() {
  17. test(1, 2, 3)
  18. }
  19. // This is the function we examine. After the preamble its stack should be
  20. // pulled down 1*addrSize for the return PC plus 3*8 for the three
  21. // arguments. That will be (1+3)*8=32 on 64-bit machines.
  22. func test(a, b, c int64) int64 {
  23. // Put in enough code that it's not inlined.
  24. for a = 0; a < 100; a++ {
  25. b += c
  26. }
  27. afterTest(a, b, c)
  28. return b
  29. }
  30. // This function follows test in the binary. We use it to force arguments
  31. // onto the stack and as a delimiter in the text we scan in the test.
  32. func afterTest(a, b, c int64) {
  33. fmt.Println(a, b, c)
  34. }