History log of /haiku/src/bin/debug/strace/strace.cpp
Revision Date Author Comments
# 29f8da76 09-Jun-2023 Trung Nguyen <trungnt282910@gmail.com>

strace: Add mutex type

Added a dedicated mutex type handler that can print mutex status
flags while still showing the mutex address.

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


# a2cb4665 05-Jun-2023 Trung Nguyen <trungnt282910@gmail.com>

strace: Improvements

- Added some utility functions to the `Context` class.
- Updated the `sockaddr` handler to retrieve the next sibling
rather than the sibling at index 2. This allows the handler to
work for syscalls where the `socklen_t` argument is not the third
one, for example, `_kern_recvfrom`.
- Added the ability to print the `flatArgs` for `_kern_exec` and
`_kern_load_image`.

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


# bfd3d337 29-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 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>


# 840faa40 23-May-2023 Jérôme Duval <jerome.duval@gmail.com>

strace: add network definitions

move select/poll to network.cpp

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


# baf281aa 28-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

strace: Fix names of hardcoded syscall lists.

Before this commit, specifying %memory or %network just crashed strace.
I guess this was never tested?


# 90b0629e 28-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

strace: Trivial improvements.

* Break in FlagsTypeHandler once we have cleared all flags.
* Use sizeof(hex) instead of writing out the size again.
* Place comment above variable name in patch_syscalls.


# 28d588d5 28-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

strace: Create a status_t type handler and use it for return values.

This way, we save 3 string comparisons on every non-empty return value.

Actually this code was broken before, and did not print error names
for return types other than status_t, because message.return_value
is an unsigned integer and thus "< 0" was always false. Now we cast
appropriately in the new TypeHandler, so this works properly.


# 8b926756 28-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

strace: Do not print unnecessary parentheses.

Cleans up output somewhat.


# 0f3ea497 28-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

strace: Add area protection flags printing.

Using the new FlagsTypeHandler.


# c9e5ef87 20-Jun-2022 Jérôme Duval <jerome.duval@gmail.com>

strace: shows values for create_pipe and socketpair.

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


# 3b8430df 28-Aug-2022 Jérôme Duval <jerome.duval@gmail.com>

strace: add an option to filter syscalls by name or by type

the type lists are hardcoded for now.

Change-Id: Iae89046ee52d3812354de619bfd9625217479c49
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5597
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 1d2cf139 26-Apr-2022 Jérôme Duval <jerome.duval@gmail.com>

strace: trace fcntl and wait_for_child syscalls parameters

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


# 949005a5 06-Dec-2021 Jérôme Duval <jerome.duval@gmail.com>

strace: handle parallel syscalls on different threads

If a thread executes a system call and meanwhile a different thread calls another one, then
the ongoing call is marked as unfinished. When the call returns it will be marked as resumed.

* remove PreSyscall, now unused.

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


# 39782e55 04-Dec-2021 Jérôme Duval <jerome.duval@gmail.com>

strace: support trace for poll() and select()

in the case of poll(), the events should be printed before the actual syscall,
and the revents after, while taking in account the return value.
thus B_DEBUGGER_MESSAGE_PRE_SYSCALL needs to be enabled and handled.
the attribute "preSyscall" is added to identify such syscalls, and the parameters
are identified with the attribute "inOut".

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


# 41ed621e 12-Oct-2021 Murai Takashi <tmurai01@gmail.com>

bin/debug/strace: fix wrong type of arguments to formatting function

Pointed out by LGTM

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


# 7903bfcf 15-Jun-2021 Jérôme Duval <jerome.duval@gmail.com>

strace: add signal name tracing

inspired by hrev23436, fix #10944

Change-Id: Ieedace86a6541a4cd1346791146a96e99d09d614
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4093
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 62826a06 09-Jan-2021 Jérôme Duval <jerome.duval@gmail.com>

strace: continue_thread can fail when the origin team is gone

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


# da452ce2 13-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

strace: Print syscall names without the "_kern_".

This makes the output much easier to read (e.g. "write(...)" vs.
"_kern_write(...)") and similar to strace/dtrace/etc. output
on other platforms.

Change-Id: Iac8e32aae0dcf3731a348c6192203f8d5b54da7a
Reviewed-on: https://review.haiku-os.org/c/1451
Reviewed-by: Bruno Albuquerque <bga@bug-br.org.br>


# 49783dc8 01-Nov-2018 Augustin Cavalier <waddlesplash@gmail.com>

strace: Gracefully handle invalid syscall numbers.

OpenJDK 1.8 somehow manages to trigger this. Before this commit it would
just attempt to read past the end of the vector, which of course segfaulted,
which seems to imply nobody has run into this case before.


# e69a3a86 17-Dec-2015 Axel Dörfler <axeld@pinc-software.de>

strace: Added option to dump syscall stats.

* Use -c/-C (same as in Linux's strace) to enable the stat output.
* Former -c to turn of colored output is now --no-color.


# 3aeed660 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# 4dc355e9 27-Jun-2013 Rene Gollent <anevilyak@gmail.com>

Adjust debug_utils functions.

The functions in question now return an error rather than simply calling
exit() directly when they fail, as this behavior wasn't acceptable for
e.g. Debugger. Adjusted all calling apps accordingly.


# a3802ca9 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

x86_64 support for GDB.

As mentioned in one of the previous commits, breakpoints don't work
properly yet, and I haven't done much extensive testing yet, but the
basic functionality works.


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64c68424 26-Aug-2009 François Revol <revol@free.fr>

Fix warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32706 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8df6a8db 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved strace sourced to src/bin/debug/.
* Factored a few functions out of strace that can be reused.
* Added the beginnings of a "profile" command. It is very much work in
progress, though it is already able to profile the main thread of a
program.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27533 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3aeed6607cd07762c0e709633c012b3a632dbad9 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# 4dc355e9a98bf91d5e0851e432692fb267839de0 27-Jun-2013 Rene Gollent <anevilyak@gmail.com>

Adjust debug_utils functions.

The functions in question now return an error rather than simply calling
exit() directly when they fail, as this behavior wasn't acceptable for
e.g. Debugger. Adjusted all calling apps accordingly.


# a3802ca96702d7011ad4967428c38f196b07480c 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

x86_64 support for GDB.

As mentioned in one of the previous commits, breakpoints don't work
properly yet, and I haven't done much extensive testing yet, but the
basic functionality works.


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64c68424bdecd7a8c7a1a7de9bdf725e68245125 26-Aug-2009 François Revol <revol@free.fr>

Fix warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32706 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8df6a8dbf579280f55b61d725e470dee5d504e83 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved strace sourced to src/bin/debug/.
* Factored a few functions out of strace that can be reused.
* Added the beginnings of a "profile" command. It is very much work in
progress, though it is already able to profile the main thread of a
program.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27533 a95241bf-73f2-0310-859d-f6bbb57e9c96