This commit is contained in:
emil
2024-10-18 08:57:09 +03:00
parent 7d42f510ad
commit b34431b2df
4 changed files with 59 additions and 2 deletions
+28
View File
@@ -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
View File
@@ -8,5 +8,4 @@ SET(GCC_COVERAGE_COMPILE_FLAGS "-pthread")
add_executable(OS
Lab6/agent.c
Lab6/agent.c)
Lab8/ex1.c)
Executable
BIN
View File
Binary file not shown.
+30
View File
@@ -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.
*/