diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..08d9005 --- /dev/null +++ b/.vscode/tasks.json @@ -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" +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 75d5bb2..ecb4a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,5 +8,4 @@ SET(GCC_COVERAGE_COMPILE_FLAGS "-pthread") add_executable(OS - Lab6/agent.c - Lab6/agent.c) + Lab8/ex1.c) diff --git a/Lab8/ex1 b/Lab8/ex1 new file mode 100755 index 0000000..87bdf3f Binary files /dev/null and b/Lab8/ex1 differ diff --git a/Lab8/ex1.c b/Lab8/ex1.c new file mode 100644 index 0000000..963a227 --- /dev/null +++ b/Lab8/ex1.c @@ -0,0 +1,30 @@ +#include +#include +#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. +*/ \ No newline at end of file