Forum > General

[Solved] Q: Debug a plugin DLL - can we do OutputDebugstring to the event log?

(1/2) > >>

d7_2_laz:
After some initial hurdles basically i got debugging a Notepad++ plugin DLL (here: a demo template) to work.

But stumbled across two questions. The first one here:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure THelloWorldDockingForm.FormCreate(Sender: TObject);...begin   Outputdebugstring(pchar('THelloWorldDockingForm.FormCreate' ));
No output within the event log. Is this normal when debugging a (plugin) DLL?

Debug backend is gdb.

Martin_fr:
Simplest way is to try it.

I would guess that it will work (if it works from a normal app, which iirc it does / but I don't remember when I last used it).

After all, this goes to the windows api, and the windows api sends it to an attached debugger. Debuggers (incl gdb) attach to a process. So main program or dll should not matter, all the same process.

If an app launches a child process, then probably not. Threads likely yes.


Support for non ascii depends on the debugger. And using the W version of the function.

d7_2_laz:
Had tried it, no intended output (differently to normal windows apps, where i use it punctually for to gather some information quickly).

Where gdb (via project options) is a bit more talkative than fpdebug here, at least it says some lines more (see image), but not the content i wrote in 'FormCreate'.

The image tells also about the host process (notepad++.exe), and maybe the message would be routed to that one?

Btw, due to the line: 'Debug output:' (empty) : for to exclude it comes from me, but is empty due to a missing W-version of OutputDebugString  (which accepts only PChar), i repeated the directive 4 times, but there was always only one empty line in the output. So that line comes from a different source.

Edit:
Oh, there's really a W-version for OutputDebugString (didn't know that yet);

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   OutputDebugStringW(LPCWSTR(' THelloWorldDockingForm.FormCreate   ' ));but it doesn't create a different output here, and in my string are not non-ascii chars.

Martin_fr:
You can check what gdb actually gets, versus what the IDE reports.
Menu: view > ide internals > debug output.

Has all the data exchanged with gdb.

I don't know if (and if then from which version on) gdb would get the "W" texts.

A debugger must tell Windows if it can handle those. If it can't, I am not sure if it gets nothing, or some translations, or.....
And obviously I don't know gdb internals. I don't know if it reads the W version.

IIRC I added the W version to fpdebug.

But I don't use that myself, so it got a few tests when added, and that is it.

If it has a bug, then I would appreciate if you have an easy way to reproduce and report it on the bug tracker.
Ideally not requiring notepad++, but have app and dll to be pascal code.

Though I can't promise how soon I can get to that. Very busy right now.

440bx:
@d7_2_laz

see what you get using sysinternals DebugView.

You can download it from https://learn.microsoft.com/en-us/sysinternals/downloads/debugview

HTH.

Navigation

[0] Message Index

[#] Next page

Go to full version