@@ -173,7 +173,7 @@ Why do you think it's broken?
173173What fixes did you try?
174174
175175(This may seem foolish, but this technique once revealed to me that I had been debugging code
176- for an hour under the misapprehension that 9 was a prime number.
176+ for an hour under the misapprehension that 9 was a prime number.[ ^ statistically ]
177177You'd be amazed at the things you don't realize until you think about how to explain something
178178to someone else.)
179179
@@ -293,7 +293,7 @@ For example, if your code segfaults, it'll print something like
293293
294294~~~
295295Program received signal SIGSEGV, Segmentation fault.
296- 0x0000555555554923 in pretty_print (array=...) at segfault.cpp:14
296+ 0x555555554923 in pretty_print (array=...) at segfault.cpp:14
29729714 cout << array.elements[i] << ", ";
298298~~~
299299
@@ -317,8 +317,8 @@ you can use the `backtrace` (or `bt` for short) command to ask `gdb` where you c
317317
318318~~~
319319(gdb) bt
320- #0 0x0000555555554923 in pretty_print (array=...) at segfault.cpp:14
321- #1 0x00005555555549b3 in main () at segfault.cpp:24
320+ #0 0x555555554923 in pretty_print (array=...) at segfault.cpp:14
321+ #1 0x5555555549b3 in main () at segfault.cpp:24
322322~~~
323323
324324The backtrace shows you the function stack: starting from ` main() ` ,
@@ -372,9 +372,10 @@ the next (`main`) is numbered `1`, and so on.
372372` up ` increments the number of the selected stack frame; ` down ` decrements it.
373373
374374So, for example, to move to ` main ` 's stack frame, we'd do:
375+
375376~~~
376377(gdb) up
377- #1 0x00005555555549b3 in main () at segfault.cpp:24
378+ #1 0x5555555549b3 in main () at segfault.cpp:24
37837924 pretty_print(stuff);
379380~~~
380381
@@ -469,15 +470,15 @@ Breakpoint 2 at 0x555555554b05: file guess.cpp, line 17.
469470(gdb) break 19
470471Breakpoint 3 at 0x555555554ba0: file guess.cpp, line 19.
471472(gdb) info breakpoints
472- Num Type Disp Enb Address What
473- 1 breakpoint keep y 0x0000555555554af6 at guess.cpp:15
474- 2 breakpoint keep y 0x0000555555554b05 at guess.cpp:17
475- 3 breakpoint keep y 0x0000555555554ba0 at guess.cpp:19
473+ Num Type Disp Enb Address What
474+ 1 breakpoint keep y 0x555555554af6 at guess.cpp:15
475+ 2 breakpoint keep y 0x555555554b05 at guess.cpp:17
476+ 3 breakpoint keep y 0x555555554ba0 at guess.cpp:19
476477(gdb) delete 2
477478(gdb) info breakpoints
478- Num Type Disp Enb Address What
479- 1 breakpoint keep y 0x0000555555554af6 at guess.cpp:15
480- 3 breakpoint keep y 0x0000555555554ba0 at guess.cpp:19
479+ Num Type Disp Enb Address What
480+ 1 breakpoint keep y 0x555555554af6 at guess.cpp:15
481+ 3 breakpoint keep y 0x555555554ba0 at guess.cpp:19
481482~~~
482483
483484#### Stepping through the code
@@ -639,7 +640,7 @@ Name: `______________________________`
6396402. How would you set a breakpoint for line 17 of file `my_funcs.cpp`?
640641\vspace{10em}
641642
642- 3. Consult `help list`. How would you list the source code of the `encabulate_beziers` function ?
643+ 3. Consult `help list`. How would you list the source code of a function named `encabulate_beziers`?
643644\vspace{10em}
644645
6456464. What is the difference between `break` and `advance`?
@@ -701,3 +702,4 @@ Name: `______________________________`
701702[^dont]: Don't actually do this, though.
702703 We're just demonstrating how you'd pass command line arguments.
703704[^picture]: Well, a picture of her. The publisher wouldn't let us include a live chicken tucked between the pages of the book.
705+ [^statistically]: In my defense, odd numbers between 2 and 10 have a 75% chance of being prime, so I was statistically correct!
0 commit comments