1 //===-- MachThread.cpp ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Created by Greg Clayton on 6/19/07.
12 //===----------------------------------------------------------------------===//
15 #include <mach/thread_policy.h>
17 #include "MachThread.h"
18 #include "MachProcess.h"
21 #include "ThreadInfo.h"
26 static uint32_t g_nextID = 0;
30 MachThread::MachThread (MachProcess *process, bool is_64_bit, uint64_t unique_thread_id, thread_t mach_port_num) :
32 m_unique_id (unique_thread_id),
33 m_mach_port_number (mach_port_num),
34 m_seq_id (GetSequenceID()),
35 m_state (eStateUnloaded),
36 m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
39 m_arch_ap (DNBArchProtocol::Create (this)),
44 m_dispatch_queue_name(),
45 m_is_64_bit(is_64_bit),
46 m_pthread_qos_class_decode (nullptr)
48 nub_size_t num_reg_sets = 0;
49 m_reg_sets = m_arch_ap->GetRegisterSetInfo (&num_reg_sets);
50 m_num_reg_sets = num_reg_sets;
52 m_pthread_qos_class_decode = (unsigned int (*)(unsigned long, int*, unsigned long*)) dlsym (RTLD_DEFAULT, "_pthread_qos_class_decode");
54 // Get the thread state so we know if a thread is in a state where we can't
55 // muck with it and also so we get the suspend count correct in case it was
58 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%8.8" PRIx64 ", seq_id = %u )", &m_process, m_unique_id, m_seq_id);
61 MachThread::~MachThread()
63 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::~MachThread() for tid = 0x%8.8" PRIx64 " (%u)", m_unique_id, m_seq_id);
71 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
72 if (MachPortNumberIsValid(m_mach_port_number))
74 DNBError err(::thread_suspend (m_mach_port_number), DNBError::MachKernel);
77 if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
78 err.LogThreaded("::thread_suspend (%4.4" PRIx32 ")", m_mach_port_number);
83 MachThread::Resume(bool others_stopped)
85 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
86 if (MachPortNumberIsValid(m_mach_port_number))
88 SetSuspendCountBeforeResume(others_stopped);
93 MachThread::SetSuspendCountBeforeResume(bool others_stopped)
95 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
97 if (MachPortNumberIsValid(m_mach_port_number) == false)
100 integer_t times_to_resume;
106 times_to_resume = m_basic_info.suspend_count;
107 m_suspend_count = - (times_to_resume - m_suspend_count);
114 times_to_resume = m_suspend_count;
118 if (times_to_resume > 0)
120 while (times_to_resume > 0)
122 err = ::thread_resume (m_mach_port_number);
123 if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
124 err.LogThreaded("::thread_resume (%4.4" PRIx32 ")", m_mach_port_number);
130 times_to_resume = m_basic_info.suspend_count;
140 MachThread::RestoreSuspendCountAfterStop ()
142 DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
144 if (MachPortNumberIsValid(m_mach_port_number) == false)
147 if (m_suspend_count > 0)
149 while (m_suspend_count > 0)
151 err = ::thread_resume (m_mach_port_number);
152 if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
153 err.LogThreaded("::thread_resume (%4.4" PRIx32 ")", m_mach_port_number);
159 m_suspend_count = m_basic_info.suspend_count;
166 else if (m_suspend_count < 0)
168 while (m_suspend_count < 0)
170 err = ::thread_suspend (m_mach_port_number);
173 if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
175 err.LogThreaded("::thread_suspend (%4.4" PRIx32 ")", m_mach_port_number);
185 MachThread::GetBasicInfoAsString () const
187 static char g_basic_info_string[1024];
188 struct thread_basic_info basicInfo;
190 if (GetBasicInfo(m_mach_port_number, &basicInfo))
193 // char run_state_str[32];
194 // size_t run_state_str_size = sizeof(run_state_str);
195 // switch (basicInfo.run_state)
197 // case TH_STATE_RUNNING: strncpy(run_state_str, "running", run_state_str_size); break;
198 // case TH_STATE_STOPPED: strncpy(run_state_str, "stopped", run_state_str_size); break;
199 // case TH_STATE_WAITING: strncpy(run_state_str, "waiting", run_state_str_size); break;
200 // case TH_STATE_UNINTERRUPTIBLE: strncpy(run_state_str, "uninterruptible", run_state_str_size); break;
201 // case TH_STATE_HALTED: strncpy(run_state_str, "halted", run_state_str_size); break;
202 // default: snprintf(run_state_str, run_state_str_size, "%d", basicInfo.run_state); break; // ???
204 float user = (float)basicInfo.user_time.seconds + (float)basicInfo.user_time.microseconds / 1000000.0f;
205 float system = (float)basicInfo.user_time.seconds + (float)basicInfo.user_time.microseconds / 1000000.0f;
206 snprintf(g_basic_info_string, sizeof(g_basic_info_string), "Thread 0x%8.8" PRIx64 ": user=%f system=%f cpu=%d sleep_time=%d",
211 basicInfo.sleep_time);
213 return g_basic_info_string;
218 // Finds the Mach port number for a given thread in the inferior process' port namespace.
220 MachThread::InferiorThreadID() const
222 mach_msg_type_number_t i;
223 mach_port_name_array_t names;
224 mach_port_type_array_t types;
225 mach_msg_type_number_t ncount, tcount;
226 thread_t inferior_tid = INVALID_NUB_THREAD;
227 task_t my_task = ::mach_task_self();
228 task_t task = m_process->Task().TaskPort();
230 kern_return_t kret = ::mach_port_names (task, &names, &ncount, &types, &tcount);
231 if (kret == KERN_SUCCESS)
234 for (i = 0; i < ncount; i++)
237 mach_msg_type_name_t my_type;
239 kret = ::mach_port_extract_right (task, names[i], MACH_MSG_TYPE_COPY_SEND, &my_name, &my_type);
240 if (kret == KERN_SUCCESS)
242 ::mach_port_deallocate (my_task, my_name);
243 if (my_name == m_mach_port_number)
245 inferior_tid = names[i];
250 // Free up the names and types
251 ::vm_deallocate (my_task, (vm_address_t) names, ncount * sizeof (mach_port_name_t));
252 ::vm_deallocate (my_task, (vm_address_t) types, tcount * sizeof (mach_port_type_t));
258 MachThread::IsUserReady()
260 if (m_basic_info.run_state == 0)
263 switch (m_basic_info.run_state)
266 case TH_STATE_UNINTERRUPTIBLE:
269 case TH_STATE_RUNNING:
270 case TH_STATE_STOPPED:
271 case TH_STATE_WAITING:
272 case TH_STATE_HALTED:
278 struct thread_basic_info *
279 MachThread::GetBasicInfo ()
281 if (MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info))
282 return &m_basic_info;
288 MachThread::GetBasicInfo(thread_t thread, struct thread_basic_info *basicInfoPtr)
290 if (MachPortNumberIsValid(thread))
292 unsigned int info_count = THREAD_BASIC_INFO_COUNT;
293 kern_return_t err = ::thread_info (thread, THREAD_BASIC_INFO, (thread_info_t) basicInfoPtr, &info_count);
294 if (err == KERN_SUCCESS)
297 ::memset (basicInfoPtr, 0, sizeof (struct thread_basic_info));
303 MachThread::ThreadIDIsValid(uint64_t thread)
309 MachThread::MachPortNumberIsValid(thread_t thread)
311 return thread != THREAD_NULL;
315 MachThread::GetRegisterState(int flavor, bool force)
317 return m_arch_ap->GetRegisterState(flavor, force) == KERN_SUCCESS;
321 MachThread::SetRegisterState(int flavor)
323 return m_arch_ap->SetRegisterState(flavor) == KERN_SUCCESS;
327 MachThread::GetPC(uint64_t failValue)
329 // Get program counter
330 return m_arch_ap->GetPC(failValue);
334 MachThread::SetPC(uint64_t value)
336 // Set program counter
337 return m_arch_ap->SetPC(value);
341 MachThread::GetSP(uint64_t failValue)
344 return m_arch_ap->GetSP(failValue);
348 MachThread::ProcessID() const
351 return m_process->ProcessID();
352 return INVALID_NUB_PROCESS;
356 MachThread::Dump(uint32_t index)
358 const char * thread_run_state = NULL;
360 switch (m_basic_info.run_state)
362 case TH_STATE_RUNNING: thread_run_state = "running"; break; // 1 thread is running normally
363 case TH_STATE_STOPPED: thread_run_state = "stopped"; break; // 2 thread is stopped
364 case TH_STATE_WAITING: thread_run_state = "waiting"; break; // 3 thread is waiting normally
365 case TH_STATE_UNINTERRUPTIBLE: thread_run_state = "uninter"; break; // 4 thread is in an uninterruptible wait
366 case TH_STATE_HALTED: thread_run_state = "halted "; break; // 5 thread is halted at a
367 default: thread_run_state = "???"; break;
370 DNBLogThreaded("[%3u] #%3u tid: 0x%8.8" PRIx64 ", pc: 0x%16.16" PRIx64 ", sp: 0x%16.16" PRIx64 ", user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
374 GetPC(INVALID_NUB_ADDRESS),
375 GetSP(INVALID_NUB_ADDRESS),
376 m_basic_info.user_time.seconds, m_basic_info.user_time.microseconds,
377 m_basic_info.system_time.seconds, m_basic_info.system_time.microseconds,
378 m_basic_info.cpu_usage,
380 m_basic_info.run_state,
383 m_basic_info.suspend_count, m_suspend_count,
384 m_basic_info.sleep_time);
385 //DumpRegisterState(0);
389 MachThread::ThreadWillResume(const DNBThreadResumeAction *thread_action, bool others_stopped)
391 if (thread_action->addr != INVALID_NUB_ADDRESS)
392 SetPC (thread_action->addr);
394 SetState (thread_action->state);
395 switch (thread_action->state)
398 case eStateSuspended:
399 assert (others_stopped == false);
405 Resume(others_stopped);
410 m_arch_ap->ThreadWillResume();
411 m_stop_exception.Clear();
415 MachThread::CurrentBreakpoint()
417 return m_process->Breakpoints().FindByAddress(GetPC());
421 MachThread::ShouldStop(bool &step_more)
423 // See if this thread is at a breakpoint?
424 DNBBreakpoint *bp = CurrentBreakpoint();
428 // This thread is sitting at a breakpoint, ask the breakpoint
429 // if we should be stopping here.
434 if (m_arch_ap->StepNotComplete())
439 // The thread state is used to let us know what the thread was
440 // trying to do. MachThread::ThreadWillResume() will set the
441 // thread state to various values depending if the thread was
442 // the current thread and if it was to be single stepped, or
444 if (GetState() == eStateRunning)
446 // If our state is running, then we should continue as we are in
447 // the process of stepping over a breakpoint.
452 // Stop if we have any kind of valid exception for this
454 if (GetStopException().IsValid())
461 MachThread::IsStepping()
463 return GetState() == eStateStepping;
468 MachThread::ThreadDidStop()
470 // This thread has existed prior to resuming under debug nub control,
471 // and has just been stopped. Do any cleanup that needs to be done
474 // The thread state and breakpoint will still have the same values
475 // as they had prior to resuming the thread, so it makes it easy to check
476 // if we were trying to step a thread, or we tried to resume while being
479 // When this method gets called, the process state is still in the
480 // state it was in while running so we can act accordingly.
481 m_arch_ap->ThreadDidStop();
484 // We may have suspended this thread so the primary thread could step
485 // without worrying about race conditions, so lets restore our suspend
487 RestoreSuspendCountAfterStop();
489 // Update the basic information for a thread
490 MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info);
492 if (m_basic_info.suspend_count > 0)
493 SetState(eStateSuspended);
495 SetState(eStateStopped);
500 MachThread::NotifyException(MachException::Data& exc)
502 // Allow the arch specific protocol to process (MachException::Data &)exc
503 // first before possible reassignment of m_stop_exception with exc.
504 // See also MachThread::GetStopException().
505 bool handled = m_arch_ap->NotifyException(exc);
507 if (m_stop_exception.IsValid())
509 // We may have more than one exception for a thread, but we need to
510 // only remember the one that we will say is the reason we stopped.
511 // We may have been single stepping and also gotten a signal exception,
512 // so just remember the most pertinent one.
513 if (m_stop_exception.IsBreakpoint())
514 m_stop_exception = exc;
518 m_stop_exception = exc;
526 MachThread::GetState()
528 // If any other threads access this we will need a mutex for it
529 PTHREAD_MUTEX_LOCKER (locker, m_state_mutex);
534 MachThread::SetState(nub_state_t state)
536 PTHREAD_MUTEX_LOCKER (locker, m_state_mutex);
538 DNBLogThreadedIf(LOG_THREAD, "MachThread::SetState ( %s ) for tid = 0x%8.8" PRIx64 "", DNBStateAsString(state), m_unique_id);
542 MachThread::GetNumRegistersInSet(nub_size_t regSet) const
544 if (regSet < m_num_reg_sets)
545 return m_reg_sets[regSet].num_registers;
550 MachThread::GetRegisterSetName(nub_size_t regSet) const
552 if (regSet < m_num_reg_sets)
553 return m_reg_sets[regSet].name;
557 const DNBRegisterInfo *
558 MachThread::GetRegisterInfo(nub_size_t regSet, nub_size_t regIndex) const
560 if (regSet < m_num_reg_sets)
561 if (regIndex < m_reg_sets[regSet].num_registers)
562 return &m_reg_sets[regSet].registers[regIndex];
566 MachThread::DumpRegisterState(nub_size_t regSet)
568 if (regSet == REGISTER_SET_ALL)
570 for (regSet = 1; regSet < m_num_reg_sets; regSet++)
571 DumpRegisterState(regSet);
575 if (m_arch_ap->RegisterSetStateIsValid((int)regSet))
577 const size_t numRegisters = GetNumRegistersInSet(regSet);
578 uint32_t regIndex = 0;
579 DNBRegisterValueClass reg;
580 for (regIndex = 0; regIndex < numRegisters; ++regIndex)
582 if (m_arch_ap->GetRegisterValue((uint32_t)regSet, regIndex, ®))
584 reg.Dump(NULL, NULL);
590 DNBLog("%s: registers are not currently valid.", GetRegisterSetName(regSet));
595 const DNBRegisterSetInfo *
596 MachThread::GetRegisterSetInfo(nub_size_t *num_reg_sets ) const
598 *num_reg_sets = m_num_reg_sets;
599 return &m_reg_sets[0];
603 MachThread::GetRegisterValue ( uint32_t set, uint32_t reg, DNBRegisterValue *value )
605 return m_arch_ap->GetRegisterValue(set, reg, value);
609 MachThread::SetRegisterValue ( uint32_t set, uint32_t reg, const DNBRegisterValue *value )
611 return m_arch_ap->SetRegisterValue(set, reg, value);
615 MachThread::GetRegisterContext (void *buf, nub_size_t buf_len)
617 return m_arch_ap->GetRegisterContext(buf, buf_len);
621 MachThread::SetRegisterContext (const void *buf, nub_size_t buf_len)
623 return m_arch_ap->SetRegisterContext(buf, buf_len);
627 MachThread::SaveRegisterState ()
629 return m_arch_ap->SaveRegisterState();
633 MachThread::RestoreRegisterState (uint32_t save_id)
635 return m_arch_ap->RestoreRegisterState(save_id);
639 MachThread::EnableHardwareBreakpoint (const DNBBreakpoint *bp)
641 if (bp != NULL && bp->IsBreakpoint())
642 return m_arch_ap->EnableHardwareBreakpoint(bp->Address(), bp->ByteSize());
643 return INVALID_NUB_HW_INDEX;
647 MachThread::EnableHardwareWatchpoint (const DNBBreakpoint *wp, bool also_set_on_task)
649 if (wp != NULL && wp->IsWatchpoint())
650 return m_arch_ap->EnableHardwareWatchpoint(wp->Address(), wp->ByteSize(), wp->WatchpointRead(), wp->WatchpointWrite(), also_set_on_task);
651 return INVALID_NUB_HW_INDEX;
655 MachThread::RollbackTransForHWP()
657 return m_arch_ap->RollbackTransForHWP();
661 MachThread::FinishTransForHWP()
663 return m_arch_ap->FinishTransForHWP();
667 MachThread::DisableHardwareBreakpoint (const DNBBreakpoint *bp)
669 if (bp != NULL && bp->IsHardware())
670 return m_arch_ap->DisableHardwareBreakpoint(bp->GetHardwareIndex());
675 MachThread::DisableHardwareWatchpoint (const DNBBreakpoint *wp, bool also_set_on_task)
677 if (wp != NULL && wp->IsHardware())
678 return m_arch_ap->DisableHardwareWatchpoint(wp->GetHardwareIndex(), also_set_on_task);
683 MachThread::NumSupportedHardwareWatchpoints () const
685 return m_arch_ap->NumSupportedHardwareWatchpoints();
689 MachThread::GetIdentifierInfo ()
691 // Don't try to get the thread info once and cache it for the life of the thread. It changes over time, for instance
692 // if the thread name changes, then the thread_handle also changes... So you have to refetch it every time.
693 mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
694 kern_return_t kret = ::thread_info (m_mach_port_number, THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count);
695 return kret == KERN_SUCCESS;
702 MachThread::GetName ()
704 if (GetIdentifierInfo ())
706 int len = ::proc_pidinfo (m_process->ProcessID(), PROC_PIDTHREADINFO, m_ident_info.thread_handle, &m_proc_threadinfo, sizeof (m_proc_threadinfo));
708 if (len && m_proc_threadinfo.pth_name[0])
709 return m_proc_threadinfo.pth_name;
716 MachThread::GetGloballyUniqueThreadIDForMachPortID (thread_t mach_port_id)
719 thread_identifier_info_data_t tident;
720 mach_msg_type_number_t tident_count = THREAD_IDENTIFIER_INFO_COUNT;
721 kr = thread_info (mach_port_id, THREAD_IDENTIFIER_INFO,
722 (thread_info_t) &tident, &tident_count);
723 if (kr != KERN_SUCCESS)
727 return tident.thread_id;
731 MachThread::GetPThreadT ()
733 nub_addr_t pthread_t_value = INVALID_NUB_ADDRESS;
734 if (MachPortNumberIsValid (m_mach_port_number))
737 thread_identifier_info_data_t tident;
738 mach_msg_type_number_t tident_count = THREAD_IDENTIFIER_INFO_COUNT;
739 kr = thread_info (m_mach_port_number, THREAD_IDENTIFIER_INFO,
740 (thread_info_t) &tident, &tident_count);
741 if (kr == KERN_SUCCESS)
743 // Dereference thread_handle to get the pthread_t value for this thread.
747 if (m_process->ReadMemory (tident.thread_handle, 8, &addr) == 8)
751 pthread_t_value = addr;
758 if (m_process->ReadMemory (tident.thread_handle, 4, &addr) == 4)
762 pthread_t_value = addr;
768 return pthread_t_value;
771 // Return this thread's TSD (Thread Specific Data) address.
772 // This is computed based on this thread's pthread_t value.
774 // We compute the TSD from the pthread_t by one of two methods.
776 // If plo_pthread_tsd_base_offset is non-zero, this is a simple offset that we add to
777 // the pthread_t to get the TSD base address.
779 // Else we read a pointer from memory at pthread_t + plo_pthread_tsd_base_address_offset and
780 // that gives us the TSD address.
782 // These plo_pthread_tsd_base values must be read out of libpthread by lldb & provided to debugserver.
785 MachThread::GetTSDAddressForThread (uint64_t plo_pthread_tsd_base_address_offset, uint64_t plo_pthread_tsd_base_offset, uint64_t plo_pthread_tsd_entry_size)
787 nub_addr_t tsd_addr = INVALID_NUB_ADDRESS;
788 nub_addr_t pthread_t_value = GetPThreadT();
789 if (plo_pthread_tsd_base_offset != 0 && plo_pthread_tsd_base_offset != INVALID_NUB_ADDRESS)
791 tsd_addr = pthread_t_value + plo_pthread_tsd_base_offset;
795 if (plo_pthread_tsd_entry_size == 4)
798 if (m_process->ReadMemory (pthread_t_value + plo_pthread_tsd_base_address_offset, 4, &addr) == 4)
806 if (plo_pthread_tsd_entry_size == 4)
809 if (m_process->ReadMemory (pthread_t_value + plo_pthread_tsd_base_address_offset, 8, &addr) == 8)
823 MachThread::GetDispatchQueueT ()
825 nub_addr_t dispatch_queue_t_value = INVALID_NUB_ADDRESS;
826 if (MachPortNumberIsValid (m_mach_port_number))
829 thread_identifier_info_data_t tident;
830 mach_msg_type_number_t tident_count = THREAD_IDENTIFIER_INFO_COUNT;
831 kr = thread_info (m_mach_port_number, THREAD_IDENTIFIER_INFO,
832 (thread_info_t) &tident, &tident_count);
833 if (kr == KERN_SUCCESS && tident.dispatch_qaddr != 0 && tident.dispatch_qaddr != INVALID_NUB_ADDRESS)
835 // Dereference dispatch_qaddr to get the dispatch_queue_t value for this thread's queue, if any.
839 if (m_process->ReadMemory (tident.dispatch_qaddr, 8, &addr) == 8)
842 dispatch_queue_t_value = addr;
848 if (m_process->ReadMemory (tident.dispatch_qaddr, 4, &addr) == 4)
851 dispatch_queue_t_value = addr;
856 return dispatch_queue_t_value;
861 MachThread::GetRequestedQoS (nub_addr_t tsd, uint64_t dti_qos_class_index)
863 ThreadInfo::QoS qos_value;
864 if (MachPortNumberIsValid (m_mach_port_number) && m_pthread_qos_class_decode != nullptr)
866 uint64_t pthread_priority_value = 0;
870 if (m_process->ReadMemory (tsd + (dti_qos_class_index * 8), 8, &pri) == 8)
872 pthread_priority_value = pri;
878 if (m_process->ReadMemory (tsd + (dti_qos_class_index * 4), 4, &pri) == 4)
880 pthread_priority_value = pri;
884 uint32_t requested_qos = m_pthread_qos_class_decode (pthread_priority_value, NULL, NULL);
886 switch (requested_qos)
888 // These constants from <pthread/qos.h>
890 qos_value.enum_value = requested_qos;
891 qos_value.constant_name = "QOS_CLASS_USER_INTERACTIVE";
892 qos_value.printable_name = "User Interactive";
895 qos_value.enum_value = requested_qos;
896 qos_value.constant_name = "QOS_CLASS_USER_INITIATED";
897 qos_value.printable_name = "User Initiated";
900 qos_value.enum_value = requested_qos;
901 qos_value.constant_name = "QOS_CLASS_DEFAULT";
902 qos_value.printable_name = "Default";
905 qos_value.enum_value = requested_qos;
906 qos_value.constant_name = "QOS_CLASS_UTILITY";
907 qos_value.printable_name = "Utility";
910 qos_value.enum_value = requested_qos;
911 qos_value.constant_name = "QOS_CLASS_BACKGROUND";
912 qos_value.printable_name = "Background";
915 qos_value.enum_value = requested_qos;
916 qos_value.constant_name = "QOS_CLASS_UNSPECIFIED";
917 qos_value.printable_name = "Unspecified";