Project

General

Profile

Bug #4654

agent LWP evades detection from mdb

Added by Robert Mustacchi over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Category:
mdb - modular debugger
Start date:
2014-03-01
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Should one have a dump in which the agent LWP is present, mdb will not find it. Unfortunately, a dump with an agent is most likely because the agent itself has died, which will make the dump rather difficult to debug:

> mdb core.ksh93.17332 
Loading modules: [ libc.so.1 ld.so.1 ]
> $r
mdb: failed to get current register set: invalid thread identifier

The problem is that mdb is relying on libc_db to find the threads in a process – but the agent LWP does not exist on any libc structures. One can work around this by forcing the thread model to the LWP model (with the heretofore useless "tmodel" dcmd). The LWP model doesn't use libc_db but rather libproc to gather thread information:

> $r
mdb: failed to get current register set: invalid thread identifier
> ::tmodel lwp
> $r
%rax = 0x0000000000000009       %r8  = 0x000000000042bae0
%rbx = 0xfffffd7ffefed148       %r9  = 0x0000000000000200
%rcx = 0x000000000042b6d8       %r10 = 0x000000000042b6d8
%rdx = 0xfffffd7fffdfd2c0       %r11 = 0x000000000042bae0
%rsi = 0xfffffd7ffefed148       %r12 = 0x0000000000000048
%rdi = 0x000000000042b620       %r13 = 0x000000000042b620
                                %r14 = 0xfffffd7fff0162ea
                                %r15 = 0x000000000042b620

%cs = 0x0053    %fs = 0x0000    %gs = 0x0000
%ds = 0x004b    %es = 0x004b    %ss = 0x004b

%rip = 0xfffffd7fff39e0cb 
%rbp = 0xfffffd7fffdfd1c0
%rsp = 0xfffffd7fffdf7fa0

%rflags = 0x00010283
  id=0 vip=0 vif=0 ac=0 vm=0 rf=1 nt=0 iopl=0x0
  status=<of,df,IF,tf,SF,zf,af,pf,CF>

%gsbase = 0x0000000000000000
%fsbase = 0xfffffd7fff172a40
%trapno = 0xe
 %err = 0x6

History

#1

Updated by Electric Monk over 5 years ago

git commit 28ea8e035d9b795cf364f8a33b68afaceca5de8c

Author: Bryan Cantrill <bryan@joyent.com>

4654 agent LWP evades detection from mdb
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

#2

Updated by Robert Mustacchi over 5 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF