Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- Target.cpp ----------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "lldb/Target/Target.h" |
| 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
| 15 | // Project includes |
| 16 | #include "lldb/Breakpoint/BreakpointResolver.h" |
| 17 | #include "lldb/Breakpoint/BreakpointResolverAddress.h" |
| 18 | #include "lldb/Breakpoint/BreakpointResolverFileLine.h" |
| 19 | #include "lldb/Breakpoint/BreakpointResolverName.h" |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 20 | #include "lldb/Core/DataBufferMemoryMap.h" |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 21 | #include "lldb/Core/Debugger.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 22 | #include "lldb/Core/Event.h" |
| 23 | #include "lldb/Core/Log.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 24 | #include "lldb/Core/StreamString.h" |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 25 | #include "lldb/Core/Timer.h" |
| 26 | #include "lldb/Core/ValueObject.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 27 | #include "lldb/Host/Host.h" |
| 28 | #include "lldb/lldb-private-log.h" |
| 29 | #include "lldb/Symbol/ObjectFile.h" |
| 30 | #include "lldb/Target/Process.h" |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 31 | #include "lldb/Target/StackFrame.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 32 | |
| 33 | using namespace lldb; |
| 34 | using namespace lldb_private; |
| 35 | |
| 36 | //---------------------------------------------------------------------- |
| 37 | // Target constructor |
| 38 | //---------------------------------------------------------------------- |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 39 | Target::Target(Debugger &debugger) : |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 40 | Broadcaster("lldb.target"), |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 41 | TargetInstanceSettings (*GetSettingsController()), |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 42 | m_debugger (debugger), |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 43 | m_mutex (Mutex::eMutexTypeRecursive), |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 44 | m_images(), |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 45 | m_section_load_list (), |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 46 | m_breakpoint_list (false), |
| 47 | m_internal_breakpoint_list (true), |
| 48 | m_process_sp(), |
| 49 | m_triple(), |
| 50 | m_search_filter_sp(), |
| 51 | m_image_search_paths (ImageSearchPathsChanged, this), |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 52 | m_scratch_ast_context_ap (NULL), |
| 53 | m_persistent_variables () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 54 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 55 | SetEventName (eBroadcastBitBreakpointChanged, "breakpoint-changed"); |
| 56 | SetEventName (eBroadcastBitModulesLoaded, "modules-loaded"); |
| 57 | SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded"); |
| 58 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 59 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 60 | if (log) |
| 61 | log->Printf ("%p Target::Target()", this); |
| 62 | } |
| 63 | |
| 64 | //---------------------------------------------------------------------- |
| 65 | // Destructor |
| 66 | //---------------------------------------------------------------------- |
| 67 | Target::~Target() |
| 68 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 69 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 70 | if (log) |
| 71 | log->Printf ("%p Target::~Target()", this); |
| 72 | DeleteCurrentProcess (); |
| 73 | } |
| 74 | |
| 75 | void |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 76 | Target::Dump (Stream *s, lldb::DescriptionLevel description_level) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 77 | { |
Greg Clayton | 3fed8b9 | 2010-10-08 00:21:05 +0000 | [diff] [blame] | 78 | // s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 79 | if (description_level != lldb::eDescriptionLevelBrief) |
| 80 | { |
| 81 | s->Indent(); |
| 82 | s->PutCString("Target\n"); |
| 83 | s->IndentMore(); |
Greg Clayton | 3f5ee7f | 2010-10-29 04:59:35 +0000 | [diff] [blame] | 84 | m_images.Dump(s); |
| 85 | m_breakpoint_list.Dump(s); |
| 86 | m_internal_breakpoint_list.Dump(s); |
| 87 | s->IndentLess(); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 88 | } |
| 89 | else |
| 90 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 91 | s->PutCString (GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 92 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | void |
| 96 | Target::DeleteCurrentProcess () |
| 97 | { |
| 98 | if (m_process_sp.get()) |
| 99 | { |
Greg Clayton | 49480b1 | 2010-09-14 23:52:43 +0000 | [diff] [blame] | 100 | m_section_load_list.Clear(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 101 | if (m_process_sp->IsAlive()) |
| 102 | m_process_sp->Destroy(); |
| 103 | else |
| 104 | m_process_sp->Finalize(); |
| 105 | |
| 106 | // Do any cleanup of the target we need to do between process instances. |
| 107 | // NB It is better to do this before destroying the process in case the |
| 108 | // clean up needs some help from the process. |
| 109 | m_breakpoint_list.ClearAllBreakpointSites(); |
| 110 | m_internal_breakpoint_list.ClearAllBreakpointSites(); |
| 111 | m_process_sp.reset(); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | const lldb::ProcessSP & |
| 116 | Target::CreateProcess (Listener &listener, const char *plugin_name) |
| 117 | { |
| 118 | DeleteCurrentProcess (); |
| 119 | m_process_sp.reset(Process::FindPlugin(*this, plugin_name, listener)); |
| 120 | return m_process_sp; |
| 121 | } |
| 122 | |
| 123 | const lldb::ProcessSP & |
| 124 | Target::GetProcessSP () const |
| 125 | { |
| 126 | return m_process_sp; |
| 127 | } |
| 128 | |
| 129 | lldb::TargetSP |
| 130 | Target::GetSP() |
| 131 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 132 | return m_debugger.GetTargetList().GetTargetSP(this); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | BreakpointList & |
| 136 | Target::GetBreakpointList(bool internal) |
| 137 | { |
| 138 | if (internal) |
| 139 | return m_internal_breakpoint_list; |
| 140 | else |
| 141 | return m_breakpoint_list; |
| 142 | } |
| 143 | |
| 144 | const BreakpointList & |
| 145 | Target::GetBreakpointList(bool internal) const |
| 146 | { |
| 147 | if (internal) |
| 148 | return m_internal_breakpoint_list; |
| 149 | else |
| 150 | return m_breakpoint_list; |
| 151 | } |
| 152 | |
| 153 | BreakpointSP |
| 154 | Target::GetBreakpointByID (break_id_t break_id) |
| 155 | { |
| 156 | BreakpointSP bp_sp; |
| 157 | |
| 158 | if (LLDB_BREAK_ID_IS_INTERNAL (break_id)) |
| 159 | bp_sp = m_internal_breakpoint_list.FindBreakpointByID (break_id); |
| 160 | else |
| 161 | bp_sp = m_breakpoint_list.FindBreakpointByID (break_id); |
| 162 | |
| 163 | return bp_sp; |
| 164 | } |
| 165 | |
| 166 | BreakpointSP |
| 167 | Target::CreateBreakpoint (const FileSpec *containingModule, const FileSpec &file, uint32_t line_no, bool check_inlines, bool internal) |
| 168 | { |
| 169 | SearchFilterSP filter_sp(GetSearchFilterForModule (containingModule)); |
| 170 | BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL, file, line_no, check_inlines)); |
| 171 | return CreateBreakpoint (filter_sp, resolver_sp, internal); |
| 172 | } |
| 173 | |
| 174 | |
| 175 | BreakpointSP |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 176 | Target::CreateBreakpoint (lldb::addr_t addr, bool internal) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 177 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 178 | Address so_addr; |
| 179 | // Attempt to resolve our load address if possible, though it is ok if |
| 180 | // it doesn't resolve to section/offset. |
| 181 | |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 182 | // Try and resolve as a load address if possible |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 183 | m_section_load_list.ResolveLoadAddress(addr, so_addr); |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 184 | if (!so_addr.IsValid()) |
| 185 | { |
| 186 | // The address didn't resolve, so just set this as an absolute address |
| 187 | so_addr.SetOffset (addr); |
| 188 | } |
| 189 | BreakpointSP bp_sp (CreateBreakpoint(so_addr, internal)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 190 | return bp_sp; |
| 191 | } |
| 192 | |
| 193 | BreakpointSP |
| 194 | Target::CreateBreakpoint (Address &addr, bool internal) |
| 195 | { |
| 196 | TargetSP target_sp = this->GetSP(); |
| 197 | SearchFilterSP filter_sp(new SearchFilter (target_sp)); |
| 198 | BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr)); |
| 199 | return CreateBreakpoint (filter_sp, resolver_sp, internal); |
| 200 | } |
| 201 | |
| 202 | BreakpointSP |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 203 | Target::CreateBreakpoint (FileSpec *containingModule, const char *func_name, uint32_t func_name_type_mask, bool internal) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 204 | { |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 205 | BreakpointSP bp_sp; |
| 206 | if (func_name) |
| 207 | { |
| 208 | SearchFilterSP filter_sp(GetSearchFilterForModule (containingModule)); |
| 209 | BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, func_name, func_name_type_mask, Breakpoint::Exact)); |
| 210 | bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal); |
| 211 | } |
| 212 | return bp_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | |
| 216 | SearchFilterSP |
| 217 | Target::GetSearchFilterForModule (const FileSpec *containingModule) |
| 218 | { |
| 219 | SearchFilterSP filter_sp; |
| 220 | lldb::TargetSP target_sp = this->GetSP(); |
| 221 | if (containingModule != NULL) |
| 222 | { |
| 223 | // TODO: We should look into sharing module based search filters |
| 224 | // across many breakpoints like we do for the simple target based one |
| 225 | filter_sp.reset (new SearchFilterByModule (target_sp, *containingModule)); |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | if (m_search_filter_sp.get() == NULL) |
| 230 | m_search_filter_sp.reset (new SearchFilter (target_sp)); |
| 231 | filter_sp = m_search_filter_sp; |
| 232 | } |
| 233 | return filter_sp; |
| 234 | } |
| 235 | |
| 236 | BreakpointSP |
| 237 | Target::CreateBreakpoint (FileSpec *containingModule, RegularExpression &func_regex, bool internal) |
| 238 | { |
| 239 | SearchFilterSP filter_sp(GetSearchFilterForModule (containingModule)); |
| 240 | BreakpointResolverSP resolver_sp(new BreakpointResolverName (NULL, func_regex)); |
| 241 | |
| 242 | return CreateBreakpoint (filter_sp, resolver_sp, internal); |
| 243 | } |
| 244 | |
| 245 | BreakpointSP |
| 246 | Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp, bool internal) |
| 247 | { |
| 248 | BreakpointSP bp_sp; |
| 249 | if (filter_sp && resolver_sp) |
| 250 | { |
| 251 | bp_sp.reset(new Breakpoint (*this, filter_sp, resolver_sp)); |
| 252 | resolver_sp->SetBreakpoint (bp_sp.get()); |
| 253 | |
| 254 | if (internal) |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 255 | m_internal_breakpoint_list.Add (bp_sp, false); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 256 | else |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 257 | m_breakpoint_list.Add (bp_sp, true); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 258 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 259 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 260 | if (log) |
| 261 | { |
| 262 | StreamString s; |
| 263 | bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); |
| 264 | log->Printf ("Target::%s (internal = %s) => break_id = %s\n", __FUNCTION__, internal ? "yes" : "no", s.GetData()); |
| 265 | } |
| 266 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 267 | bp_sp->ResolveBreakpoint(); |
| 268 | } |
Jim Ingham | d168690 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 269 | |
| 270 | if (!internal && bp_sp) |
| 271 | { |
| 272 | m_last_created_breakpoint = bp_sp; |
| 273 | } |
| 274 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 275 | return bp_sp; |
| 276 | } |
| 277 | |
| 278 | void |
| 279 | Target::RemoveAllBreakpoints (bool internal_also) |
| 280 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 281 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 282 | if (log) |
| 283 | log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); |
| 284 | |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 285 | m_breakpoint_list.RemoveAll (true); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 286 | if (internal_also) |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 287 | m_internal_breakpoint_list.RemoveAll (false); |
Jim Ingham | d168690 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 288 | |
| 289 | m_last_created_breakpoint.reset(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | void |
| 293 | Target::DisableAllBreakpoints (bool internal_also) |
| 294 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 295 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 296 | if (log) |
| 297 | log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); |
| 298 | |
| 299 | m_breakpoint_list.SetEnabledAll (false); |
| 300 | if (internal_also) |
| 301 | m_internal_breakpoint_list.SetEnabledAll (false); |
| 302 | } |
| 303 | |
| 304 | void |
| 305 | Target::EnableAllBreakpoints (bool internal_also) |
| 306 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 307 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 308 | if (log) |
| 309 | log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); |
| 310 | |
| 311 | m_breakpoint_list.SetEnabledAll (true); |
| 312 | if (internal_also) |
| 313 | m_internal_breakpoint_list.SetEnabledAll (true); |
| 314 | } |
| 315 | |
| 316 | bool |
| 317 | Target::RemoveBreakpointByID (break_id_t break_id) |
| 318 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 319 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 320 | if (log) |
| 321 | log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); |
| 322 | |
| 323 | if (DisableBreakpointByID (break_id)) |
| 324 | { |
| 325 | if (LLDB_BREAK_ID_IS_INTERNAL (break_id)) |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 326 | m_internal_breakpoint_list.Remove(break_id, false); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 327 | else |
Jim Ingham | d168690 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 328 | { |
Greg Clayton | 22c9e0d | 2011-01-24 23:35:47 +0000 | [diff] [blame^] | 329 | if (m_last_created_breakpoint) |
| 330 | { |
| 331 | if (m_last_created_breakpoint->GetID() == break_id) |
| 332 | m_last_created_breakpoint.reset(); |
| 333 | } |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 334 | m_breakpoint_list.Remove(break_id, true); |
Jim Ingham | d168690 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 335 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 336 | return true; |
| 337 | } |
| 338 | return false; |
| 339 | } |
| 340 | |
| 341 | bool |
| 342 | Target::DisableBreakpointByID (break_id_t break_id) |
| 343 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 344 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 345 | if (log) |
| 346 | log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); |
| 347 | |
| 348 | BreakpointSP bp_sp; |
| 349 | |
| 350 | if (LLDB_BREAK_ID_IS_INTERNAL (break_id)) |
| 351 | bp_sp = m_internal_breakpoint_list.FindBreakpointByID (break_id); |
| 352 | else |
| 353 | bp_sp = m_breakpoint_list.FindBreakpointByID (break_id); |
| 354 | if (bp_sp) |
| 355 | { |
| 356 | bp_sp->SetEnabled (false); |
| 357 | return true; |
| 358 | } |
| 359 | return false; |
| 360 | } |
| 361 | |
| 362 | bool |
| 363 | Target::EnableBreakpointByID (break_id_t break_id) |
| 364 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 365 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 366 | if (log) |
| 367 | log->Printf ("Target::%s (break_id = %i, internal = %s)\n", |
| 368 | __FUNCTION__, |
| 369 | break_id, |
| 370 | LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); |
| 371 | |
| 372 | BreakpointSP bp_sp; |
| 373 | |
| 374 | if (LLDB_BREAK_ID_IS_INTERNAL (break_id)) |
| 375 | bp_sp = m_internal_breakpoint_list.FindBreakpointByID (break_id); |
| 376 | else |
| 377 | bp_sp = m_breakpoint_list.FindBreakpointByID (break_id); |
| 378 | |
| 379 | if (bp_sp) |
| 380 | { |
| 381 | bp_sp->SetEnabled (true); |
| 382 | return true; |
| 383 | } |
| 384 | return false; |
| 385 | } |
| 386 | |
| 387 | ModuleSP |
| 388 | Target::GetExecutableModule () |
| 389 | { |
| 390 | ModuleSP executable_sp; |
| 391 | if (m_images.GetSize() > 0) |
| 392 | executable_sp = m_images.GetModuleAtIndex(0); |
| 393 | return executable_sp; |
| 394 | } |
| 395 | |
| 396 | void |
| 397 | Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) |
| 398 | { |
| 399 | m_images.Clear(); |
| 400 | m_scratch_ast_context_ap.reset(); |
| 401 | |
| 402 | if (executable_sp.get()) |
| 403 | { |
| 404 | Timer scoped_timer (__PRETTY_FUNCTION__, |
| 405 | "Target::SetExecutableModule (executable = '%s/%s')", |
| 406 | executable_sp->GetFileSpec().GetDirectory().AsCString(), |
| 407 | executable_sp->GetFileSpec().GetFilename().AsCString()); |
| 408 | |
| 409 | m_images.Append(executable_sp); // The first image is our exectuable file |
| 410 | |
| 411 | ArchSpec exe_arch = executable_sp->GetArchitecture(); |
Jim Ingham | 7508e73 | 2010-08-09 23:31:02 +0000 | [diff] [blame] | 412 | // If we haven't set an architecture yet, reset our architecture based on what we found in the executable module. |
| 413 | if (!m_arch_spec.IsValid()) |
| 414 | m_arch_spec = exe_arch; |
| 415 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 416 | FileSpecList dependent_files; |
| 417 | ObjectFile * executable_objfile = executable_sp->GetObjectFile(); |
| 418 | if (executable_objfile == NULL) |
| 419 | { |
| 420 | |
| 421 | FileSpec bundle_executable(executable_sp->GetFileSpec()); |
Greg Clayton | 24b48ff | 2010-10-17 22:03:32 +0000 | [diff] [blame] | 422 | if (Host::ResolveExecutableInBundle (bundle_executable)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 423 | { |
| 424 | ModuleSP bundle_exe_module_sp(GetSharedModule(bundle_executable, |
| 425 | exe_arch)); |
| 426 | SetExecutableModule (bundle_exe_module_sp, get_dependent_files); |
| 427 | if (bundle_exe_module_sp->GetObjectFile() != NULL) |
| 428 | executable_sp = bundle_exe_module_sp; |
| 429 | return; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | if (executable_objfile) |
| 434 | { |
| 435 | executable_objfile->GetDependentModules(dependent_files); |
| 436 | for (uint32_t i=0; i<dependent_files.GetSize(); i++) |
| 437 | { |
| 438 | ModuleSP image_module_sp(GetSharedModule(dependent_files.GetFileSpecPointerAtIndex(i), |
| 439 | exe_arch)); |
| 440 | if (image_module_sp.get()) |
| 441 | { |
| 442 | //image_module_sp->Dump(&s);// REMOVE THIS, DEBUG ONLY |
| 443 | ObjectFile *objfile = image_module_sp->GetObjectFile(); |
| 444 | if (objfile) |
| 445 | objfile->GetDependentModules(dependent_files); |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | // Now see if we know the target triple, and if so, create our scratch AST context: |
| 451 | ConstString target_triple; |
| 452 | if (GetTargetTriple(target_triple)) |
| 453 | { |
| 454 | m_scratch_ast_context_ap.reset (new ClangASTContext(target_triple.GetCString())); |
| 455 | } |
| 456 | } |
Caroline Tice | 1ebef44 | 2010-09-27 00:30:10 +0000 | [diff] [blame] | 457 | |
| 458 | UpdateInstanceName(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | |
| 462 | ModuleList& |
| 463 | Target::GetImages () |
| 464 | { |
| 465 | return m_images; |
| 466 | } |
| 467 | |
| 468 | ArchSpec |
| 469 | Target::GetArchitecture () const |
| 470 | { |
Jim Ingham | 7508e73 | 2010-08-09 23:31:02 +0000 | [diff] [blame] | 471 | return m_arch_spec; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 472 | } |
| 473 | |
Jim Ingham | 7508e73 | 2010-08-09 23:31:02 +0000 | [diff] [blame] | 474 | bool |
| 475 | Target::SetArchitecture (const ArchSpec &arch_spec) |
| 476 | { |
| 477 | if (m_arch_spec == arch_spec) |
| 478 | { |
| 479 | // If we're setting the architecture to our current architecture, we |
| 480 | // don't need to do anything. |
| 481 | return true; |
| 482 | } |
| 483 | else if (!m_arch_spec.IsValid()) |
| 484 | { |
| 485 | // If we haven't got a valid arch spec, then we just need to set it. |
| 486 | m_arch_spec = arch_spec; |
| 487 | return true; |
| 488 | } |
| 489 | else |
| 490 | { |
| 491 | // If we have an executable file, try to reset the executable to the desired architecture |
| 492 | m_arch_spec = arch_spec; |
| 493 | ModuleSP executable_sp = GetExecutableModule (); |
| 494 | m_images.Clear(); |
| 495 | m_scratch_ast_context_ap.reset(); |
| 496 | m_triple.Clear(); |
| 497 | // Need to do something about unsetting breakpoints. |
| 498 | |
| 499 | if (executable_sp) |
| 500 | { |
| 501 | FileSpec exec_file_spec = executable_sp->GetFileSpec(); |
| 502 | Error error = ModuleList::GetSharedModule(exec_file_spec, |
| 503 | arch_spec, |
| 504 | NULL, |
| 505 | NULL, |
| 506 | 0, |
| 507 | executable_sp, |
| 508 | NULL, |
| 509 | NULL); |
| 510 | |
| 511 | if (!error.Fail() && executable_sp) |
| 512 | { |
| 513 | SetExecutableModule (executable_sp, true); |
| 514 | return true; |
| 515 | } |
| 516 | else |
| 517 | { |
| 518 | return false; |
| 519 | } |
| 520 | } |
| 521 | else |
| 522 | { |
| 523 | return false; |
| 524 | } |
| 525 | } |
| 526 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 527 | |
| 528 | bool |
| 529 | Target::GetTargetTriple(ConstString &triple) |
| 530 | { |
| 531 | triple.Clear(); |
| 532 | |
| 533 | if (m_triple) |
| 534 | { |
| 535 | triple = m_triple; |
| 536 | } |
| 537 | else |
| 538 | { |
| 539 | Module *exe_module = GetExecutableModule().get(); |
| 540 | if (exe_module) |
| 541 | { |
| 542 | ObjectFile *objfile = exe_module->GetObjectFile(); |
| 543 | if (objfile) |
| 544 | { |
| 545 | objfile->GetTargetTriple(m_triple); |
| 546 | triple = m_triple; |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | return !triple.IsEmpty(); |
| 551 | } |
| 552 | |
| 553 | void |
| 554 | Target::ModuleAdded (ModuleSP &module_sp) |
| 555 | { |
| 556 | // A module is being added to this target for the first time |
| 557 | ModuleList module_list; |
| 558 | module_list.Append(module_sp); |
| 559 | ModulesDidLoad (module_list); |
| 560 | } |
| 561 | |
| 562 | void |
| 563 | Target::ModuleUpdated (ModuleSP &old_module_sp, ModuleSP &new_module_sp) |
| 564 | { |
| 565 | // A module is being added to this target for the first time |
| 566 | ModuleList module_list; |
| 567 | module_list.Append (old_module_sp); |
| 568 | ModulesDidUnload (module_list); |
| 569 | module_list.Clear (); |
| 570 | module_list.Append (new_module_sp); |
| 571 | ModulesDidLoad (module_list); |
| 572 | } |
| 573 | |
| 574 | void |
| 575 | Target::ModulesDidLoad (ModuleList &module_list) |
| 576 | { |
| 577 | m_breakpoint_list.UpdateBreakpoints (module_list, true); |
| 578 | // TODO: make event data that packages up the module_list |
| 579 | BroadcastEvent (eBroadcastBitModulesLoaded, NULL); |
| 580 | } |
| 581 | |
| 582 | void |
| 583 | Target::ModulesDidUnload (ModuleList &module_list) |
| 584 | { |
| 585 | m_breakpoint_list.UpdateBreakpoints (module_list, false); |
Greg Clayton | 7b9fcc0 | 2010-12-06 23:51:26 +0000 | [diff] [blame] | 586 | |
| 587 | // Remove the images from the target image list |
| 588 | m_images.Remove(module_list); |
| 589 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 590 | // TODO: make event data that packages up the module_list |
| 591 | BroadcastEvent (eBroadcastBitModulesUnloaded, NULL); |
| 592 | } |
| 593 | |
| 594 | size_t |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 595 | Target::ReadMemoryFromFileCache (const Address& addr, void *dst, size_t dst_len, Error &error) |
| 596 | { |
| 597 | const Section *section = addr.GetSection(); |
| 598 | if (section && section->GetModule()) |
| 599 | { |
| 600 | ObjectFile *objfile = section->GetModule()->GetObjectFile(); |
| 601 | if (objfile) |
| 602 | { |
| 603 | size_t bytes_read = section->ReadSectionDataFromObjectFile (objfile, |
| 604 | addr.GetOffset(), |
| 605 | dst, |
| 606 | dst_len); |
| 607 | if (bytes_read > 0) |
| 608 | return bytes_read; |
| 609 | else |
| 610 | error.SetErrorStringWithFormat("error reading data from section %s", section->GetName().GetCString()); |
| 611 | } |
| 612 | else |
| 613 | { |
| 614 | error.SetErrorString("address isn't from a object file"); |
| 615 | } |
| 616 | } |
| 617 | else |
| 618 | { |
| 619 | error.SetErrorString("address doesn't contain a section that points to a section in a object file"); |
| 620 | } |
| 621 | return 0; |
| 622 | } |
| 623 | |
| 624 | size_t |
| 625 | Target::ReadMemory (const Address& addr, bool prefer_file_cache, void *dst, size_t dst_len, Error &error) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 626 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 627 | error.Clear(); |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 628 | |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 629 | bool process_is_valid = m_process_sp && m_process_sp->IsAlive(); |
| 630 | |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 631 | size_t bytes_read = 0; |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 632 | Address resolved_addr(addr); |
| 633 | if (!resolved_addr.IsSectionOffset()) |
| 634 | { |
| 635 | if (process_is_valid) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 636 | { |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 637 | m_section_load_list.ResolveLoadAddress (addr.GetOffset(), resolved_addr); |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 638 | } |
| 639 | else |
| 640 | { |
| 641 | m_images.ResolveFileAddress(addr.GetOffset(), resolved_addr); |
| 642 | } |
| 643 | } |
| 644 | |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 645 | if (prefer_file_cache) |
| 646 | { |
| 647 | bytes_read = ReadMemoryFromFileCache (resolved_addr, dst, dst_len, error); |
| 648 | if (bytes_read > 0) |
| 649 | return bytes_read; |
| 650 | } |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 651 | |
| 652 | if (process_is_valid) |
| 653 | { |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 654 | lldb::addr_t load_addr = resolved_addr.GetLoadAddress (this); |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 655 | if (load_addr == LLDB_INVALID_ADDRESS) |
| 656 | { |
| 657 | if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec()) |
| 658 | error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded.\n", |
| 659 | resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString(), |
| 660 | resolved_addr.GetFileAddress()); |
| 661 | else |
| 662 | error.SetErrorStringWithFormat("0x%llx can't be resolved.\n", resolved_addr.GetFileAddress()); |
| 663 | } |
| 664 | else |
| 665 | { |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 666 | bytes_read = m_process_sp->ReadMemory(load_addr, dst, dst_len, error); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 667 | if (bytes_read != dst_len) |
| 668 | { |
| 669 | if (error.Success()) |
| 670 | { |
| 671 | if (bytes_read == 0) |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 672 | error.SetErrorStringWithFormat("Read memory from 0x%llx failed.\n", load_addr); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 673 | else |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 674 | error.SetErrorStringWithFormat("Only %zu of %zu bytes were read from memory at 0x%llx.\n", bytes_read, dst_len, load_addr); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 675 | } |
| 676 | } |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 677 | if (bytes_read) |
| 678 | return bytes_read; |
| 679 | // If the address is not section offset we have an address that |
| 680 | // doesn't resolve to any address in any currently loaded shared |
| 681 | // libaries and we failed to read memory so there isn't anything |
| 682 | // more we can do. If it is section offset, we might be able to |
| 683 | // read cached memory from the object file. |
| 684 | if (!resolved_addr.IsSectionOffset()) |
| 685 | return 0; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 686 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 687 | } |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 688 | |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 689 | if (!prefer_file_cache) |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 690 | { |
Greg Clayton | 26100dc | 2011-01-07 01:57:07 +0000 | [diff] [blame] | 691 | // If we didn't already try and read from the object file cache, then |
| 692 | // try it after failing to read from the process. |
| 693 | return ReadMemoryFromFileCache (resolved_addr, dst, dst_len, error); |
Greg Clayton | 7043635 | 2010-06-30 23:03:03 +0000 | [diff] [blame] | 694 | } |
| 695 | return 0; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 696 | } |
| 697 | |
| 698 | |
| 699 | ModuleSP |
| 700 | Target::GetSharedModule |
| 701 | ( |
| 702 | const FileSpec& file_spec, |
| 703 | const ArchSpec& arch, |
| 704 | const UUID *uuid_ptr, |
| 705 | const ConstString *object_name, |
| 706 | off_t object_offset, |
| 707 | Error *error_ptr |
| 708 | ) |
| 709 | { |
| 710 | // Don't pass in the UUID so we can tell if we have a stale value in our list |
| 711 | ModuleSP old_module_sp; // This will get filled in if we have a new version of the library |
| 712 | bool did_create_module = false; |
| 713 | ModuleSP module_sp; |
| 714 | |
| 715 | // If there are image search path entries, try to use them first to acquire a suitable image. |
| 716 | |
| 717 | Error error; |
| 718 | |
| 719 | if (m_image_search_paths.GetSize()) |
| 720 | { |
| 721 | FileSpec transformed_spec; |
| 722 | if (m_image_search_paths.RemapPath (file_spec.GetDirectory(), transformed_spec.GetDirectory())) |
| 723 | { |
| 724 | transformed_spec.GetFilename() = file_spec.GetFilename(); |
| 725 | error = ModuleList::GetSharedModule (transformed_spec, arch, uuid_ptr, object_name, object_offset, module_sp, &old_module_sp, &did_create_module); |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | // If a module hasn't been found yet, use the unmodified path. |
| 730 | |
| 731 | if (!module_sp) |
| 732 | { |
| 733 | error = (ModuleList::GetSharedModule (file_spec, arch, uuid_ptr, object_name, object_offset, module_sp, &old_module_sp, &did_create_module)); |
| 734 | } |
| 735 | |
| 736 | if (module_sp) |
| 737 | { |
| 738 | m_images.Append (module_sp); |
| 739 | if (did_create_module) |
| 740 | { |
| 741 | if (old_module_sp && m_images.GetIndexForModule (old_module_sp.get()) != LLDB_INVALID_INDEX32) |
| 742 | ModuleUpdated(old_module_sp, module_sp); |
| 743 | else |
| 744 | ModuleAdded(module_sp); |
| 745 | } |
| 746 | } |
| 747 | if (error_ptr) |
| 748 | *error_ptr = error; |
| 749 | return module_sp; |
| 750 | } |
| 751 | |
| 752 | |
| 753 | Target * |
| 754 | Target::CalculateTarget () |
| 755 | { |
| 756 | return this; |
| 757 | } |
| 758 | |
| 759 | Process * |
| 760 | Target::CalculateProcess () |
| 761 | { |
| 762 | return NULL; |
| 763 | } |
| 764 | |
| 765 | Thread * |
| 766 | Target::CalculateThread () |
| 767 | { |
| 768 | return NULL; |
| 769 | } |
| 770 | |
| 771 | StackFrame * |
| 772 | Target::CalculateStackFrame () |
| 773 | { |
| 774 | return NULL; |
| 775 | } |
| 776 | |
| 777 | void |
Greg Clayton | a830adb | 2010-10-04 01:05:56 +0000 | [diff] [blame] | 778 | Target::CalculateExecutionContext (ExecutionContext &exe_ctx) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 779 | { |
| 780 | exe_ctx.target = this; |
| 781 | exe_ctx.process = NULL; // Do NOT fill in process... |
| 782 | exe_ctx.thread = NULL; |
| 783 | exe_ctx.frame = NULL; |
| 784 | } |
| 785 | |
| 786 | PathMappingList & |
| 787 | Target::GetImageSearchPathList () |
| 788 | { |
| 789 | return m_image_search_paths; |
| 790 | } |
| 791 | |
| 792 | void |
| 793 | Target::ImageSearchPathsChanged |
| 794 | ( |
| 795 | const PathMappingList &path_list, |
| 796 | void *baton |
| 797 | ) |
| 798 | { |
| 799 | Target *target = (Target *)baton; |
| 800 | if (target->m_images.GetSize() > 1) |
| 801 | { |
| 802 | ModuleSP exe_module_sp (target->GetExecutableModule()); |
| 803 | if (exe_module_sp) |
| 804 | { |
| 805 | target->m_images.Clear(); |
| 806 | target->SetExecutableModule (exe_module_sp, true); |
| 807 | } |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | ClangASTContext * |
| 812 | Target::GetScratchClangASTContext() |
| 813 | { |
| 814 | return m_scratch_ast_context_ap.get(); |
| 815 | } |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 816 | |
Greg Clayton | 990de7b | 2010-11-18 23:32:35 +0000 | [diff] [blame] | 817 | void |
| 818 | Target::Initialize () |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 819 | { |
Greg Clayton | 990de7b | 2010-11-18 23:32:35 +0000 | [diff] [blame] | 820 | UserSettingsControllerSP &usc = GetSettingsController(); |
| 821 | usc.reset (new SettingsController); |
| 822 | UserSettingsController::InitializeSettingsController (usc, |
| 823 | SettingsController::global_settings_table, |
| 824 | SettingsController::instance_settings_table); |
| 825 | } |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 826 | |
Greg Clayton | 990de7b | 2010-11-18 23:32:35 +0000 | [diff] [blame] | 827 | void |
| 828 | Target::Terminate () |
| 829 | { |
| 830 | UserSettingsControllerSP &usc = GetSettingsController(); |
| 831 | UserSettingsController::FinalizeSettingsController (usc); |
| 832 | usc.reset(); |
| 833 | } |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 834 | |
Greg Clayton | 990de7b | 2010-11-18 23:32:35 +0000 | [diff] [blame] | 835 | UserSettingsControllerSP & |
| 836 | Target::GetSettingsController () |
| 837 | { |
| 838 | static UserSettingsControllerSP g_settings_controller; |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 839 | return g_settings_controller; |
| 840 | } |
| 841 | |
| 842 | ArchSpec |
| 843 | Target::GetDefaultArchitecture () |
| 844 | { |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 845 | lldb::UserSettingsControllerSP &settings_controller = GetSettingsController(); |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 846 | lldb::SettableVariableType var_type; |
| 847 | Error err; |
| 848 | StringList result = settings_controller->GetVariable ("target.default-arch", var_type, "[]", err); |
| 849 | |
| 850 | const char *default_name = ""; |
| 851 | if (result.GetSize() == 1 && err.Success()) |
| 852 | default_name = result.GetStringAtIndex (0); |
| 853 | |
| 854 | ArchSpec default_arch (default_name); |
| 855 | return default_arch; |
| 856 | } |
| 857 | |
| 858 | void |
| 859 | Target::SetDefaultArchitecture (ArchSpec new_arch) |
| 860 | { |
| 861 | if (new_arch.IsValid()) |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 862 | GetSettingsController ()->SetVariable ("target.default-arch", |
| 863 | new_arch.AsCString(), |
| 864 | lldb::eVarSetOperationAssign, |
| 865 | false, |
| 866 | "[]"); |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 867 | } |
| 868 | |
Greg Clayton | a830adb | 2010-10-04 01:05:56 +0000 | [diff] [blame] | 869 | Target * |
| 870 | Target::GetTargetFromContexts (const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr) |
| 871 | { |
| 872 | // The target can either exist in the "process" of ExecutionContext, or in |
| 873 | // the "target_sp" member of SymbolContext. This accessor helper function |
| 874 | // will get the target from one of these locations. |
| 875 | |
| 876 | Target *target = NULL; |
| 877 | if (sc_ptr != NULL) |
| 878 | target = sc_ptr->target_sp.get(); |
| 879 | if (target == NULL) |
| 880 | { |
| 881 | if (exe_ctx_ptr != NULL && exe_ctx_ptr->process != NULL) |
| 882 | target = &exe_ctx_ptr->process->GetTarget(); |
| 883 | } |
| 884 | return target; |
| 885 | } |
| 886 | |
| 887 | |
Caroline Tice | 1ebef44 | 2010-09-27 00:30:10 +0000 | [diff] [blame] | 888 | void |
| 889 | Target::UpdateInstanceName () |
| 890 | { |
| 891 | StreamString sstr; |
| 892 | |
| 893 | ModuleSP module_sp = GetExecutableModule(); |
| 894 | if (module_sp) |
| 895 | { |
Greg Clayton | bf6e210 | 2010-10-27 02:06:37 +0000 | [diff] [blame] | 896 | sstr.Printf ("%s_%s", |
| 897 | module_sp->GetFileSpec().GetFilename().AsCString(), |
Caroline Tice | 1ebef44 | 2010-09-27 00:30:10 +0000 | [diff] [blame] | 898 | module_sp->GetArchitecture().AsCString()); |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 899 | GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), |
| 900 | sstr.GetData()); |
Caroline Tice | 1ebef44 | 2010-09-27 00:30:10 +0000 | [diff] [blame] | 901 | } |
| 902 | } |
| 903 | |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 904 | const char * |
| 905 | Target::GetExpressionPrefixContentsAsCString () |
| 906 | { |
| 907 | return m_expr_prefix_contents.c_str(); |
| 908 | } |
| 909 | |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 910 | ExecutionResults |
| 911 | Target::EvaluateExpression |
| 912 | ( |
| 913 | const char *expr_cstr, |
| 914 | StackFrame *frame, |
| 915 | bool unwind_on_error, |
Sean Callanan | 6a92553 | 2011-01-13 08:53:35 +0000 | [diff] [blame] | 916 | bool keep_in_memory, |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 917 | lldb::ValueObjectSP &result_valobj_sp |
| 918 | ) |
| 919 | { |
| 920 | ExecutionResults execution_results = eExecutionSetupError; |
| 921 | |
| 922 | result_valobj_sp.reset(); |
| 923 | |
| 924 | ExecutionContext exe_ctx; |
| 925 | if (frame) |
| 926 | { |
| 927 | frame->CalculateExecutionContext(exe_ctx); |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 928 | Error error; |
Greg Clayton | c67efa4 | 2011-01-20 19:27:18 +0000 | [diff] [blame] | 929 | const uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember | |
| 930 | StackFrame::eExpressionPathOptionsNoFragileObjcIvar; |
| 931 | result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr, expr_path_options, error); |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 932 | } |
| 933 | else if (m_process_sp) |
| 934 | { |
| 935 | m_process_sp->CalculateExecutionContext(exe_ctx); |
| 936 | } |
| 937 | else |
| 938 | { |
| 939 | CalculateExecutionContext(exe_ctx); |
| 940 | } |
| 941 | |
| 942 | if (result_valobj_sp) |
| 943 | { |
| 944 | execution_results = eExecutionCompleted; |
| 945 | // We got a result from the frame variable expression path above... |
| 946 | ConstString persistent_variable_name (m_persistent_variables.GetNextPersistentVariableName()); |
| 947 | |
| 948 | lldb::ValueObjectSP const_valobj_sp; |
| 949 | |
| 950 | // Check in case our value is already a constant value |
| 951 | if (result_valobj_sp->GetIsConstant()) |
| 952 | { |
| 953 | const_valobj_sp = result_valobj_sp; |
| 954 | const_valobj_sp->SetName (persistent_variable_name); |
| 955 | } |
| 956 | else |
| 957 | const_valobj_sp = result_valobj_sp->CreateConstantValue (exe_ctx.GetBestExecutionContextScope(), |
| 958 | persistent_variable_name); |
| 959 | |
Sean Callanan | 6a92553 | 2011-01-13 08:53:35 +0000 | [diff] [blame] | 960 | lldb::ValueObjectSP live_valobj_sp = result_valobj_sp; |
| 961 | |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 962 | result_valobj_sp = const_valobj_sp; |
| 963 | |
Sean Callanan | 6a92553 | 2011-01-13 08:53:35 +0000 | [diff] [blame] | 964 | ClangExpressionVariableSP clang_expr_variable_sp(m_persistent_variables.CreatePersistentVariable(result_valobj_sp)); |
| 965 | assert (clang_expr_variable_sp.get()); |
| 966 | |
| 967 | // Set flags and live data as appropriate |
| 968 | |
| 969 | const Value &result_value = live_valobj_sp->GetValue(); |
| 970 | |
| 971 | switch (result_value.GetValueType()) |
| 972 | { |
| 973 | case Value::eValueTypeHostAddress: |
| 974 | case Value::eValueTypeFileAddress: |
| 975 | // we don't do anything with these for now |
| 976 | break; |
| 977 | case Value::eValueTypeScalar: |
| 978 | clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated; |
| 979 | clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation; |
| 980 | break; |
| 981 | case Value::eValueTypeLoadAddress: |
| 982 | clang_expr_variable_sp->m_live_sp = live_valobj_sp; |
| 983 | clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsProgramReference; |
| 984 | break; |
| 985 | } |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 986 | } |
| 987 | else |
| 988 | { |
| 989 | // Make sure we aren't just trying to see the value of a persistent |
| 990 | // variable (something like "$0") |
Greg Clayton | a875b64 | 2011-01-09 21:07:35 +0000 | [diff] [blame] | 991 | lldb::ClangExpressionVariableSP persistent_var_sp; |
| 992 | // Only check for persistent variables the expression starts with a '$' |
| 993 | if (expr_cstr[0] == '$') |
| 994 | persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr); |
| 995 | |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 996 | if (persistent_var_sp) |
| 997 | { |
| 998 | result_valobj_sp = persistent_var_sp->GetValueObject (); |
| 999 | execution_results = eExecutionCompleted; |
| 1000 | } |
| 1001 | else |
| 1002 | { |
| 1003 | const char *prefix = GetExpressionPrefixContentsAsCString(); |
| 1004 | |
| 1005 | execution_results = ClangUserExpression::Evaluate (exe_ctx, |
Sean Callanan | 6a92553 | 2011-01-13 08:53:35 +0000 | [diff] [blame] | 1006 | unwind_on_error, |
| 1007 | keep_in_memory, |
Greg Clayton | 427f290 | 2010-12-14 02:59:59 +0000 | [diff] [blame] | 1008 | expr_cstr, |
| 1009 | prefix, |
| 1010 | result_valobj_sp); |
| 1011 | } |
| 1012 | } |
| 1013 | return execution_results; |
| 1014 | } |
| 1015 | |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1016 | //-------------------------------------------------------------- |
| 1017 | // class Target::SettingsController |
| 1018 | //-------------------------------------------------------------- |
| 1019 | |
| 1020 | Target::SettingsController::SettingsController () : |
| 1021 | UserSettingsController ("target", Debugger::GetSettingsController()), |
| 1022 | m_default_architecture () |
| 1023 | { |
| 1024 | m_default_settings.reset (new TargetInstanceSettings (*this, false, |
| 1025 | InstanceSettings::GetDefaultName().AsCString())); |
| 1026 | } |
| 1027 | |
| 1028 | Target::SettingsController::~SettingsController () |
| 1029 | { |
| 1030 | } |
| 1031 | |
| 1032 | lldb::InstanceSettingsSP |
| 1033 | Target::SettingsController::CreateInstanceSettings (const char *instance_name) |
| 1034 | { |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 1035 | TargetInstanceSettings *new_settings = new TargetInstanceSettings (*GetSettingsController(), |
| 1036 | false, |
| 1037 | instance_name); |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1038 | lldb::InstanceSettingsSP new_settings_sp (new_settings); |
| 1039 | return new_settings_sp; |
| 1040 | } |
| 1041 | |
| 1042 | const ConstString & |
| 1043 | Target::SettingsController::DefArchVarName () |
| 1044 | { |
| 1045 | static ConstString def_arch_var_name ("default-arch"); |
| 1046 | |
| 1047 | return def_arch_var_name; |
| 1048 | } |
| 1049 | |
| 1050 | bool |
| 1051 | Target::SettingsController::SetGlobalVariable (const ConstString &var_name, |
| 1052 | const char *index_value, |
| 1053 | const char *value, |
| 1054 | const SettingEntry &entry, |
| 1055 | const lldb::VarSetOperationType op, |
| 1056 | Error&err) |
| 1057 | { |
| 1058 | if (var_name == DefArchVarName()) |
| 1059 | { |
| 1060 | ArchSpec tmp_spec (value); |
| 1061 | if (tmp_spec.IsValid()) |
| 1062 | m_default_architecture = tmp_spec; |
| 1063 | else |
| 1064 | err.SetErrorStringWithFormat ("'%s' is not a valid architecture.", value); |
| 1065 | } |
| 1066 | return true; |
| 1067 | } |
| 1068 | |
| 1069 | |
| 1070 | bool |
| 1071 | Target::SettingsController::GetGlobalVariable (const ConstString &var_name, |
| 1072 | StringList &value, |
| 1073 | Error &err) |
| 1074 | { |
| 1075 | if (var_name == DefArchVarName()) |
| 1076 | { |
Greg Clayton | bf6e210 | 2010-10-27 02:06:37 +0000 | [diff] [blame] | 1077 | // If the arch is invalid (the default), don't show a string for it |
| 1078 | if (m_default_architecture.IsValid()) |
| 1079 | value.AppendString (m_default_architecture.AsCString()); |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1080 | return true; |
| 1081 | } |
| 1082 | else |
| 1083 | err.SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); |
| 1084 | |
| 1085 | return false; |
| 1086 | } |
| 1087 | |
| 1088 | //-------------------------------------------------------------- |
| 1089 | // class TargetInstanceSettings |
| 1090 | //-------------------------------------------------------------- |
| 1091 | |
Greg Clayton | 638351a | 2010-12-04 00:10:17 +0000 | [diff] [blame] | 1092 | TargetInstanceSettings::TargetInstanceSettings |
| 1093 | ( |
| 1094 | UserSettingsController &owner, |
| 1095 | bool live_instance, |
| 1096 | const char *name |
| 1097 | ) : |
| 1098 | InstanceSettings (owner, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance) |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1099 | { |
| 1100 | // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called |
| 1101 | // until the vtables for TargetInstanceSettings are properly set up, i.e. AFTER all the initializers. |
| 1102 | // For this reason it has to be called here, rather than in the initializer or in the parent constructor. |
| 1103 | // This is true for CreateInstanceName() too. |
| 1104 | |
| 1105 | if (GetInstanceName () == InstanceSettings::InvalidName()) |
| 1106 | { |
| 1107 | ChangeInstanceName (std::string (CreateInstanceName().AsCString())); |
| 1108 | m_owner.RegisterInstanceSettings (this); |
| 1109 | } |
| 1110 | |
| 1111 | if (live_instance) |
| 1112 | { |
| 1113 | const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); |
| 1114 | CopyInstanceSettings (pending_settings,false); |
| 1115 | //m_owner.RemovePendingSettings (m_instance_name); |
| 1116 | } |
| 1117 | } |
| 1118 | |
| 1119 | TargetInstanceSettings::TargetInstanceSettings (const TargetInstanceSettings &rhs) : |
Greg Clayton | c0c1b0c | 2010-11-19 03:46:01 +0000 | [diff] [blame] | 1120 | InstanceSettings (*Target::GetSettingsController(), CreateInstanceName().AsCString()) |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1121 | { |
| 1122 | if (m_instance_name != InstanceSettings::GetDefaultName()) |
| 1123 | { |
| 1124 | const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); |
| 1125 | CopyInstanceSettings (pending_settings,false); |
| 1126 | //m_owner.RemovePendingSettings (m_instance_name); |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | TargetInstanceSettings::~TargetInstanceSettings () |
| 1131 | { |
| 1132 | } |
| 1133 | |
| 1134 | TargetInstanceSettings& |
| 1135 | TargetInstanceSettings::operator= (const TargetInstanceSettings &rhs) |
| 1136 | { |
| 1137 | if (this != &rhs) |
| 1138 | { |
| 1139 | } |
| 1140 | |
| 1141 | return *this; |
| 1142 | } |
| 1143 | |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1144 | #define EXPR_PREFIX_STRING "expr-prefix" |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1145 | |
| 1146 | void |
| 1147 | TargetInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name, |
| 1148 | const char *index_value, |
| 1149 | const char *value, |
| 1150 | const ConstString &instance_name, |
| 1151 | const SettingEntry &entry, |
| 1152 | lldb::VarSetOperationType op, |
| 1153 | Error &err, |
| 1154 | bool pending) |
| 1155 | { |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1156 | static ConstString expr_prefix_str (EXPR_PREFIX_STRING); |
| 1157 | |
| 1158 | if (var_name == expr_prefix_str) |
| 1159 | { |
| 1160 | switch (op) |
| 1161 | { |
| 1162 | default: |
| 1163 | err.SetErrorToGenericError (); |
| 1164 | err.SetErrorString ("Unrecognized operation. Cannot update value.\n"); |
| 1165 | return; |
| 1166 | case lldb::eVarSetOperationAssign: |
| 1167 | { |
| 1168 | FileSpec file_spec(value, true); |
| 1169 | |
| 1170 | if (!file_spec.Exists()) |
| 1171 | { |
| 1172 | err.SetErrorToGenericError (); |
| 1173 | err.SetErrorStringWithFormat ("%s does not exist.\n", value); |
| 1174 | return; |
| 1175 | } |
| 1176 | |
| 1177 | DataBufferMemoryMap buf; |
| 1178 | |
| 1179 | if (!buf.MemoryMapFromFileSpec(&file_spec) && |
| 1180 | buf.GetError().Fail()) |
| 1181 | { |
| 1182 | err.SetErrorToGenericError (); |
| 1183 | err.SetErrorStringWithFormat ("Couldn't read from %s: %s\n", value, buf.GetError().AsCString()); |
| 1184 | return; |
| 1185 | } |
| 1186 | |
| 1187 | m_expr_prefix_path = value; |
| 1188 | m_expr_prefix_contents.assign(reinterpret_cast<const char *>(buf.GetBytes()), buf.GetByteSize()); |
| 1189 | } |
| 1190 | return; |
| 1191 | case lldb::eVarSetOperationAppend: |
| 1192 | err.SetErrorToGenericError (); |
| 1193 | err.SetErrorString ("Cannot append to a path.\n"); |
| 1194 | return; |
| 1195 | case lldb::eVarSetOperationClear: |
| 1196 | m_expr_prefix_path.clear (); |
| 1197 | m_expr_prefix_contents.clear (); |
| 1198 | return; |
| 1199 | } |
| 1200 | } |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1201 | } |
| 1202 | |
| 1203 | void |
| 1204 | TargetInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings, |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1205 | bool pending) |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1206 | { |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1207 | TargetInstanceSettings *new_settings_ptr = static_cast <TargetInstanceSettings *> (new_settings.get()); |
| 1208 | |
| 1209 | if (!new_settings_ptr) |
| 1210 | return; |
| 1211 | |
| 1212 | m_expr_prefix_path = new_settings_ptr->m_expr_prefix_path; |
| 1213 | m_expr_prefix_contents = new_settings_ptr->m_expr_prefix_contents; |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1214 | } |
| 1215 | |
Caroline Tice | bcb5b45 | 2010-09-20 21:37:42 +0000 | [diff] [blame] | 1216 | bool |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1217 | TargetInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry, |
| 1218 | const ConstString &var_name, |
| 1219 | StringList &value, |
Caroline Tice | bcb5b45 | 2010-09-20 21:37:42 +0000 | [diff] [blame] | 1220 | Error *err) |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1221 | { |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1222 | static ConstString expr_prefix_str (EXPR_PREFIX_STRING); |
| 1223 | |
| 1224 | if (var_name == expr_prefix_str) |
| 1225 | { |
| 1226 | value.AppendString (m_expr_prefix_path.c_str(), m_expr_prefix_path.size()); |
| 1227 | } |
| 1228 | else |
| 1229 | { |
| 1230 | if (err) |
| 1231 | err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); |
| 1232 | return false; |
| 1233 | } |
| 1234 | |
| 1235 | return true; |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | const ConstString |
| 1239 | TargetInstanceSettings::CreateInstanceName () |
| 1240 | { |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1241 | StreamString sstr; |
Caroline Tice | 1ebef44 | 2010-09-27 00:30:10 +0000 | [diff] [blame] | 1242 | static int instance_count = 1; |
| 1243 | |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1244 | sstr.Printf ("target_%d", instance_count); |
| 1245 | ++instance_count; |
| 1246 | |
| 1247 | const ConstString ret_val (sstr.GetData()); |
| 1248 | return ret_val; |
| 1249 | } |
| 1250 | |
| 1251 | //-------------------------------------------------- |
| 1252 | // Target::SettingsController Variable Tables |
| 1253 | //-------------------------------------------------- |
| 1254 | |
| 1255 | SettingEntry |
| 1256 | Target::SettingsController::global_settings_table[] = |
| 1257 | { |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1258 | //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, |
| 1259 | { "default-arch", eSetVarTypeString, NULL, NULL, false, false, "Default architecture to choose, when there's a choice." }, |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1260 | { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } |
| 1261 | }; |
| 1262 | |
| 1263 | SettingEntry |
| 1264 | Target::SettingsController::instance_settings_table[] = |
| 1265 | { |
Sean Callanan | 77e9394 | 2010-10-29 00:29:03 +0000 | [diff] [blame] | 1266 | //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, |
| 1267 | { EXPR_PREFIX_STRING, eSetVarTypeString, NULL, NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." }, |
Caroline Tice | 5bc8c97 | 2010-09-20 20:44:43 +0000 | [diff] [blame] | 1268 | { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } |
| 1269 | }; |