History log of /haiku/src/system/kernel/debug/user_debugger.cpp (Results 1 – 25 of 92)
Revision Date Author Comments
# 788da26b 06-Sep-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Let user_debugger take care of tracking syscall runtime.

If we just use the kernel entry time, then the pre-syscall tracing
routine (with a debugger message send) will be counted in the sysc

kernel: Let user_debugger take care of tracking syscall runtime.

If we just use the kernel entry time, then the pre-syscall tracing
routine (with a debugger message send) will be counted in the syscall's
runtime.

Makes the output of timing in strace and strace -c much more accurate,
however it won't include the "syscall overhead" (time spent in the
syscall entry routines, etc.) But we already can't account for time
spent in the userland-to-kernel transition, so that should probably
be measured some other way if knowing it is desired.

In fact, on architectures which used the generic syscall dispatcher
(e.g. RISC-V), this is the behavior that already existed. So this just
makes x86 consistent with them.

Change-Id: I8cef6111e478ab49b0584e15575172eea77a8760
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8240
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

show more ...


# ab262541 06-Aug-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Check the debugged team ID properly.

If it's B_CURRENT_TEAM we need to fetch the real ID before doing
the check.


# 5868d23d 24-Jul-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Use the timer->hook filed to indicate if the timer is set.

It seems there is presently a race between debugger state teardown
and canceling the profiling timer, which can lead

kernel/user_debugger: Use the timer->hook filed to indicate if the timer is set.

It seems there is presently a race between debugger state teardown
and canceling the profiling timer, which can lead to timers being
double-added in some circumstances (which hangs the system.)

Obviously that should be fixed, but for now adjust things
so that we catch this in an ASSERT.

show more ...


# bc19d91f 19-Jul-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Clean up scheduling of flushes a bit.

Instead of doing the checks in profiling_do_sample, we now do them
in profiling_event. This allows some comments to be consolidated
and ma

kernel/user_debugger: Clean up scheduling of flushes a bit.

Instead of doing the checks in profiling_do_sample, we now do them
in profiling_event. This allows some comments to be consolidated
and make the logic clearer (but it should be functionally the same.)

Also add a check that profiling is still happening at the end
of profiling_flush.

show more ...


# 6baf6183 18-Jul-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Rework profiler flush mechanism.

Instead of taking the sample inside the timer callback
or the flush callback depending, always take it in the timer
callback, for consistency's

kernel/user_debugger: Rework profiler flush mechanism.

Instead of taking the sample inside the timer callback
or the flush callback depending, always take it in the timer
callback, for consistency's sake. This should always work
because we try to flush the buffer when it's only 70% full;
in testing I can't recall seeing any dropped ticks.

Also add a flush call in the post_syscall hook, in case
we hit the flush threshhold while profiling in the kernel
and couldn't trigger the flush then.

Seems to significantly reduce "missed" ticks overall,
but there are still wildly inconsistent results and
lots of missing time.

Change-Id: I43a5e9c050a50309329da39f8a2386c3e2b3c0dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7851
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

show more ...


# 7eb6aafc 17-Jul-2024 Augustin Cavalier <waddlesplash@gmail.com>

profiler: Actually support profiling user stack frames only.

The "-k" argument (which never did anything before) is now inverted
compared to what it used to be, i.e. now specifying it will profile
k

profiler: Actually support profiling user stack frames only.

The "-k" argument (which never did anything before) is now inverted
compared to what it used to be, i.e. now specifying it will profile
kernel frames, too, whereas by default only user frames will be
sampled.

show more ...


# 2813fd13 28-Jun-2024 Augustin Cavalier <waddlesplash@gmail.com>

profiler: Report CPU times and use them to compute "missed" ticks.

This shows that the profiler is still pretty broken, because we
are missing quite a lot of ticks on average. One run of
"profile pk

profiler: Report CPU times and use them to compute "missed" ticks.

This shows that the profiler is still pretty broken, because we
are missing quite a lot of ticks on average. One run of
"profile pkgman search" here produced an output with 66 total ticks
and 423 (!) missed ticks. A brief run of WebPositive was not quite
as bad (main thread: 1078 total ticks, 157 missed ticks.)

Change-Id: Idfc34534e66eff0fe7e948fcc3576be09db879a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7820
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

show more ...


# f3cb51a8 19-Jun-2024 Trung Nguyen <trungnt282910@gmail.com>

kernel/debug: Report killing signals

Adds a `signal` field to the `team_deleted` event. Since killing
signals like `SIGKILL` and `SIGKILLTHR` do not generate a
`signal_received` event, debuggers wou

kernel/debug: Report killing signals

Adds a `signal` field to the `team_deleted` event. Since killing
signals like `SIGKILL` and `SIGKILLTHR` do not generate a
`signal_received` event, debuggers would only see a `team_deleted`
message with the `status` field set to 0. This makes debuggers like
GDB think that the debuggee has exited with a status code of 0.

To correctly report these signals, when a killing signal is sent
to a team, this signal is relayed to the main thread instead of
defaulting to just a `SIGKILLTHR` for both cases.

Change-Id: If69c9e2e4d87bfbd31f654f5cb6f696ac69ef777
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7756
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

show more ...


# 9631ca73 04-Jun-2024 Trung Nguyen <trungnt282910@gmail.com>

kernel/debug: Report team/thread exit status

Add a field to `debug_[team/thread]_deleted` to report the exit status
on the corresponding events.

This is useful for debuggers like GDB expecting a re

kernel/debug: Report team/thread exit status

Add a field to `debug_[team/thread]_deleted` to report the exit status
on the corresponding events.

This is useful for debuggers like GDB expecting a return value when one
of their inferiors quit.

Also add a `usage` field to `debug_team_deleted` since this is another
potentially useful piece of information exposed by the `waitpid` family
of syscalls.

Change-Id: Ieff7c31f56b1b9f8f709725d19050273b21f2504
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7736
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

show more ...


# bfd3d337 30-May-2023 Trung Nguyen <trungnt282910@gmail.com>

strace: Print detailed signal information

- Add support for retrieving the `siginfo_t` structure of a signal
event from the Debugger API.
- Add code to `strace` to display this information every tim

strace: Print detailed signal information

- Add support for retrieving the `siginfo_t` structure of a signal
event from the Debugger API.
- Add code to `strace` to display this information every time a
signal event occurs, similar to the Linux `strace` tool.

Change-Id: If4e92bbae049ee0b52efaf9fc911d66511da62f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6393
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

show more ...


# 97f11716 04-Sep-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Merge remote-tracking branch 'origin/master' into dev/netservices

Change-Id: I588c4a840523995f820161d63741c137bc5c719c


# 071f4aad 19-May-2022 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel/user_debugger: Show the thread name in addition to the id

* Helps in debugging early boot issues where you won't have
access to the list of thread id's

Change-Id: Ic06bd0b53ccceccd8c911156

kernel/user_debugger: Show the thread name in addition to the id

* Helps in debugging early boot issues where you won't have
access to the list of thread id's

Change-Id: Ic06bd0b53ccceccd8c911156724a799ca6a1c28b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5322
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

show more ...


# 268f99dd 22-Dec-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Merge branch 'master' into dev/netservices


# afc04c50 17-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Add initialization to appease -Wmaybe-uninitialized.


# 057fe191 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Break thread-related AutoLockers into a separate header.

Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash ta

kernel: Break thread-related AutoLockers into a separate header.

Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash tables, linked lists, Referenceable, etc. that the vast majority
of AutoLock.h consumers neither want nor need.

So, put these in a separate header, and adjust all consumers of these
lockers to include the new file.

This change exposes the fact that a lot of files were inadvertently
making use of headers included indirectly through thread.h. Those
will be fixed in the next commit.

show more ...


# 2d85a564 27-Sep-2019 Kacper Kasper <kacperkasper@gmail.com>

Fix SMAP violation when running profile

* Fixes #15379.

Change-Id: I3d5672ec0ffd4c09a35535f641e433d3d714412a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1890
Reviewed-by: Jérôme Duval <jerom

Fix SMAP violation when running profile

* Fixes #15379.

Change-Id: I3d5672ec0ffd4c09a35535f641e433d3d714412a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1890
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>

show more ...


# 719cfad7 05-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Don't try to cast an integer to a pointer.

Should fix the x86_64 build.


# 24f7b647 04-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Initialize the condition variables.

Should (actually) fix #15223 and #15226. After things settle
down a bit, I'll refactor our ConditionVariable constructors
to detect this at

kernel/user_debugger: Initialize the condition variables.

Should (actually) fix #15223 and #15226. After things settle
down a bit, I'll refactor our ConditionVariable constructors
to detect this at compile time instead of creating obscure
KDLs...

show more ...


# 5c97129c 08-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/team: Remove team_get_team_struct, add team_geteuid.

Thanks to Axel for the review.


# 6f0aa00c 04-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Add missing permissions checks.

Part of #14961.


# ee0b0d6d 10-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Fix typos in documentation.

Spotted by Clang (yes, there is a -Wdocumentation that understands
how to parse Doxygen comments!)


# 467fe4ca 24-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel: Add core dump facility

* Add function core_dump_write_core_file(). It writes a core file for
the current thread's team. The file format is similar to that of
other OSs (i.e. ELF with PT_

kernel: Add core dump facility

* Add function core_dump_write_core_file(). It writes a core file for
the current thread's team. The file format is similar to that of
other OSs (i.e. ELF with PT_LOAD segments and a PT_NOTE segment), but
most of the notes are Haiku specific (infos for team, areas, images,
threads). More data will probably need to be added.
* Add team flag TEAM_FLAG_DUMP_CORE, thread flag
THREAD_FLAGS_TRAP_FOR_CORE_DUMP, and Team property coreDumpCondition,
a condition variable available while a core dump is progress. A
thread that finds its flag THREAD_FLAGS_TRAP_FOR_CORE_DUMP set before
exiting the kernel to userland calls core_dump_trap_thread(), which
blocks on the condition variable until the core dump has finished. We
need the team's threads to stop so we can get their CPU state (and
have a generally unchanging team state while writing the core file).
* Add user debugger message B_DEBUG_WRITE_CORE_FILE. It causes
core_dump_write_core_file() to be called for the team.
* Dumping core as an immediate effect of a terminal signal has not been
implemented yet, but that should be fairly straight forward.

show more ...


# 7a187cd6 09-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_thread(): Use new signal SIGNAL_DEBUG_THREAD

This resolves a TODO: We used thread_interrupt() to wake up the thread
from an interruptable wait. However, if the thread was already in the

_user_debug_thread(): Use new signal SIGNAL_DEBUG_THREAD

This resolves a TODO: We used thread_interrupt() to wake up the thread
from an interruptable wait. However, if the thread was already in the
kernel and about to start waiting, that would have no effect and the
thread would wait anyway. Now there's the new non-blockable signal
SIGNAL_DEBUG_THREAD, which is sent to the thread instead, making sure
that thread doesn't start waiting.

show more ...


# 27dec4bb 30-Jul-2015 Rene Gollent <rene@gollent.com>

user_debugger: Adjust handling of continue request.

- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
is in a suspended state rather than waiting on the debug nub port, and

user_debugger: Adjust handling of continue request.

- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
is in a suspended state rather than waiting on the debug nub port, and
if so, handles resuming it automatically. This allows the continue message
to be used on the main thread of a team that was freshly created under
debug control without the API user having to be cognizant of the distinction.

show more ...


# 8f9d4cad 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

syscalls: Remove get_stack_trace syscall again.

This reverts the other half of b959d46dbd2f9087ae860dbced40440c28596a6e.


1234