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

GDB works only with hbreak, not break for libos #1982

Open
g2flyer opened this issue Aug 27, 2024 · 4 comments
Open

GDB works only with hbreak, not break for libos #1982

g2flyer opened this issue Aug 27, 2024 · 4 comments

Comments

@g2flyer
Copy link
Contributor

g2flyer commented Aug 27, 2024

Description of the problem

While standard software breakpoints (break) work for PAL and application, it seems currently for libos one needs hardware breakpoints (hbreak) to interrupt the program (setting breakpoints for libos functions with break seems to work but the program never stops ...). I think this previously did work with break also for libos but i'm not 100% sure and, more importantly, i don't know when it stopped working. Using hbreak instead of break is not a big deal, but thought i would create this issue so folks could find this workaround while searching issues if they run in the same problem ...

PS: Note that CI does test gdb break points but only for PAL (which works), not libos (which doesn't) ....

Steps to reproduce

  • start a program using protected files with GDB=1 gramine-direct ...
  • set a breakpoint with b ipf_open
  • run program with run

Expected results

gdb should stop when ipf_open is encountered

Actual results

gdb runs to the end (even though, with log_level=trace one can see that ipf_open was called

Gramine commit hash

68b9602

@g2flyer
Copy link
Contributor Author

g2flyer commented Aug 27, 2024

BTW: Unless somebody knows right away what the issue is, this is probably not worth spending time investigating. Makes me wonder, though, should i maybe create a small PR to update the documentation with a corresponding comment?

@mkow
Copy link
Member

mkow commented Aug 27, 2024

I'm pretty sure it worked correctly in the past, it's quite unlucky that this scenario wasn't tested.
Instead of documenting this, I'd rather find someone to debug and fix it, as it's clearly a bug :)

@kailun-qin
Copy link
Contributor

From a quick bisect, it looks like 72668bb introduced some regressions.

@dimakuv
Copy link

dimakuv commented Aug 28, 2024

From a quick bisect, it looks like 72668bb introduced some regressions.

After a quick check, I don't see anything suspicious... Clearly the problem is somewhere around here:

_PalDebugMapAdd(g_entrypoint_map.l_name, (void*)g_entrypoint_map.l_base_diff);

But I don't see how that particular commit could modify anything... Needs proper debugging.

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

No branches or pull requests

4 participants