Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

(solved)CS 288 Please see an attachment for details

Rating
-
Sold
-
Pages
3
Grade
A+
Uploaded on
30-10-2022
Written in
2022/2023

Problem 1 Write a C program that "examines" the memory storing the input parameters of the main() function (i.e., argy and all command line parameters). The program "examines" the memory in a similar way as what the "examine" gdb command does with the "xb" format, i.e., taking memory space as a bit string and printing out the bytes in this bit string in a hexadecimal format. But your program only "examines" the memory space containing the pointers and strings related to argv. They include the argy variable (first part in the sample output below), the array of pointers (second part in the sample output), and the command line parameters (the third part in the sample output). Assume the executable file of the program is named examine. Executing command "./examine this is CS 288" prints the following output. Do not use the example addresses below. Obtain your own memory addresses and draw them by executing your own program. The output of your program does not have to as the same as below, but somehow you need to be able to convey the memory addresses and data. argv | 00 00 7f fd de 8c fd a8 | 0x7ffdde8cfc90 argv [0] | 00 00 7f fd de 8d 07 25 | 0x7ffdde8cfda8 argv [1] | 00 00 7f fd de 8d 07 2f | 0x7ffdde8cfdb0 argv [2] 00 00 7f fd de 8d 07 34 | 0x7ffdde8cfdb8 argv [3] | 00 00 7f fd de 8d 07 37 | 0x7ffdde8cfdc0 argv [4] | 00 00 7f fd de 8d 07 3a | 0x7ffdde8cfdc8 165 (e) 21(/) 2e(.) 00 (0) 00 (0) 00 (0) 00(0) 00 (0) |0x7ffdde8d0720 174 (t) 00 (0) 65(e) be (n) 69 (i) 6d (m) 61 (a) 78 (x) | 0x7ffdde8d0728 143 (C) 00 (0) 73 (s) 69 (1) 00 ( 0) 73 (s) 69 (1) 68 (h) | 0x7ffdde8d0730 153 (S) 4c (L) 00 ( 0) 38 (8) 38 (8) 32 (2) 00 (0) 53 (S) | 0x7ffdde8d0738 In the above output, each line shows 8 bytes of memory contents in hexadecimal format. There are three parts. The first part (first line) shows in the middle of the line the 8B contents saved in variable argv, which is the starting address of the array of pointers (argv[0], argv[1], ...). The line also shows the variable name on the left before "|', and shows the address of the variable on the right after "|". After an empty line, the second part shows the contents in argv[0], argv[1], etc, which are the memory addresses of the strings containing command line arguments. Also, each line shows variable names on the left and addresses of argv[0], argv[1], etc on the right. The third part is mainly to show the strings containing command line arguments. However, it contains all memory contents arounds these strings to give you a better picture on how these strings are saved in memory. For this, this part starts at a memory address that is aligned to 8B and ends at a memory address aligned to 8B. To contain all the command line arguments, this part starts before the first byte in first command line argument and ends after the last byte (i.e., the NULL character)

Show more Read less
Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
October 30, 2022
Number of pages
3
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$8.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Abbyy01 Exam Questions
Follow You need to be logged in order to follow users or courses
Sold
96
Member since
4 year
Number of followers
33
Documents
1337
Last sold
2 weeks ago

3.5

13 reviews

5
5
4
2
3
3
2
1
1
2

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions