如何找到Pybind11从Python致电到C++

发布于 2025-01-22 16:54:34 字数 1521 浏览 2 评论 0 原文

试图调试从Python到C ++的PYBIND11。可以设置断点并按顺序击中两侧。

Python中的功能是 pyspiel.load_game line36

 game = pyspiel.load_game('kuhn_poker', {'players': num_players})

试图在C ++方面找到load_game函数,如下 line544 m.def(“ load_game”, 但是这一行中的断点无法击中。

然后尝试将LoadGame定位在下面,但是这里的断点也无法击中。 Line259

    std::shared_ptr<const Game> LoadGame(const std::string& short_name,

试图查看呼叫堆栈,然后随机设置一些断点,从Pybind11部分中调用的第一个功能似乎如下。 https://github.com/deepmind/deepmind/deepmind/open_spiel/blob/blob/blob/blob/mbaster/ open_spiel/spiel.h LINE1062

static std::map<std...

这样做意味着首先调用 loadGame gamereGisterer

我可以在C ++方面了解 loadGame 的开始应该在哪里放置断点。

非常感谢您的建议。

亚历克斯

Trying to debug a pybind11 calling from python to c++. The breakpoints can be setup and hitted in both sides in sequence.

The function in python is
pyspiel.load_game
line36

https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/egt/examples/alpharank_example.py

 game = pyspiel.load_game('kuhn_poker', {'players': num_players})

Tried to locate the load_game function in c++ side is LoadGame as below
https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/pybind11/pyspiel.cc
line544m.def("load_game",
But breakpoint in this line cannot be hitted.

Then try to locate LoadGame in as below, but the breakpoint here also cannot be hitted.
https://github.com/deepmind/open_spiel/blob/master/open_spiel/spiel.cc
line259

    std::shared_ptr<const Game> LoadGame(const std::string& short_name,

Tried to look into the call stack, and randomly setup some breakpoints, the first function called out of pybind11 portion seems as below.
https://github.com/deepmind/open_spiel/blob/master/open_spiel/spiel.h
line1062

static std::map<std...

Does that means that in LoadGame the GameRegisterer is called firstly.

May I learn where should put breakpoint for the start of LoadGame in c++ side.

Thank you very much for your suggestion.

alex

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文