-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
main module gets base address added again to symbols on FreeBSD #18254
Comments
This seems to be intermittent, and after adding additional debugging I cannot currently reproduce it. I did observe the behaviour w/ DTrace on one occasion, and observed that the DoReadMemory(..., ..., bp_opcode_size) call still returned bp_opcode_size (indicating the bytes were read successfully) even though the underlying ptrace(PT_IO, ...) call returned < 0 with errno = EFAULT. This is not the cause of the problem, but makes the resulting error or log message less clear as to the failure. |
I've received a report with additional details on this issue, and it turns out the symbol addresses end up being (incorrectly) modified after stopping: (lldb) b main
|
From a single run of a debugging session: SectionLoadList::SetSectionLoadAddress (section = 0x807ffbd80 (../tools/lldb/test/python_api/thread/test_step_out_of_malloc_into_function_b_with_dwarf..interp), load_addr = 0x0000000000400200) module = 0x807cdda00 SectionLoadList::SetSectionLoadAddress (section = 0x807ffbd80 (../tools/lldb/test/python_api/thread/test_step_out_of_malloc_into_function_b_with_dwarf..interp), load_addr = 0x0000000000800200) module = 0x807cdda00 The second one comes from DynamicLoaderPOSIXDYLD::LoadAllCurrentModules(). On FreeBSD we see the main module in the link map, with the base address 0x400000. This gets added to the symbol address, so 0x400000 (base addr) + 0x400200 (main) gives 0x800200. |
Workaround committed to the FreeBSD repository, pending the real fix: http://svnweb.freebsd.org/changeset/base/258873 |
"Proper" fix in review in http://reviews.llvm.org/D2389 |
It appears this is resolved by: |
Following commit of http://reviews.llvm.org/D10267 ( rL239195 ), the problem still exists when debugging an a.out referenced as a relative PATH
or |
Curious enough, I can reproduce this only at the first connection of a given LLDB session, i.e.: start the server: ./bin/lldb-server g :1234 ./a.out(lldb) gdb-remote 1234
restart the server but keep client running(lldb) gdb-remote 1234 [2/1908]
|
This seems to be the cause: lldb DYLDRendezvous::DYLDRendezvous cannot cache exe module path: null executable module pointer |
Ok, I think I understand the problem. The executable path is cached in constructor, while DynamicLoaderPOSIXDYLD establishes it later in DidAttach() case. It works for the second connection because LLDB still has the filename from the first connection, i.e. it is wrong still. |
Fix for my instance submitted as: |
Extended Description
Sometime in the last month lldb on FreeBSD reports this error, although the breakpoint actually does get set.
Using the dictionary.c example / tutorial code,
feynman% bin/lldb /tank/emaste/src/snippets/dictionary
Current executable set to '/tank/emaste/src/snippets/dictionary' (x86_64).
(lldb) b find_word
warning: failed to set breakpoint site at 0x400e60 for breakpoint 2.1: failed to verify the breakpoint trap in memory.
(lldb) run romeo-and-juliet.txt
Process 75214 launched: '/tank/emaste/src/snippets/dictionary' (x86_64)
Dictionary loaded.
Enter search word: Romeo
Process 75214 stopped
The text was updated successfully, but these errors were encountered: