| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // Always zero. Crash() divides by this in order to trigger a crash. This is | 345 // Always zero. Crash() divides by this in order to trigger a crash. This is |
| 346 // structured as a static volatile int to ward off aggressive compiler | 346 // structured as a static volatile int to ward off aggressive compiler |
| 347 // optimizations. | 347 // optimizations. |
| 348 static volatile int zero_; | 348 static volatile int zero_; |
| 349 | 349 |
| 350 DISALLOW_COPY_AND_ASSIGN(Child); | 350 DISALLOW_COPY_AND_ASSIGN(Child); |
| 351 }; | 351 }; |
| 352 | 352 |
| 353 // MachMultiprocess: | 353 // MachMultiprocess: |
| 354 | 354 |
| 355 virtual void MachMultiprocessParent() override { | 355 void MachMultiprocessParent() override { |
| 356 // Wait for the child process to be ready. It needs to have all of its | 356 // Wait for the child process to be ready. It needs to have all of its |
| 357 // threads set up before proceeding if in kSetOutOfProcess mode. | 357 // threads set up before proceeding if in kSetOutOfProcess mode. |
| 358 char c; | 358 char c; |
| 359 CheckedReadFD(ReadPipeFD(), &c, 1); | 359 CheckedReadFD(ReadPipeFD(), &c, 1); |
| 360 EXPECT_EQ('\0', c); | 360 EXPECT_EQ('\0', c); |
| 361 | 361 |
| 362 mach_port_t local_port = LocalPort(); | 362 mach_port_t local_port = LocalPort(); |
| 363 | 363 |
| 364 // Get an ExceptionPorts object for the task and each of its threads. | 364 // Get an ExceptionPorts object for the task and each of its threads. |
| 365 ExceptionPorts task_ports(ExceptionPorts::kTargetTypeTask, ChildTask()); | 365 ExceptionPorts task_ports(ExceptionPorts::kTargetTypeTask, ChildTask()); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 453 |
| 454 EXPECT_TRUE(handled_); | 454 EXPECT_TRUE(handled_); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // Wait for the child process to exit or terminate, as indicated by it | 457 // Wait for the child process to exit or terminate, as indicated by it |
| 458 // closing its pipe. This keeps LocalPort() alive in the child as | 458 // closing its pipe. This keeps LocalPort() alive in the child as |
| 459 // RemotePort(), for the child’s use in its TestGetExceptionPorts(). | 459 // RemotePort(), for the child’s use in its TestGetExceptionPorts(). |
| 460 CheckedReadFDAtEOF(ReadPipeFD()); | 460 CheckedReadFDAtEOF(ReadPipeFD()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 virtual void MachMultiprocessChild() override { | 463 void MachMultiprocessChild() override { |
| 464 Child child(this); | 464 Child child(this); |
| 465 child.Run(); | 465 child.Run(); |
| 466 } | 466 } |
| 467 | 467 |
| 468 SetType set_type_; | 468 SetType set_type_; |
| 469 SetOn set_on_; | 469 SetOn set_on_; |
| 470 WhoCrashes who_crashes_; | 470 WhoCrashes who_crashes_; |
| 471 | 471 |
| 472 // true if an exception message was handled. | 472 // true if an exception message was handled. |
| 473 bool handled_; | 473 bool handled_; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 if (geteuid() == 0) { | 568 if (geteuid() == 0) { |
| 569 EXPECT_TRUE(rv); | 569 EXPECT_TRUE(rv); |
| 570 } else { | 570 } else { |
| 571 EXPECT_FALSE(rv); | 571 EXPECT_FALSE(rv); |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace | 575 } // namespace |
| 576 } // namespace test | 576 } // namespace test |
| 577 } // namespace crashpad | 577 } // namespace crashpad |
| OLD | NEW |