forked from osandov/drgn
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge branch 'master' into '6.0/stage' #25
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Davide Cavalca <[email protected]>
Signed-off-by: Davide Cavalca <[email protected]>
/proc/pid/mem is indexed by address. On 32-bit systems, addresses may be out of the range of a 32-bit signed off_t. This results in pread() returning EINVAL in drgn_read_memory_file(). Use AC_SYS_LARGEFILE in configure.ac so that we use 64-bit off_t by default. Closes osandov#98. Signed-off-by: Omar Sandoval <[email protected]>
…in_python Using a Python dictionary for this is much more heavyweight than just using a thread-local variable (with no benefit as far as I can tell). This also gets rid of a call to _PyDict_GetItem(). Signed-off-by: Omar Sandoval <[email protected]>
CPython commit fb5db7ec5862 ("bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId. (GH-22648)") (in v3.10) removed _PyDict_GetItemId() because it suppresses errors. Use _PyDict_GetItemIdWithError() instead (which we should've been using anyways). Closes osandov#101. Signed-off-by: Omar Sandoval <[email protected]>
CPython commit b775106d940e ("bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)") changed repr(enum.Flag) from, e.g., <Qualifiers.VOLATILE|CONST: 3> to Qualifiers.CONST|Qualifiers.VOLATILE. Fix tests.test_type.TestType.test_qualifiers to not assume the format. Signed-off-by: Omar Sandoval <[email protected]>
Closes osandov#99. Signed-off-by: Omar Sandoval <[email protected]>
…om_dwarf_internal() If the DIE passed to drgn_type_from_dwarf_internal() is a declaration, then we overwrite it with dwarf_offdie(). As far as I can tell, this doesn't break anything at the moment, but it's sketchy to overwrite an input parameter and may cause issues in the future. Use a temporary DIE on the stack in this case instead. Signed-off-by: Omar Sandoval <[email protected]>
Adds support for parsing of type units as enabled by -fdebug-types-section. If a module has both a debug info section and type unit section, both are read. Signed-off-by: Jay Kamat <[email protected]>
When using type units, skeleton declarations are made instead of concrete ones. However, these declarations have signature tags attached that point to the type unit with the definition, so we can simply follow the signature to get the concrete type. Signed-off-by: Jay Kamat <[email protected]>
Signed-off-by: Jay Kamat <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
I often use examples/load_debug_info to benchmark loading/DWARF indexing, so add a -T option that prints the time it takes to load debug info. Signed-off-by: Omar Sandoval <[email protected]>
FaultError() also takes an error message. Fixes: 80c9fb3 ("Add type hint stubs and generate documentation from them") Signed-off-by: Omar Sandoval <[email protected]>
Black 21.4b2 now replaces empty docstrings with a docstring containing a single space. Apply that formatting. Signed-off-by: Omar Sandoval <[email protected]>
Rather than silently ignoring attributes whose form we don't recognize, return an error. This way, we won't mysteriously skip indexing DIEs. While we're doing this, split the form -> instruction mapping to its own functions. Signed-off-by: Omar Sandoval <[email protected]>
First, add instructions for DW_FORM_indirect. Then, we can call the function to convert a form to an instruction whenever we see an indirect instruction. Note that without elfutils commit d63b26b8d21f ("libdw: handle DW_FORM_indirect when reading attributes") (queued for elfutils 0.184), DW_FORM_indirect will cause errors later when parsing with libdw. Signed-off-by: Jay Kamat <[email protected]>
Pick a few DWARF parsing test cases that exercise the interesting cases for DW_FORM_indirect and run them with and without DW_FORM_indirect. We only test DW_FORM_indirect if libdw is new enough to support it. Signed-off-by: Omar Sandoval <[email protected]>
The master branch was renamed to main. GitHub redirects links to the old branch, but we might as well update them explicitly. Signed-off-by: Omar Sandoval <[email protected]>
As noted by commit 7382612 ("CI: temporarily disable vmtest"), vmtest was generating too much traffic to the Dropbox shared folder that hosted vmtest kernels. Instead, we can store kernel packages as GitHub release assets. Update the code for downloading and uploading vmtest assets, and also add a scheduled GitHub action to build new kernels every Monday so I don't have to remember to do it manually. This also drops vmtest support for 5.6-5.9, which now fail to build with newer binutils due to the issue fixed in Linux kernel commit 1d489151e9f9 ("objtool: Don't fail on missing symbol table"). Signed-off-by: Omar Sandoval <[email protected]>
The previous commit mentioned this action but forgot to add it. Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
Now that the vmtest kernels have a new home on GitHub, reenable vmtest for the CI workflow. Signed-off-by: Omar Sandoval <[email protected]>
Otherwise, an exception causes setup.py test -K to hang. Signed-off-by: Omar Sandoval <[email protected]>
In Python before 3.8, tempfile.TemporaryDirectory.cleanup() fails when the directory doesn't exist. Since we rename the temporary download directory to its final name, this always fails. Switch to using tempfile.mkdtemp() directly instead. Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
actions/runner-images@15a6106 changed the default version of Clang from 10 to 11, but `apt-get install libomp-dev` still installs libomp-10-dev. Ideally, the correct version of libomp would already be pre-installed (see actions/runner-images#3506), but for now make sure we install the correct version. Signed-off-by: Omar Sandoval <[email protected]>
If the program already had a platform set, we should its callbacks instead of the ones from the ELF file's platform. Signed-off-by: Omar Sandoval <[email protected]>
Define that addresses for memory reads wrap around after the maximum address rather than the current unpredictable behavior. This is done by: 1. Reworking drgn_memory_reader to work with an inclusive address range so that a segment can contain UINT64_MAX. drgn_memory_reader remains agnostic to the maximum address and requires that address ranges do not overflow a uint64_t. 2. Adding the overflow/wrap-around logic to drgn_program_add_memory_segment() and drgn_program_read_memory(). 3. Changing direct uses of drgn_memory_reader_reader() to drgn_program_read_memory() now that they are no longer equivalent. (For some platforms, a fault might be more appropriate than wrapping around, but this is a step in the right direction.) Signed-off-by: Omar Sandoval <[email protected]>
…uted A malformed DWARF expression can easily get us into an infinite loop. Avoid this by capping the number of operations that we'll execute. Signed-off-by: Omar Sandoval <[email protected]>
It doesn't make a difference anywhere it's currently used, but let's do it just in case that changes in the future. Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
.debug_loc will be used for variable resolution. Signed-off-by: Omar Sandoval <[email protected]>
Implement looking up location descriptions and evaluating DW_OP_fbreg. This isn't actually used yet since CFI expressions don't have a current function DIE, but it will be used for parameters/local variables in stack traces. Signed-off-by: Omar Sandoval <[email protected]>
…escriptions Add support for evaluating a DWARF location description and translating it into a drgn object. In this commit, this is just used for global variables, but an upcoming commit will wire this up to stack traces for parameters and local variables. There are a few locations that drgn's object model can't represent yet. DW_OP_piece/DW_OP_bit_piece can describe objects that are only partially known or partially in memory; we approximate these where we can. We don't have a good way to support DW_OP_implicit_pointer at all yet. This also adds test cases for DWARF expressions, which we couldn't easily test before. Signed-off-by: Omar Sandoval <[email protected]>
We have a couple of upcoming use cases for iterating through all of the DIEs in a module: searching for scopes and searching for a DIE's ancestors. Add a DIE iterator interface to abstract away the details of walking DIEs and allows us to efficiently track ancestors. Signed-off-by: Omar Sandoval <[email protected]>
This will be used for finding functions, inlined functions, and blocks containing a PC for stack unwinding and variable lookups. Signed-off-by: Omar Sandoval <[email protected]>
This will be used for finding the ancestors of the abstract instance root corresponding to a concrete inlined instance root for variable lookups in inlined functions. Signed-off-by: Omar Sandoval <[email protected]>
…unctions If we want to access a parameter or local variable in an inlined function, then we need a stack frame for that function. It's also much more useful to see inlined functions in the stack trace in general. So, when we've unwound the registers for a stack frame, walk the debugging information to find all of the (possibly inlined) functions at the program counter, and add a drgn stack frame for each of those. Also add StackFrame.name and StackFrame.is_inline so that we can distinguish inline frames. Also add StackFrame.source() to get the filename and line and column numbers. Finally, add the source code location to pretty-printed stack traces and add pretty-printing for individual stack frames that includes extra information. Signed-off-by: Omar Sandoval <[email protected]>
After all of the preparatory work, the last two missing pieces are a way to find a variable by name in the list of scopes that we saved while unwinding, and a way to find the containing scopes of an inlined function. With that, we can finally look up parameters and variables in stack traces. Signed-off-by: Omar Sandoval <[email protected]>
The manylinux image apparently added a PyPy interpreter, which drgn doesn't support. Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
drgn depends heavily on libelf and libdw, so it's useful to know what version we're using. Add drgn._elfutils_version and use that in the CLI and in the test cases where we currently check the libdw version. Signed-off-by: Omar Sandoval <[email protected]>
The stack trace variable work introduced a regression that causes objects with size zero to always be marked absent even if they have an address. This matters because GCC sometimes seems to omit the complete array type for arrays declared without a length, so an array variable can end up with an incomplete array type. I saw this with the "swapper_spaces" variable in mm/swap_state.c from the Linux kernel. Make sure to use the address of an empty piece if the variable is also empty. Fixes: ffcb9cc ("libdrgn: debug_info: implement creating objects from DWARF location descriptions") Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
copy_lsbytes() doesn't copy enough bytes when copying from a smaller little-endian value to a larger big-endian value. This was caught by the test cases for DW_OP_deref{,_size}, but it can affect other places when debugging a little-endian target from a big-endian host or vice-versa. Closes osandov#105. Signed-off-by: Omar Sandoval <[email protected]>
sdimitro
approved these changes
Jun 9, 2021
prakashsurya
approved these changes
Jun 9, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.