Skip to content

Commit

Permalink
Change error code display
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Sep 9, 2021
1 parent ca81f72 commit 236bc37
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 2 deletions.
39 changes: 38 additions & 1 deletion PointerSearcher/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 114 additions & 1 deletion PointerSearcher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,10 @@ private bool is_attached()

private bool showerror( byte[] b )
{
errorBox.Text = Convert.ToString( b[0] ) + " . " + Convert.ToString( b[1] ) + " . " + Convert.ToString( b[2] ) + " . " + Convert.ToString( b[3] );
int rc = BitConverter.ToInt32( b, 0 );
int module = rc & 0x1FF;
int res = ( ( rc ) >> 9 ) & 0x1FFF;
errorBox.Text = Convert.ToString( module ) + "." + Convert.ToString( res );//Convert.ToString( b[0] ) + " . " + Convert.ToString( b[1] ) + " . " + Convert.ToString( b[2] ) + " . " + Convert.ToString( b[3] );
if ( b[0] == 15 && b[1] == 8 )
{
errorBox.Text += " pminfo not valid";
Expand All @@ -909,6 +912,16 @@ private bool showerror( byte[] b )
{
errorBox.Text += " file not accessible";
}
if (module == 1)
{
errorBox.Text += " Kernel ";
if ( res == 114 )
errorBox.Text += "InvalidHandle";
if ( res == 116 )
errorBox.Text += "InvalidCombination";
if ( res == 127 )
errorBox.Text += "InvalidHwBreakpoint";
}
user_abort = false;
user_abort2 = false;
command_inprogress = false;
Expand Down Expand Up @@ -2316,5 +2329,105 @@ private void button13_Click_1( Object sender, EventArgs e )
};
textBox1.Text = new string( reverse );
}

private void SetWatchPoint_button_Click( Object sender, EventArgs e )
{
if ( !command_available() )
{
return;
}

WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;

int a = SendMessage( NoexsCommands.SetBreakpoint );
// setup HWBP context
// send id = 5
byte[] id = new byte[4];
id = BitConverter.GetBytes( Convert.ToInt32(textBox8.Text) );
a = SendData( id );
// send addr = 0
byte[] k = new byte[8];
// long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text ); //get address
//long k1 = 0;
long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text, 16 ); //get address long heapStart = Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[3].Value.ToString(), 16 );
k = BitConverter.GetBytes( k1 );
a = SendData( k );
// send flag
long res = 1; //enabled
res |= 0xF << 5; // Match the A64 or A32 instruction at DBGBVR, or context match.n
res |= 6 << 16; // does this matter?
res |= 3 << 20; // LINKED_CONTEXT_IDR_MATCH(0b0011)
long dbgbcr = ( 0x3 << 20 ) | ( 0x0 << 16 ) | ( 0xF << 5 ) | 1;
k = BitConverter.GetBytes( (long)dbgbcr );
a = SendData( k );


while ( s.Available < 4 )
{
;
}


byte[] b = new byte[s.Available];
s.Receive( b );
if ( !showerror( b ) )
{
WatchPointAddress_textBox11.BackColor = System.Drawing.Color.LightGreen;
pausebutton.Enabled = true;
resumebutton.Enabled = false;
}
}

private void WatchPointAddress_textBox11_TextChanged( Object sender, EventArgs e )
{
WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;
}

private void button14_Click( Object sender, EventArgs e )
{

if ( !command_available() )
{
return;
}

WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;

int a = SendMessage( NoexsCommands.SetBreakpoint );
// set up watch point
// send id = 0x10
byte[] id = new byte[4];
id = BitConverter.GetBytes( (int)0x10 );
a = SendData( id );
// send addr = 0
byte[] k = new byte[8];
long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text,16 ); //get address long heapStart = Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[3].Value.ToString(), 16 );
k = BitConverter.GetBytes( k1 );
a = SendData( k );
// send flag
long res = 1; //enabled
res |= 2 << 3; //1 = read, 2 = write, 3 = RW
res |= 0xFF << 5; // byte select all 8 bytes
res |= 4 << 16; // link BP number
res |= 5 << 24; // not using mask == 0
k = BitConverter.GetBytes( res );
a = SendData( k );


while ( s.Available < 4 )
{
;
}


byte[] b = new byte[s.Available];
s.Receive( b );
if ( !showerror( b ) )
{
WatchPointAddress_textBox11.BackColor = System.Drawing.Color.LightGreen;
pausebutton.Enabled = true;
resumebutton.Enabled = false;
}
}
}
}
27 changes: 27 additions & 0 deletions PointerSearcher/PointerSearcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -169,5 +184,17 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit 236bc37

Please sign in to comment.