Skip to content

Conversation

@KrzaQ
Copy link
Contributor

@KrzaQ KrzaQ commented Apr 5, 2023

Please note: the proprietary XBOX dll is not included in this commit and is only available to verified customers.

@KrzaQ KrzaQ requested a review from konraddysput April 5, 2023 06:33
@KrzaQ KrzaQ self-assigned this Apr 5, 2023
if (showNativeCrashesSettings)
{
#if UNITY_STANDALONE_WIN
#if UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you use it anywhere?

#elif UNITY_STANDALONE_OSX
string.Format("~/Library/Logs/{0}/{1}/Player.log", Application.companyName, Application.productName);
#elif UNITY_STANDALONE_WIN
#elif UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure Unity logs are available in this path on Xbox?


internal class NativeClient : NativeClientBase, INativeClient
{
[DllImport("breakpad_xbox_simplified_abi_mt.dll")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure breakpad_xbox_simplified name is a good idea for a library that our users will add to the code? Wouldn't it be better if we name it backtrace-xbox or backtrace-unity-xbox?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not. It's "simplified ABI" since the dll only exposes a few basic functions, C-style (undecorated ABI), which is different from the full Breakpad library.

I am open to changing the name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can hide what is this because I'm not sure if this is important to share that this is c-style library. I think it's not from the end user perspective. How about: backtrace-unity-xbox ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library could be used from other game engines as well. I would rather not package the same library several times just by changing the name.

internal class NativeClient : NativeClientBase, INativeClient
{
[DllImport("breakpad_xbox_simplified_abi_mt.dll")]
private static extern bool BacktraceCrash();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to start every method in "Backtrace" library with prefix "Backtrace"? I think it is obvious enough if we call it "Crash"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DLL exposes undecorated symbols, C-style. It's idiomatic to namespace them

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but the dll is alerady backtrace dll

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the issue. C does not have namespaces. If we have a method Initialize() in our DLL, and another DLL exposes the same method, they will clash.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you call the dll directly based on the dll name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's a hard requirement for you, I can do it. But IMO it's better to offer one generic library that we could reuse in other projects.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's still can be generic, right? We can share the library with a note it's an abi_mt library. We don't need to show in our code we use breakpad or this is the "simplify" the library. If we switch to other crash reporter for any reason someone will have more manual work to do. Can we just rename it to backtrace-xbox?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm of two minds here. We actually offer multiple versions of Breakpad because some customers use mt/md libraries.

);

[DllImport("breakpad_xbox_simplified_abi_mt.dll")]
private static extern bool BacktraceBreakpadInitialized();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you use it anywhere?


if (!CaptureNativeCrashes)
{
Debug.LogWarning("Backtrace native integration status: Cannot initialize Crashpad client");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashpad client is not a good name - can we rename it to xbox native integration or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-paste error, absolutely


public void HandleAnr()
{
throw new NotImplementedException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support ANR for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't - why do we respect ANR behavior in the constructor by filtering error types? We need to be sure the use cannot setup it.


public void GetAttributes(IDictionary<string, string> attributes)
{
throw new NotImplementedException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the value in implementing this method, but can do so. But it'll require additional implementation on the C-side and the hassle of marshalling the data through C-strings, for very dubious (IMO) gain.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but leaving not implemented exception is not something that our users want to see


public bool OnOOM()
{
throw new NotImplementedException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support OOM for now.

Copy link
Collaborator

@konraddysput konraddysput Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but not implemented exception is not something that our users want to see - they expect to have the same behavior like in any other our integration

}

#if UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#if UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

}

#if UNITY_STANDALONE_WIN
#if UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

get
{
#if UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#if UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

{

#if UNITY_STANDALONE_WIN
#if UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

@konraddysput konraddysput merged commit e3ec70d into master Apr 18, 2023
@konraddysput konraddysput deleted the kq-add-xbox branch September 21, 2023 10:16
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

Successfully merging this pull request may close these issues.

3 participants