drltrace icon indicating copy to clipboard operation
drltrace copied to clipboard

Change the way of printing logs:

Open CedricHerzog opened this issue 5 years ago • 6 comments

The API calls were not printed in the right order. This commit introduces a string that we fill for each API call so we can return all the information at once.

Outputing arguments in wide strings format still needs to be implemented. For now, only the address is printed.


As you can see in the picture bellow, I had problems in the way the tool prints logs. I wrote something to correct it and it seems to work for the API calls' names. As I do not need the information about the arguments, I did not test whether or not they are well printed.
I'm not used to code in C++ so this commit may not follow the good practices. I thought you might be interested anyway.

error

CedricHerzog avatar Aug 11 '20 16:08 CedricHerzog

Thank you for your commit! :) I believe it is a usefull feature but I see that it is not passing build tests. We first need to make sure that the pull request is not breaking anything to move forward.

mxmssh avatar Aug 13 '20 00:08 mxmssh

Hi,

I can't manage to make my code pass the 4th windows test. Do you have an idea why it fails?

CedricHerzog avatar Aug 15 '20 13:08 CedricHerzog

I think the problem is this difference between correct and incorrect log printing: Before it was

4: ~~1412~~ MSVCR120.dll!printf
4:     arg 0: done
4:  (type=char*, size=0x0)

after

4: ~~2952~~ MSVCR120.dll!printf
4:     arg 0: done (type=char*, size=0x0)

You can just change expected output regex in the test to reflect the new way of printing. It is here

https://github.com/mxmssh/drltrace/blob/94dc91107dcf10a99a715947494f38c6de11e6b0/drltrace_src/CMakeLists.txt#L465

You need to remove \n after done.

mxmssh avatar Aug 15 '20 16:08 mxmssh

I think the problem is this difference between correct and incorrect log printing: Before it was

4: ~~1412~~ MSVCR120.dll!printf
4:     arg 0: done
4:  (type=char*, size=0x0)

after

4: ~~2952~~ MSVCR120.dll!printf
4:     arg 0: done (type=char*, size=0x0)

You can just change expected output regex in the test to reflect the new way of printing. It is here

https://github.com/mxmssh/drltrace/blob/94dc91107dcf10a99a715947494f38c6de11e6b0/drltrace_src/CMakeLists.txt#L465

You need to remove \n after done.

Ok that was indeed the problem. I changed the code to stick to the tests.

I still have to do some modifications as I have warning during the build. Then, it should be good to be reviewed.

CedricHerzog avatar Aug 16 '20 14:08 CedricHerzog

Ok, ping me whenever you are ready for review with this :)

mxmssh avatar Aug 18 '20 01:08 mxmssh

The warnings are due to the usage of %x instead of %p to print pointers. It may behave differently on some systems. Do you know how to fix this warnings properly and keep the same behavior?

I tried to use the PFX and PIFX but it does not output the same string with snprintf() than with dr_fprintf().

CedricHerzog avatar Sep 07 '20 11:09 CedricHerzog