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

JInspector improvements #112

Open
faustus123 opened this issue Jun 24, 2022 · 8 comments
Open

JInspector improvements #112

faustus123 opened this issue Jun 24, 2022 · 8 comments

Comments

@faustus123
Copy link
Collaborator

Ran into several issues trying to use the built-in JInspector tool from gdb. These were done using the JTest plugin that comes with JANA2. I tried ran it like this:

gdb --args jana -Pplugins=JTest -Pjana:timeout=600 -Pnthreads=1
(gdb) break JTestTracker::Process
Function "JTestTracker::Process" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (JTestTracker::Process) pending.
(gdb) run

  1. If debug symbols are not present, then aEvent is optimized out. The real issue here is whether debug symbols should be included in the default JTest plugin and any plugins created with jana-generate.py. At least for JTest, having them there by default avoids having to document in the tutorial how to re-build JANA with them in the section on running with gdb.

  2. Even with debug symbols turned on, the JEvent::Inspect() method is inlined so gdb can't call it.

  3. Calling aEvent->mInspector.Loop() directly works, but not quite. The initial call to PrintEvent() seems to work before entering the loop and the "JANA:" prompt is printed. Then it seems to revert to printing the ticker line while not responding to any commands. Some temporary print statements seem to indicate it is stalling on the "std::getline(m_in, user_input)" call. Why that frees up the heartbeat thread is unclear. Why it does not accept a command after typing and hitting return is also unclear.

@nathanwbrei
Copy link
Collaborator

nathanwbrei commented Jun 24, 2022 via email

@faustus123
Copy link
Collaborator Author

For 3. I think the problem isn't really the ticker lines (though we should probably disable them while in the inspector loop). This real issue is that it is not accepting commands. What I expect to see is the command and its output interspersed with the ticker lines. I see no indication it ever returns from the getline call.

@faustus123
Copy link
Collaborator Author

I take that back. It does seem to be responding to the commands. Somehow fooled myself before.

@nathanwbrei
Copy link
Collaborator

nathanwbrei commented Jun 24, 2022 via email

@faustus123
Copy link
Collaborator Author

OK. I think there was some operator error before. I seem to have it working now. At least if I call aEvent->mInspector.Loop(). I have modified the Loop routine to turn off both the timeout check and ticker before entering the loop and to turn them back on when leaving. It is not ideal since they should really be returned to whatever state they were in when entering the method. JApplication though does not give access to this info at the moment.

@nathanwbrei
Copy link
Collaborator

nathanwbrei commented Jun 24, 2022 via email

nathanwbrei added a commit that referenced this issue Jul 25, 2022
nathanwbrei added a commit that referenced this issue Jul 28, 2022
@nathanwbrei
Copy link
Collaborator

Did we decide we needed to do something to prevent JEvent::Inspect from being optimized out?

@faustus123
Copy link
Collaborator Author

Yes, if it is fairly easy (e.g. #pragma). If not, then we should make it clearer, at least in embedded documentation in the code, how to use it if it has been optimized out.

@nathanwbrei nathanwbrei changed the title JInspector JInspector improvements Jul 17, 2024
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