Consider the following code: memory.c. You may find this reference useful on the difference between structs and unions.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Consider the following code: memory.c. You may find this reference useful on the difference between structs and unions.

Post by answerhappygod »

Consider The Following Code Memory C You May Find This Reference Useful On The Difference Between Structs And Unions 1
Consider The Following Code Memory C You May Find This Reference Useful On The Difference Between Structs And Unions 1 (254.54 KiB) Viewed 10 times
Consider the following code: memory.c. You may find this reference useful on the difference between structs and unions. Q1.1: During the function call q1(), what two lines get printed? You may find an ASCII table (like this one) useful. Line 1: ASCII is fun Line 2: 3141593 We run GDB on memory.c on a 64-bit little-endian system, up to the line marked Breakpoint 1. We then run several GDB commands; the commands and their outputs are here: memoryGDBoutput.txt Quick reference guide: print expr evaluates expr and prints out the result. x/20xw expr prints out 20 words of memory, starting at the given memory address, as if memory was an array of word-size values, in hexadecimal. $sp is a pointer to the bottom of the stack. Line 3: Q2.1: Given the information from the GDB memory dump, what two lines get printed by q2()? Hint: Try and find where the two constants are in the stack. What information in the GDB dump could you have used to find those constants, if you didn't know their actual values? Line 4: ? 100% ? ✓ 100% is fun 100% ? x 0%
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply