File: BreakPointThread2Prg.pas

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (102 lines) | stat: -rw-r--r-- 1,819 bytes parent folder | download | duplicates (4)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
program BreakPointThread2Prg;
{$asmMode intel}
uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  sysutils, Classes;

type

  { TTestThread }

  TTestThread = class(TThread)
    procedure Execute; override;
  end;

  { TTestThread2 }

  TTestThread2 = class(TThread)
    procedure Execute; override;
  end;


var
  T1, x, BreakDummy: Integer;

label
testasmlbl1;

{ TTestThread }

procedure TTestThread.Execute;
var
  i: Integer;
  t: array [0..5] of TTestThread2;
begin
  for i := 0 to high(t) do
    t[i] := TTestThread2.Create(False);
  InterLockedIncrement(T1);
  while not Terminated do
    for i := 0 to high(t) do begin
      t[i].WaitFor;
      t[i].Free;
      t[i] := TTestThread2.Create(False);
    end;
end;

{ TTestThread2 }

procedure TTestThread2.Execute;
begin
  //
end;

begin
  TTestThread.Create(False);
  TTestThread.Create(False);
  TTestThread.Create(False);
  TTestThread.Create(False);
  TTestThread.Create(False);
  while InterLockedExchangeAdd(T1, 0) < 4 do
    sleep(10);

  BreakDummy := 1;

  asm
    nop  // TEST_BREAKPOINT=BrkMainBegin
    xor eax, eax
    xor ebx, ebx
    add eax, 20
testasmlbl1:
    sub eax, 20
    add eax, 1 // TEST_BREAKPOINT=BrkMain0
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain1
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain2
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain3
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain4
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain5
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain6
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain7
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain8
    add eax, 1
    add eax, 1 // TEST_BREAKPOINT=BrkMain9
    add eax, 1

    add ebx, 1
    jmp testasmlbl1

    nop
    nop  // TEST_BREAKPOINT=BrkMainEnd
  end;

end.