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

Don't read /proc/$PID/maps for core files #12

Open
doctau opened this issue Jul 25, 2014 · 5 comments
Open

Don't read /proc/$PID/maps for core files #12

doctau opened this issue Jul 25, 2014 · 5 comments

Comments

@doctau
Copy link

doctau commented Jul 25, 2014

iter_mmap_heap_chunks() tries to read /proc/$PID/maps which only works if the process is currently running. If you are using a core file, it will fail with an exceptions.IOError.

Having iter_mmap_chunks() return immediately if we are processing a core file rather than having an attached process solves it.

@rogerhu
Copy link
Owner

rogerhu commented Jul 25, 2014

Do you have a PR?

@doctau
Copy link
Author

doctau commented Jul 25, 2014

Not yet, I just added a "return" to the top temporarily to work on the core file I'm looking at. I can do one later after I've had a chance to look at the gdb API which I haven't used before (unless you fix it first)

@davidmalcolm
Copy link
Contributor

If we return immediately, it presumably won't find the mmapped chunks.

I'm told that

(gdb) info proc mappings

works for core files from NT_FILE; this could be a way to find them when running on a coredump.

@spaceone
Copy link
Contributor

spaceone commented Dec 2, 2019

Same problem hiere:

(gdb) heap
Python Exception <class 'FileNotFoundError'> [Errno 2] No such file or directory: '/proc/4951/maps':
Error occurred in Python command: [Errno 2] No such file or directory: '/proc/4951/maps'

@XCemaXX
Copy link

XCemaXX commented Dec 13, 2023

There is another util for analyzing heap in core dumps: https://github.com/vmware/chap
If you want, you can dump allocation list via comand "list allocations" in chap. After that you need to parse this list to get allocations for gdbheap instead of porcfs.
I also tried parse allocations via gdbheap based on gdb command "info files", but this method failed.

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

No branches or pull requests

5 participants