@@ -123,8 +123,7 @@ CoreProcess::getRegs(lwpid_t pid, CoreRegisters *reg)
123123#ifdef NT_PRSTATUS
124124 for (auto note : coreImage->notes ) {
125125 if (note.name () == " CORE" && note.type () == NT_PRSTATUS ) {
126- prstatus_t prstatus;
127- note.data ()->readObj (0 , &prstatus);
126+ const auto &prstatus = note.data ()->readObj <prstatus_t >(0 );
128127 if (prstatus.pr_pid == pid) {
129128 memcpy (reg, &prstatus.pr_reg , sizeof (*reg));
130129 return true ;
@@ -136,13 +135,13 @@ CoreProcess::getRegs(lwpid_t pid, CoreRegisters *reg)
136135}
137136
138137void
139- CoreProcess::resume (pid_t )
138+ CoreProcess::resume (pid_t /* unused */ )
140139{
141140 // can't resume post-mortem debugger.
142141}
143142
144143void
145- CoreProcess::stop (lwpid_t )
144+ CoreProcess::stop (lwpid_t /* unused */ )
146145{
147146 // can't stop a dead process.
148147}
@@ -157,25 +156,18 @@ CoreProcess::stopProcess()
157156pid_t
158157CoreProcess::getPID () const
159158{
160- for (auto note : coreImage->notes ) {
161- // Return the PID of the first task in the core.
162- if (note.name () == " CORE" && note.type () == NT_PRSTATUS ) {
163- prstatus_t status;
164- note.data ()->readObj (0 , &status);
165- return status.pr_pid ;
166- }
167- }
159+ // Return the PID of the first task in the core.
160+ for (auto note : coreImage->notes )
161+ if (note.name () == " CORE" && note.type () == NT_PRSTATUS )
162+ return note.data ()->readObj <prstatus_t >(0 ).pr_pid ;
168163 return -1 ;
169164}
170165
171166void
172167CoreProcess::findLWPs ()
173168{
174169 for (auto note : coreImage->notes ) {
175- if (note.name () == " CORE" && note.type () == NT_PRSTATUS ) {
176- prstatus_t status;
177- note.data ()->readObj (0 , &status);
178- (void )lwps[status.pr_pid ];
179- }
170+ if (note.name () == " CORE" && note.type () == NT_PRSTATUS )
171+ (void )lwps[note.data ()->readObj <prstatus_t >(0 ).pr_pid ];
180172 }
181173}
0 commit comments