{"id":21117254,"url":"https://github.com/dmillard/eigengdb","last_synced_at":"2025-07-08T20:30:35.875Z","repository":{"id":42533941,"uuid":"187119666","full_name":"dmillard/eigengdb","owner":"dmillard","description":"GDB pretty printers for eigen types","archived":false,"fork":false,"pushed_at":"2023-12-01T08:56:49.000Z","size":67,"stargazers_count":62,"open_issues_count":2,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T12:10:25.874Z","etag":null,"topics":["eigen","gdb","gdbinit"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmillard.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-05-17T00:30:51.000Z","updated_at":"2025-02-10T06:22:55.000Z","dependencies_parsed_at":"2025-06-01T03:29:48.903Z","dependency_job_id":"eff079a4-6b1a-43ff-a000-212a01a826a2","html_url":"https://github.com/dmillard/eigengdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmillard%2Feigengdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmillard%2Feigengdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmillard%2Feigengdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmillard%2Feigengdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmillard","download_url":"https://codeload.github.com/dmillard/eigengdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmillard%2Feigengdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258655440,"owners_count":22736642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eigen","gdb","gdbinit"],"created_at":"2024-11-20T02:41:14.176Z","updated_at":"2025-07-08T20:30:35.604Z","avatar_url":"https://github.com/dmillard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"eigengdb\n========\n\nThis is a pretty printer for eigen types (with some support for stan-math\ntypes). Much of the logic comes from upstream eigen. Formatting is handled\nby `numpy`.\n\nMotivation\n----------\n\nYour debugging output shouldn't look like this:\n\n.. code-block::\n\n   (gdb) p mat\n   $1 = {\u003cEigen::PlainObjectBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e \u003e\u003e = {\u003cEigen::MatrixBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e \u003e\u003e = {\u003cEigen::DenseBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e \u003e\u003e = {\u003cEigen::DenseCoeffsBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e, 3\u003e\u003e = {\u003cEigen::DenseCoeffsBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e, 1\u003e\u003e = {\u003cEigen::DenseCoeffsBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e, 0\u003e\u003e = {\u003cEigen::EigenBase\u003cEigen::Matrix\u003cdouble, 4, 4, 0, 4, 4\u003e \u003e\u003e = {\u003cNo data fields\u003e}, \u003cNo data fields\u003e}, \u003cNo data fields\u003e}, \u003cNo data fields\u003e}, \u003cNo data fields\u003e}, \u003cNo data fields\u003e}, m_storage = {m_data = {array = {\n             0.68037543430941905, -0.21123414636181392, 0.56619844751721171, 0.59688006695214657,\n             0.82329471587356862, -0.60489726141323208, -0.32955448857022196, 0.53645918962380801,\n             -0.44445057839362445, 0.10793991159086103, -0.045205896275679502, 0.25774184952384882,\n             -0.27043105441631332, 0.026801820391231024, 0.90445945034942565,\n             0.8323901360074013}}}}, \u003cNo data fields\u003e}\n\nBut rather like this!\n\n.. code-block::\n\n   (gdb) p mat\n   $1 = Eigen::Matrix\u003cdouble,4,4,ColMajor\u003e (data ptr: 0x7fffffffdde0)\n   [[ 0.68037543  0.82329472 -0.44445058 -0.27043105]\n    [-0.21123415 -0.60489726  0.10793991  0.02680182]\n    [ 0.56619845 -0.32955449 -0.0452059   0.90445945]\n    [ 0.59688007  0.53645919  0.25774185  0.83239014]]\n\n\nInstallation\n------------\n\nIt is important to use the python/pip version which corresponds to your GDB\ninstallation. You can find out more information using the :code:`python` command in\nGDB. For example, from GDB repl, you can find where GDB python will search for\npackages.\n\n.. code-block:: bash\n\n   (gdb) python\n   \u003eimport sys\n   \u003eprint(sys.path)\n   \u003eend\n   [..., '/path/to/site-packages', ...]\n\nIn Linux, you can also find the python used by checking the libraries linked to GDB.\n\n.. code-block:: bash\n\n   $ ldd $(which gdb) | grep python\n\n\nOnce you find the python interpreter used by GDB, install :code:`eigengdb` using a corresponding python/pip (usually system pip).\n\n\nFrom Source\n~~~~~~~~~~~\n\n.. code-block:: bash\n\n   git clone https://github.com/dmillard/eigengdb\n   cd eigengdb\n   python setup.py install # Make sure to use system python which matches GDB\n   python bin/eigengdb_register_printers\n\nTest\n----\n\nThere is an example program you can play with in the :code:`examples/` directory.\n\n.. code-block:: bash\n\n   cd examples\n   make\n   make debug\n   \nIn the resulting gdb prompt that shows up, add your breakpoint and run the file\n\n.. code-block:: bash\n\n   b 7\n   run # run until breakpoint\n   p mat # shows eigengdb formatting\n\nCustomizing the printer\n-----------------------\nSince NumPy is used to render the matrix, you can adjust `NumPy's printing options \u003chttps://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html\u003e`_ in your gdb session to tweak the appearance, for example:\n\n.. code-block:: bash\n\n   (gdb) p lin_invar_pref\n   $11 = Eigen::Matrix\u003cdouble,4,12,ColMajor\u003e (data ptr: 0x613000001380)\n   [[ 1.00000000e+00  3.16292670e-01  1.05028445e+00  5.02844469e-02\n      1.31629267e+00 -2.19900950e-01 -1.69616503e-01 -1.19332056e-01\n     -6.90476092e-02 -1.87631623e-02  3.15212845e-02  1.92783441e-01]\n    [ 0.00000000e+00  1.00000000e+00  1.88824955e-01  1.88824955e-01\n      1.00000000e+00 -8.36652088e-01 -6.47827133e-01 -4.59002178e-01\n     -2.70177223e-01 -8.13522683e-02  1.07472687e-01  3.26695824e-01]\n    [ 0.00000000e+00  0.00000000e+00  1.00000000e+00  1.00000000e+00\n      6.83197897e-16 -2.18264785e-01  7.81735215e-01  1.78173522e+00\n      2.78173522e+00  3.78173522e+00  4.78173522e+00 -4.36529569e-01]\n    [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+00\n      0.00000000e+00  3.97719125e-01  3.97719125e-01  3.97719125e-01\n      3.97719125e-01  3.97719125e-01  3.97719125e-01  7.95438250e-01]]\n   \n   (gdb) python\n   \u003eimport numpy as np\n   \u003enp.set_printoptions(linewidth=200, formatter={'float': lambda x: \"{:5.2f}\".format(x) if x !=0 else \"     \"})\n   \u003eend\n   (gdb) p lin_invar_pref\n   $12 = Eigen::Matrix\u003cdouble,4,12,ColMajor\u003e (data ptr: 0x613000001380)\n   [[ 1.00  0.32  1.05  0.05  1.32 -0.22 -0.17 -0.12 -0.07 -0.02  0.03  0.19]\n    [       1.00  0.19  0.19  1.00 -0.84 -0.65 -0.46 -0.27 -0.08  0.11  0.33]\n    [             1.00  1.00  0.00 -0.22  0.78  1.78  2.78  3.78  4.78 -0.44]\n    [                               0.40  0.40  0.40  0.40  0.40  0.40  0.80]]\n\n\nLicense\n-------\n\neigengdb is licensed under MPL2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmillard%2Feigengdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmillard%2Feigengdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmillard%2Feigengdb/lists"}