diff --git a/.vscode/launch.json b/.vscode/launch.json index db0e149..e9ec5d1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -33,7 +33,9 @@ "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/examples/elfdump/elfdump", - "args": ["tests/elf_examples/hello_32"], + "args": [ + "tests/elf_examples/hello_32" + ], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -55,10 +57,10 @@ "request": "launch", "program": "${workspaceFolder}/build/examples/proc_mem/proc_mem", "args": [ - "2919", + "11706", "/usr/bin/bash" ], - "sudo" : true, + "sudo": true, "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -71,7 +73,30 @@ "ignoreFailures": true } ], - "miDebuggerPath": "/home/user/ELFIO/examples/proc_mem/sudo_gdb.sh" + "miDebuggerPath": "/home/user/ELFIO/examples/sudo_gdb.sh" + }, + { + "name": "Run dump for /proc/kcore", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/examples/elfdump/elfdump", + "args": [ + "/proc/kcore" + ], + "sudo": true, + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "miDebuggerPath": "/home/user/ELFIO/examples/sudo_gdb.sh" } ] } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a1a0e0..5601743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,12 +44,12 @@ if (ELFIO_BUILD_EXAMPLES OR ELFIO_BUILD_TESTS) endif() if (ELFIO_BUILD_EXAMPLES) - set (CMAKE_CXX_FLAGS "-Wall") + set (CMAKE_CXX_FLAGS "-Wall -Wextra") add_subdirectory(examples) endif() if (ELFIO_BUILD_TESTS AND IS_TOP_PROJECT) - set (CMAKE_CXX_FLAGS "-Wall") + set (CMAKE_CXX_FLAGS "-Wall -Wextra") enable_testing() add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} USES_TERMINAL) add_subdirectory(tests) diff --git a/examples/proc_mem/sudo_gdb.sh b/examples/proc_mem/sudo_gdb.sh deleted file mode 100755 index ec1cf29..0000000 --- a/examples/proc_mem/sudo_gdb.sh +++ /dev/null @@ -1,3 +0,0 @@ -# The file is used for VSCode debugging ability. Use it as following: -# "miDebuggerPath": "/home/user/ELFIO/examples/proc_mem/sudo_gdb.sh" -sudo /usr/bin/gdb "$@" diff --git a/examples/sudo_gdb.sh b/examples/sudo_gdb.sh new file mode 100755 index 0000000..bb40b1f --- /dev/null +++ b/examples/sudo_gdb.sh @@ -0,0 +1,3 @@ +# The file is used for VSCode debugging with sudo. Use it as following: +# "miDebuggerPath": "/home/user/ELFIO/examples/sudo_gdb.sh" +sudo /usr/bin/gdb "$@"