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

Source files not found automatically #10

Open
yurikhan opened this issue Apr 19, 2022 · 4 comments
Open

Source files not found automatically #10

yurikhan opened this issue Apr 19, 2022 · 4 comments

Comments

@yurikhan
Copy link
Contributor

yurikhan commented Apr 19, 2022

Suppose I debug a binary built from thousands of source files in hundreds of directories. As soon as I set a breakpoint (b main RET), I get a minibuffer prompt:

Unable to locate GTestExtMain.cpp
Blacklist it for location tracking? (y or n)

Of course not, I say. (n) I get the next prompt:

Find this error in (default GTestExtMain.cpp): ~/src/…/build/Debug/bin/

It seems I am now supposed to produce the fully qualified name of the file where the function I’m breakpointing is defined.

If, before attempting to set the breakpoint, I enter the following incantation:

settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{\`${function.name}}}{ at ${line.file.fullpath}:${line.number}}\n

that I cribbed on Stack Overflow, the file is successfully and automatically found and displayed upon b main RET.

It would be nice if realgud-lldb automatically fed lldb the above incantation shortly after starting. I expect the mechanism to do that to be similar to this in gdb/gdb.el.

@rocky
Copy link
Collaborator

rocky commented Apr 19, 2022

Sounds reasonable. Are you up for submitting a PR for this?

@yurikhan
Copy link
Contributor Author

Hm, it turns out not so easy.

The frame-format setting affects the display of stack frames, such as those emitted when the breakpoint is hit. However, realgud-lldb seems to trigger on the emission of a breakpoint description, which is not dynamically customizable. The relevant code in lldb seems to be here (method declaration; note show_fullpaths argument) and here (invocation; note hardcoded false value passed).

Passing the frame-format setting has the following suboptimal effect:

  • On setting a breakpoint (b main RET), I get the two prompts, first to blacklist the file, second to locate it manually. I can refuse the first one and Ctrl+G the second one.
  • Then, when I run the program and the breakpoint hits, I get the correct file visited.

Ideas?

@yurikhan
Copy link
Contributor Author

Tentative PR. ☝️

@rocky
Copy link
Collaborator

rocky commented Apr 19, 2022

I don't have any suggestions. If I recall correctly somewhere in the code there is a way to tell realgud that a breakpoint message is expected but ignore that.

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

2 participants