Skip to content
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

tools/libdynamorio.so-gdb.py causes "RuntimeError: Cannot access memory at address 0x712fd867" #2100

Open
thorstent opened this issue Dec 9, 2016 · 3 comments

Comments

@thorstent
Copy link

I'm running DynamoRIO on a fresh Ubuntu 16.10 64bit VM in VirtualBox (Host is Windows).

I am using DynamoRIO 6.2 binary release. But the problem persists with the latest nightly 6.2.17144-0x12112de

My ~/.gdbinit file constists of these two lines:

add-auto-load-safe-path /home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so.6.2-gdb.py
add-auto-load-safe-path /home/ttarrach/Downloads/DynamoRIO-Linux-6.2.17144-0x12112de/lib64/debug/libdynamorio.so.6.2-gdb.py

The minimal steps to reproduce this problem are:

  1. start GDB: ~/Downloads/DynamoRIO-Linux-6.2.0-2$ gdb --args bin64/drrun -debug -- ls
  2. type run into the GDB command prompt

Here is the complete output:

GNU gdb (Ubuntu 7.11.90.20161005-0ubuntu1) 7.11.90.20161005-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bin64/drrun...Reading symbols from /home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/bin64/drrun.debug...done.
done.
(gdb) run
Starting program: /home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/bin64/drrun -debug -- ls
process 2728 is executing new program: /home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so.6.2
Loading gdb scripts for debugging DynamoRIO...
Traceback (most recent call last):
  File "/home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so.6.2-gdb.py", line 185, in <module>
    PrivloadBP()
  File "/home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so.6.2-gdb.py", line 151, in __init__
    internal=not self.DEBUG)
RuntimeError: Cannot access memory at address 0x712fd867
<Starting application /bin/ls (2728)>
<Paste into GDB to debug DynamoRIO clients:
set confirm off
add-symbol-file '/home/ttarrach/Downloads/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so' 0x000000007102d808
>
<Initial options = -no_dynamic_options -code_api -stack_size 56K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >

I would expect the python script to run and not throw a memory exception. The same problems I observed in my Debian Jessie VM.

@derekbruening
Copy link
Contributor

Looks like this is a duplicate of #1678 but since that one sat there we'll close it and have this remain.

Adding to the minimal steps:

Run the add-auto-load-safe-path command in gdb (or place into .gdbinit)

Contributions welcome.

@derekbruening
Copy link
Contributor

Let's consider this issue covering reviving the libdynamorio.so-gdb.py script in general and having it auto-load DR symbols.

derekbruening added a commit that referenced this issue Oct 30, 2020
Adds two gdb python scripts I've developed that may be useful to others:

1) drsymload: loads DR symbols regardless of gdb's current state,
which may include having DR symbols at the wrong address.  It does
this by reading /proc/self/maps and running objdump on
libdynamorio.so.  Ideally this would be integrated into a revived
libdynamorio.so-gdb.py: that's part of #2100.

2) memquery: prints the /proc/self/maps line for a given address.
I'm still shocked gdb doesn't provide such a command natively.

Issue: #2100
derekbruening added a commit that referenced this issue Oct 30, 2020
Adds two gdb python scripts I've developed that may be useful to others:

1) drsymload: loads DR symbols regardless of gdb's current state,
which may include having DR symbols at the wrong address.  It does
this by reading /proc/self/maps and running objdump on
libdynamorio.so.  Ideally this would be integrated into a revived
libdynamorio.so-gdb.py: that's part of #2100.

2) memquery: prints the /proc/self/maps line for a given address.
I'm still shocked gdb doesn't provide such a command natively.

Issue: #2100
@derekbruening
Copy link
Contributor

For the particular wrong address issue it may have the base library address wrong somehow; xref https://github.com/DynamoRIO/dynamorio/blob/master/tools/gdb-scripts/gdb-drsymload.py referenced at https://dynamorio.org/page_debugging.html#autotoc_md143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants