Giter Site home page Giter Site logo

gdbprofiler's People

Contributors

aantron avatar copy avatar ygrek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdbprofiler's Issues

Not passing a pid after -p causes usage to be printed multiple times

Anyone familiar with Arg got an idea why this is happening?

% ./rmp.native -p 
./rmp.native: option '-p' needs an argument.
Usage: rmp -p <pid> [--use-lldb] [--debugger path] [--cpuprofile path] [--callgrind path]
  -p : process id (pid)
  --cpuprofile : Write out cpuprofile file to the given path (can be opened with Chromium)
  --callgrind : Write out callgrind file to the given path (can be opened with kcachegrind)
  --use-lldb : pass this to use lldb instead of gdb
  --debugger : the debugger to invoke. Defaults to 'lldb-mi' if --use-lldb is passed and 'gdb' otherwise
  -help  Display this list of options
  --help  Display this list of options
./rmp.native: ./rmp.native: option '-p' needs an argument.
Usage: rmp -p <pid> [--use-lldb] [--debugger path] [--cpuprofile path] [--callgrind path]
  -p : process id (pid)
  --cpuprofile : Write out cpuprofile file to the given path (can be opened with Chromium)
  --callgrind : Write out callgrind file to the given path (can be opened with kcachegrind)
  --use-lldb : pass this to use lldb instead of gdb
  --debugger : the debugger to invoke. Defaults to 'lldb-mi' if --use-lldb is passed and 'gdb' otherwise
  -help  Display this list of options
  --help  Display this list of options
.
Usage: rmp -p <pid> [--use-lldb] [--debugger path] [--cpuprofile path] [--callgrind path]
  -p : process id (pid)
  --cpuprofile : Write out cpuprofile file to the given path (can be opened with Chromium)
  --callgrind : Write out callgrind file to the given path (can be opened with kcachegrind)
  --use-lldb : pass this to use lldb instead of gdb
  --debugger : the debugger to invoke. Defaults to 'lldb-mi' if --use-lldb is passed and 'gdb' otherwise
  -help  Display this list of options
  --help  Display this list of options

lldb support

lldb also supports the mi interface, so it should be possible to use it as a debugger backend too. The implementation seems to be slightly different though, so it doesn't work out of the box.

This tool works on windows wsl2 and macOS 12.

It is not really an issue but I want to share if people are wondering whether this tool works on other platforms other than real linux.

I test it under OCaml 4.14.0.

wsl2 (work)

For ubuntu 20.04 on windows wsl2, just follow the instructions in Readme.md.

mac + lldb (work)

For macOS 12, I build lldb-mi from the source. I follow the instructions in section Building against custom LLDB with llvm installed from homebrew:

cmake . -DLLVM_DIR=/usr/local/opt/llvm/lib/cmake/llvm
cmake --build .

Then I change the command a bit:

gdbprofiler -p `pgrep my_example_program.native` --cpuprofile example.cpuprofile --callgrind callgrind.out --use-lldb

mac + gdb (not work)

I don't figure out how to use gdb mode on mac.

I installed gdb from homebrew and followed the certificate signing suggested in the brew installation log. After doing the manual steps, I can enter the normal gdb.
However, when running gdbprofiler, my program always exits immediately. I guess there may be some interrupt.

(since mac+llvm works, I don't delve into it)

Support for >4.06?

The readme mentions that OCaml is supported up to 4.06. Is there a reason why this project can't be made to work on later versions?

Improve error when lldb-mi is absent

The following stacktrace is present now:

Fatal error: exception End_of_file
Raised at file "src/gdb.ml", line 58, characters 4-576
Re-raised at file "src/gdb.ml", line 97, characters 2-122
Re-raised at file "cli/gdbprofiler.ml", line 100, characters 2-1023
Re-raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "cli/gdbprofiler.ml", line 207, characters 6-84

stack-list-frames error result: (Gdbmi_types.OpError ("No registers.", None))

I get this result when running measure.ml to completion:

ocamlfind opt -g -linkpkg -package unix -package markup measure.ml && ./a.out React-1774 & sleep 1 && rmp -p `pidof a.out` --cpuprofile react.cpuprofile
[1] 20180
Press enter to stop
cpu:  126.0 ms
wall: 128.1 ms
[1]  + 20180 done       ./a.out React-1774
Fatal error: exception Failure("stack-list-frames error result: (Gdbmi_types.OpError (\"No registers.\", None))")
Raised at file "src/core/lwt.ml", line 805, characters 16-23
Called from file "src/unix/lwt_main.ml", line 34, characters 8-18
Called from file "cli/rmp.ml", line 158, characters 4-61

This is on an OS X system using GNU gdb 7.9.1 from MacPorts. I am sure that this is using MacPorts gdb because I had to patch Gdb.launch to start ggdb instead of trying gdb, which could be its own issue.

If I "press enter," I get this instead:

Fatal error: exception Failure("Empty records")

May look into this in a few days. Would be nice to get rmp running :)

does not produce a .cpuprofile file compatible with current tools

I'm running gdbprofiler with OCaml 5.1.1 on Ubuntu 24.04.

gdbprofiler does not seem to produce a .cpuprofile file that is compatible with current tools. For example, I used it to profile the attached file hello.ml. It produced the attached file out.cpuprofile. I'm not able to open this file in the Visual Studio Code cpuprofile view, or in Chromium's developer tools, or in an online cpuprofile viewer (https://lahmatiy.github.io/cpupro/).

hello.ml
out.cpuprofile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.