| ## require optimize=none |
| [zxdb] b $main |
| Created Breakpoint 1 @ $main |
| Pending: No current matches for location. It will be matched against new |
| processes and shared libraries. |
| |
| [zxdb] run-component fuchsia-pkg://fuchsia.com/zxdb_e2e_inferiors#meta/cpp_functions.cm |
| run-component won't work for many v2 components. See "help run-component". |
| Launched Process 1 state=Running koid=?? name=cpp_functions.cm component=cpp_functions.cm |
| Breakpoint 1 now matching 1 addrs for $main |
| 🛑 on bp 1 main() • cpp_functions.cc:?? |
| |
| # Simple types require no prerequisites to be passed. |
| [zxdb] p AddTwoInts(3, 5) |
| 🛑 on bp 1 main() • cpp_functions.cc:?? |
| 8 |
| |
| # Initialize some local variables. |
| [zxdb] until 71 |
| 🛑 main() • cpp_functions.cc:?? |
| |
| [zxdb] locals |
| lhs = 7 |
| rhs = 8 |
| |
| # Local variables with simple, built-in types can be passed by value. |
| [zxdb] p AddTwoInts(lhs, rhs) |
| 🛑 main() • cpp_functions.cc:?? |
| 15 |
| |
| # Local variables have addresses that can be coerced. |
| [zxdb] p SwapPointedToValues(&lhs, &rhs) |
| 🛑 main() • cpp_functions.cc:?? |
| void |
| |
| [zxdb] locals |
| lhs = 8 |
| rhs = 7 |
| |
| # Coerce a char[] to a char* implicitly. |
| [zxdb] p EchoCharPtr(kHello) |
| 🛑 main() • cpp_functions.cc:?? |
| void |
| |
| [zxdb] p EchoCharPtr(kCharStar) |
| 🛑 main() • cpp_functions.cc:?? |
| void |
| |
| # Initialize some more local variables. |
| [zxdb] until 80 |
| 🛑 main() • cpp_functions.cc:?? |
| |
| [zxdb] locals |
| s = {one = 1, two = 2, nums = {3, 4, 5, 6}} |
| |
| # User defined objects should be passable by pointer. |
| [zxdb] p DoSomeStuff(&s) |
| 🛑 main() • cpp_functions.cc:?? |
| void |
| |
| [zxdb] locals |
| s = {one = 2, two = 3, nums = {3, 4, 5}} |
| |
| [zxdb] c |
| Process 1 exited with code 0. |