Commit Graph

25 Commits

Author SHA1 Message Date
Andreas Kling
4c44c96bc6 LibDebug: Unbreak LineProgram::parse_source_directories()
This regressed with ac9f6fd1f8 where
we switched to using InputMemoryStream.
2020-08-06 11:35:40 +02:00
Andreas Kling
078969b92f LibDebug: Fix bitrotted DWARF_DEBUG code 2020-08-06 11:32:17 +02:00
asynts
ac9f6fd1f8 LibDebug: Use InputMemoryStream instead of BufferStream.
This removes another call to ByteBuffer::wrap(const void*, size_t).
2020-08-06 10:33:16 +02:00
Brian Gianforcaro
1f7c61b15f LibDebug: Disable and cleanup DebugSession breakpoints on destruction
Breakpoints need to be disabled before we detach from the debugee.

I noticed this while looking into the fact that if you continue
executing a program in sdb (/bin/ls) where you had previously
set a breakpoint, it would crash on sdb exit once the debugee died
with an assert on HashMap destruction where we were iterating
while clearing is set. This change also happens to fix this assert.
2020-08-02 19:26:58 +02:00
Itamar
240eb3242a LibDebug: Add support for the various DW_FORM_block types
This fixes #2885.
2020-07-27 00:06:47 +02:00
Andreas Kling
4a572df465 LibDebug: Put DWARF debug logging spam behind DEBUG_SPAM
With this logging enabled, it takes way too long to load debug info.
2020-07-21 19:08:01 +02:00
FalseHonesty
870bcaeef6 LibDebug: Add all Dwarf v5 attributes, tags, and form enum values 2020-06-03 08:12:50 +02:00
FalseHonesty
a4f23429aa LibDebug: Add support for enum value types
Additionally, we will parse and expose the types of variables
if they are complex, like Enums or Structs. Variables of an enum
type are special in that they do not store all the members of said
enum in their own VariableInfo like Structs do, rather, all of the
values are stored in the VariableInfo for the Enum.
2020-06-03 08:12:50 +02:00
Emanuele Torre
937d0be762 Meta: Add a script check the presence of "#pragma once" in header files
.. and make travis run it.

I renamed check-license-headers.sh to check-style.sh and expanded it so
that it now also checks for the presence of "#pragma once" in .h files.

It also checks the presence of a (single) blank line above and below the
"#pragma once" line.

I also added "#pragma once" to all the files that need it: even the ones
we are not check.
I also added/removed blank lines in order to make the script not fail.

I also ran clang-format on the files I modified.
2020-05-29 07:59:45 +02:00
Itamar
f9d62fd5e5 LibDebug: Make sure to not single step the program twice
After hitting a breakpoint, we single step the program to execute the
instruction we breaked on and re-enable the breakpoint.
We also single step the program when the user of LibDebug returned a
DebugDecision::SingleStep.

Previously, if we hit a breakpoint and then were asked to to a
DebugDecision::SingleStep, we would single step twice.

This bug can actually crash programs, because it might cause us to
skip over a patched INT3 instruction in the second single-step.

Interestingely enough, this bug manifested as functrace crashing
certain programs: after hitting a breakpoint on a CALL instruction,
functrace single steps the program to see where the CALL jumps to
(yes, this can be optimized :D). functrace crashed when a CALL
instruction jumps to another CALL, because it inserts breakpoints on CALL
instructions, and so the INT3 in the 2nd CALL was skipped over, and we
executed garbage :).

This commit fixes this by making sure not to single-step twice.
2020-05-24 10:42:21 +02:00
Itamar
2686957836 LibDebug: Tolerate missing debug information
We previously crashed when programs were missing certain debug information.
2020-05-24 10:42:21 +02:00
Andreas Kling
dd924b730a Kernel+LibC: Fix various build issues introduced by ssize_t
Now that ssize_t is derived from size_t, we have to
2020-05-23 15:27:33 +02:00
Andreas Kling
250c3b363d Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem"
This reverts commit c1eb744ff0.
2020-05-20 16:24:26 +02:00
Andrew Kaster
c1eb744ff0 Build: Include headers from LibC, LibM, and LibPthread with -isystem
Make sure that userspace is always referencing "system" headers in a way
that would build on target :). This means removing the explicit
include_directories of Libraries/LibC in favor of having it export its
headers as SYSTEM. Also remove a redundant include_directories of
Libraries in the 'serenity build' part of the build script. It's already
set at the top.

This causes issues for the Kernel, and for crt0.o. These special cases
are handled individually.
2020-05-20 08:37:50 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Itamar
b28ca9fad1 LibDebug: Add support for creating VariableInfo for paramters 2020-05-09 23:41:08 +02:00
Itamar
1fb62df02a HackStudio: Show a backtrace in the debug information tab 2020-05-09 23:41:08 +02:00
Itamar
14ee090f25 HackStudio: Support variable inspection in nested scopes 2020-05-08 12:16:10 +02:00
Itamar
5fd64045b1 LibDebug: Miscellaneous fixes from #2097 2020-05-07 23:32:11 +02:00
Itamar
c5eb20d0cc LibDebug: Parse DWARF information entries
We can now iterate the tree structure of the DIEs, access attribute
values and parse some very basic DWARF expressions.
2020-05-05 11:01:36 +02:00
Itamar
009b4ea3f4 LibDebug: Add remove_breakpoint
Also, change the interface of all breakpoint management functions to
only take the address of the breakpoint as an argument.
2020-04-25 13:16:46 +02:00
Itamar
e35219b5ce Debugger: Add source-level operations
- Print current source location, if available
- Add a breakpoint at a source location
- "sl" command - step to the next line in source
2020-04-20 17:25:50 +02:00
Itamar
8a886e0e96 LibDebug: Parse line number information from DWARF format
DWARF line number information, if generated, is stored  in the
.debug_line section of an object file.

The information is encoded as instructions for a VM that is defined in
the DWARF specification.
By executing these instructions, we can extract the encoded line number
information.
2020-04-20 17:25:50 +02:00
Itamar
af338a34c0 LibDebug: Add ContinueBreakAtSyscall decision
When the user of the DebugSession uses this decision, the debugged
program will be continued until it is either stopped by a singal (e.g
as a reuslt of a breakpoint), or enters a syscall.
2020-04-16 11:17:33 +02:00
Itamar
f4418361c4 Userland: Add "functrace" utility
functrace traces the function calls a program makes.
It's like strace, but for userspace.

It works by using Debugging functionality to insert breakpoints
at call&ret instructions.
2020-04-16 11:17:33 +02:00