Lab8
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: gcc build active file",
|
||||
"command": "/usr/bin/gcc",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}/${fileBasenameNoExtension}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
+1
-2
@@ -8,5 +8,4 @@ SET(GCC_COVERAGE_COMPILE_FLAGS "-pthread")
|
||||
|
||||
|
||||
add_executable(OS
|
||||
Lab6/agent.c
|
||||
Lab6/agent.c)
|
||||
Lab8/ex1.c)
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "string.h"
|
||||
|
||||
int main() {
|
||||
char* pass = "";
|
||||
|
||||
size_t pid = getpid();
|
||||
printf("\n%d\n", pid);
|
||||
while (1) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Create a simple program which stores only a message in the heap.
|
||||
Keep the program running and access the maps file at
|
||||
/proc/{pid}/maps. Print the content of the file to stdout. Locate
|
||||
the start and end addresses of the heap.
|
||||
You can access the virtual memory of the process whose id is pid
|
||||
at /proc/{pid}/mem. Try to access the file using less command.
|
||||
Access the heap of the program using
|
||||
Navigate the heap memory file till finding the message. Locate the
|
||||
page number where the message is stored and its address.
|
||||
Access the file /proc/{pid}/smaps and specify what the total size
|
||||
of pages of the heap. What is the file /proc/{pid}/map files?
|
||||
Use the command pmap to check the memory mappings of the
|
||||
process.
|
||||
*/
|
||||
Reference in New Issue
Block a user