Wednesday Nov 25, 2009

Adplus configuration

While working on a Java Plugin(on Windows) issue, I found one useful feature of
Adplus.

I was having a problem with LoadLibraryEx() and I was trying to load a dll into
another process' address space but it was not getting loaded. Adplus report was
showing DLL_Load and DLL_Unload First Chance Exceptions for the attempts of
loading and then unloading the dll. I wanted to find why the dll was getting
unloaded immediately after it was attempted to get loaded. And for this, I
wanted to obtain the stack trace or crash dump for this First Chance unloading
Exception. The default action for this event is to just log the details.
Adplus report:
  DLL_Load [ld]       return: GN GN
      1st chance: Log
      2nd chance: Log
  DLL_UnLoad [ud]       return: GN GN
      1st chance: Log
      2nd chance: Log
  Process_Shut_Down [epr]       return: VOID VOID
      1st chance: Log;Time;EventLog;Stacks;FullDump
      2nd chance: 


Then I found a way on how to change the actions for these exceptions. Adplus
can accept a configuration file where in we can specify the actions for
Exceptions. I created a conf file 'conf.txt' with following contents:
<ADPlus>
  <Settings>
    <ProcessID>4856</ProcessID>
    <RunMode>CRASH</RunMode>
    <OutputDir>d:\\poonam</OutputDir>
  </Settings>
  <Exceptions>
    <Config>
      <Code>AllExceptions</Code>
      <Actions1>MiniDump;Stack;Log;EventLog</Actions1>
    </Config>
  </Exceptions>
</ADPlus>


and ran adplus:

# adplus -c conf.txt

With this I could get the stack trace and crash dump of DLL_Unload event. And
adplus log contained:
  DLL_Load [ld]       return: GN GN
      1st chance: MiniDump;Stack;Log;EventLog
      2nd chance: Log
  DLL_UnLoad [ud]       return: GN GN
      1st chance: MiniDump;Stack;Log;EventLog
      2nd chance: Log
  Process_Shut_Down [epr]       return: VOID VOID
      1st chance: MiniDump;Stack;Log;EventLog
      2nd chance:


Details on Adplus configuration here:
http://msdn.microsoft.com/en-us/library/cc390932.aspx

Also, it is possible to define the actions for a specific Exception provided
you know the ExceptionCode. I could not find the code for DLL_UnLoad exception
so I used 'AllExceptions'.
<Code> { ExceptionCode | AllExceptions } </Code>

About

poonam

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today