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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 old_stateCnt = kThreadStateFlavorCount; | 261 old_stateCnt = kThreadStateFlavorCount; |
262 | 262 |
263 // Adjust the message size for the data that it’s actually carrying, which | 263 // Adjust the message size for the data that it’s actually carrying, which |
264 // may be smaller than the maximum that it can carry. | 264 // may be smaller than the maximum that it can carry. |
265 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); | 265 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); |
266 } | 266 } |
267 }; | 267 }; |
268 | 268 |
269 // The reply messages for exception_raise_state and | 269 // The reply messages for exception_raise_state and |
270 // exception_raise_state_identity are identical. | 270 // exception_raise_state_identity are identical. |
271 typedef ExceptionRaiseStateReply ExceptionRaiseStateIdentityReply; | 271 using ExceptionRaiseStateIdentityReply = ExceptionRaiseStateReply; |
272 | 272 |
273 struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest { | 273 struct __attribute__((packed, aligned(4))) MachExceptionRaiseRequest { |
274 mach_msg_header_t Head; | 274 mach_msg_header_t Head; |
275 mach_msg_body_t msgh_body; | 275 mach_msg_body_t msgh_body; |
276 mach_msg_port_descriptor_t thread; | 276 mach_msg_port_descriptor_t thread; |
277 mach_msg_port_descriptor_t task; | 277 mach_msg_port_descriptor_t task; |
278 NDR_record_t NDR; | 278 NDR_record_t NDR; |
279 exception_type_t exception; | 279 exception_type_t exception; |
280 mach_msg_type_number_t codeCnt; | 280 mach_msg_type_number_t codeCnt; |
281 int64_t code[2]; | 281 int64_t code[2]; |
(...skipping 13 matching lines...) Expand all Loading... |
295 NDR = NDR_record; | 295 NDR = NDR_record; |
296 exception = kExceptionType; | 296 exception = kExceptionType; |
297 codeCnt = 2; | 297 codeCnt = 2; |
298 code[0] = kTestMachExceptionCodes[0]; | 298 code[0] = kTestMachExceptionCodes[0]; |
299 code[1] = kTestMachExceptionCodes[1]; | 299 code[1] = kTestMachExceptionCodes[1]; |
300 } | 300 } |
301 }; | 301 }; |
302 | 302 |
303 // The reply messages for exception_raise and mach_exception_raise are | 303 // The reply messages for exception_raise and mach_exception_raise are |
304 // identical. | 304 // identical. |
305 typedef ExceptionRaiseReply MachExceptionRaiseReply; | 305 using MachExceptionRaiseReply = ExceptionRaiseReply; |
306 | 306 |
307 struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest { | 307 struct __attribute__((packed, aligned(4))) MachExceptionRaiseStateRequest { |
308 mach_msg_header_t Head; | 308 mach_msg_header_t Head; |
309 NDR_record_t NDR; | 309 NDR_record_t NDR; |
310 exception_type_t exception; | 310 exception_type_t exception; |
311 mach_msg_type_number_t codeCnt; | 311 mach_msg_type_number_t codeCnt; |
312 int64_t code[2]; | 312 int64_t code[2]; |
313 int flavor; | 313 int flavor; |
314 mach_msg_type_number_t old_stateCnt; | 314 mach_msg_type_number_t old_stateCnt; |
315 natural_t old_state[THREAD_STATE_MAX]; | 315 natural_t old_state[THREAD_STATE_MAX]; |
(...skipping 15 matching lines...) Expand all Loading... |
331 old_stateCnt = kThreadStateFlavorCount; | 331 old_stateCnt = kThreadStateFlavorCount; |
332 | 332 |
333 // Adjust the message size for the data that it’s actually carrying, which | 333 // Adjust the message size for the data that it’s actually carrying, which |
334 // may be smaller than the maximum that it can carry. | 334 // may be smaller than the maximum that it can carry. |
335 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); | 335 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); |
336 } | 336 } |
337 }; | 337 }; |
338 | 338 |
339 // The reply messages for exception_raise_state and mach_exception_raise_state | 339 // The reply messages for exception_raise_state and mach_exception_raise_state |
340 // are identical. | 340 // are identical. |
341 typedef ExceptionRaiseStateReply MachExceptionRaiseStateReply; | 341 using MachExceptionRaiseStateReply = ExceptionRaiseStateReply; |
342 | 342 |
343 struct __attribute__((packed, | 343 struct __attribute__((packed, |
344 aligned(4))) MachExceptionRaiseStateIdentityRequest { | 344 aligned(4))) MachExceptionRaiseStateIdentityRequest { |
345 mach_msg_header_t Head; | 345 mach_msg_header_t Head; |
346 mach_msg_body_t msgh_body; | 346 mach_msg_body_t msgh_body; |
347 mach_msg_port_descriptor_t thread; | 347 mach_msg_port_descriptor_t thread; |
348 mach_msg_port_descriptor_t task; | 348 mach_msg_port_descriptor_t task; |
349 NDR_record_t NDR; | 349 NDR_record_t NDR; |
350 exception_type_t exception; | 350 exception_type_t exception; |
351 mach_msg_type_number_t codeCnt; | 351 mach_msg_type_number_t codeCnt; |
(...skipping 23 matching lines...) Expand all Loading... |
375 old_stateCnt = kThreadStateFlavorCount; | 375 old_stateCnt = kThreadStateFlavorCount; |
376 | 376 |
377 // Adjust the message size for the data that it’s actually carrying, which | 377 // Adjust the message size for the data that it’s actually carrying, which |
378 // may be smaller than the maximum that it can carry. | 378 // may be smaller than the maximum that it can carry. |
379 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); | 379 Head.msgh_size += sizeof(old_state[0]) * old_stateCnt - sizeof(old_state); |
380 } | 380 } |
381 }; | 381 }; |
382 | 382 |
383 // The reply messages for exception_raise_state_identity and | 383 // The reply messages for exception_raise_state_identity and |
384 // mach_exception_raise_state_identity are identical. | 384 // mach_exception_raise_state_identity are identical. |
385 typedef ExceptionRaiseStateIdentityReply MachExceptionRaiseStateIdentityReply; | 385 using MachExceptionRaiseStateIdentityReply = ExceptionRaiseStateIdentityReply; |
386 | 386 |
387 // InvalidRequest and BadIDErrorReply are used to test that | 387 // InvalidRequest and BadIDErrorReply are used to test that |
388 // UniversalMachExcServer deals appropriately with messages that it does not | 388 // UniversalMachExcServer deals appropriately with messages that it does not |
389 // understand: messages with an unknown Head.msgh_id. | 389 // understand: messages with an unknown Head.msgh_id. |
390 | 390 |
391 struct __attribute__((packed, aligned(4))) InvalidRequest | 391 struct __attribute__((packed, aligned(4))) InvalidRequest |
392 : public mach_msg_empty_send_t { | 392 : public mach_msg_empty_send_t { |
393 void InitializeForTesting(mach_msg_id_t id) { | 393 void InitializeForTesting(mach_msg_id_t id) { |
394 memset(this, 0xa5, sizeof(*this)); | 394 memset(this, 0xa5, sizeof(*this)); |
395 header.msgh_bits = | 395 header.msgh_bits = |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 | 1167 |
1168 EXPECT_EQ(test_data.kr, | 1168 EXPECT_EQ(test_data.kr, |
1169 ExcServerSuccessfulReturnValue(test_data.behavior, | 1169 ExcServerSuccessfulReturnValue(test_data.behavior, |
1170 test_data.set_thread_state)); | 1170 test_data.set_thread_state)); |
1171 } | 1171 } |
1172 } | 1172 } |
1173 | 1173 |
1174 } // namespace | 1174 } // namespace |
1175 } // namespace test | 1175 } // namespace test |
1176 } // namespace crashpad | 1176 } // namespace crashpad |
OLD | NEW |