comparison agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java @ 8750:39432a1cefdd

8003348: SA can not read core file on OS Summary: Macosx uses Mach-O file format for binary files, not ELF format. Currently SA works on core files on other platforms, t his change enables SA work on core file generated on Darwin. Reviewed-by: sla, sspitsyn Contributed-by: yumin.qi@oracle.com
author minqi
date Thu, 14 Mar 2013 00:33:08 -0700
parents 758935f7c23f
children
comparison
equal deleted inserted replaced
8719:c8b31b461e1a 8750:39432a1cefdd
1 /* 1 /*
2 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
42 this.unique_thread_id = uniqueThreadIdAddr.getCIntegerAt(0, 8, true); 42 this.unique_thread_id = uniqueThreadIdAddr.getCIntegerAt(0, 8, true);
43 } 43 }
44 44
45 BsdThread(BsdDebugger debugger, long id) { 45 BsdThread(BsdDebugger debugger, long id) {
46 this.debugger = debugger; 46 this.debugger = debugger;
47 this.thread_id = (int) id; 47 // use unique_thread_id to identify thread
48 this.unique_thread_id = id;
48 } 49 }
49 50
50 public boolean equals(Object obj) { 51 public boolean equals(Object obj) {
51 if ((obj == null) || !(obj instanceof BsdThread)) { 52 if ((obj == null) || !(obj instanceof BsdThread)) {
52 return false; 53 return false;
53 } 54 }
54 55
55 return (((BsdThread) obj).thread_id == thread_id); 56 return (((BsdThread) obj).unique_thread_id == unique_thread_id);
56 } 57 }
57 58
58 public int hashCode() { 59 public int hashCode() {
59 return thread_id; 60 return thread_id;
60 } 61 }
78 79
79 public void setContext(ThreadContext context) 80 public void setContext(ThreadContext context)
80 throws IllegalThreadStateException, DebuggerException { 81 throws IllegalThreadStateException, DebuggerException {
81 throw new DebuggerException("Unimplemented"); 82 throw new DebuggerException("Unimplemented");
82 } 83 }
84
85 /** this is not interface function, used in core file to get unique thread id on Macosx*/
86 public long getUniqueThreadId() {
87 return unique_thread_id;
88 }
83 } 89 }