[Lldb-commits] [lldb] r251532 - Move lldb/test to lldb/packages/Python/lldbsuite/test.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 28 10:43:43 PDT 2015
Removed: lldb/trunk/test/lldbcurses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py (removed)
@@ -1,1137 +0,0 @@
-import use_lldb_suite
-
-import curses, curses.panel
-import sys
-import six
-import time
-
-class Point(object):
- def __init__(self, x, y):
- self.x = x
- self.y = y
-
- def __repr__(self):
- return str(self)
-
- def __str__(self):
- return "(x=%u, y=%u)" % (self.x, self.y)
-
- def __eq__(self, rhs):
- return self.x == rhs.x and self.y == rhs.y
-
- def __ne__(self, rhs):
- return self.x != rhs.x or self.y != rhs.y
-
- def is_valid_coordinate(self):
- return self.x >= 0 and self.y >= 0
-
-class Size(object):
- def __init__(self, w, h):
- self.w = w
- self.h = h
-
- def __repr__(self):
- return str(self)
-
- def __str__(self):
- return "(w=%u, h=%u)" % (self.w, self.h)
-
- def __eq__(self, rhs):
- return self.w == rhs.w and self.h == rhs.h
-
- def __ne__(self, rhs):
- return self.w != rhs.w or self.h != rhs.h
-
-class Rect(object):
- def __init__(self, x=0, y=0, w=0, h=0):
- self.origin = Point(x, y)
- self.size = Size(w, h)
-
- def __repr__(self):
- return str(self)
-
- def __str__(self):
- return "{ %s, %s }" % (str(self.origin), str(self.size))
-
- def get_min_x(self):
- return self.origin.x
-
- def get_max_x(self):
- return self.origin.x + self.size.w
-
- def get_min_y(self):
- return self.origin.y
-
- def get_max_y(self):
- return self.origin.y + self.size.h
-
- def contains_point(self, pt):
- if pt.x < self.get_max_x():
- if pt.y < self.get_max_y():
- if pt.x >= self.get_min_y():
- return pt.y >= self.get_min_y()
- return False
-
- def __eq__(self, rhs):
- return self.origin == rhs.origin and self.size == rhs.size
-
- def __ne__(self, rhs):
- return self.origin != rhs.origin or self.size != rhs.size
-
-class QuitException(Exception):
- def __init__(self):
- super(QuitException, self).__init__('QuitException')
-
-class Window(object):
- def __init__(self, window, delegate = None, can_become_first_responder = True):
- self.window = window
- self.parent = None
- self.delegate = delegate
- self.children = list()
- self.first_responders = list()
- self.can_become_first_responder = can_become_first_responder
- self.key_actions = dict()
-
- def add_child(self, window):
- self.children.append(window)
- window.parent = self
-
- def resize(self, size):
- self.window.resize(size.h, size.w)
-
- def resize_child(self, child, delta_size, adjust_neighbors):
- if child in self.children:
- frame = self.get_frame()
- orig_frame = child.get_frame()
- new_frame = Rect(x=orig_frame.origin.x, y=orig_frame.origin.y, w=orig_frame.size.w + delta_size.w, h=orig_frame.size.h + delta_size.h)
- old_child_max_x = orig_frame.get_max_x()
- new_child_max_x = new_frame.get_max_x()
- window_max_x = frame.get_max_x()
- if new_child_max_x < window_max_x:
- child.resize(new_frame.size)
- if old_child_max_x == window_max_x:
- new_frame.origin.x += window_max_x - new_child_max_x
- child.set_position(new_frame.origin)
- elif new_child_max_x > window_max_x:
- new_frame.origin.x -= new_child_max_x - window_max_x
- child.set_position(new_frame.origin)
- child.resize(new_frame.size)
-
- if adjust_neighbors:
- #print('orig_frame = %s\r\n' % (str(orig_frame)), end='')
- for curr_child in self.children:
- if curr_child is child:
- continue
- curr_child_frame = curr_child.get_frame()
- if delta_size.w != 0:
- #print('curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- if curr_child_frame.get_min_x() == orig_frame.get_max_x():
- curr_child_frame.origin.x += delta_size.w
- curr_child_frame.size.w -= delta_size.w
- #print('adjusted curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- curr_child.resize (curr_child_frame.size)
- curr_child.slide_position (Size(w=delta_size.w, h=0))
- elif curr_child_frame.get_max_x() == orig_frame.get_min_x():
- curr_child_frame.size.w -= delta_size.w
- #print('adjusted curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- curr_child.resize (curr_child_frame.size)
-
- def add_key_action(self, arg, callback, decription):
- if isinstance(arg, list):
- for key in arg:
- self.add_key_action(key, callback, description)
- else:
- if isinstance(arg, six.integer_types):
- key_action_dict = { 'key' : arg,
- 'callback' : callback,
- 'description' : decription }
- self.key_actions[arg] = key_action_dict
- elif isinstance(arg, basestring):
- key_integer = ord(arg)
- key_action_dict = { 'key' : key_integer,
- 'callback' : callback,
- 'description' : decription }
- self.key_actions[key_integer] = key_action_dict
- else:
- raise ValueError
-
- def draw_title_box(self, title):
- is_in_first_responder_chain = self.is_in_first_responder_chain()
- if is_in_first_responder_chain:
- self.attron (curses.A_REVERSE)
- self.box()
- if is_in_first_responder_chain:
- self.attroff (curses.A_REVERSE)
- if title:
- self.addstr(Point(x=2, y=0), ' ' + title + ' ')
-
- def remove_child(self, window):
- self.children.remove(window)
-
- def get_first_responder(self):
- if len(self.first_responders):
- return self.first_responders[-1]
- else:
- return None
-
- def set_first_responder(self, window):
- if window.can_become_first_responder:
- if six.callable(getattr(window, "hidden", None)) and window.hidden():
- return False
- if not window in self.children:
- self.add_child(window)
- # See if we have a current first responder, and if we do, let it know that
- # it will be resigning as first responder
- first_responder = self.get_first_responder()
- if first_responder:
- first_responder.relinquish_first_responder()
- # Now set the first responder to "window"
- if len(self.first_responders) == 0:
- self.first_responders.append(window)
- else:
- self.first_responders[-1] = window
- return True
- else:
- return False
-
- def push_first_responder(self, window):
- # Only push the window as the new first responder if the window isn't already the first responder
- if window != self.get_first_responder():
- self.first_responders.append(window)
-
- def pop_first_responder(self, window):
- # Only pop the window from the first responder list if it is the first responder
- if window == self.get_first_responder():
- old_first_responder = self.first_responders.pop()
- old_first_responder.relinquish_first_responder()
- return True
- else:
- return False
-
- def relinquish_first_responder(self):
- '''Override if there is something that you need to do when you lose first responder status.'''
- pass
-
- # def resign_first_responder(self, remove_from_parent, new_first_responder):
- # success = False
- # if self.parent:
- # if self.is_first_responder():
- # self.relinquish_first_responder()
- # if len(self.parent.first_responder):
- # self.parent.first_responder = None
- # success = True
- # if remove_from_parent:
- # self.parent.remove_child(self)
- # if new_first_responder:
- # self.parent.set_first_responder(new_first_responder)
- # else:
- # self.parent.select_next_first_responder()
- # return success
-
- def is_first_responder(self):
- if self.parent:
- return self.parent.get_first_responder() == self
- else:
- return False
-
- def is_in_first_responder_chain(self):
- if self.parent:
- return self in self.parent.first_responders
- else:
- return False
-
- def select_next_first_responder(self):
- if len(self.first_responders) > 1:
- self.pop_first_responder(self.first_responders[-1])
- else:
- num_children = len(self.children)
- if num_children == 1:
- return self.set_first_responder(self.children[0])
- for (i,window) in enumerate(self.children):
- if window.is_first_responder():
- break
- if i < num_children:
- for i in range(i+1,num_children):
- if self.set_first_responder(self.children[i]):
- return True
- for i in range(0, i):
- if self.set_first_responder(self.children[i]):
- return True
-
- def point_in_window(self, pt):
- size = self.get_size()
- return pt.x >= 0 and pt.x < size.w and pt.y >= 0 and pt.y < size.h
-
- def addch(self, c):
- try:
- self.window.addch(c)
- except:
- pass
-
- def addch_at_point(self, pt, c):
- try:
- self.window.addch(pt.y, pt.x, c)
- except:
- pass
-
- def addstr(self, pt, str):
- try:
- self.window.addstr(pt.y, pt.x, str)
- except:
- pass
-
- def addnstr_at_point(self, pt, str, n):
- try:
- self.window.addnstr(pt.y, pt.x, str, n)
- except:
- pass
- def addnstr(self, str, n):
- try:
- self.window.addnstr(str, n)
- except:
- pass
-
- def attron(self, attr):
- return self.window.attron (attr)
-
- def attroff(self, attr):
- return self.window.attroff (attr)
-
- def box(self, vertch=0, horch=0):
- if vertch == 0:
- vertch = curses.ACS_VLINE
- if horch == 0:
- horch = curses.ACS_HLINE
- self.window.box(vertch, horch)
-
- def get_contained_rect(self, top_inset=0, bottom_inset=0, left_inset=0, right_inset=0, height=-1, width=-1):
- '''Get a rectangle based on the top "height" lines of this window'''
- rect = self.get_frame()
- x = rect.origin.x + left_inset
- y = rect.origin.y + top_inset
- if height == -1:
- h = rect.size.h - (top_inset + bottom_inset)
- else:
- h = height
- if width == -1:
- w = rect.size.w - (left_inset + right_inset)
- else:
- w = width
- return Rect (x = x, y = y, w = w, h = h)
-
- def erase(self):
- self.window.erase()
-
- def get_cursor(self):
- (y, x) = self.window.getyx()
- return Point(x=x, y=y)
-
- def get_frame(self):
- position = self.get_position()
- size = self.get_size()
- return Rect(x=position.x, y=position.y, w=size.w, h=size.h)
-
- def get_frame_in_parent(self):
- position = self.get_position_in_parent()
- size = self.get_size()
- return Rect(x=position.x, y=position.y, w=size.w, h=size.h)
-
- def get_position_in_parent(self):
- (y, x) = self.window.getparyx()
- return Point(x, y)
-
- def get_position(self):
- (y, x) = self.window.getbegyx()
- return Point(x, y)
-
- def get_size(self):
- (y, x) = self.window.getmaxyx()
- return Size(w=x, h=y)
-
- def move(self, pt):
- self.window.move(pt.y, pt.x)
-
- def refresh(self):
- self.update()
- curses.panel.update_panels()
- self.move(Point(x=0, y=0))
- return self.window.refresh()
-
- def resize(self, size):
- return self.window.resize(size.h, size.w)
-
- def timeout(self, timeout_msec):
- return self.window.timeout(timeout_msec)
-
- def handle_key(self, key, check_parent=True):
- '''Handle a key press in this window.'''
-
- # First try the first responder if this window has one, but don't allow
- # it to check with its parent (False second parameter) so we don't recurse
- # and get a stack overflow
- for first_responder in reversed(self.first_responders):
- if first_responder.handle_key(key, False):
- return True
-
- # Check our key map to see if we have any actions. Actions don't take
- # any arguments, they must be callable
- if key in self.key_actions:
- key_action = self.key_actions[key]
- key_action['callback']()
- return True
- # Check if there is a wildcard key for any key
- if -1 in self.key_actions:
- key_action = self.key_actions[-1]
- key_action['callback']()
- return True
- # Check if the window delegate wants to handle this key press
- if self.delegate:
- if six.callable(getattr(self.delegate, "handle_key", None)):
- if self.delegate.handle_key(self, key):
- return True
- if self.delegate(self, key):
- return True
- # Check if we have a parent window and if so, let the parent
- # window handle the key press
- if check_parent and self.parent:
- return self.parent.handle_key(key, True)
- else:
- return False # Key not handled
-
- def update(self):
- for child in self.children:
- child.update()
-
- def quit_action(self):
- raise QuitException
-
- def get_key(self, timeout_msec=-1):
- self.timeout(timeout_msec)
- done = False
- c = self.window.getch()
- if c == 27:
- self.timeout(0)
- escape_key = 0
- while True:
- escape_key = self.window.getch()
- if escape_key == -1:
- break
- else:
- c = c << 8 | escape_key
- self.timeout(timeout_msec)
- return c
-
- def key_event_loop(self, timeout_msec=-1, n=sys.maxsize):
- '''Run an event loop to receive key presses and pass them along to the
- responder chain.
-
- timeout_msec is the timeout it milliseconds. If the value is -1, an
- infinite wait will be used. It the value is zero, a non-blocking mode
- will be used, and if greater than zero it will wait for a key press
- for timeout_msec milliseconds.
-
- n is the number of times to go through the event loop before exiting'''
- done = False
- while not done and n > 0:
- c = self.get_key(timeout_msec)
- if c != -1:
- try:
- self.handle_key(c)
- except QuitException:
- done = True
- n -= 1
-
-class Panel(Window):
- def __init__(self, frame, delegate = None, can_become_first_responder = True):
- window = curses.newwin(frame.size.h,frame.size.w, frame.origin.y, frame.origin.x)
- super(Panel, self).__init__(window, delegate, can_become_first_responder)
- self.panel = curses.panel.new_panel(window)
-
- def hide(self):
- return self.panel.hide()
-
- def hidden(self):
- return self.panel.hidden()
-
- def show(self):
- return self.panel.show()
-
- def top(self):
- return self.panel.top()
-
- def set_position(self, pt):
- self.panel.move(pt.y, pt.x)
-
- def slide_position(self, size):
- new_position = self.get_position()
- new_position.x = new_position.x + size.w
- new_position.y = new_position.y + size.h
- self.set_position(new_position)
-
-class BoxedPanel(Panel):
- def __init__(self, frame, title, delegate = None, can_become_first_responder = True):
- super(BoxedPanel, self).__init__(frame, delegate, can_become_first_responder)
- self.title = title
- self.lines = list()
- self.first_visible_idx = 0
- self.selected_idx = -1
- self.add_key_action(curses.KEY_UP, self.select_prev, "Select the previous item")
- self.add_key_action(curses.KEY_DOWN, self.select_next, "Select the next item")
- self.add_key_action(curses.KEY_HOME, self.scroll_begin, "Go to the beginning of the list")
- self.add_key_action(curses.KEY_END, self.scroll_end, "Go to the end of the list")
- self.add_key_action(0x1b4f48, self.scroll_begin, "Go to the beginning of the list")
- self.add_key_action(0x1b4f46, self.scroll_end, "Go to the end of the list")
- self.add_key_action(curses.KEY_PPAGE, self.scroll_page_backward, "Scroll to previous page")
- self.add_key_action(curses.KEY_NPAGE, self.scroll_page_forward, "Scroll to next forward")
- self.update()
-
- def clear(self, update=True):
- self.lines = list()
- self.first_visible_idx = 0
- self.selected_idx = -1
- if update:
- self.update()
-
- def get_usable_width(self):
- '''Valid usable width is 0 to (width - 3) since the left and right lines display the box around
- this frame and we skip a leading space'''
- w = self.get_size().w
- if w > 3:
- return w-3
- else:
- return 0
-
- def get_usable_height(self):
- '''Valid line indexes are 0 to (height - 2) since the top and bottom lines display the box around this frame.'''
- h = self.get_size().h
- if h > 2:
- return h-2
- else:
- return 0
-
- def get_point_for_line(self, global_line_idx):
- '''Returns the point to use when displaying a line whose index is "line_idx"'''
- line_idx = global_line_idx - self.first_visible_idx
- num_lines = self.get_usable_height()
- if line_idx < num_lines:
- return Point(x=2, y=1+line_idx)
- else:
- return Point(x=-1, y=-1) # return an invalid coordinate if the line index isn't valid
-
- def set_title (self, title, update=True):
- self.title = title
- if update:
- self.update()
-
- def scroll_to_line (self, idx):
- if idx < len(self.lines):
- self.selected_idx = idx
- max_visible_lines = self.get_usable_height()
- if idx < self.first_visible_idx or idx >= self.first_visible_idx + max_visible_lines:
- self.first_visible_idx = idx
- self.refresh()
-
- def scroll_begin (self):
- self.first_visible_idx = 0
- if len(self.lines) > 0:
- self.selected_idx = 0
- else:
- self.selected_idx = -1
- self.update()
-
- def scroll_end (self):
- max_visible_lines = self.get_usable_height()
- num_lines = len(self.lines)
- if num_lines > max_visible_lines:
- self.first_visible_idx = num_lines - max_visible_lines
- else:
- self.first_visible_idx = 0
- self.selected_idx = num_lines-1
- self.update()
-
- def scroll_page_backward(self):
- num_lines = len(self.lines)
- max_visible_lines = self.get_usable_height()
- new_index = self.first_visible_idx - max_visible_lines
- if new_index < 0:
- self.first_visible_idx = 0
- else:
- self.first_visible_idx = new_index
- self.refresh()
-
- def scroll_page_forward(self):
- max_visible_lines = self.get_usable_height()
- self.first_visible_idx += max_visible_lines
- self._adjust_first_visible_line()
- self.refresh()
-
- def select_next (self):
- self.selected_idx += 1
- if self.selected_idx >= len(self.lines):
- self.selected_idx = len(self.lines) - 1
- self.refresh()
-
- def select_prev (self):
- self.selected_idx -= 1
- if self.selected_idx < 0:
- if len(self.lines) > 0:
- self.selected_idx = 0
- else:
- self.selected_idx = -1
- self.refresh()
-
- def get_selected_idx(self):
- return self.selected_idx
-
- def _adjust_first_visible_line(self):
- num_lines = len(self.lines)
- max_visible_lines = self.get_usable_height()
- if (self.first_visible_idx >= num_lines) or (num_lines - self.first_visible_idx) > max_visible_lines:
- self.first_visible_idx = num_lines - max_visible_lines
-
- def append_line(self, s, update=True):
- self.lines.append(s)
- self._adjust_first_visible_line()
- if update:
- self.update()
-
- def set_line(self, line_idx, s, update=True):
- '''Sets a line "line_idx" within the boxed panel to be "s"'''
- if line_idx < 0:
- return
- while line_idx >= len(self.lines):
- self.lines.append('')
- self.lines[line_idx] = s
- self._adjust_first_visible_line()
- if update:
- self.update()
-
- def update(self):
- self.erase()
- self.draw_title_box(self.title)
- max_width = self.get_usable_width()
- for line_idx in range(self.first_visible_idx, len(self.lines)):
- pt = self.get_point_for_line(line_idx)
- if pt.is_valid_coordinate():
- is_selected = line_idx == self.selected_idx
- if is_selected:
- self.attron (curses.A_REVERSE)
- self.move(pt)
- self.addnstr(self.lines[line_idx], max_width)
- if is_selected:
- self.attroff (curses.A_REVERSE)
- else:
- return
-
- def load_file(self, path):
- f = open(path)
- if f:
- self.lines = f.read().splitlines()
- for (idx, line) in enumerate(self.lines):
- # Remove any tabs from lines since they hose up the display
- if "\t" in line:
- self.lines[idx] = (8*' ').join(line.split('\t'))
- self.selected_idx = 0
- self.first_visible_idx = 0
- self.refresh()
-
-class Item(object):
- def __init__(self, title, action):
- self.title = title
- self.action = action
-
-class TreeItemDelegate(object):
-
- def might_have_children(self):
- return False
-
- def update_children(self, item):
- '''Return a list of child Item objects'''
- return None
-
- def draw_item_string(self, tree_window, item, s):
- pt = tree_window.get_cursor()
- width = tree_window.get_size().w - 1
- if width > pt.x:
- tree_window.addnstr(s, width - pt.x)
-
- def draw_item(self, tree_window, item):
- self.draw_item_string(tree_window, item, item.title)
-
- def do_action(self):
- pass
-
-class TreeItem(object):
- def __init__(self, delegate, parent = None, title = None, action = None, is_expanded = False):
- self.parent = parent
- self.title = title
- self.action = action
- self.delegate = delegate
- self.is_expanded = not parent or is_expanded == True
- self._might_have_children = None
- self.children = None
- self._children_might_have_children = False
-
- def get_children(self):
- if self.is_expanded and self.might_have_children():
- if self.children is None:
- self._children_might_have_children = False
- self.children = self.update_children()
- for child in self.children:
- if child.might_have_children():
- self._children_might_have_children = True
- break
- else:
- self._children_might_have_children = False
- self.children = None
- return self.children
-
- def append_visible_items(self, items):
- items.append(self)
- children = self.get_children()
- if children:
- for child in children:
- child.append_visible_items(items)
-
- def might_have_children(self):
- if self._might_have_children is None:
- if not self.parent:
- # Root item always might have children
- self._might_have_children = True
- else:
- # Check with the delegate to see if the item might have children
- self._might_have_children = self.delegate.might_have_children()
- return self._might_have_children
-
- def children_might_have_children(self):
- return self._children_might_have_children
-
- def update_children(self):
- if self.is_expanded and self.might_have_children():
- self.children = self.delegate.update_children(self)
- for child in self.children:
- child.update_children()
- else:
- self.children = None
- return self.children
-
- def get_num_visible_rows(self):
- rows = 1
- if self.is_expanded:
- children = self.get_children()
- if children:
- for child in children:
- rows += child.get_num_visible_rows()
- return rows
- def draw(self, tree_window, row):
- display_row = tree_window.get_display_row(row)
- if display_row >= 0:
- tree_window.move(tree_window.get_item_draw_point(row))
- if self.parent:
- self.parent.draw_tree_for_child(tree_window, self, 0)
- if self.might_have_children():
- tree_window.addch (curses.ACS_DIAMOND)
- tree_window.addch (curses.ACS_HLINE)
- elif self.parent and self.parent.children_might_have_children():
- if self.parent.parent:
- tree_window.addch (curses.ACS_HLINE)
- tree_window.addch (curses.ACS_HLINE)
- else:
- tree_window.addch (' ')
- tree_window.addch (' ')
- is_selected = tree_window.is_selected(row)
- if is_selected:
- tree_window.attron (curses.A_REVERSE)
- self.delegate.draw_item(tree_window, self)
- if is_selected:
- tree_window.attroff (curses.A_REVERSE)
-
- def draw_tree_for_child (self, tree_window, child, reverse_depth):
- if self.parent:
- self.parent.draw_tree_for_child (tree_window, self, reverse_depth + 1)
- if self.children[-1] == child:
- # Last child
- if reverse_depth == 0:
- tree_window.addch (curses.ACS_LLCORNER)
- tree_window.addch (curses.ACS_HLINE)
- else:
- tree_window.addch (' ')
- tree_window.addch (' ')
- else:
- # Middle child
- if reverse_depth == 0:
- tree_window.addch (curses.ACS_LTEE)
- tree_window.addch (curses.ACS_HLINE)
- else:
- tree_window.addch (curses.ACS_VLINE)
- tree_window.addch (' ')
-
- def was_selected(self):
- self.delegate.do_action()
-
-class TreePanel(Panel):
- def __init__(self, frame, title, root_item):
- self.root_item = root_item
- self.title = title
- self.first_visible_idx = 0
- self.selected_idx = 0
- self.items = None
- super(TreePanel, self).__init__(frame)
- self.add_key_action(curses.KEY_UP, self.select_prev, "Select the previous item")
- self.add_key_action(curses.KEY_DOWN, self.select_next, "Select the next item")
- self.add_key_action(curses.KEY_RIGHT,self.right_arrow, "Expand an item")
- self.add_key_action(curses.KEY_LEFT, self.left_arrow, "Unexpand an item or navigate to parent")
- self.add_key_action(curses.KEY_HOME, self.scroll_begin, "Go to the beginning of the tree")
- self.add_key_action(curses.KEY_END, self.scroll_end, "Go to the end of the tree")
- self.add_key_action(0x1b4f48, self.scroll_begin, "Go to the beginning of the tree")
- self.add_key_action(0x1b4f46, self.scroll_end, "Go to the end of the tree")
- self.add_key_action(curses.KEY_PPAGE, self.scroll_page_backward, "Scroll to previous page")
- self.add_key_action(curses.KEY_NPAGE, self.scroll_page_forward, "Scroll to next forward")
-
- def get_selected_item(self):
- if self.selected_idx < len(self.items):
- return self.items[self.selected_idx]
- else:
- return None
-
- def select_item(self, item):
- if self.items and item in self.items:
- self.selected_idx = self.items.index(item)
- return True
- else:
- return False
-
- def get_visible_items(self):
- # Clear self.items when you want to update all chidren
- if self.items is None:
- self.items = list()
- children = self.root_item.get_children()
- if children:
- for child in children:
- child.append_visible_items(self.items)
- return self.items
-
- def update(self):
- self.erase()
- self.draw_title_box(self.title)
- visible_items = self.get_visible_items()
- for (row, child) in enumerate(visible_items):
- child.draw(self, row)
-
- def get_item_draw_point(self, row):
- display_row = self.get_display_row(row)
- if display_row >= 0:
- return Point(2, display_row + 1)
- else:
- return Point(-1, -1)
-
- def get_display_row(self, row):
- if row >= self.first_visible_idx:
- display_row = row - self.first_visible_idx
- if display_row < self.get_size().h-2:
- return display_row
- return -1
-
- def is_selected(self, row):
- return row == self.selected_idx
-
- def get_num_lines(self):
- self.get_visible_items()
- return len(self.items)
-
- def get_num_visible_lines(self):
- return self.get_size().h-2
- def select_next (self):
- self.selected_idx += 1
- num_lines = self.get_num_lines()
- if self.selected_idx >= num_lines:
- self.selected_idx = num_lines - 1
- self._selection_changed()
- self.refresh()
-
- def select_prev (self):
- self.selected_idx -= 1
- if self.selected_idx < 0:
- num_lines = self.get_num_lines()
- if num_lines > 0:
- self.selected_idx = 0
- else:
- self.selected_idx = -1
- self._selection_changed()
- self.refresh()
-
- def scroll_begin (self):
- self.first_visible_idx = 0
- num_lines = self.get_num_lines()
- if num_lines > 0:
- self.selected_idx = 0
- else:
- self.selected_idx = -1
- self.refresh()
-
- def redisplay_tree(self):
- self.items = None
- self.refresh()
-
- def right_arrow(self):
- selected_item = self.get_selected_item()
- if selected_item and selected_item.is_expanded == False:
- selected_item.is_expanded = True
- self.redisplay_tree()
-
- def left_arrow(self):
- selected_item = self.get_selected_item()
- if selected_item:
- if selected_item.is_expanded == True:
- selected_item.is_expanded = False
- self.redisplay_tree()
- elif selected_item.parent:
- if self.select_item(selected_item.parent):
- self.refresh()
-
-
- def scroll_end (self):
- num_visible_lines = self.get_num_visible_lines()
- num_lines = self.get_num_lines()
- if num_lines > num_visible_lines:
- self.first_visible_idx = num_lines - num_visible_lines
- else:
- self.first_visible_idx = 0
- self.selected_idx = num_lines-1
- self.refresh()
-
- def scroll_page_backward(self):
- num_visible_lines = self.get_num_visible_lines()
- new_index = self.selected_idx - num_visible_lines
- if new_index < 0:
- self.selected_idx = 0
- else:
- self.selected_idx = new_index
- self._selection_changed()
- self.refresh()
-
- def scroll_page_forward(self):
- num_lines = self.get_num_lines()
- num_visible_lines = self.get_num_visible_lines()
- new_index = self.selected_idx + num_visible_lines
- if new_index >= num_lines:
- new_index = num_lines - 1
- self.selected_idx = new_index
- self._selection_changed()
- self.refresh()
-
- def _selection_changed(self):
- num_lines = self.get_num_lines()
- num_visible_lines = self.get_num_visible_lines()
- last_visible_index = self.first_visible_idx + num_visible_lines
- if self.selected_idx >= last_visible_index:
- self.first_visible_idx += (self.selected_idx - last_visible_index + 1)
- if self.selected_idx < self.first_visible_idx:
- self.first_visible_idx = self.selected_idx
- if self.selected_idx >= 0 and self.selected_idx < len(self.items):
- item = self.items[self.selected_idx]
- item.was_selected()
-
-
-class Menu(BoxedPanel):
- def __init__(self, title, items):
- max_title_width = 0
- for item in items:
- if max_title_width < len(item.title):
- max_title_width = len(item.title)
- frame = Rect(x=0, y=0, w=max_title_width+4, h=len(items)+2)
- super(Menu, self).__init__(frame, title=None, delegate=None, can_become_first_responder=True)
- self.selected_idx = 0
- self.title = title
- self.items = items
- for (item_idx, item) in enumerate(items):
- self.set_line(item_idx, item.title)
- self.hide()
-
- def update(self):
- super(Menu, self).update()
-
- def relinquish_first_responder(self):
- if not self.hidden():
- self.hide()
-
- def perform_action(self):
- selected_idx = self.get_selected_idx()
- if selected_idx < len(self.items):
- action = self.items[selected_idx].action
- if action:
- action()
-
-class MenuBar(Panel):
- def __init__(self, frame):
- super(MenuBar, self).__init__(frame, can_become_first_responder=True)
- self.menus = list()
- self.selected_menu_idx = -1
- self.add_key_action(curses.KEY_LEFT, self.select_prev, "Select the previous menu")
- self.add_key_action(curses.KEY_RIGHT, self.select_next, "Select the next menu")
- self.add_key_action(curses.KEY_DOWN, lambda: self.select(0), "Select the first menu")
- self.add_key_action(27, self.relinquish_first_responder, "Hide current menu")
- self.add_key_action(curses.KEY_ENTER, self.perform_action, "Select the next menu item")
- self.add_key_action(10, self.perform_action, "Select the next menu item")
-
- def insert_menu(self, menu, index=sys.maxsize):
- if index >= len(self.menus):
- self.menus.append(menu)
- else:
- self.menus.insert(index, menu)
- pt = self.get_position()
- for menu in self.menus:
- menu.set_position(pt)
- pt.x += len(menu.title) + 5
-
- def perform_action(self):
- '''If no menu is visible, show the first menu. If a menu is visible, perform the action
- associated with the selected menu item in the menu'''
- menu_visible = False
- for menu in self.menus:
- if not menu.hidden():
- menu_visible = True
- break
- if menu_visible:
- menu.perform_action()
- self.selected_menu_idx = -1
- self._selected_menu_changed()
- else:
- self.select(0)
-
- def relinquish_first_responder(self):
- if self.selected_menu_idx >= 0:
- self.selected_menu_idx = -1
- self._selected_menu_changed()
-
- def _selected_menu_changed(self):
- for (menu_idx, menu) in enumerate(self.menus):
- is_hidden = menu.hidden()
- if menu_idx != self.selected_menu_idx:
- if not is_hidden:
- if self.parent.pop_first_responder(menu) == False:
- menu.hide()
- for (menu_idx, menu) in enumerate(self.menus):
- is_hidden = menu.hidden()
- if menu_idx == self.selected_menu_idx:
- if is_hidden:
- menu.show()
- self.parent.push_first_responder(menu)
- menu.top()
- self.parent.refresh()
-
- def select(self, index):
- if index < len(self.menus):
- self.selected_menu_idx = index
- self._selected_menu_changed()
-
- def select_next (self):
- num_menus = len(self.menus)
- if self.selected_menu_idx == -1:
- if num_menus > 0:
- self.selected_menu_idx = 0
- self._selected_menu_changed()
- else:
- if self.selected_menu_idx + 1 < num_menus:
- self.selected_menu_idx += 1
- else:
- self.selected_menu_idx = -1
- self._selected_menu_changed()
-
- def select_prev (self):
- num_menus = len(self.menus)
- if self.selected_menu_idx == -1:
- if num_menus > 0:
- self.selected_menu_idx = num_menus - 1
- self._selected_menu_changed()
- else:
- if self.selected_menu_idx - 1 >= 0:
- self.selected_menu_idx -= 1
- else:
- self.selected_menu_idx = -1
- self._selected_menu_changed()
-
- def update(self):
- self.erase()
- is_in_first_responder_chain = self.is_in_first_responder_chain()
- if is_in_first_responder_chain:
- self.attron (curses.A_REVERSE)
- pt = Point(x=0, y=0)
- for menu in self.menus:
- self.addstr(pt, '| ' + menu.title + ' ')
- pt.x += len(menu.title) + 5
- self.addstr(pt, '|')
- width = self.get_size().w
- while pt.x < width:
- self.addch_at_point(pt, ' ')
- pt.x += 1
- if is_in_first_responder_chain:
- self.attroff (curses.A_REVERSE)
-
- for menu in self.menus:
- menu.update()
-
-
-class StatusPanel(Panel):
- def __init__(self, frame):
- super(StatusPanel, self).__init__(frame, delegate=None, can_become_first_responder=False)
- self.status_items = list()
- self.status_dicts = dict()
- self.next_status_x = 1
-
- def add_status_item(self, name, title, format, width, value, update=True):
- status_item_dict = { 'name': name,
- 'title' : title,
- 'width' : width,
- 'format' : format,
- 'value' : value,
- 'x' : self.next_status_x }
- index = len(self.status_items)
- self.status_items.append(status_item_dict)
- self.status_dicts[name] = index
- self.next_status_x += width + 2;
- if update:
- self.update()
-
- def increment_status(self, name, update=True):
- if name in self.status_dicts:
- status_item_idx = self.status_dicts[name]
- status_item_dict = self.status_items[status_item_idx]
- status_item_dict['value'] = status_item_dict['value'] + 1
- if update:
- self.update()
-
- def update_status(self, name, value, update=True):
- if name in self.status_dicts:
- status_item_idx = self.status_dicts[name]
- status_item_dict = self.status_items[status_item_idx]
- status_item_dict['value'] = status_item_dict['format'] % (value)
- if update:
- self.update()
- def update(self):
- self.erase();
- for status_item_dict in self.status_items:
- self.addnstr_at_point(Point(x=status_item_dict['x'], y=0), '%s: %s' % (status_item_dict['title'], status_item_dict['value']), status_item_dict['width'])
-
-stdscr = None
-
-def intialize_curses():
- global stdscr
- stdscr = curses.initscr()
- curses.noecho()
- curses.cbreak()
- stdscr.keypad(1)
- try:
- curses.start_color()
- except:
- pass
- return Window(stdscr)
-
-def terminate_curses():
- global stdscr
- if stdscr:
- stdscr.keypad(0)
- curses.echo()
- curses.nocbreak()
- curses.endwin()
-
Removed: lldb/trunk/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbinline.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbinline.py (original)
+++ lldb/trunk/test/lldbinline.py (removed)
@@ -1,202 +0,0 @@
-from __future__ import print_function
-
-import lldb
-from lldbtest import *
-import lldbutil
-import os
-import sys
-
-def source_type(filename):
- _, extension = os.path.splitext(filename)
- return {
- '.c' : 'C_SOURCES',
- '.cpp' : 'CXX_SOURCES',
- '.cxx' : 'CXX_SOURCES',
- '.cc' : 'CXX_SOURCES',
- '.m' : 'OBJC_SOURCES',
- '.mm' : 'OBJCXX_SOURCES'
- }.get(extension, None)
-
-class CommandParser:
- def __init__(self):
- self.breakpoints = []
-
- def parse_one_command(self, line):
- parts = line.split('//%')
-
- command = None
- new_breakpoint = True
-
- if len(parts) == 2:
- command = parts[1].strip() # take off whitespace
- new_breakpoint = parts[0].strip() != ""
-
- return (command, new_breakpoint)
-
- def parse_source_files(self, source_files):
- for source_file in source_files:
- file_handle = open(source_file)
- lines = file_handle.readlines()
- line_number = 0
- current_breakpoint = None # non-NULL means we're looking through whitespace to find additional commands
- for line in lines:
- line_number = line_number + 1 # 1-based, so we do this first
- (command, new_breakpoint) = self.parse_one_command(line)
-
- if new_breakpoint:
- current_breakpoint = None
-
- if command != None:
- if current_breakpoint == None:
- current_breakpoint = {}
- current_breakpoint['file_name'] = source_file
- current_breakpoint['line_number'] = line_number
- current_breakpoint['command'] = command
- self.breakpoints.append(current_breakpoint)
- else:
- current_breakpoint['command'] = current_breakpoint['command'] + "\n" + command
-
- def set_breakpoints(self, target):
- for breakpoint in self.breakpoints:
- breakpoint['breakpoint'] = target.BreakpointCreateByLocation(breakpoint['file_name'], breakpoint['line_number'])
-
- def handle_breakpoint(self, test, breakpoint_id):
- for breakpoint in self.breakpoints:
- if breakpoint['breakpoint'].GetID() == breakpoint_id:
- test.execute_user_command(breakpoint['command'])
- return
-
-class InlineTest(TestBase):
- # Internal implementation
-
- def getRerunArgs(self):
- # The -N option says to NOT run a if it matches the option argument, so
- # if we are using dSYM we say to NOT run dwarf (-N dwarf) and vice versa.
- if self.using_dsym is None:
- # The test was skipped altogether.
- return ""
- elif self.using_dsym:
- return "-N dwarf %s" % (self.mydir)
- else:
- return "-N dsym %s" % (self.mydir)
-
- def BuildMakefile(self):
- if os.path.exists("Makefile"):
- return
-
- categories = {}
-
- for f in os.listdir(os.getcwd()):
- t = source_type(f)
- if t:
- if t in list(categories.keys()):
- categories[t].append(f)
- else:
- categories[t] = [f]
-
- makefile = open("Makefile", 'w+')
-
- level = os.sep.join([".."] * len(self.mydir.split(os.sep))) + os.sep + "make"
-
- makefile.write("LEVEL = " + level + "\n")
-
- for t in list(categories.keys()):
- line = t + " := " + " ".join(categories[t])
- makefile.write(line + "\n")
-
- if ('OBJCXX_SOURCES' in list(categories.keys())) or ('OBJC_SOURCES' in list(categories.keys())):
- makefile.write("LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
-
- if ('CXX_SOURCES' in list(categories.keys())):
- makefile.write("CXXFLAGS += -std=c++11\n")
-
- makefile.write("include $(LEVEL)/Makefile.rules\n")
- makefile.flush()
- makefile.close()
-
-
- @skipUnlessDarwin
- def __test_with_dsym(self):
- self.using_dsym = True
- self.BuildMakefile()
- self.buildDsym()
- self.do_test()
-
- def __test_with_dwarf(self):
- self.using_dsym = False
- self.BuildMakefile()
- self.buildDwarf()
- self.do_test()
-
- def __test_with_dwo(self):
- self.using_dsym = False
- self.BuildMakefile()
- self.buildDwo()
- self.do_test()
-
- def execute_user_command(self, __command):
- exec __command in globals(), locals()
-
- def do_test(self):
- exe_name = "a.out"
- exe = os.path.join(os.getcwd(), exe_name)
- source_files = [ f for f in os.listdir(os.getcwd()) if source_type(f) ]
- target = self.dbg.CreateTarget(exe)
-
- parser = CommandParser()
- parser.parse_source_files(source_files)
- parser.set_breakpoints(target)
-
- process = target.LaunchSimple(None, None, os.getcwd())
-
- while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- breakpoint_id = thread.GetStopReasonDataAtIndex (0)
- parser.handle_breakpoint(self, breakpoint_id)
- process.Continue()
-
-
- # Utilities for testcases
-
- def check_expression (self, expression, expected_result, use_summary = True):
- value = self.frame().EvaluateExpression (expression)
- self.assertTrue(value.IsValid(), expression+"returned a valid value")
- if self.TraceOn():
- print(value.GetSummary())
- print(value.GetValue())
- if use_summary:
- answer = value.GetSummary()
- else:
- answer = value.GetValue()
- report_str = "%s expected: %s got: %s"%(expression, expected_result, answer)
- self.assertTrue(answer == expected_result, report_str)
-
-def ApplyDecoratorsToFunction(func, decorators):
- tmp = func
- if type(decorators) == list:
- for decorator in decorators:
- tmp = decorator(tmp)
- elif hasattr(decorators, '__call__'):
- tmp = decorators(tmp)
- return tmp
-
-
-def MakeInlineTest(__file, __globals, decorators=None):
- # Derive the test name from the current file name
- file_basename = os.path.basename(__file)
- InlineTest.mydir = TestBase.compute_mydir(__file)
-
- test_name, _ = os.path.splitext(file_basename)
- # Build the test case
- test = type(test_name, (InlineTest,), {'using_dsym': None})
- test.name = test_name
-
- test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators)
- test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
- test.test_with_dwo = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators)
-
- # Add the test case to the globals, and hide InlineTest
- __globals.update({test_name : test})
-
- return test
-
Removed: lldb/trunk/test/lldbpexpect.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbpexpect.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbpexpect.py (original)
+++ lldb/trunk/test/lldbpexpect.py (removed)
@@ -1,59 +0,0 @@
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldb
-from lldbtest import *
-import lldbutil
-import os
-import sys
-import pexpect
-
-class PExpectTest(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- TestBase.setUp(self)
-
- def launchArgs(self):
- pass
-
- def launch(self, timeout=None):
- if timeout is None: timeout = 30
- logfile = sys.stdout if self.TraceOn() else None
- self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.launchArgs()), logfile=logfile)
- self.child.timeout = timeout
- self.timeout = timeout
-
- def expect(self, patterns=None, timeout=None, exact=None):
- if patterns is None: return None
- if timeout is None: timeout = self.timeout
- if exact is None: exact = False
- if exact:
- return self.child.expect_exact(patterns, timeout=timeout)
- else:
- return self.child.expect(patterns, timeout=timeout)
-
- def expectall(self, patterns=None, timeout=None, exact=None):
- if patterns is None: return None
- if timeout is None: timeout = self.timeout
- if exact is None: exact = False
- for pattern in patterns:
- self.expect(pattern, timeout=timeout, exact=exact)
-
- def sendimpl(self, sender, command, patterns=None, timeout=None, exact=None):
- sender(command)
- return self.expect(patterns=patterns, timeout=timeout, exact=exact)
-
- def send(self, command, patterns=None, timeout=None, exact=None):
- return self.sendimpl(self.child.send, command, patterns, timeout, exact)
-
- def sendline(self, command, patterns=None, timeout=None, exact=None):
- return self.sendimpl(self.child.sendline, command, patterns, timeout, exact)
-
- def quit(self, gracefully=None):
- if gracefully is None: gracefully = True
- self.child.sendeof()
- self.child.close(force=not gracefully)
- self.child = None
Removed: lldb/trunk/test/lldbplatformutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbplatformutil.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbplatformutil.py (original)
+++ lldb/trunk/test/lldbplatformutil.py (removed)
@@ -1,13 +0,0 @@
-""" This module contains functions used by the test cases to hide the
-architecture and/or the platform dependent nature of the tests. """
-
-def check_first_register_readable(test_case):
- if test_case.getArchitecture() in ['x86_64', 'i386']:
- test_case.expect("register read eax", substrs = ['eax = 0x'])
- elif test_case.getArchitecture() in ['arm']:
- test_case.expect("register read r0", substrs = ['r0 = 0x'])
- elif test_case.getArchitecture() in ['aarch64']:
- test_case.expect("register read x0", substrs = ['x0 = 0x'])
- else:
- # TODO: Add check for other architectures
- test_case.fail("Unsupported architecture for test case (arch: %s)" % test_case.getArchitecture())
Removed: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py (removed)
@@ -1,2838 +0,0 @@
-"""
-LLDB module which provides the abstract base class of lldb test case.
-
-The concrete subclass can override lldbtest.TesBase in order to inherit the
-common behavior for unitest.TestCase.setUp/tearDown implemented in this file.
-
-The subclass should override the attribute mydir in order for the python runtime
-to locate the individual test cases when running as part of a large test suite
-or when running each test case as a separate python invocation.
-
-./dotest.py provides a test driver which sets up the environment to run the
-entire of part of the test suite . Example:
-
-# Exercises the test suite in the types directory....
-/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 types
-...
-
-Session logs for test failures/errors/unexpected successes will go into directory '2012-05-16-13_35_42'
-Command invoked: python ./dotest.py -A x86_64 types
-compilers=['clang']
-
-Configuration: arch=x86_64 compiler=clang
-----------------------------------------------------------------------
-Collected 72 tests
-
-........................................................................
-----------------------------------------------------------------------
-Ran 72 tests in 135.468s
-
-OK
-$
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import abc
-import gc
-import glob
-import os, sys, traceback
-import os.path
-import re
-import signal
-from subprocess import *
-import time
-import types
-import unittest2
-import lldb
-import lldbtest_config
-import lldbutil
-import test_categories
-
-from six import add_metaclass
-from six import StringIO as SixStringIO
-from six.moves.urllib import parse as urlparse
-import six
-import collections
-
-# dosep.py starts lots and lots of dotest instances
-# This option helps you find if two (or more) dotest instances are using the same
-# directory at the same time
-# Enable it to cause test failures and stderr messages if dotest instances try to run in
-# the same directory simultaneously
-# it is disabled by default because it litters the test directories with ".dirlock" files
-debug_confirm_directory_exclusivity = False
-
-# See also dotest.parseOptionsAndInitTestdirs(), where the environment variables
-# LLDB_COMMAND_TRACE and LLDB_DO_CLEANUP are set from '-t' and '-r dir' options.
-
-# By default, traceAlways is False.
-if "LLDB_COMMAND_TRACE" in os.environ and os.environ["LLDB_COMMAND_TRACE"]=="YES":
- traceAlways = True
-else:
- traceAlways = False
-
-# By default, doCleanup is True.
-if "LLDB_DO_CLEANUP" in os.environ and os.environ["LLDB_DO_CLEANUP"]=="NO":
- doCleanup = False
-else:
- doCleanup = True
-
-
-#
-# Some commonly used assert messages.
-#
-
-COMMAND_FAILED_AS_EXPECTED = "Command has failed as expected"
-
-CURRENT_EXECUTABLE_SET = "Current executable set successfully"
-
-PROCESS_IS_VALID = "Process is valid"
-
-PROCESS_KILLED = "Process is killed successfully"
-
-PROCESS_EXITED = "Process exited successfully"
-
-PROCESS_STOPPED = "Process status should be stopped"
-
-RUN_SUCCEEDED = "Process is launched successfully"
-
-RUN_COMPLETED = "Process exited successfully"
-
-BACKTRACE_DISPLAYED_CORRECTLY = "Backtrace displayed correctly"
-
-BREAKPOINT_CREATED = "Breakpoint created successfully"
-
-BREAKPOINT_STATE_CORRECT = "Breakpoint state is correct"
-
-BREAKPOINT_PENDING_CREATED = "Pending breakpoint created successfully"
-
-BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit cout = 1"
-
-BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit cout = 2"
-
-BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit cout = 3"
-
-MISSING_EXPECTED_REGISTERS = "At least one expected register is unavailable."
-
-OBJECT_PRINTED_CORRECTLY = "Object printed correctly"
-
-SOURCE_DISPLAYED_CORRECTLY = "Source code displayed correctly"
-
-STEP_OUT_SUCCEEDED = "Thread step-out succeeded"
-
-STOPPED_DUE_TO_EXC_BAD_ACCESS = "Process should be stopped due to bad access exception"
-
-STOPPED_DUE_TO_ASSERT = "Process should be stopped due to an assertion"
-
-STOPPED_DUE_TO_BREAKPOINT = "Process should be stopped due to breakpoint"
-
-STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS = "%s, %s" % (
- STOPPED_DUE_TO_BREAKPOINT, "instead, the actual stop reason is: '%s'")
-
-STOPPED_DUE_TO_BREAKPOINT_CONDITION = "Stopped due to breakpoint condition"
-
-STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT = "Stopped due to breakpoint and ignore count"
-
-STOPPED_DUE_TO_SIGNAL = "Process state is stopped due to signal"
-
-STOPPED_DUE_TO_STEP_IN = "Process state is stopped due to step in"
-
-STOPPED_DUE_TO_WATCHPOINT = "Process should be stopped due to watchpoint"
-
-DATA_TYPES_DISPLAYED_CORRECTLY = "Data type(s) displayed correctly"
-
-VALID_BREAKPOINT = "Got a valid breakpoint"
-
-VALID_BREAKPOINT_LOCATION = "Got a valid breakpoint location"
-
-VALID_COMMAND_INTERPRETER = "Got a valid command interpreter"
-
-VALID_FILESPEC = "Got a valid filespec"
-
-VALID_MODULE = "Got a valid module"
-
-VALID_PROCESS = "Got a valid process"
-
-VALID_SYMBOL = "Got a valid symbol"
-
-VALID_TARGET = "Got a valid target"
-
-VALID_PLATFORM = "Got a valid platform"
-
-VALID_TYPE = "Got a valid type"
-
-VALID_VARIABLE = "Got a valid variable"
-
-VARIABLES_DISPLAYED_CORRECTLY = "Variable(s) displayed correctly"
-
-WATCHPOINT_CREATED = "Watchpoint created successfully"
-
-def CMD_MSG(str):
- '''A generic "Command '%s' returns successfully" message generator.'''
- return "Command '%s' returns successfully" % str
-
-def COMPLETION_MSG(str_before, str_after):
- '''A generic message generator for the completion mechanism.'''
- return "'%s' successfully completes to '%s'" % (str_before, str_after)
-
-def EXP_MSG(str, exe):
- '''A generic "'%s' returns expected result" message generator if exe.
- Otherwise, it generates "'%s' matches expected result" message.'''
- return "'%s' %s expected result" % (str, 'returns' if exe else 'matches')
-
-def SETTING_MSG(setting):
- '''A generic "Value of setting '%s' is correct" message generator.'''
- return "Value of setting '%s' is correct" % setting
-
-def EnvArray():
- """Returns an env variable array from the os.environ map object."""
- return list(map(lambda k,v: k+"="+v, list(os.environ.keys()), list(os.environ.values())))
-
-def line_number(filename, string_to_match):
- """Helper function to return the line number of the first matched string."""
- with open(filename, 'r') as f:
- for i, line in enumerate(f):
- if line.find(string_to_match) != -1:
- # Found our match.
- return i+1
- raise Exception("Unable to find '%s' within file %s" % (string_to_match, filename))
-
-def pointer_size():
- """Return the pointer size of the host system."""
- import ctypes
- a_pointer = ctypes.c_void_p(0xffff)
- return 8 * ctypes.sizeof(a_pointer)
-
-def is_exe(fpath):
- """Returns true if fpath is an executable."""
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-
-def which(program):
- """Returns the full path to a program; None otherwise."""
- fpath, fname = os.path.split(program)
- if fpath:
- if is_exe(program):
- return program
- else:
- for path in os.environ["PATH"].split(os.pathsep):
- exe_file = os.path.join(path, program)
- if is_exe(exe_file):
- return exe_file
- return None
-
-class recording(SixStringIO):
- """
- A nice little context manager for recording the debugger interactions into
- our session object. If trace flag is ON, it also emits the interactions
- into the stderr.
- """
- def __init__(self, test, trace):
- """Create a SixStringIO instance; record the session obj and trace flag."""
- SixStringIO.__init__(self)
- # The test might not have undergone the 'setUp(self)' phase yet, so that
- # the attribute 'session' might not even exist yet.
- self.session = getattr(test, "session", None) if test else None
- self.trace = trace
-
- def __enter__(self):
- """
- Context management protocol on entry to the body of the with statement.
- Just return the SixStringIO object.
- """
- return self
-
- def __exit__(self, type, value, tb):
- """
- Context management protocol on exit from the body of the with statement.
- If trace is ON, it emits the recordings into stderr. Always add the
- recordings to our session object. And close the SixStringIO object, too.
- """
- if self.trace:
- print(self.getvalue(), file=sys.stderr)
- if self.session:
- print(self.getvalue(), file=self.session)
- self.close()
-
- at add_metaclass(abc.ABCMeta)
-class _BaseProcess(object):
-
- @abc.abstractproperty
- def pid(self):
- """Returns process PID if has been launched already."""
-
- @abc.abstractmethod
- def launch(self, executable, args):
- """Launches new process with given executable and args."""
-
- @abc.abstractmethod
- def terminate(self):
- """Terminates previously launched process.."""
-
-class _LocalProcess(_BaseProcess):
-
- def __init__(self, trace_on):
- self._proc = None
- self._trace_on = trace_on
- self._delayafterterminate = 0.1
-
- @property
- def pid(self):
- return self._proc.pid
-
- def launch(self, executable, args):
- self._proc = Popen([executable] + args,
- stdout = open(os.devnull) if not self._trace_on else None,
- stdin = PIPE)
-
- def terminate(self):
- if self._proc.poll() == None:
- # Terminate _proc like it does the pexpect
- signals_to_try = [sig for sig in ['SIGHUP', 'SIGCONT', 'SIGINT'] if sig in dir(signal)]
- for sig in signals_to_try:
- try:
- self._proc.send_signal(getattr(signal, sig))
- time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
- return
- except ValueError:
- pass # Windows says SIGINT is not a valid signal to send
- self._proc.terminate()
- time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
- return
- self._proc.kill()
- time.sleep(self._delayafterterminate)
-
- def poll(self):
- return self._proc.poll()
-
-class _RemoteProcess(_BaseProcess):
-
- def __init__(self, install_remote):
- self._pid = None
- self._install_remote = install_remote
-
- @property
- def pid(self):
- return self._pid
-
- def launch(self, executable, args):
- if self._install_remote:
- src_path = executable
- dst_path = lldbutil.append_to_process_working_directory(os.path.basename(executable))
-
- dst_file_spec = lldb.SBFileSpec(dst_path, False)
- err = lldb.remote_platform.Install(lldb.SBFileSpec(src_path, True), dst_file_spec)
- if err.Fail():
- raise Exception("remote_platform.Install('%s', '%s') failed: %s" % (src_path, dst_path, err))
- else:
- dst_path = executable
- dst_file_spec = lldb.SBFileSpec(executable, False)
-
- launch_info = lldb.SBLaunchInfo(args)
- launch_info.SetExecutableFile(dst_file_spec, True)
- launch_info.SetWorkingDirectory(lldb.remote_platform.GetWorkingDirectory())
-
- # Redirect stdout and stderr to /dev/null
- launch_info.AddSuppressFileAction(1, False, True)
- launch_info.AddSuppressFileAction(2, False, True)
-
- err = lldb.remote_platform.Launch(launch_info)
- if err.Fail():
- raise Exception("remote_platform.Launch('%s', '%s') failed: %s" % (dst_path, args, err))
- self._pid = launch_info.GetProcessID()
-
- def terminate(self):
- lldb.remote_platform.Kill(self._pid)
-
-# From 2.7's subprocess.check_output() convenience function.
-# Return a tuple (stdoutdata, stderrdata).
-def system(commands, **kwargs):
- r"""Run an os command with arguments and return its output as a byte string.
-
- If the exit code was non-zero it raises a CalledProcessError. The
- CalledProcessError object will have the return code in the returncode
- attribute and output in the output attribute.
-
- The arguments are the same as for the Popen constructor. Example:
-
- >>> check_output(["ls", "-l", "/dev/null"])
- 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
-
- The stdout argument is not allowed as it is used internally.
- To capture standard error in the result, use stderr=STDOUT.
-
- >>> check_output(["/bin/sh", "-c",
- ... "ls -l non_existent_file ; exit 0"],
- ... stderr=STDOUT)
- 'ls: non_existent_file: No such file or directory\n'
- """
-
- # Assign the sender object to variable 'test' and remove it from kwargs.
- test = kwargs.pop('sender', None)
-
- # [['make', 'clean', 'foo'], ['make', 'foo']] -> ['make clean foo', 'make foo']
- commandList = [' '.join(x) for x in commands]
- output = ""
- error = ""
- for shellCommand in commandList:
- if 'stdout' in kwargs:
- raise ValueError('stdout argument not allowed, it will be overridden.')
- if 'shell' in kwargs and kwargs['shell']==False:
- raise ValueError('shell=False not allowed')
- process = Popen(shellCommand, stdout=PIPE, stderr=PIPE, shell=True, **kwargs)
- pid = process.pid
- this_output, this_error = process.communicate()
- retcode = process.poll()
-
- # Enable trace on failure return while tracking down FreeBSD buildbot issues
- trace = traceAlways
- if not trace and retcode and sys.platform.startswith("freebsd"):
- trace = True
-
- with recording(test, trace) as sbuf:
- print(file=sbuf)
- print("os command:", shellCommand, file=sbuf)
- print("with pid:", pid, file=sbuf)
- print("stdout:", this_output, file=sbuf)
- print("stderr:", this_error, file=sbuf)
- print("retcode:", retcode, file=sbuf)
- print(file=sbuf)
-
- if retcode:
- cmd = kwargs.get("args")
- if cmd is None:
- cmd = shellCommand
- raise CalledProcessError(retcode, cmd)
- output = output + this_output
- error = error + this_error
- return (output, error)
-
-def getsource_if_available(obj):
- """
- Return the text of the source code for an object if available. Otherwise,
- a print representation is returned.
- """
- import inspect
- try:
- return inspect.getsource(obj)
- except:
- return repr(obj)
-
-def builder_module():
- if sys.platform.startswith("freebsd"):
- return __import__("builder_freebsd")
- return __import__("builder_" + sys.platform)
-
-def run_adb_command(cmd, device_id):
- device_id_args = []
- if device_id:
- device_id_args = ["-s", device_id]
- full_cmd = ["adb"] + device_id_args + cmd
- p = Popen(full_cmd, stdout=PIPE, stderr=PIPE)
- stdout, stderr = p.communicate()
- return p.returncode, stdout, stderr
-
-def append_android_envs(dictionary):
- if dictionary is None:
- dictionary = {}
- dictionary["OS"] = "Android"
- if android_device_api() >= 16:
- dictionary["PIE"] = 1
- return dictionary
-
-def target_is_android():
- if not hasattr(target_is_android, 'result'):
- triple = lldb.DBG.GetSelectedPlatform().GetTriple()
- match = re.match(".*-.*-.*-android", triple)
- target_is_android.result = match is not None
- return target_is_android.result
-
-def android_device_api():
- if not hasattr(android_device_api, 'result'):
- assert lldb.platform_url is not None
- device_id = None
- parsed_url = urlparse.urlparse(lldb.platform_url)
- if parsed_url.scheme == "adb":
- device_id = parsed_url.netloc.split(":")[0]
- retcode, stdout, stderr = run_adb_command(
- ["shell", "getprop", "ro.build.version.sdk"], device_id)
- if retcode == 0:
- android_device_api.result = int(stdout)
- else:
- raise LookupError(
- ">>> Unable to determine the API level of the Android device.\n"
- ">>> stdout:\n%s\n"
- ">>> stderr:\n%s\n" % (stdout, stderr))
- return android_device_api.result
-
-#
-# Decorators for categorizing test cases.
-#
-from functools import wraps
-def add_test_categories(cat):
- """Decorate an item with test categories"""
- cat = test_categories.validate(cat, True)
- def impl(func):
- func.getCategories = lambda test: cat
- return func
- return impl
-
-def benchmarks_test(func):
- """Decorate the item as a benchmarks test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@benchmarks_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if not lldb.just_do_benchmarks_test:
- self.skipTest("benchmarks tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__benchmarks_test__ = True
- return wrapper
-
-def no_debug_info_test(func):
- """Decorate the item as a test what don't use any debug info. If this annotation is specified
- then the test runner won't generate a separate test for each debug info format. """
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@no_debug_info_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__no_debug_info_test__ = True
- return wrapper
-
-def dsym_test(func):
- """Decorate the item as a dsym test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@dsym_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.dont_do_dsym_test:
- self.skipTest("dsym tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__dsym_test__ = True
- return wrapper
-
-def dwarf_test(func):
- """Decorate the item as a dwarf test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@dwarf_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.dont_do_dwarf_test:
- self.skipTest("dwarf tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__dwarf_test__ = True
- return wrapper
-
-def dwo_test(func):
- """Decorate the item as a dwo test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@dwo_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.dont_do_dwo_test:
- self.skipTest("dwo tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__dwo_test__ = True
- return wrapper
-
-def debugserver_test(func):
- """Decorate the item as a debugserver test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@debugserver_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.dont_do_debugserver_test:
- self.skipTest("debugserver tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__debugserver_test__ = True
- return wrapper
-
-def llgs_test(func):
- """Decorate the item as a lldb-server test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@llgs_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.dont_do_llgs_test:
- self.skipTest("llgs tests")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__llgs_test__ = True
- return wrapper
-
-def not_remote_testsuite_ready(func):
- """Decorate the item as a test which is not ready yet for remote testsuite."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@not_remote_testsuite_ready can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- if lldb.lldbtest_remote_sandbox or lldb.remote_platform:
- self.skipTest("not ready for remote testsuite")
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__not_ready_for_remote_testsuite_test__ = True
- return wrapper
-
-def expectedFailure(expected_fn, bugnumber=None):
- def expectedFailure_impl(func):
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- try:
- func(*args, **kwargs)
- except Exception:
- if expected_fn(self):
- raise case._ExpectedFailure(sys.exc_info(), bugnumber)
- else:
- raise
- if expected_fn(self):
- raise case._UnexpectedSuccess(sys.exc_info(), bugnumber)
- return wrapper
- # if bugnumber is not-callable(incluing None), that means decorator function is called with optional arguments
- # return decorator in this case, so it will be used to decorating original method
- if six.callable(bugnumber):
- return expectedFailure_impl(bugnumber)
- else:
- return expectedFailure_impl
-
-# provide a function to xfail on defined oslist, compiler version, and archs
-# if none is specified for any argument, that argument won't be checked and thus means for all
-# for example,
-# @expectedFailureAll, xfail for all platform/compiler/arch,
-# @expectedFailureAll(compiler='gcc'), xfail for gcc on all platform/architecture
-# @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), xfail for gcc>=4.9 on linux with i386
-def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, compiler_version=None, archs=None, triple=None, debug_info=None):
- def fn(self):
- return ((oslist is None or self.getPlatform() in oslist) and
- (compiler is None or (compiler in self.getCompiler() and self.expectedCompilerVersion(compiler_version))) and
- self.expectedArch(archs) and
- (triple is None or re.match(triple, lldb.DBG.GetSelectedPlatform().GetTriple())) and
- (debug_info is None or self.debug_info in debug_info))
- return expectedFailure(fn, bugnumber)
-
-def expectedFailureDwarf(bugnumber=None):
- return expectedFailureAll(bugnumber=bugnumber, debug_info="dwarf")
-
-def expectedFailureDwo(bugnumber=None):
- return expectedFailureAll(bugnumber=bugnumber, debug_info="dwo")
-
-def expectedFailureDsym(bugnumber=None):
- return expectedFailureAll(bugnumber=bugnumber, debug_info="dsym")
-
-def expectedFailureCompiler(compiler, compiler_version=None, bugnumber=None):
- if compiler_version is None:
- compiler_version=['=', None]
- return expectedFailureAll(bugnumber=bugnumber, compiler=compiler, compiler_version=compiler_version)
-
-# to XFAIL a specific clang versions, try this
-# @expectedFailureClang('bugnumber', ['<=', '3.4'])
-def expectedFailureClang(bugnumber=None, compiler_version=None):
- return expectedFailureCompiler('clang', compiler_version, bugnumber)
-
-def expectedFailureGcc(bugnumber=None, compiler_version=None):
- return expectedFailureCompiler('gcc', compiler_version, bugnumber)
-
-def expectedFailureIcc(bugnumber=None):
- return expectedFailureCompiler('icc', None, bugnumber)
-
-def expectedFailureArch(arch, bugnumber=None):
- def fn(self):
- return arch in self.getArchitecture()
- return expectedFailure(fn, bugnumber)
-
-def expectedFailurei386(bugnumber=None):
- return expectedFailureArch('i386', bugnumber)
-
-def expectedFailurex86_64(bugnumber=None):
- return expectedFailureArch('x86_64', bugnumber)
-
-def expectedFailureOS(oslist, bugnumber=None, compilers=None, debug_info=None):
- def fn(self):
- return (self.getPlatform() in oslist and
- self.expectedCompiler(compilers) and
- (debug_info is None or self.debug_info in debug_info))
- return expectedFailure(fn, bugnumber)
-
-def expectedFailureHostOS(oslist, bugnumber=None, compilers=None):
- def fn(self):
- return (getHostPlatform() in oslist and
- self.expectedCompiler(compilers))
- return expectedFailure(fn, bugnumber)
-
-def expectedFailureDarwin(bugnumber=None, compilers=None, debug_info=None):
- # For legacy reasons, we support both "darwin" and "macosx" as OS X triples.
- return expectedFailureOS(getDarwinOSTriples(), bugnumber, compilers, debug_info=debug_info)
-
-def expectedFailureFreeBSD(bugnumber=None, compilers=None, debug_info=None):
- return expectedFailureOS(['freebsd'], bugnumber, compilers, debug_info=debug_info)
-
-def expectedFailureLinux(bugnumber=None, compilers=None, debug_info=None):
- return expectedFailureOS(['linux'], bugnumber, compilers, debug_info=debug_info)
-
-def expectedFailureWindows(bugnumber=None, compilers=None, debug_info=None):
- return expectedFailureOS(['windows'], bugnumber, compilers, debug_info=debug_info)
-
-def expectedFailureHostWindows(bugnumber=None, compilers=None):
- return expectedFailureHostOS(['windows'], bugnumber, compilers)
-
-def matchAndroid(api_levels=None, archs=None):
- def match(self):
- if not target_is_android():
- return False
- if archs is not None and self.getArchitecture() not in archs:
- return False
- if api_levels is not None and android_device_api() not in api_levels:
- return False
- return True
- return match
-
-
-def expectedFailureAndroid(bugnumber=None, api_levels=None, archs=None):
- """ Mark a test as xfail for Android.
-
- Arguments:
- bugnumber - The LLVM pr associated with the problem.
- api_levels - A sequence of numbers specifying the Android API levels
- for which a test is expected to fail. None means all API level.
- arch - A sequence of architecture names specifying the architectures
- for which a test is expected to fail. None means all architectures.
- """
- return expectedFailure(matchAndroid(api_levels, archs), bugnumber)
-
-# if the test passes on the first try, we're done (success)
-# if the test fails once, then passes on the second try, raise an ExpectedFailure
-# if the test fails twice in a row, re-throw the exception from the second test run
-def expectedFlakey(expected_fn, bugnumber=None):
- def expectedFailure_impl(func):
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- try:
- func(*args, **kwargs)
- # don't retry if the test case is already decorated with xfail or skip
- except (case._ExpectedFailure, case.SkipTest, case._UnexpectedSuccess):
- raise
- except Exception:
- if expected_fn(self):
- # before retry, run tearDown for previous run and setup for next
- try:
- self.tearDown()
- self.setUp()
- func(*args, **kwargs)
- except Exception:
- # oh snap! two failures in a row, record a failure/error
- raise
- # record the expected failure
- raise case._ExpectedFailure(sys.exc_info(), bugnumber)
- else:
- raise
- return wrapper
- # if bugnumber is not-callable(incluing None), that means decorator function is called with optional arguments
- # return decorator in this case, so it will be used to decorating original method
- if six.callable(bugnumber):
- return expectedFailure_impl(bugnumber)
- else:
- return expectedFailure_impl
-
-def expectedFlakeyDwarf(bugnumber=None):
- def fn(self):
- return self.debug_info == "dwarf"
- return expectedFlakey(fn, bugnumber)
-
-def expectedFlakeyDsym(bugnumber=None):
- def fn(self):
- return self.debug_info == "dwarf"
- return expectedFlakey(fn, bugnumber)
-
-def expectedFlakeyOS(oslist, bugnumber=None, compilers=None):
- def fn(self):
- return (self.getPlatform() in oslist and
- self.expectedCompiler(compilers))
- return expectedFlakey(fn, bugnumber)
-
-def expectedFlakeyDarwin(bugnumber=None, compilers=None):
- # For legacy reasons, we support both "darwin" and "macosx" as OS X triples.
- return expectedFlakeyOS(getDarwinOSTriples(), bugnumber, compilers)
-
-def expectedFlakeyLinux(bugnumber=None, compilers=None):
- return expectedFlakeyOS(['linux'], bugnumber, compilers)
-
-def expectedFlakeyFreeBSD(bugnumber=None, compilers=None):
- return expectedFlakeyOS(['freebsd'], bugnumber, compilers)
-
-def expectedFlakeyCompiler(compiler, compiler_version=None, bugnumber=None):
- if compiler_version is None:
- compiler_version=['=', None]
- def fn(self):
- return compiler in self.getCompiler() and self.expectedCompilerVersion(compiler_version)
- return expectedFlakey(fn, bugnumber)
-
-# @expectedFlakeyClang('bugnumber', ['<=', '3.4'])
-def expectedFlakeyClang(bugnumber=None, compiler_version=None):
- return expectedFlakeyCompiler('clang', compiler_version, bugnumber)
-
-# @expectedFlakeyGcc('bugnumber', ['<=', '3.4'])
-def expectedFlakeyGcc(bugnumber=None, compiler_version=None):
- return expectedFlakeyCompiler('gcc', compiler_version, bugnumber)
-
-def expectedFlakeyAndroid(bugnumber=None, api_levels=None, archs=None):
- return expectedFlakey(matchAndroid(api_levels, archs), bugnumber)
-
-def skipIfRemote(func):
- """Decorate the item to skip tests if testing remotely."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfRemote can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- if lldb.remote_platform:
- self = args[0]
- self.skipTest("skip on remote platform")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipUnlessListedRemote(remote_list=None):
- def myImpl(func):
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfRemote can only be used to decorate a "
- "test method")
-
- @wraps(func)
- def wrapper(*args, **kwargs):
- if remote_list and lldb.remote_platform:
- self = args[0]
- triple = self.dbg.GetSelectedPlatform().GetTriple()
- for r in remote_list:
- if r in triple:
- func(*args, **kwargs)
- return
- self.skipTest("skip on remote platform %s" % str(triple))
- else:
- func(*args, **kwargs)
- return wrapper
-
- return myImpl
-
-def skipIfRemoteDueToDeadlock(func):
- """Decorate the item to skip tests if testing remotely due to the test deadlocking."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfRemote can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- if lldb.remote_platform:
- self = args[0]
- self.skipTest("skip on remote platform (deadlocks)")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfNoSBHeaders(func):
- """Decorate the item to mark tests that should be skipped when LLDB is built with no SB API headers."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfNoSBHeaders can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- if sys.platform.startswith("darwin"):
- header = os.path.join(os.environ["LLDB_LIB_DIR"], 'LLDB.framework', 'Versions','Current','Headers','LLDB.h')
- else:
- header = os.path.join(os.environ["LLDB_SRC"], "include", "lldb", "API", "LLDB.h")
- platform = sys.platform
- if not os.path.exists(header):
- self.skipTest("skip because LLDB.h header not found")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfFreeBSD(func):
- """Decorate the item to skip tests that should be skipped on FreeBSD."""
- return skipIfPlatform(["freebsd"])(func)
-
-def getDarwinOSTriples():
- return ['darwin', 'macosx', 'ios']
-
-def skipIfDarwin(func):
- """Decorate the item to skip tests that should be skipped on Darwin."""
- return skipIfPlatform(getDarwinOSTriples())(func)
-
-def skipIfLinux(func):
- """Decorate the item to skip tests that should be skipped on Linux."""
- return skipIfPlatform(["linux"])(func)
-
-def skipUnlessHostLinux(func):
- """Decorate the item to skip tests that should be skipped on any non Linux host."""
- return skipUnlessHostPlatform(["linux"])(func)
-
-def skipIfWindows(func):
- """Decorate the item to skip tests that should be skipped on Windows."""
- return skipIfPlatform(["windows"])(func)
-
-def skipIfHostWindows(func):
- """Decorate the item to skip tests that should be skipped on Windows."""
- return skipIfHostPlatform(["windows"])(func)
-
-def skipUnlessWindows(func):
- """Decorate the item to skip tests that should be skipped on any non-Windows platform."""
- return skipUnlessPlatform(["windows"])(func)
-
-def skipUnlessDarwin(func):
- """Decorate the item to skip tests that should be skipped on any non Darwin platform."""
- return skipUnlessPlatform(getDarwinOSTriples())(func)
-
-def skipUnlessGoInstalled(func):
- """Decorate the item to skip tests when no Go compiler is available."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfGcc can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- compiler = self.getGoCompilerVersion()
- if not compiler:
- self.skipTest("skipping because go compiler not found")
- else:
- # Ensure the version is the minimum version supported by
- # the LLDB go support.
- match_version = re.search(r"(\d+\.\d+(\.\d+)?)", compiler)
- if not match_version:
- # Couldn't determine version.
- self.skipTest(
- "skipping because go version could not be parsed "
- "out of {}".format(compiler))
- else:
- from distutils.version import StrictVersion
- min_strict_version = StrictVersion("1.4.0")
- compiler_strict_version = StrictVersion(match_version.group(1))
- if compiler_strict_version < min_strict_version:
- self.skipTest(
- "skipping because available go version ({}) does "
- "not meet minimum required go version ({})".format(
- compiler_strict_version,
- min_strict_version))
- func(*args, **kwargs)
- return wrapper
-
-def getPlatform():
- """Returns the target platform which the tests are running on."""
- platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
- if platform.startswith('freebsd'):
- platform = 'freebsd'
- return platform
-
-def getHostPlatform():
- """Returns the host platform running the test suite."""
- # Attempts to return a platform name matching a target Triple platform.
- if sys.platform.startswith('linux'):
- return 'linux'
- elif sys.platform.startswith('win32'):
- return 'windows'
- elif sys.platform.startswith('darwin'):
- return 'darwin'
- elif sys.platform.startswith('freebsd'):
- return 'freebsd'
- else:
- return sys.platform
-
-def platformIsDarwin():
- """Returns true if the OS triple for the selected platform is any valid apple OS"""
- return getPlatform() in getDarwinOSTriples()
-
-def skipIfHostIncompatibleWithRemote(func):
- """Decorate the item to skip tests if binaries built on this host are incompatible."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfHostIncompatibleWithRemote can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- host_arch = self.getLldbArchitecture()
- host_platform = getHostPlatform()
- target_arch = self.getArchitecture()
- target_platform = 'darwin' if self.platformIsDarwin() else self.getPlatform()
- if not (target_arch == 'x86_64' and host_arch == 'i386') and host_arch != target_arch:
- self.skipTest("skipping because target %s is not compatible with host architecture %s" % (target_arch, host_arch))
- elif target_platform != host_platform:
- self.skipTest("skipping because target is %s but host is %s" % (target_platform, host_platform))
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfHostPlatform(oslist):
- """Decorate the item to skip tests if running on one of the listed host platforms."""
- return unittest2.skipIf(getHostPlatform() in oslist,
- "skip on %s" % (", ".join(oslist)))
-
-def skipUnlessHostPlatform(oslist):
- """Decorate the item to skip tests unless running on one of the listed host platforms."""
- return unittest2.skipUnless(getHostPlatform() in oslist,
- "requires on of %s" % (", ".join(oslist)))
-
-def skipUnlessArch(archlist):
- """Decorate the item to skip tests unless running on one of the listed architectures."""
- def myImpl(func):
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipUnlessArch can only be used to decorate a test method")
-
- @wraps(func)
- def wrapper(*args, **kwargs):
- self = args[0]
- if self.getArchitecture() not in archlist:
- self.skipTest("skipping for architecture %s (requires one of %s)" %
- (self.getArchitecture(), ", ".join(archlist)))
- else:
- func(*args, **kwargs)
- return wrapper
-
- return myImpl
-
-def skipIfPlatform(oslist):
- """Decorate the item to skip tests if running on one of the listed platforms."""
- return unittest2.skipIf(getPlatform() in oslist,
- "skip on %s" % (", ".join(oslist)))
-
-def skipUnlessPlatform(oslist):
- """Decorate the item to skip tests unless running on one of the listed platforms."""
- return unittest2.skipUnless(getPlatform() in oslist,
- "requires on of %s" % (", ".join(oslist)))
-
-def skipIfLinuxClang(func):
- """Decorate the item to skip tests that should be skipped if building on
- Linux with clang.
- """
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfLinuxClang can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- compiler = self.getCompiler()
- platform = self.getPlatform()
- if "clang" in compiler and platform == "linux":
- self.skipTest("skipping because Clang is used on Linux")
- else:
- func(*args, **kwargs)
- return wrapper
-
-# provide a function to skip on defined oslist, compiler version, and archs
-# if none is specified for any argument, that argument won't be checked and thus means for all
-# for example,
-# @skipIf, skip for all platform/compiler/arch,
-# @skipIf(compiler='gcc'), skip for gcc on all platform/architecture
-# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for gcc>=4.9 on linux with i386
-
-# TODO: refactor current code, to make skipIfxxx functions to call this function
-def skipIf(bugnumber=None, oslist=None, compiler=None, compiler_version=None, archs=None, debug_info=None):
- def fn(self):
- return ((oslist is None or self.getPlatform() in oslist) and
- (compiler is None or (compiler in self.getCompiler() and self.expectedCompilerVersion(compiler_version))) and
- self.expectedArch(archs) and
- (debug_info is None or self.debug_info in debug_info))
- return skipTestIfFn(fn, bugnumber, skipReason="skipping because os:%s compiler: %s %s arch: %s debug info: %s"%(oslist, compiler, compiler_version, archs, debug_info))
-
-def skipIfDebugInfo(bugnumber=None, debug_info=None):
- return skipIf(bugnumber=bugnumber, debug_info=debug_info)
-
-def skipIfDWO(bugnumber=None):
- return skipIfDebugInfo(bugnumber, ["dwo"])
-
-def skipIfDwarf(bugnumber=None):
- return skipIfDebugInfo(bugnumber, ["dwarf"])
-
-def skipIfDsym(bugnumber=None):
- return skipIfDebugInfo(bugnumber, ["dsym"])
-
-def skipTestIfFn(expected_fn, bugnumber=None, skipReason=None):
- def skipTestIfFn_impl(func):
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- if expected_fn(self):
- self.skipTest(skipReason)
- else:
- func(*args, **kwargs)
- return wrapper
- if six.callable(bugnumber):
- return skipTestIfFn_impl(bugnumber)
- else:
- return skipTestIfFn_impl
-
-def skipIfGcc(func):
- """Decorate the item to skip tests that should be skipped if building with gcc ."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfGcc can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- compiler = self.getCompiler()
- if "gcc" in compiler:
- self.skipTest("skipping because gcc is the test compiler")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfIcc(func):
- """Decorate the item to skip tests that should be skipped if building with icc ."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfIcc can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- compiler = self.getCompiler()
- if "icc" in compiler:
- self.skipTest("skipping because icc is the test compiler")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfi386(func):
- """Decorate the item to skip tests that should be skipped if building 32-bit."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfi386 can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- if "i386" == self.getArchitecture():
- self.skipTest("skipping because i386 is not a supported architecture")
- else:
- func(*args, **kwargs)
- return wrapper
-
-def skipIfTargetAndroid(api_levels=None, archs=None):
- """Decorator to skip tests when the target is Android.
-
- Arguments:
- api_levels - The API levels for which the test should be skipped. If
- it is None, then the test will be skipped for all API levels.
- arch - A sequence of architecture names specifying the architectures
- for which a test is skipped. None means all architectures.
- """
- def myImpl(func):
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipIfTargetAndroid can only be used to "
- "decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- self = args[0]
- if matchAndroid(api_levels, archs)(self):
- self.skipTest("skiped on Android target with API %d and architecture %s" %
- (android_device_api(), self.getArchitecture()))
- func(*args, **kwargs)
- return wrapper
- return myImpl
-
-def skipUnlessCompilerRt(func):
- """Decorate the item to skip tests if testing remotely."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipUnless can only be used to decorate a test method")
- @wraps(func)
- def wrapper(*args, **kwargs):
- from unittest2 import case
- import os.path
- compilerRtPath = os.path.join(os.path.dirname(__file__), "..", "..", "..", "projects", "compiler-rt")
- if not os.path.exists(compilerRtPath):
- self = args[0]
- self.skipTest("skip if compiler-rt not found")
- else:
- func(*args, **kwargs)
- return wrapper
-
-class _PlatformContext(object):
- """Value object class which contains platform-specific options."""
-
- def __init__(self, shlib_environment_var, shlib_prefix, shlib_extension):
- self.shlib_environment_var = shlib_environment_var
- self.shlib_prefix = shlib_prefix
- self.shlib_extension = shlib_extension
-
-
-class Base(unittest2.TestCase):
- """
- Abstract base for performing lldb (see TestBase) or other generic tests (see
- BenchBase for one example). lldbtest.Base works with the test driver to
- accomplish things.
-
- """
-
- # The concrete subclass should override this attribute.
- mydir = None
-
- # Keep track of the old current working directory.
- oldcwd = None
-
- @staticmethod
- def compute_mydir(test_file):
- '''Subclasses should call this function to correctly calculate the required "mydir" attribute as follows:
-
- mydir = TestBase.compute_mydir(__file__)'''
- test_dir = os.path.dirname(test_file)
- return test_dir[len(os.environ["LLDB_TEST"])+1:]
-
- def TraceOn(self):
- """Returns True if we are in trace mode (tracing detailed test execution)."""
- return traceAlways
-
- @classmethod
- def setUpClass(cls):
- """
- Python unittest framework class setup fixture.
- Do current directory manipulation.
- """
- # Fail fast if 'mydir' attribute is not overridden.
- if not cls.mydir or len(cls.mydir) == 0:
- raise Exception("Subclasses must override the 'mydir' attribute.")
-
- # Save old working directory.
- cls.oldcwd = os.getcwd()
-
- # Change current working directory if ${LLDB_TEST} is defined.
- # See also dotest.py which sets up ${LLDB_TEST}.
- if ("LLDB_TEST" in os.environ):
- full_dir = os.path.join(os.environ["LLDB_TEST"], cls.mydir)
- if traceAlways:
- print("Change dir to:", full_dir, file=sys.stderr)
- os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir))
-
- if debug_confirm_directory_exclusivity:
- import lock
- cls.dir_lock = lock.Lock(os.path.join(full_dir, ".dirlock"))
- try:
- cls.dir_lock.try_acquire()
- # write the class that owns the lock into the lock file
- cls.dir_lock.handle.write(cls.__name__)
- except IOError as ioerror:
- # nothing else should have this directory lock
- # wait here until we get a lock
- cls.dir_lock.acquire()
- # read the previous owner from the lock file
- lock_id = cls.dir_lock.handle.read()
- print("LOCK ERROR: {} wants to lock '{}' but it is already locked by '{}'".format(cls.__name__, full_dir, lock_id), file=sys.stderr)
- raise ioerror
-
- # Set platform context.
- if platformIsDarwin():
- cls.platformContext = _PlatformContext('DYLD_LIBRARY_PATH', 'lib', 'dylib')
- elif getPlatform() == "linux" or getPlatform() == "freebsd":
- cls.platformContext = _PlatformContext('LD_LIBRARY_PATH', 'lib', 'so')
- else:
- cls.platformContext = None
-
- @classmethod
- def tearDownClass(cls):
- """
- Python unittest framework class teardown fixture.
- Do class-wide cleanup.
- """
-
- if doCleanup and not lldb.skip_build_and_cleanup:
- # First, let's do the platform-specific cleanup.
- module = builder_module()
- module.cleanup()
-
- # Subclass might have specific cleanup function defined.
- if getattr(cls, "classCleanup", None):
- if traceAlways:
- print("Call class-specific cleanup function for class:", cls, file=sys.stderr)
- try:
- cls.classCleanup()
- except:
- exc_type, exc_value, exc_tb = sys.exc_info()
- traceback.print_exception(exc_type, exc_value, exc_tb)
-
- if debug_confirm_directory_exclusivity:
- cls.dir_lock.release()
- del cls.dir_lock
-
- # Restore old working directory.
- if traceAlways:
- print("Restore dir to:", cls.oldcwd, file=sys.stderr)
- os.chdir(cls.oldcwd)
-
- @classmethod
- def skipLongRunningTest(cls):
- """
- By default, we skip long running test case.
- This can be overridden by passing '-l' to the test driver (dotest.py).
- """
- if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ["LLDB_SKIP_LONG_RUNNING_TEST"]:
- return False
- else:
- return True
-
- def enableLogChannelsForCurrentTest(self):
- if len(lldbtest_config.channels) == 0:
- return
-
- # if debug channels are specified in lldbtest_config.channels,
- # create a new set of log files for every test
- log_basename = self.getLogBasenameForCurrentTest()
-
- # confirm that the file is writeable
- host_log_path = "{}-host.log".format(log_basename)
- open(host_log_path, 'w').close()
-
- log_enable = "log enable -Tpn -f {} ".format(host_log_path)
- for channel_with_categories in lldbtest_config.channels:
- channel_then_categories = channel_with_categories.split(' ', 1)
- channel = channel_then_categories[0]
- if len(channel_then_categories) > 1:
- categories = channel_then_categories[1]
- else:
- categories = "default"
-
- if channel == "gdb-remote":
- # communicate gdb-remote categories to debugserver
- os.environ["LLDB_DEBUGSERVER_LOG_FLAGS"] = categories
-
- self.ci.HandleCommand(log_enable + channel_with_categories, self.res)
- if not self.res.Succeeded():
- raise Exception('log enable failed (check LLDB_LOG_OPTION env variable)')
-
- # Communicate log path name to debugserver & lldb-server
- server_log_path = "{}-server.log".format(log_basename)
- open(server_log_path, 'w').close()
- os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path
-
- # Communicate channels to lldb-server
- os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)
-
- if len(lldbtest_config.channels) == 0:
- return
-
- def disableLogChannelsForCurrentTest(self):
- # close all log files that we opened
- for channel_and_categories in lldbtest_config.channels:
- # channel format - <channel-name> [<category0> [<category1> ...]]
- channel = channel_and_categories.split(' ', 1)[0]
- self.ci.HandleCommand("log disable " + channel, self.res)
- if not self.res.Succeeded():
- raise Exception('log disable failed (check LLDB_LOG_OPTION env variable)')
-
- def setUp(self):
- """Fixture for unittest test case setup.
-
- It works with the test driver to conditionally skip tests and does other
- initializations."""
- #import traceback
- #traceback.print_stack()
-
- if "LIBCXX_PATH" in os.environ:
- self.libcxxPath = os.environ["LIBCXX_PATH"]
- else:
- self.libcxxPath = None
-
- if "LLDBMI_EXEC" in os.environ:
- self.lldbMiExec = os.environ["LLDBMI_EXEC"]
- else:
- self.lldbMiExec = None
-
- # If we spawn an lldb process for test (via pexpect), do not load the
- # init file unless told otherwise.
- if "NO_LLDBINIT" in os.environ and "NO" == os.environ["NO_LLDBINIT"]:
- self.lldbOption = ""
- else:
- self.lldbOption = "--no-lldbinit"
-
- # Assign the test method name to self.testMethodName.
- #
- # For an example of the use of this attribute, look at test/types dir.
- # There are a bunch of test cases under test/types and we don't want the
- # module cacheing subsystem to be confused with executable name "a.out"
- # used for all the test cases.
- self.testMethodName = self._testMethodName
-
- # Benchmarks test is decorated with @benchmarks_test,
- # which also sets the "__benchmarks_test__" attribute of the
- # function object to True.
- try:
- if lldb.just_do_benchmarks_test:
- testMethod = getattr(self, self._testMethodName)
- if getattr(testMethod, "__benchmarks_test__", False):
- pass
- else:
- self.skipTest("non benchmarks test")
- except AttributeError:
- pass
-
- # This is for the case of directly spawning 'lldb'/'gdb' and interacting
- # with it using pexpect.
- self.child = None
- self.child_prompt = "(lldb) "
- # If the child is interacting with the embedded script interpreter,
- # there are two exits required during tear down, first to quit the
- # embedded script interpreter and second to quit the lldb command
- # interpreter.
- self.child_in_script_interpreter = False
-
- # These are for customized teardown cleanup.
- self.dict = None
- self.doTearDownCleanup = False
- # And in rare cases where there are multiple teardown cleanups.
- self.dicts = []
- self.doTearDownCleanups = False
-
- # List of spawned subproces.Popen objects
- self.subprocesses = []
-
- # List of forked process PIDs
- self.forkedProcessPids = []
-
- # Create a string buffer to record the session info, to be dumped into a
- # test case specific file if test failure is encountered.
- self.log_basename = self.getLogBasenameForCurrentTest()
-
- session_file = "{}.log".format(self.log_basename)
- unbuffered = 0 # 0 is the constant for unbuffered
- self.session = open(session_file, "w", unbuffered)
-
- # Optimistically set __errored__, __failed__, __expected__ to False
- # initially. If the test errored/failed, the session info
- # (self.session) is then dumped into a session specific file for
- # diagnosis.
- self.__cleanup_errored__ = False
- self.__errored__ = False
- self.__failed__ = False
- self.__expected__ = False
- # We are also interested in unexpected success.
- self.__unexpected__ = False
- # And skipped tests.
- self.__skipped__ = False
-
- # See addTearDownHook(self, hook) which allows the client to add a hook
- # function to be run during tearDown() time.
- self.hooks = []
-
- # See HideStdout(self).
- self.sys_stdout_hidden = False
-
- if self.platformContext:
- # set environment variable names for finding shared libraries
- self.dylibPath = self.platformContext.shlib_environment_var
-
- # Create the debugger instance if necessary.
- try:
- self.dbg = lldb.DBG
- except AttributeError:
- self.dbg = lldb.SBDebugger.Create()
-
- if not self.dbg:
- raise Exception('Invalid debugger instance')
-
- # Retrieve the associated command interpreter instance.
- self.ci = self.dbg.GetCommandInterpreter()
- if not self.ci:
- raise Exception('Could not get the command interpreter')
-
- # And the result object.
- self.res = lldb.SBCommandReturnObject()
-
- self.enableLogChannelsForCurrentTest()
-
- def runHooks(self, child=None, child_prompt=None, use_cmd_api=False):
- """Perform the run hooks to bring lldb debugger to the desired state.
-
- By default, expect a pexpect spawned child and child prompt to be
- supplied (use_cmd_api=False). If use_cmd_api is true, ignore the child
- and child prompt and use self.runCmd() to run the hooks one by one.
-
- Note that child is a process spawned by pexpect.spawn(). If not, your
- test case is mostly likely going to fail.
-
- See also dotest.py where lldb.runHooks are processed/populated.
- """
- if not lldb.runHooks:
- self.skipTest("No runhooks specified for lldb, skip the test")
- if use_cmd_api:
- for hook in lldb.runhooks:
- self.runCmd(hook)
- else:
- if not child or not child_prompt:
- self.fail("Both child and child_prompt need to be defined.")
- for hook in lldb.runHooks:
- child.sendline(hook)
- child.expect_exact(child_prompt)
-
- def setAsync(self, value):
- """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
- old_async = self.dbg.GetAsync()
- self.dbg.SetAsync(value)
- self.addTearDownHook(lambda: self.dbg.SetAsync(old_async))
-
- def cleanupSubprocesses(self):
- # Ensure any subprocesses are cleaned up
- for p in self.subprocesses:
- p.terminate()
- del p
- del self.subprocesses[:]
- # Ensure any forked processes are cleaned up
- for pid in self.forkedProcessPids:
- if os.path.exists("/proc/" + str(pid)):
- os.kill(pid, signal.SIGTERM)
-
- def spawnSubprocess(self, executable, args=[], install_remote=True):
- """ Creates a subprocess.Popen object with the specified executable and arguments,
- saves it in self.subprocesses, and returns the object.
- NOTE: if using this function, ensure you also call:
-
- self.addTearDownHook(self.cleanupSubprocesses)
-
- otherwise the test suite will leak processes.
- """
- proc = _RemoteProcess(install_remote) if lldb.remote_platform else _LocalProcess(self.TraceOn())
- proc.launch(executable, args)
- self.subprocesses.append(proc)
- return proc
-
- def forkSubprocess(self, executable, args=[]):
- """ Fork a subprocess with its own group ID.
- NOTE: if using this function, ensure you also call:
-
- self.addTearDownHook(self.cleanupSubprocesses)
-
- otherwise the test suite will leak processes.
- """
- child_pid = os.fork()
- if child_pid == 0:
- # If more I/O support is required, this can be beefed up.
- fd = os.open(os.devnull, os.O_RDWR)
- os.dup2(fd, 1)
- os.dup2(fd, 2)
- # This call causes the child to have its of group ID
- os.setpgid(0,0)
- os.execvp(executable, [executable] + args)
- # Give the child time to get through the execvp() call
- time.sleep(0.1)
- self.forkedProcessPids.append(child_pid)
- return child_pid
-
- def HideStdout(self):
- """Hide output to stdout from the user.
-
- During test execution, there might be cases where we don't want to show the
- standard output to the user. For example,
-
- self.runCmd(r'''sc print("\n\n\tHello!\n")''')
-
- tests whether command abbreviation for 'script' works or not. There is no
- need to show the 'Hello' output to the user as long as the 'script' command
- succeeds and we are not in TraceOn() mode (see the '-t' option).
-
- In this case, the test method calls self.HideStdout(self) to redirect the
- sys.stdout to a null device, and restores the sys.stdout upon teardown.
-
- Note that you should only call this method at most once during a test case
- execution. Any subsequent call has no effect at all."""
- if self.sys_stdout_hidden:
- return
-
- self.sys_stdout_hidden = True
- old_stdout = sys.stdout
- sys.stdout = open(os.devnull, 'w')
- def restore_stdout():
- sys.stdout = old_stdout
- self.addTearDownHook(restore_stdout)
-
- # =======================================================================
- # Methods for customized teardown cleanups as well as execution of hooks.
- # =======================================================================
-
- def setTearDownCleanup(self, dictionary=None):
- """Register a cleanup action at tearDown() time with a dictinary"""
- self.dict = dictionary
- self.doTearDownCleanup = True
-
- def addTearDownCleanup(self, dictionary):
- """Add a cleanup action at tearDown() time with a dictinary"""
- self.dicts.append(dictionary)
- self.doTearDownCleanups = True
-
- def addTearDownHook(self, hook):
- """
- Add a function to be run during tearDown() time.
-
- Hooks are executed in a first come first serve manner.
- """
- if six.callable(hook):
- with recording(self, traceAlways) as sbuf:
- print("Adding tearDown hook:", getsource_if_available(hook), file=sbuf)
- self.hooks.append(hook)
-
- return self
-
- def deletePexpectChild(self):
- # This is for the case of directly spawning 'lldb' and interacting with it
- # using pexpect.
- if self.child and self.child.isalive():
- import pexpect
- with recording(self, traceAlways) as sbuf:
- print("tearing down the child process....", file=sbuf)
- try:
- if self.child_in_script_interpreter:
- self.child.sendline('quit()')
- self.child.expect_exact(self.child_prompt)
- self.child.sendline('settings set interpreter.prompt-on-quit false')
- self.child.sendline('quit')
- self.child.expect(pexpect.EOF)
- except (ValueError, pexpect.ExceptionPexpect):
- # child is already terminated
- pass
- except OSError as exception:
- import errno
- if exception.errno != errno.EIO:
- # unexpected error
- raise
- # child is already terminated
- pass
- finally:
- # Give it one final blow to make sure the child is terminated.
- self.child.close()
-
- def tearDown(self):
- """Fixture for unittest test case teardown."""
- #import traceback
- #traceback.print_stack()
-
- self.deletePexpectChild()
-
- # Check and run any hook functions.
- for hook in reversed(self.hooks):
- with recording(self, traceAlways) as sbuf:
- print("Executing tearDown hook:", getsource_if_available(hook), file=sbuf)
- import inspect
- hook_argc = len(inspect.getargspec(hook).args)
- if hook_argc == 0 or getattr(hook,'im_self',None):
- hook()
- elif hook_argc == 1:
- hook(self)
- else:
- hook() # try the plain call and hope it works
-
- del self.hooks
-
- # Perform registered teardown cleanup.
- if doCleanup and self.doTearDownCleanup:
- self.cleanup(dictionary=self.dict)
-
- # In rare cases where there are multiple teardown cleanups added.
- if doCleanup and self.doTearDownCleanups:
- if self.dicts:
- for dict in reversed(self.dicts):
- self.cleanup(dictionary=dict)
-
- self.disableLogChannelsForCurrentTest()
-
- # =========================================================
- # Various callbacks to allow introspection of test progress
- # =========================================================
-
- def markError(self):
- """Callback invoked when an error (unexpected exception) errored."""
- self.__errored__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "ERROR" to the stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print("ERROR", file=sbuf)
-
- def markCleanupError(self):
- """Callback invoked when an error occurs while a test is cleaning up."""
- self.__cleanup_errored__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "CLEANUP_ERROR" to the stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print("CLEANUP_ERROR", file=sbuf)
-
- def markFailure(self):
- """Callback invoked when a failure (test assertion failure) occurred."""
- self.__failed__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "FAIL" to the stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print("FAIL", file=sbuf)
-
- def markExpectedFailure(self,err,bugnumber):
- """Callback invoked when an expected failure/error occurred."""
- self.__expected__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "expected failure" to the
- # stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- if bugnumber == None:
- print("expected failure", file=sbuf)
- else:
- print("expected failure (problem id:" + str(bugnumber) + ")", file=sbuf)
-
- def markSkippedTest(self):
- """Callback invoked when a test is skipped."""
- self.__skipped__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "skipped test" to the
- # stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print("skipped test", file=sbuf)
-
- def markUnexpectedSuccess(self, bugnumber):
- """Callback invoked when an unexpected success occurred."""
- self.__unexpected__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "unexpected success" to the
- # stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- if bugnumber == None:
- print("unexpected success", file=sbuf)
- else:
- print("unexpected success (problem id:" + str(bugnumber) + ")", file=sbuf)
-
- def getRerunArgs(self):
- return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
-
- def getLogBasenameForCurrentTest(self, prefix=None):
- """
- returns a partial path that can be used as the beginning of the name of multiple
- log files pertaining to this test
-
- <session-dir>/<arch>-<compiler>-<test-file>.<test-class>.<test-method>
- """
- dname = os.path.join(os.environ["LLDB_TEST"],
- os.environ["LLDB_SESSION_DIRNAME"])
- if not os.path.isdir(dname):
- os.mkdir(dname)
-
- compiler = self.getCompiler()
-
- if compiler[1] == ':':
- compiler = compiler[2:]
- if os.path.altsep is not None:
- compiler = compiler.replace(os.path.altsep, os.path.sep)
-
- fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), "_".join(compiler.split(os.path.sep)))
- if len(fname) > 200:
- fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), compiler.split(os.path.sep)[-1])
-
- if prefix is not None:
- fname = "{}-{}".format(prefix, fname)
-
- return os.path.join(dname, fname)
-
- def dumpSessionInfo(self):
- """
- Dump the debugger interactions leading to a test error/failure. This
- allows for more convenient postmortem analysis.
-
- See also LLDBTestResult (dotest.py) which is a singlton class derived
- from TextTestResult and overwrites addError, addFailure, and
- addExpectedFailure methods to allow us to to mark the test instance as
- such.
- """
-
- # We are here because self.tearDown() detected that this test instance
- # either errored or failed. The lldb.test_result singleton contains
- # two lists (erros and failures) which get populated by the unittest
- # framework. Look over there for stack trace information.
- #
- # The lists contain 2-tuples of TestCase instances and strings holding
- # formatted tracebacks.
- #
- # See http://docs.python.org/library/unittest.html#unittest.TestResult.
-
- # output tracebacks into session
- pairs = []
- if self.__errored__:
- pairs = lldb.test_result.errors
- prefix = 'Error'
- elif self.__cleanup_errored__:
- pairs = lldb.test_result.cleanup_errors
- prefix = 'CleanupError'
- elif self.__failed__:
- pairs = lldb.test_result.failures
- prefix = 'Failure'
- elif self.__expected__:
- pairs = lldb.test_result.expectedFailures
- prefix = 'ExpectedFailure'
- elif self.__skipped__:
- prefix = 'SkippedTest'
- elif self.__unexpected__:
- prefix = 'UnexpectedSuccess'
- else:
- prefix = 'Success'
-
- if not self.__unexpected__ and not self.__skipped__:
- for test, traceback in pairs:
- if test is self:
- print(traceback, file=self.session)
-
- # put footer (timestamp/rerun instructions) into session
- testMethod = getattr(self, self._testMethodName)
- if getattr(testMethod, "__benchmarks_test__", False):
- benchmarks = True
- else:
- benchmarks = False
-
- import datetime
- print("Session info generated @", datetime.datetime.now().ctime(), file=self.session)
- print("To rerun this test, issue the following command from the 'test' directory:\n", file=self.session)
- print("./dotest.py %s -v %s %s" % (self.getRunOptions(),
- ('+b' if benchmarks else '-t'),
- self.getRerunArgs()), file=self.session)
- self.session.close()
- del self.session
-
- # process the log files
- log_files_for_this_test = glob.glob(self.log_basename + "*")
-
- if prefix != 'Success' or lldbtest_config.log_success:
- # keep all log files, rename them to include prefix
- dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
- for src in log_files_for_this_test:
- if os.path.isfile(src):
- dst = src.replace(self.log_basename, dst_log_basename)
- if os.name == "nt" and os.path.isfile(dst):
- # On Windows, renaming a -> b will throw an exception if b exists. On non-Windows platforms
- # it silently replaces the destination. Ultimately this means that atomic renames are not
- # guaranteed to be possible on Windows, but we need this to work anyway, so just remove the
- # destination first if it already exists.
- os.remove(dst)
-
- os.rename(src, dst)
- else:
- # success! (and we don't want log files) delete log files
- for log_file in log_files_for_this_test:
- try:
- os.unlink(log_file)
- except:
- # We've seen consistent unlink failures on Windows, perhaps because the
- # just-created log file is being scanned by anti-virus. Empirically, this
- # sleep-and-retry approach allows tests to succeed much more reliably.
- # Attempts to figure out exactly what process was still holding a file handle
- # have failed because running instrumentation like Process Monitor seems to
- # slow things down enough that the problem becomes much less consistent.
- time.sleep(0.5)
- os.unlink(log_file)
-
- # ====================================================
- # Config. methods supported through a plugin interface
- # (enables reading of the current test configuration)
- # ====================================================
-
- def getArchitecture(self):
- """Returns the architecture in effect the test suite is running with."""
- module = builder_module()
- arch = module.getArchitecture()
- if arch == 'amd64':
- arch = 'x86_64'
- return arch
-
- def getLldbArchitecture(self):
- """Returns the architecture of the lldb binary."""
- if not hasattr(self, 'lldbArchitecture'):
-
- # spawn local process
- command = [
- lldbtest_config.lldbExec,
- "-o",
- "file " + lldbtest_config.lldbExec,
- "-o",
- "quit"
- ]
-
- output = check_output(command)
- str = output.decode("utf-8");
-
- for line in str.splitlines():
- m = re.search("Current executable set to '.*' \\((.*)\\)\\.", line)
- if m:
- self.lldbArchitecture = m.group(1)
- break
-
- return self.lldbArchitecture
-
- def getCompiler(self):
- """Returns the compiler in effect the test suite is running with."""
- module = builder_module()
- return module.getCompiler()
-
- def getCompilerBinary(self):
- """Returns the compiler binary the test suite is running with."""
- return self.getCompiler().split()[0]
-
- def getCompilerVersion(self):
- """ Returns a string that represents the compiler version.
- Supports: llvm, clang.
- """
- from lldbutil import which
- version = 'unknown'
-
- compiler = self.getCompilerBinary()
- version_output = system([[which(compiler), "-v"]])[1]
- for line in version_output.split(os.linesep):
- m = re.search('version ([0-9\.]+)', line)
- if m:
- version = m.group(1)
- return version
-
- def getGoCompilerVersion(self):
- """ Returns a string that represents the go compiler version, or None if go is not found.
- """
- compiler = which("go")
- if compiler:
- version_output = system([[compiler, "version"]])[0]
- for line in version_output.split(os.linesep):
- m = re.search('go version (devel|go\\S+)', line)
- if m:
- return m.group(1)
- return None
-
- def platformIsDarwin(self):
- """Returns true if the OS triple for the selected platform is any valid apple OS"""
- return platformIsDarwin()
-
- def getPlatform(self):
- """Returns the target platform the test suite is running on."""
- return getPlatform()
-
- def isIntelCompiler(self):
- """ Returns true if using an Intel (ICC) compiler, false otherwise. """
- return any([x in self.getCompiler() for x in ["icc", "icpc", "icl"]])
-
- def expectedCompilerVersion(self, compiler_version):
- """Returns True iff compiler_version[1] matches the current compiler version.
- Use compiler_version[0] to specify the operator used to determine if a match has occurred.
- Any operator other than the following defaults to an equality test:
- '>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
- """
- if (compiler_version == None):
- return True
- operator = str(compiler_version[0])
- version = compiler_version[1]
-
- if (version == None):
- return True
- if (operator == '>'):
- return self.getCompilerVersion() > version
- if (operator == '>=' or operator == '=>'):
- return self.getCompilerVersion() >= version
- if (operator == '<'):
- return self.getCompilerVersion() < version
- if (operator == '<=' or operator == '=<'):
- return self.getCompilerVersion() <= version
- if (operator == '!=' or operator == '!' or operator == 'not'):
- return str(version) not in str(self.getCompilerVersion())
- return str(version) in str(self.getCompilerVersion())
-
- def expectedCompiler(self, compilers):
- """Returns True iff any element of compilers is a sub-string of the current compiler."""
- if (compilers == None):
- return True
-
- for compiler in compilers:
- if compiler in self.getCompiler():
- return True
-
- return False
-
- def expectedArch(self, archs):
- """Returns True iff any element of archs is a sub-string of the current architecture."""
- if (archs == None):
- return True
-
- for arch in archs:
- if arch in self.getArchitecture():
- return True
-
- return False
-
- def getRunOptions(self):
- """Command line option for -A and -C to run this test again, called from
- self.dumpSessionInfo()."""
- arch = self.getArchitecture()
- comp = self.getCompiler()
- if arch:
- option_str = "-A " + arch
- else:
- option_str = ""
- if comp:
- option_str += " -C " + comp
- return option_str
-
- # ==================================================
- # Build methods supported through a plugin interface
- # ==================================================
-
- def getstdlibFlag(self):
- """ Returns the proper -stdlib flag, or empty if not required."""
- if self.platformIsDarwin() or self.getPlatform() == "freebsd":
- stdlibflag = "-stdlib=libc++"
- else:
- stdlibflag = ""
- return stdlibflag
-
- def getstdFlag(self):
- """ Returns the proper stdflag. """
- if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
- stdflag = "-std=c++0x"
- else:
- stdflag = "-std=c++11"
- return stdflag
-
- def buildDriver(self, sources, exe_name):
- """ Platform-specific way to build a program that links with LLDB (via the liblldb.so
- or LLDB.framework).
- """
-
- stdflag = self.getstdFlag()
- stdlibflag = self.getstdlibFlag()
-
- lib_dir = os.environ["LLDB_LIB_DIR"]
- if sys.platform.startswith("darwin"):
- dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s" % (stdflag, stdlibflag),
- 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
- 'LD_EXTRAS' : "%s -Wl,-rpath,%s" % (dsym, lib_dir),
- }
- elif sys.platform.startswith('freebsd') or sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-L%s -llldb" % lib_dir}
- elif sys.platform.startswith('win'):
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
- if self.TraceOn():
- print("Building LLDB Driver (%s) from sources %s" % (exe_name, sources))
-
- self.buildDefault(dictionary=d)
-
- def buildLibrary(self, sources, lib_name):
- """Platform specific way to build a default library. """
-
- stdflag = self.getstdFlag()
-
- lib_dir = os.environ["LLDB_LIB_DIR"]
- if self.platformIsDarwin():
- dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -stdlib=libc++" % stdflag,
- 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
- 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, lib_dir),
- }
- elif self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux' or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-shared -L%s -llldb" % lib_dir}
- elif self.getPlatform() == 'windows':
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
- if self.TraceOn():
- print("Building LLDB Library (%s) from sources %s" % (lib_name, sources))
-
- self.buildDefault(dictionary=d)
-
- def buildProgram(self, sources, exe_name):
- """ Platform specific way to build an executable from C/C++ sources. """
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name}
- self.buildDefault(dictionary=d)
-
- def buildDefault(self, architecture=None, compiler=None, dictionary=None, clean=True):
- """Platform specific way to build the default binaries."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if target_is_android():
- dictionary = append_android_envs(dictionary)
- if not module.buildDefault(self, architecture, compiler, dictionary, clean):
- raise Exception("Don't know how to build default binary")
-
- def buildDsym(self, architecture=None, compiler=None, dictionary=None, clean=True):
- """Platform specific way to build binaries with dsym info."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if not module.buildDsym(self, architecture, compiler, dictionary, clean):
- raise Exception("Don't know how to build binary with dsym")
-
- def buildDwarf(self, architecture=None, compiler=None, dictionary=None, clean=True):
- """Platform specific way to build binaries with dwarf maps."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if target_is_android():
- dictionary = append_android_envs(dictionary)
- if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
- raise Exception("Don't know how to build binary with dwarf")
-
- def buildDwo(self, architecture=None, compiler=None, dictionary=None, clean=True):
- """Platform specific way to build binaries with dwarf maps."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if target_is_android():
- dictionary = append_android_envs(dictionary)
- if not module.buildDwo(self, architecture, compiler, dictionary, clean):
- raise Exception("Don't know how to build binary with dwo")
-
- def buildGo(self):
- """Build the default go binary.
- """
- system([[which('go'), 'build -gcflags "-N -l" -o a.out main.go']])
-
- def signBinary(self, binary_path):
- if sys.platform.startswith("darwin"):
- codesign_cmd = "codesign --force --sign lldb_codesign %s" % (binary_path)
- call(codesign_cmd, shell=True)
-
- def findBuiltClang(self):
- """Tries to find and use Clang from the build directory as the compiler (instead of the system compiler)."""
- paths_to_try = [
- "llvm-build/Release+Asserts/x86_64/Release+Asserts/bin/clang",
- "llvm-build/Debug+Asserts/x86_64/Debug+Asserts/bin/clang",
- "llvm-build/Release/x86_64/Release/bin/clang",
- "llvm-build/Debug/x86_64/Debug/bin/clang",
- ]
- lldb_root_path = os.path.join(os.path.dirname(__file__), "..")
- for p in paths_to_try:
- path = os.path.join(lldb_root_path, p)
- if os.path.exists(path):
- return path
-
- # Tries to find clang at the same folder as the lldb
- path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "clang")
- if os.path.exists(path):
- return path
-
- return os.environ["CC"]
-
- def getBuildFlags(self, use_cpp11=True, use_libcxx=False, use_libstdcxx=False):
- """ Returns a dictionary (which can be provided to build* functions above) which
- contains OS-specific build flags.
- """
- cflags = ""
- ldflags = ""
-
- # On Mac OS X, unless specifically requested to use libstdc++, use libc++
- if not use_libstdcxx and self.platformIsDarwin():
- use_libcxx = True
-
- if use_libcxx and self.libcxxPath:
- cflags += "-stdlib=libc++ "
- if self.libcxxPath:
- libcxxInclude = os.path.join(self.libcxxPath, "include")
- libcxxLib = os.path.join(self.libcxxPath, "lib")
- if os.path.isdir(libcxxInclude) and os.path.isdir(libcxxLib):
- cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (libcxxInclude, libcxxLib, libcxxLib)
-
- if use_cpp11:
- cflags += "-std="
- if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
- cflags += "c++0x"
- else:
- cflags += "c++11"
- if self.platformIsDarwin() or self.getPlatform() == "freebsd":
- cflags += " -stdlib=libc++"
- elif "clang" in self.getCompiler():
- cflags += " -stdlib=libstdc++"
-
- return {'CFLAGS_EXTRAS' : cflags,
- 'LD_EXTRAS' : ldflags,
- }
-
- def cleanup(self, dictionary=None):
- """Platform specific way to do cleanup after build."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if not module.cleanup(self, dictionary):
- raise Exception("Don't know how to do cleanup with dictionary: "+dictionary)
-
- def getLLDBLibraryEnvVal(self):
- """ Returns the path that the OS-specific library search environment variable
- (self.dylibPath) should be set to in order for a program to find the LLDB
- library. If an environment variable named self.dylibPath is already set,
- the new path is appended to it and returned.
- """
- existing_library_path = os.environ[self.dylibPath] if self.dylibPath in os.environ else None
- lib_dir = os.environ["LLDB_LIB_DIR"]
- if existing_library_path:
- return "%s:%s" % (existing_library_path, lib_dir)
- elif sys.platform.startswith("darwin"):
- return os.path.join(lib_dir, 'LLDB.framework')
- else:
- return lib_dir
-
- def getLibcPlusPlusLibs(self):
- if self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux':
- return ['libc++.so.1']
- else:
- return ['libc++.1.dylib','libc++abi.dylib']
-
-# Metaclass for TestBase to change the list of test metods when a new TestCase is loaded.
-# We change the test methods to create a new test method for each test for each debug info we are
-# testing. The name of the new test method will be '<original-name>_<debug-info>' and with adding
-# the new test method we remove the old method at the same time.
-class LLDBTestCaseFactory(type):
- def __new__(cls, name, bases, attrs):
- newattrs = {}
- for attrname, attrvalue in attrs.items():
- if attrname.startswith("test") and not getattr(attrvalue, "__no_debug_info_test__", False):
- @dsym_test
- @wraps(attrvalue)
- def dsym_test_method(self, attrvalue=attrvalue):
- self.debug_info = "dsym"
- return attrvalue(self)
- dsym_method_name = attrname + "_dsym"
- dsym_test_method.__name__ = dsym_method_name
- newattrs[dsym_method_name] = dsym_test_method
-
- @dwarf_test
- @wraps(attrvalue)
- def dwarf_test_method(self, attrvalue=attrvalue):
- self.debug_info = "dwarf"
- return attrvalue(self)
- dwarf_method_name = attrname + "_dwarf"
- dwarf_test_method.__name__ = dwarf_method_name
- newattrs[dwarf_method_name] = dwarf_test_method
-
- @dwo_test
- @wraps(attrvalue)
- def dwo_test_method(self, attrvalue=attrvalue):
- self.debug_info = "dwo"
- return attrvalue(self)
- dwo_method_name = attrname + "_dwo"
- dwo_test_method.__name__ = dwo_method_name
- newattrs[dwo_method_name] = dwo_test_method
- else:
- newattrs[attrname] = attrvalue
- return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)
-
-# Setup the metaclass for this class to change the list of the test methods when a new class is loaded
- at add_metaclass(LLDBTestCaseFactory)
-class TestBase(Base):
- """
- This abstract base class is meant to be subclassed. It provides default
- implementations for setUpClass(), tearDownClass(), setUp(), and tearDown(),
- among other things.
-
- Important things for test class writers:
-
- - Overwrite the mydir class attribute, otherwise your test class won't
- run. It specifies the relative directory to the top level 'test' so
- the test harness can change to the correct working directory before
- running your test.
-
- - The setUp method sets up things to facilitate subsequent interactions
- with the debugger as part of the test. These include:
- - populate the test method name
- - create/get a debugger set with synchronous mode (self.dbg)
- - get the command interpreter from with the debugger (self.ci)
- - create a result object for use with the command interpreter
- (self.res)
- - plus other stuffs
-
- - The tearDown method tries to perform some necessary cleanup on behalf
- of the test to return the debugger to a good state for the next test.
- These include:
- - execute any tearDown hooks registered by the test method with
- TestBase.addTearDownHook(); examples can be found in
- settings/TestSettings.py
- - kill the inferior process associated with each target, if any,
- and, then delete the target from the debugger's target list
- - perform build cleanup before running the next test method in the
- same test class; examples of registering for this service can be
- found in types/TestIntegerTypes.py with the call:
- - self.setTearDownCleanup(dictionary=d)
-
- - Similarly setUpClass and tearDownClass perform classwise setup and
- teardown fixtures. The tearDownClass method invokes a default build
- cleanup for the entire test class; also, subclasses can implement the
- classmethod classCleanup(cls) to perform special class cleanup action.
-
- - The instance methods runCmd and expect are used heavily by existing
- test cases to send a command to the command interpreter and to perform
- string/pattern matching on the output of such command execution. The
- expect method also provides a mode to peform string/pattern matching
- without running a command.
-
- - The build methods buildDefault, buildDsym, and buildDwarf are used to
- build the binaries used during a particular test scenario. A plugin
- should be provided for the sys.platform running the test suite. The
- Mac OS X implementation is located in plugins/darwin.py.
- """
-
- # Maximum allowed attempts when launching the inferior process.
- # Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable.
- maxLaunchCount = 3;
-
- # Time to wait before the next launching attempt in second(s).
- # Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
- timeWaitNextLaunch = 1.0;
-
- def doDelay(self):
- """See option -w of dotest.py."""
- if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
- os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] == 'YES'):
- waitTime = 1.0
- if "LLDB_TIME_WAIT_BETWEEN_TEST_CASES" in os.environ:
- waitTime = float(os.environ["LLDB_TIME_WAIT_BETWEEN_TEST_CASES"])
- time.sleep(waitTime)
-
- # Returns the list of categories to which this test case belongs
- # by default, look for a ".categories" file, and read its contents
- # if no such file exists, traverse the hierarchy - we guarantee
- # a .categories to exist at the top level directory so we do not end up
- # looping endlessly - subclasses are free to define their own categories
- # in whatever way makes sense to them
- def getCategories(self):
- import inspect
- import os.path
- folder = inspect.getfile(self.__class__)
- folder = os.path.dirname(folder)
- while folder != '/':
- categories_file_name = os.path.join(folder,".categories")
- if os.path.exists(categories_file_name):
- categories_file = open(categories_file_name,'r')
- categories = categories_file.readline()
- categories_file.close()
- categories = str.replace(categories,'\n','')
- categories = str.replace(categories,'\r','')
- return categories.split(',')
- else:
- folder = os.path.dirname(folder)
- continue
-
- def setUp(self):
- #import traceback
- #traceback.print_stack()
-
- # Works with the test driver to conditionally skip tests via decorators.
- Base.setUp(self)
-
- try:
- if lldb.blacklist:
- className = self.__class__.__name__
- classAndMethodName = "%s.%s" % (className, self._testMethodName)
- if className in lldb.blacklist:
- self.skipTest(lldb.blacklist.get(className))
- elif classAndMethodName in lldb.blacklist:
- self.skipTest(lldb.blacklist.get(classAndMethodName))
- except AttributeError:
- pass
-
- # Insert some delay between successive test cases if specified.
- self.doDelay()
-
- if "LLDB_MAX_LAUNCH_COUNT" in os.environ:
- self.maxLaunchCount = int(os.environ["LLDB_MAX_LAUNCH_COUNT"])
-
- if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ:
- self.timeWaitNextLaunch = float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"])
-
- #
- # Warning: MAJOR HACK AHEAD!
- # If we are running testsuite remotely (by checking lldb.lldbtest_remote_sandbox),
- # redefine the self.dbg.CreateTarget(filename) method to execute a "file filename"
- # command, instead. See also runCmd() where it decorates the "file filename" call
- # with additional functionality when running testsuite remotely.
- #
- if lldb.lldbtest_remote_sandbox:
- def DecoratedCreateTarget(arg):
- self.runCmd("file %s" % arg)
- target = self.dbg.GetSelectedTarget()
- #
- # SBtarget.LaunchSimple () currently not working for remote platform?
- # johnny @ 04/23/2012
- #
- def DecoratedLaunchSimple(argv, envp, wd):
- self.runCmd("run")
- return target.GetProcess()
- target.LaunchSimple = DecoratedLaunchSimple
-
- return target
- self.dbg.CreateTarget = DecoratedCreateTarget
- if self.TraceOn():
- print("self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget))
-
- # We want our debugger to be synchronous.
- self.dbg.SetAsync(False)
-
- # Retrieve the associated command interpreter instance.
- self.ci = self.dbg.GetCommandInterpreter()
- if not self.ci:
- raise Exception('Could not get the command interpreter')
-
- # And the result object.
- self.res = lldb.SBCommandReturnObject()
-
- # Run global pre-flight code, if defined via the config file.
- if lldb.pre_flight:
- lldb.pre_flight(self)
-
- if lldb.remote_platform and lldb.remote_platform_working_dir:
- remote_test_dir = lldbutil.join_remote_paths(
- lldb.remote_platform_working_dir,
- self.getArchitecture(),
- str(self.test_number),
- self.mydir)
- error = lldb.remote_platform.MakeDirectory(remote_test_dir, 448) # 448 = 0o700
- if error.Success():
- lldb.remote_platform.SetWorkingDirectory(remote_test_dir)
-
- # This function removes all files from the current working directory while leaving
- # the directories in place. The cleaup is required to reduce the disk space required
- # by the test suit while leaving the directories untached is neccessary because
- # sub-directories might belong to an other test
- def clean_working_directory():
- # TODO: Make it working on Windows when we need it for remote debugging support
- # TODO: Replace the heuristic to remove the files with a logic what collects the
- # list of files we have to remove during test runs.
- shell_cmd = lldb.SBPlatformShellCommand("rm %s/*" % remote_test_dir)
- lldb.remote_platform.Run(shell_cmd)
- self.addTearDownHook(clean_working_directory)
- else:
- print("error: making remote directory '%s': %s" % (remote_test_dir, error))
-
- def registerSharedLibrariesWithTarget(self, target, shlibs):
- '''If we are remotely running the test suite, register the shared libraries with the target so they get uploaded, otherwise do nothing
-
- Any modules in the target that have their remote install file specification set will
- get uploaded to the remote host. This function registers the local copies of the
- shared libraries with the target and sets their remote install locations so they will
- be uploaded when the target is run.
- '''
- if not shlibs or not self.platformContext:
- return None
-
- shlib_environment_var = self.platformContext.shlib_environment_var
- shlib_prefix = self.platformContext.shlib_prefix
- shlib_extension = '.' + self.platformContext.shlib_extension
-
- working_dir = self.get_process_working_directory()
- environment = ['%s=%s' % (shlib_environment_var, working_dir)]
- # Add any shared libraries to our target if remote so they get
- # uploaded into the working directory on the remote side
- for name in shlibs:
- # The path can be a full path to a shared library, or a make file name like "Foo" for
- # "libFoo.dylib" or "libFoo.so", or "Foo.so" for "Foo.so" or "libFoo.so", or just a
- # basename like "libFoo.so". So figure out which one it is and resolve the local copy
- # of the shared library accordingly
- if os.path.exists(name):
- local_shlib_path = name # name is the full path to the local shared library
- else:
- # Check relative names
- local_shlib_path = os.path.join(os.getcwd(), shlib_prefix + name + shlib_extension)
- if not os.path.exists(local_shlib_path):
- local_shlib_path = os.path.join(os.getcwd(), name + shlib_extension)
- if not os.path.exists(local_shlib_path):
- local_shlib_path = os.path.join(os.getcwd(), name)
-
- # Make sure we found the local shared library in the above code
- self.assertTrue(os.path.exists(local_shlib_path))
-
- # Add the shared library to our target
- shlib_module = target.AddModule(local_shlib_path, None, None, None)
- if lldb.remote_platform:
- # We must set the remote install location if we want the shared library
- # to get uploaded to the remote target
- remote_shlib_path = lldbutil.append_to_process_working_directory(os.path.basename(local_shlib_path))
- shlib_module.SetRemoteInstallFileSpec(lldb.SBFileSpec(remote_shlib_path, False))
-
- return environment
-
- # utility methods that tests can use to access the current objects
- def target(self):
- if not self.dbg:
- raise Exception('Invalid debugger instance')
- return self.dbg.GetSelectedTarget()
-
- def process(self):
- if not self.dbg:
- raise Exception('Invalid debugger instance')
- return self.dbg.GetSelectedTarget().GetProcess()
-
- def thread(self):
- if not self.dbg:
- raise Exception('Invalid debugger instance')
- return self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread()
-
- def frame(self):
- if not self.dbg:
- raise Exception('Invalid debugger instance')
- return self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
-
- def get_process_working_directory(self):
- '''Get the working directory that should be used when launching processes for local or remote processes.'''
- if lldb.remote_platform:
- # Remote tests set the platform working directory up in TestBase.setUp()
- return lldb.remote_platform.GetWorkingDirectory()
- else:
- # local tests change directory into each test subdirectory
- return os.getcwd()
-
- def tearDown(self):
- #import traceback
- #traceback.print_stack()
-
- # Ensure all the references to SB objects have gone away so that we can
- # be sure that all test-specific resources have been freed before we
- # attempt to delete the targets.
- gc.collect()
-
- # Delete the target(s) from the debugger as a general cleanup step.
- # This includes terminating the process for each target, if any.
- # We'd like to reuse the debugger for our next test without incurring
- # the initialization overhead.
- targets = []
- for target in self.dbg:
- if target:
- targets.append(target)
- process = target.GetProcess()
- if process:
- rc = self.invoke(process, "Kill")
- self.assertTrue(rc.Success(), PROCESS_KILLED)
- for target in targets:
- self.dbg.DeleteTarget(target)
-
- # Run global post-flight code, if defined via the config file.
- if lldb.post_flight:
- lldb.post_flight(self)
-
- # Do this last, to make sure it's in reverse order from how we setup.
- Base.tearDown(self)
-
- # This must be the last statement, otherwise teardown hooks or other
- # lines might depend on this still being active.
- del self.dbg
-
- def switch_to_thread_with_stop_reason(self, stop_reason):
- """
- Run the 'thread list' command, and select the thread with stop reason as
- 'stop_reason'. If no such thread exists, no select action is done.
- """
- from lldbutil import stop_reason_to_str
- self.runCmd('thread list')
- output = self.res.GetOutput()
- thread_line_pattern = re.compile("^[ *] thread #([0-9]+):.*stop reason = %s" %
- stop_reason_to_str(stop_reason))
- for line in output.splitlines():
- matched = thread_line_pattern.match(line)
- if matched:
- self.runCmd('thread select %s' % matched.group(1))
-
- def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False):
- """
- Ask the command interpreter to handle the command and then check its
- return status.
- """
- # Fail fast if 'cmd' is not meaningful.
- if not cmd or len(cmd) == 0:
- raise Exception("Bad 'cmd' parameter encountered")
-
- trace = (True if traceAlways else trace)
-
- # This is an opportunity to insert the 'platform target-install' command if we are told so
- # via the settig of lldb.lldbtest_remote_sandbox.
- if cmd.startswith("target create "):
- cmd = cmd.replace("target create ", "file ")
- if cmd.startswith("file ") and lldb.lldbtest_remote_sandbox:
- with recording(self, trace) as sbuf:
- the_rest = cmd.split("file ")[1]
- # Split the rest of the command line.
- atoms = the_rest.split()
- #
- # NOTE: This assumes that the options, if any, follow the file command,
- # instead of follow the specified target.
- #
- target = atoms[-1]
- # Now let's get the absolute pathname of our target.
- abs_target = os.path.abspath(target)
- print("Found a file command, target (with absolute pathname)=%s" % abs_target, file=sbuf)
- fpath, fname = os.path.split(abs_target)
- parent_dir = os.path.split(fpath)[0]
- platform_target_install_command = 'platform target-install %s %s' % (fpath, lldb.lldbtest_remote_sandbox)
- print("Insert this command to be run first: %s" % platform_target_install_command, file=sbuf)
- self.ci.HandleCommand(platform_target_install_command, self.res)
- # And this is the file command we want to execute, instead.
- #
- # Warning: SIDE EFFECT AHEAD!!!
- # Populate the remote executable pathname into the lldb namespace,
- # so that test cases can grab this thing out of the namespace.
- #
- lldb.lldbtest_remote_sandboxed_executable = abs_target.replace(parent_dir, lldb.lldbtest_remote_sandbox)
- cmd = "file -P %s %s %s" % (lldb.lldbtest_remote_sandboxed_executable, the_rest.replace(target, ''), abs_target)
- print("And this is the replaced file command: %s" % cmd, file=sbuf)
-
- running = (cmd.startswith("run") or cmd.startswith("process launch"))
-
- for i in range(self.maxLaunchCount if running else 1):
- self.ci.HandleCommand(cmd, self.res, inHistory)
-
- with recording(self, trace) as sbuf:
- print("runCmd:", cmd, file=sbuf)
- if not check:
- print("check of return status not required", file=sbuf)
- if self.res.Succeeded():
- print("output:", self.res.GetOutput(), file=sbuf)
- else:
- print("runCmd failed!", file=sbuf)
- print(self.res.GetError(), file=sbuf)
-
- if self.res.Succeeded():
- break
- elif running:
- # For process launch, wait some time before possible next try.
- time.sleep(self.timeWaitNextLaunch)
- with recording(self, trace) as sbuf:
- print("Command '" + cmd + "' failed!", file=sbuf)
-
- if check:
- self.assertTrue(self.res.Succeeded(),
- msg if msg else CMD_MSG(cmd))
-
- def match (self, str, patterns, msg=None, trace=False, error=False, matching=True, exe=True):
- """run command in str, and match the result against regexp in patterns returning the match object for the first matching pattern
-
- Otherwise, all the arguments have the same meanings as for the expect function"""
-
- trace = (True if traceAlways else trace)
-
- if exe:
- # First run the command. If we are expecting error, set check=False.
- # Pass the assert message along since it provides more semantic info.
- self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error)
-
- # Then compare the output against expected strings.
- output = self.res.GetError() if error else self.res.GetOutput()
-
- # If error is True, the API client expects the command to fail!
- if error:
- self.assertFalse(self.res.Succeeded(),
- "Command '" + str + "' is expected to fail!")
- else:
- # No execution required, just compare str against the golden input.
- output = str
- with recording(self, trace) as sbuf:
- print("looking at:", output, file=sbuf)
-
- # The heading says either "Expecting" or "Not expecting".
- heading = "Expecting" if matching else "Not expecting"
-
- for pattern in patterns:
- # Match Objects always have a boolean value of True.
- match_object = re.search(pattern, output)
- matched = bool(match_object)
- with recording(self, trace) as sbuf:
- print("%s pattern: %s" % (heading, pattern), file=sbuf)
- print("Matched" if matched else "Not matched", file=sbuf)
- if matched:
- break
-
- self.assertTrue(matched if matching else not matched,
- msg if msg else EXP_MSG(str, exe))
-
- return match_object
-
- def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True, inHistory=False):
- """
- Similar to runCmd; with additional expect style output matching ability.
-
- Ask the command interpreter to handle the command and then check its
- return status. The 'msg' parameter specifies an informational assert
- message. We expect the output from running the command to start with
- 'startstr', matches the substrings contained in 'substrs', and regexp
- matches the patterns contained in 'patterns'.
-
- If the keyword argument error is set to True, it signifies that the API
- client is expecting the command to fail. In this case, the error stream
- from running the command is retrieved and compared against the golden
- input, instead.
-
- If the keyword argument matching is set to False, it signifies that the API
- client is expecting the output of the command not to match the golden
- input.
-
- Finally, the required argument 'str' represents the lldb command to be
- sent to the command interpreter. In case the keyword argument 'exe' is
- set to False, the 'str' is treated as a string to be matched/not-matched
- against the golden input.
- """
- trace = (True if traceAlways else trace)
-
- if exe:
- # First run the command. If we are expecting error, set check=False.
- # Pass the assert message along since it provides more semantic info.
- self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error, inHistory=inHistory)
-
- # Then compare the output against expected strings.
- output = self.res.GetError() if error else self.res.GetOutput()
-
- # If error is True, the API client expects the command to fail!
- if error:
- self.assertFalse(self.res.Succeeded(),
- "Command '" + str + "' is expected to fail!")
- else:
- # No execution required, just compare str against the golden input.
- if isinstance(str,lldb.SBCommandReturnObject):
- output = str.GetOutput()
- else:
- output = str
- with recording(self, trace) as sbuf:
- print("looking at:", output, file=sbuf)
-
- # The heading says either "Expecting" or "Not expecting".
- heading = "Expecting" if matching else "Not expecting"
-
- # Start from the startstr, if specified.
- # If there's no startstr, set the initial state appropriately.
- matched = output.startswith(startstr) if startstr else (True if matching else False)
-
- if startstr:
- with recording(self, trace) as sbuf:
- print("%s start string: %s" % (heading, startstr), file=sbuf)
- print("Matched" if matched else "Not matched", file=sbuf)
-
- # Look for endstr, if specified.
- keepgoing = matched if matching else not matched
- if endstr:
- matched = output.endswith(endstr)
- with recording(self, trace) as sbuf:
- print("%s end string: %s" % (heading, endstr), file=sbuf)
- print("Matched" if matched else "Not matched", file=sbuf)
-
- # Look for sub strings, if specified.
- keepgoing = matched if matching else not matched
- if substrs and keepgoing:
- for str in substrs:
- matched = output.find(str) != -1
- with recording(self, trace) as sbuf:
- print("%s sub string: %s" % (heading, str), file=sbuf)
- print("Matched" if matched else "Not matched", file=sbuf)
- keepgoing = matched if matching else not matched
- if not keepgoing:
- break
-
- # Search for regular expression patterns, if specified.
- keepgoing = matched if matching else not matched
- if patterns and keepgoing:
- for pattern in patterns:
- # Match Objects always have a boolean value of True.
- matched = bool(re.search(pattern, output))
- with recording(self, trace) as sbuf:
- print("%s pattern: %s" % (heading, pattern), file=sbuf)
- print("Matched" if matched else "Not matched", file=sbuf)
- keepgoing = matched if matching else not matched
- if not keepgoing:
- break
-
- self.assertTrue(matched if matching else not matched,
- msg if msg else EXP_MSG(str, exe))
-
- def invoke(self, obj, name, trace=False):
- """Use reflection to call a method dynamically with no argument."""
- trace = (True if traceAlways else trace)
-
- method = getattr(obj, name)
- import inspect
- self.assertTrue(inspect.ismethod(method),
- name + "is a method name of object: " + str(obj))
- result = method()
- with recording(self, trace) as sbuf:
- print(str(method) + ":", result, file=sbuf)
- return result
-
- def build(self, architecture=None, compiler=None, dictionary=None, clean=True):
- """Platform specific way to build the default binaries."""
- if lldb.skip_build_and_cleanup:
- return
- module = builder_module()
- if target_is_android():
- dictionary = append_android_envs(dictionary)
- if self.debug_info is None:
- return self.buildDefault(architecture, compiler, dictionary, clean)
- elif self.debug_info == "dsym":
- return self.buildDsym(architecture, compiler, dictionary, clean)
- elif self.debug_info == "dwarf":
- return self.buildDwarf(architecture, compiler, dictionary, clean)
- elif self.debug_info == "dwo":
- return self.buildDwo(architecture, compiler, dictionary, clean)
- else:
- self.fail("Can't build for debug info: %s" % self.debug_info)
-
- # =================================================
- # Misc. helper methods for debugging test execution
- # =================================================
-
- def DebugSBValue(self, val):
- """Debug print a SBValue object, if traceAlways is True."""
- from lldbutil import value_type_to_str
-
- if not traceAlways:
- return
-
- err = sys.stderr
- err.write(val.GetName() + ":\n")
- err.write('\t' + "TypeName -> " + val.GetTypeName() + '\n')
- err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n')
- err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n')
- err.write('\t' + "Value -> " + str(val.GetValue()) + '\n')
- err.write('\t' + "ValueAsUnsigned -> " + str(val.GetValueAsUnsigned())+ '\n')
- err.write('\t' + "ValueType -> " + value_type_to_str(val.GetValueType()) + '\n')
- err.write('\t' + "Summary -> " + str(val.GetSummary()) + '\n')
- err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n')
- err.write('\t' + "Location -> " + val.GetLocation() + '\n')
-
- def DebugSBType(self, type):
- """Debug print a SBType object, if traceAlways is True."""
- if not traceAlways:
- return
-
- err = sys.stderr
- err.write(type.GetName() + ":\n")
- err.write('\t' + "ByteSize -> " + str(type.GetByteSize()) + '\n')
- err.write('\t' + "IsPointerType -> " + str(type.IsPointerType()) + '\n')
- err.write('\t' + "IsReferenceType -> " + str(type.IsReferenceType()) + '\n')
-
- def DebugPExpect(self, child):
- """Debug the spwaned pexpect object."""
- if not traceAlways:
- return
-
- print(child)
-
- @classmethod
- def RemoveTempFile(cls, file):
- if os.path.exists(file):
- os.remove(file)
Removed: lldb/trunk/test/lldbtest_config.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest_config.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbtest_config.py (original)
+++ lldb/trunk/test/lldbtest_config.py (removed)
@@ -1,21 +0,0 @@
-"""
- The LLVM Compiler Infrastructure
-
- This file is distributed under the University of Illinois Open Source
- License. See LICENSE.TXT for details.
-
-Configuration options for lldbtest.py set by dotest.py during initialization
-"""
-
-# array of strings
-# each string has the name of an lldb channel followed by
-# zero or more categories in that channel
-# ex. "gdb-remote packets"
-channels = []
-
-# leave logs/traces even for successful test runs
-log_success = False
-
-# path to the lldb command line executable tool
-lldbExec = None
-
Removed: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py (removed)
@@ -1,1002 +0,0 @@
-"""
-This LLDB module contains miscellaneous utilities.
-Some of the test suite takes advantage of the utility functions defined here.
-They can also be useful for general purpose lldb scripting.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldb
-import os, sys
-import re
-
-from six import StringIO as SixStringIO
-import six
-import collections
-
-# ===================================================
-# Utilities for locating/checking executable programs
-# ===================================================
-
-def is_exe(fpath):
- """Returns True if fpath is an executable."""
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-
-def which(program):
- """Returns the full path to a program; None otherwise."""
- fpath, fname = os.path.split(program)
- if fpath:
- if is_exe(program):
- return program
- else:
- for path in os.environ["PATH"].split(os.pathsep):
- exe_file = os.path.join(path, program)
- if is_exe(exe_file):
- return exe_file
- return None
-
-# ===================================================
-# Disassembly for an SBFunction or an SBSymbol object
-# ===================================================
-
-def disassemble(target, function_or_symbol):
- """Disassemble the function or symbol given a target.
-
- It returns the disassembly content in a string object.
- """
- buf = SixStringIO()
- insts = function_or_symbol.GetInstructions(target)
- for i in insts:
- print(i, file=buf)
- return buf.getvalue()
-
-# ==========================================================
-# Integer (byte size 1, 2, 4, and 8) to bytearray conversion
-# ==========================================================
-
-def int_to_bytearray(val, bytesize):
- """Utility function to convert an integer into a bytearray.
-
- It returns the bytearray in the little endian format. It is easy to get the
- big endian format, just do ba.reverse() on the returned object.
- """
- import struct
-
- if bytesize == 1:
- return bytearray([val])
-
- # Little endian followed by a format character.
- template = "<%c"
- if bytesize == 2:
- fmt = template % 'h'
- elif bytesize == 4:
- fmt = template % 'i'
- elif bytesize == 4:
- fmt = template % 'q'
- else:
- return None
-
- packed = struct.pack(fmt, val)
- return bytearray(list(map(ord, packed)))
-
-def bytearray_to_int(bytes, bytesize):
- """Utility function to convert a bytearray into an integer.
-
- It interprets the bytearray in the little endian format. For a big endian
- bytearray, just do ba.reverse() on the object before passing it in.
- """
- import struct
-
- if bytesize == 1:
- return bytes[0]
-
- # Little endian followed by a format character.
- template = "<%c"
- if bytesize == 2:
- fmt = template % 'h'
- elif bytesize == 4:
- fmt = template % 'i'
- elif bytesize == 4:
- fmt = template % 'q'
- else:
- return None
-
- unpacked = struct.unpack(fmt, str(bytes))
- return unpacked[0]
-
-
-# ==============================================================
-# Get the description of an lldb object or None if not available
-# ==============================================================
-def get_description(obj, option=None):
- """Calls lldb_obj.GetDescription() and returns a string, or None.
-
- For SBTarget, SBBreakpointLocation, and SBWatchpoint lldb objects, an extra
- option can be passed in to describe the detailed level of description
- desired:
- o lldb.eDescriptionLevelBrief
- o lldb.eDescriptionLevelFull
- o lldb.eDescriptionLevelVerbose
- """
- method = getattr(obj, 'GetDescription')
- if not method:
- return None
- tuple = (lldb.SBTarget, lldb.SBBreakpointLocation, lldb.SBWatchpoint)
- if isinstance(obj, tuple):
- if option is None:
- option = lldb.eDescriptionLevelBrief
-
- stream = lldb.SBStream()
- if option is None:
- success = method(stream)
- else:
- success = method(stream, option)
- if not success:
- return None
- return stream.GetData()
-
-
-# =================================================
-# Convert some enum value to its string counterpart
-# =================================================
-
-def state_type_to_str(enum):
- """Returns the stateType string given an enum."""
- if enum == lldb.eStateInvalid:
- return "invalid"
- elif enum == lldb.eStateUnloaded:
- return "unloaded"
- elif enum == lldb.eStateConnected:
- return "connected"
- elif enum == lldb.eStateAttaching:
- return "attaching"
- elif enum == lldb.eStateLaunching:
- return "launching"
- elif enum == lldb.eStateStopped:
- return "stopped"
- elif enum == lldb.eStateRunning:
- return "running"
- elif enum == lldb.eStateStepping:
- return "stepping"
- elif enum == lldb.eStateCrashed:
- return "crashed"
- elif enum == lldb.eStateDetached:
- return "detached"
- elif enum == lldb.eStateExited:
- return "exited"
- elif enum == lldb.eStateSuspended:
- return "suspended"
- else:
- raise Exception("Unknown StateType enum")
-
-def stop_reason_to_str(enum):
- """Returns the stopReason string given an enum."""
- if enum == lldb.eStopReasonInvalid:
- return "invalid"
- elif enum == lldb.eStopReasonNone:
- return "none"
- elif enum == lldb.eStopReasonTrace:
- return "trace"
- elif enum == lldb.eStopReasonBreakpoint:
- return "breakpoint"
- elif enum == lldb.eStopReasonWatchpoint:
- return "watchpoint"
- elif enum == lldb.eStopReasonExec:
- return "exec"
- elif enum == lldb.eStopReasonSignal:
- return "signal"
- elif enum == lldb.eStopReasonException:
- return "exception"
- elif enum == lldb.eStopReasonPlanComplete:
- return "plancomplete"
- elif enum == lldb.eStopReasonThreadExiting:
- return "threadexiting"
- else:
- raise Exception("Unknown StopReason enum")
-
-def symbol_type_to_str(enum):
- """Returns the symbolType string given an enum."""
- if enum == lldb.eSymbolTypeInvalid:
- return "invalid"
- elif enum == lldb.eSymbolTypeAbsolute:
- return "absolute"
- elif enum == lldb.eSymbolTypeCode:
- return "code"
- elif enum == lldb.eSymbolTypeData:
- return "data"
- elif enum == lldb.eSymbolTypeTrampoline:
- return "trampoline"
- elif enum == lldb.eSymbolTypeRuntime:
- return "runtime"
- elif enum == lldb.eSymbolTypeException:
- return "exception"
- elif enum == lldb.eSymbolTypeSourceFile:
- return "sourcefile"
- elif enum == lldb.eSymbolTypeHeaderFile:
- return "headerfile"
- elif enum == lldb.eSymbolTypeObjectFile:
- return "objectfile"
- elif enum == lldb.eSymbolTypeCommonBlock:
- return "commonblock"
- elif enum == lldb.eSymbolTypeBlock:
- return "block"
- elif enum == lldb.eSymbolTypeLocal:
- return "local"
- elif enum == lldb.eSymbolTypeParam:
- return "param"
- elif enum == lldb.eSymbolTypeVariable:
- return "variable"
- elif enum == lldb.eSymbolTypeVariableType:
- return "variabletype"
- elif enum == lldb.eSymbolTypeLineEntry:
- return "lineentry"
- elif enum == lldb.eSymbolTypeLineHeader:
- return "lineheader"
- elif enum == lldb.eSymbolTypeScopeBegin:
- return "scopebegin"
- elif enum == lldb.eSymbolTypeScopeEnd:
- return "scopeend"
- elif enum == lldb.eSymbolTypeAdditional:
- return "additional"
- elif enum == lldb.eSymbolTypeCompiler:
- return "compiler"
- elif enum == lldb.eSymbolTypeInstrumentation:
- return "instrumentation"
- elif enum == lldb.eSymbolTypeUndefined:
- return "undefined"
-
-def value_type_to_str(enum):
- """Returns the valueType string given an enum."""
- if enum == lldb.eValueTypeInvalid:
- return "invalid"
- elif enum == lldb.eValueTypeVariableGlobal:
- return "global_variable"
- elif enum == lldb.eValueTypeVariableStatic:
- return "static_variable"
- elif enum == lldb.eValueTypeVariableArgument:
- return "argument_variable"
- elif enum == lldb.eValueTypeVariableLocal:
- return "local_variable"
- elif enum == lldb.eValueTypeRegister:
- return "register"
- elif enum == lldb.eValueTypeRegisterSet:
- return "register_set"
- elif enum == lldb.eValueTypeConstResult:
- return "constant_result"
- else:
- raise Exception("Unknown ValueType enum")
-
-
-# ==================================================
-# Get stopped threads due to each stop reason.
-# ==================================================
-
-def sort_stopped_threads(process,
- breakpoint_threads = None,
- crashed_threads = None,
- watchpoint_threads = None,
- signal_threads = None,
- exiting_threads = None,
- other_threads = None):
- """ Fills array *_threads with threads stopped for the corresponding stop
- reason.
- """
- for lst in [breakpoint_threads,
- watchpoint_threads,
- signal_threads,
- exiting_threads,
- other_threads]:
- if lst is not None:
- lst[:] = []
-
- for thread in process:
- dispatched = False
- for (reason, list) in [(lldb.eStopReasonBreakpoint, breakpoint_threads),
- (lldb.eStopReasonException, crashed_threads),
- (lldb.eStopReasonWatchpoint, watchpoint_threads),
- (lldb.eStopReasonSignal, signal_threads),
- (lldb.eStopReasonThreadExiting, exiting_threads),
- (None, other_threads)]:
- if not dispatched and list is not None:
- if thread.GetStopReason() == reason or reason is None:
- list.append(thread)
- dispatched = True
-
-# ==================================================
-# Utility functions for setting breakpoints
-# ==================================================
-
-def run_break_set_by_file_and_line (test, file_name, line_number, extra_options = None, num_expected_locations = 1, loc_exact=False, module_name=None):
- """Set a breakpoint by file and line, returning the breakpoint number.
-
- If extra_options is not None, then we append it to the breakpoint set command.
-
- If num_expected_locations is -1 we check that we got AT LEAST one location, otherwise we check that num_expected_locations equals the number of locations.
-
- If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
-
- if file_name == None:
- command = 'breakpoint set -l %d'%(line_number)
- else:
- command = 'breakpoint set -f "%s" -l %d'%(file_name, line_number)
-
- if module_name:
- command += " --shlib '%s'" % (module_name)
-
- if extra_options:
- command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- if num_expected_locations == 1 and loc_exact:
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations, file_name = file_name, line_number = line_number, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_symbol (test, symbol, extra_options = None, num_expected_locations = -1, sym_exact = False, module_name=None):
- """Set a breakpoint by symbol name. Common options are the same as run_break_set_by_file_and_line.
-
- If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match."""
- command = 'breakpoint set -n "%s"'%(symbol)
-
- if module_name:
- command += " --shlib '%s'" % (module_name)
-
- if extra_options:
- command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- if num_expected_locations == 1 and sym_exact:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = symbol, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_selector (test, selector, extra_options = None, num_expected_locations = -1, module_name=None):
- """Set a breakpoint by selector. Common options are the same as run_break_set_by_file_and_line."""
-
- command = 'breakpoint set -S "%s"' % (selector)
-
- if module_name:
- command += ' --shlib "%s"' % (module_name)
-
- if extra_options:
- command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- if num_expected_locations == 1:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = selector, symbol_match_exact=False, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
- """Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line."""
-
- command = 'breakpoint set -r "%s"'%(regexp)
- if extra_options:
- command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_source_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
- """Set a breakpoint by source regular expression. Common options are the same as run_break_set_by_file_and_line."""
- command = 'breakpoint set -p "%s"'%(regexp)
- if extra_options:
- command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_command (test, command):
- """Run the command passed in - it must be some break set variant - and analyze the result.
- Returns a dictionary of information gleaned from the command-line results.
- Will assert if the breakpoint setting fails altogether.
-
- Dictionary will contain:
- bpno - breakpoint of the newly created breakpoint, -1 on error.
- num_locations - number of locations set for the breakpoint.
-
- If there is only one location, the dictionary MAY contain:
- file - source file name
- line_no - source line number
- symbol - symbol name
- inline_symbol - inlined symbol name
- offset - offset from the original symbol
- module - module
- address - address at which the breakpoint was set."""
-
- patterns = [r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
- r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
- r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
- r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
- match_object = test.match (command, patterns)
- break_results = match_object.groupdict()
-
- # We always insert the breakpoint number, setting it to -1 if we couldn't find it
- # Also, make sure it gets stored as an integer.
- if not 'bpno' in break_results:
- break_results['bpno'] = -1
- else:
- break_results['bpno'] = int(break_results['bpno'])
-
- # We always insert the number of locations
- # If ONE location is set for the breakpoint, then the output doesn't mention locations, but it has to be 1...
- # We also make sure it is an integer.
-
- if not 'num_locations' in break_results:
- num_locations = 1
- else:
- num_locations = break_results['num_locations']
- if num_locations == 'no':
- num_locations = 0
- else:
- num_locations = int(break_results['num_locations'])
-
- break_results['num_locations'] = num_locations
-
- if 'line_no' in break_results:
- break_results['line_no'] = int(break_results['line_no'])
-
- return break_results
-
-def get_bpno_from_match (break_results):
- return int (break_results['bpno'])
-
-def check_breakpoint_result (test, break_results, file_name=None, line_number=-1, symbol_name=None, symbol_match_exact=True, module_name=None, offset=-1, num_locations=-1):
-
- out_num_locations = break_results['num_locations']
-
- if num_locations == -1:
- test.assertTrue (out_num_locations > 0, "Expecting one or more locations, got none.")
- else:
- test.assertTrue (num_locations == out_num_locations, "Expecting %d locations, got %d."%(num_locations, out_num_locations))
-
- if file_name:
- out_file_name = ""
- if 'file' in break_results:
- out_file_name = break_results['file']
- test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))
-
- if line_number != -1:
- out_line_number = -1
- if 'line_no' in break_results:
- out_line_number = break_results['line_no']
-
- test.assertTrue (line_number == out_line_number, "Breakpoint line number %s doesn't match resultant line %s."%(line_number, out_line_number))
-
- if symbol_name:
- out_symbol_name = ""
- # Look first for the inlined symbol name, otherwise use the symbol name:
- if 'inline_symbol' in break_results and break_results['inline_symbol']:
- out_symbol_name = break_results['inline_symbol']
- elif 'symbol' in break_results:
- out_symbol_name = break_results['symbol']
-
- if symbol_match_exact:
- test.assertTrue(symbol_name == out_symbol_name, "Symbol name '%s' doesn't match resultant symbol '%s'."%(symbol_name, out_symbol_name))
- else:
- test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))
-
- if module_name:
- out_module_name = None
- if 'module' in break_results:
- out_module_name = break_results['module']
-
- test.assertTrue (module_name.find(out_module_name) != -1, "Symbol module name '%s' isn't in expected module name '%s'."%(out_module_name, module_name))
-
-# ==================================================
-# Utility functions related to Threads and Processes
-# ==================================================
-
-def get_stopped_threads(process, reason):
- """Returns the thread(s) with the specified stop reason in a list.
-
- The list can be empty if no such thread exists.
- """
- threads = []
- for t in process:
- if t.GetStopReason() == reason:
- threads.append(t)
- return threads
-
-def get_stopped_thread(process, reason):
- """A convenience function which returns the first thread with the given stop
- reason or None.
-
- Example usages:
-
- 1. Get the stopped thread due to a breakpoint condition
-
- ...
- from lldbutil import get_stopped_thread
- thread = get_stopped_thread(process, lldb.eStopReasonPlanComplete)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- ...
-
- 2. Get the thread stopped due to a breakpoint
-
- ...
- from lldbutil import get_stopped_thread
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- ...
-
- """
- threads = get_stopped_threads(process, reason)
- if len(threads) == 0:
- return None
- return threads[0]
-
-def get_threads_stopped_at_breakpoint (process, bkpt):
- """ For a stopped process returns the thread stopped at the breakpoint passed in bkpt"""
- stopped_threads = []
- threads = []
-
- stopped_threads = get_stopped_threads (process, lldb.eStopReasonBreakpoint)
-
- if len(stopped_threads) == 0:
- return threads
-
- for thread in stopped_threads:
- # Make sure we've hit our breakpoint...
- break_id = thread.GetStopReasonDataAtIndex (0)
- if break_id == bkpt.GetID():
- threads.append(thread)
-
- return threads
-
-def is_thread_crashed (test, thread):
- """In the test suite we dereference a null pointer to simulate a crash. The way this is
- reported depends on the platform."""
- if test.platformIsDarwin():
- return thread.GetStopReason() == lldb.eStopReasonException and "EXC_BAD_ACCESS" in thread.GetStopDescription(100)
- elif test.getPlatform() == "linux":
- return thread.GetStopReason() == lldb.eStopReasonSignal and thread.GetStopReasonDataAtIndex(0) == thread.GetProcess().GetUnixSignals().GetSignalNumberFromName("SIGSEGV")
- else:
- return "invalid address" in thread.GetStopDescription(100)
-
-def get_crashed_threads (test, process):
- threads = []
- if process.GetState() != lldb.eStateStopped:
- return threads
- for thread in process:
- if is_thread_crashed(test, thread):
- threads.append(thread)
- return threads
-
-def continue_to_breakpoint (process, bkpt):
- """ Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None"""
- process.Continue()
- if process.GetState() != lldb.eStateStopped:
- return None
- else:
- return get_threads_stopped_at_breakpoint (process, bkpt)
-
-def get_caller_symbol(thread):
- """
- Returns the symbol name for the call site of the leaf function.
- """
- depth = thread.GetNumFrames()
- if depth <= 1:
- return None
- caller = thread.GetFrameAtIndex(1).GetSymbol()
- if caller:
- return caller.GetName()
- else:
- return None
-
-
-def get_function_names(thread):
- """
- Returns a sequence of function names from the stack frames of this thread.
- """
- def GetFuncName(i):
- return thread.GetFrameAtIndex(i).GetFunctionName()
-
- return list(map(GetFuncName, list(range(thread.GetNumFrames()))))
-
-
-def get_symbol_names(thread):
- """
- Returns a sequence of symbols for this thread.
- """
- def GetSymbol(i):
- return thread.GetFrameAtIndex(i).GetSymbol().GetName()
-
- return list(map(GetSymbol, list(range(thread.GetNumFrames()))))
-
-
-def get_pc_addresses(thread):
- """
- Returns a sequence of pc addresses for this thread.
- """
- def GetPCAddress(i):
- return thread.GetFrameAtIndex(i).GetPCAddress()
-
- return list(map(GetPCAddress, list(range(thread.GetNumFrames()))))
-
-
-def get_filenames(thread):
- """
- Returns a sequence of file names from the stack frames of this thread.
- """
- def GetFilename(i):
- return thread.GetFrameAtIndex(i).GetLineEntry().GetFileSpec().GetFilename()
-
- return list(map(GetFilename, list(range(thread.GetNumFrames()))))
-
-
-def get_line_numbers(thread):
- """
- Returns a sequence of line numbers from the stack frames of this thread.
- """
- def GetLineNumber(i):
- return thread.GetFrameAtIndex(i).GetLineEntry().GetLine()
-
- return list(map(GetLineNumber, list(range(thread.GetNumFrames()))))
-
-
-def get_module_names(thread):
- """
- Returns a sequence of module names from the stack frames of this thread.
- """
- def GetModuleName(i):
- return thread.GetFrameAtIndex(i).GetModule().GetFileSpec().GetFilename()
-
- return list(map(GetModuleName, list(range(thread.GetNumFrames()))))
-
-
-def get_stack_frames(thread):
- """
- Returns a sequence of stack frames for this thread.
- """
- def GetStackFrame(i):
- return thread.GetFrameAtIndex(i)
-
- return list(map(GetStackFrame, list(range(thread.GetNumFrames()))))
-
-
-def print_stacktrace(thread, string_buffer = False):
- """Prints a simple stack trace of this thread."""
-
- output = SixStringIO() if string_buffer else sys.stdout
- target = thread.GetProcess().GetTarget()
-
- depth = thread.GetNumFrames()
-
- mods = get_module_names(thread)
- funcs = get_function_names(thread)
- symbols = get_symbol_names(thread)
- files = get_filenames(thread)
- lines = get_line_numbers(thread)
- addrs = get_pc_addresses(thread)
-
- if thread.GetStopReason() != lldb.eStopReasonInvalid:
- desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
- else:
- desc = ""
- print("Stack trace for thread id={0:#x} name={1} queue={2} ".format(
- thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc, file=output)
-
- for i in range(depth):
- frame = thread.GetFrameAtIndex(i)
- function = frame.GetFunction()
-
- load_addr = addrs[i].GetLoadAddress(target)
- if not function:
- file_addr = addrs[i].GetFileAddress()
- start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
- symbol_offset = file_addr - start_addr
- print(" frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
- num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset), file=output)
- else:
- print(" frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
- num=i, addr=load_addr, mod=mods[i],
- func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
- file=files[i], line=lines[i],
- args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()'), file=output)
-
- if string_buffer:
- return output.getvalue()
-
-
-def print_stacktraces(process, string_buffer = False):
- """Prints the stack traces of all the threads."""
-
- output = SixStringIO() if string_buffer else sys.stdout
-
- print("Stack traces for " + str(process), file=output)
-
- for thread in process:
- print(print_stacktrace(thread, string_buffer=True), file=output)
-
- if string_buffer:
- return output.getvalue()
-
-def expect_state_changes(test, listener, states, timeout = 5):
- """Listens for state changed events on the listener and makes sure they match what we
- expect. Stop-and-restart events (where GetRestartedFromEvent() returns true) are ignored."""
- event = lldb.SBEvent()
- for expected_state in states:
- if not listener.WaitForEvent(timeout, event):
- test.Fail("Timed out while waiting for a transition to state %s" %
- lldb.SBDebugger.StateAsCString(expected_state))
-
- got_state = lldb.SBProcess.GetStateFromEvent(event)
- if got_state == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
- continue
-
- test.assertEqual(expected_state, got_state)
-
-# ===================================
-# Utility functions related to Frames
-# ===================================
-
-def get_parent_frame(frame):
- """
- Returns the parent frame of the input frame object; None if not available.
- """
- thread = frame.GetThread()
- parent_found = False
- for f in thread:
- if parent_found:
- return f
- if f.GetFrameID() == frame.GetFrameID():
- parent_found = True
-
- # If we reach here, no parent has been found, return None.
- return None
-
-def get_args_as_string(frame, showFuncName=True):
- """
- Returns the args of the input frame object as a string.
- """
- # arguments => True
- # locals => False
- # statics => False
- # in_scope_only => True
- vars = frame.GetVariables(True, False, False, True) # type of SBValueList
- args = [] # list of strings
- for var in vars:
- args.append("(%s)%s=%s" % (var.GetTypeName(),
- var.GetName(),
- var.GetValue()))
- if frame.GetFunction():
- name = frame.GetFunction().GetName()
- elif frame.GetSymbol():
- name = frame.GetSymbol().GetName()
- else:
- name = ""
- if showFuncName:
- return "%s(%s)" % (name, ", ".join(args))
- else:
- return "(%s)" % (", ".join(args))
-
-def print_registers(frame, string_buffer = False):
- """Prints all the register sets of the frame."""
-
- output = SixStringIO() if string_buffer else sys.stdout
-
- print("Register sets for " + str(frame), file=output)
-
- registerSet = frame.GetRegisters() # Return type of SBValueList.
- print("Frame registers (size of register set = %d):" % registerSet.GetSize(), file=output)
- for value in registerSet:
- #print(value, file=output)
- print("%s (number of children = %d):" % (value.GetName(), value.GetNumChildren()), file=output)
- for child in value:
- print("Name: %s, Value: %s" % (child.GetName(), child.GetValue()), file=output)
-
- if string_buffer:
- return output.getvalue()
-
-def get_registers(frame, kind):
- """Returns the registers given the frame and the kind of registers desired.
-
- Returns None if there's no such kind.
- """
- registerSet = frame.GetRegisters() # Return type of SBValueList.
- for value in registerSet:
- if kind.lower() in value.GetName().lower():
- return value
-
- return None
-
-def get_GPRs(frame):
- """Returns the general purpose registers of the frame as an SBValue.
-
- The returned SBValue object is iterable. An example:
- ...
- from lldbutil import get_GPRs
- regs = get_GPRs(frame)
- for reg in regs:
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
- ...
- """
- return get_registers(frame, "general purpose")
-
-def get_FPRs(frame):
- """Returns the floating point registers of the frame as an SBValue.
-
- The returned SBValue object is iterable. An example:
- ...
- from lldbutil import get_FPRs
- regs = get_FPRs(frame)
- for reg in regs:
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
- ...
- """
- return get_registers(frame, "floating point")
-
-def get_ESRs(frame):
- """Returns the exception state registers of the frame as an SBValue.
-
- The returned SBValue object is iterable. An example:
- ...
- from lldbutil import get_ESRs
- regs = get_ESRs(frame)
- for reg in regs:
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
- ...
- """
- return get_registers(frame, "exception state")
-
-# ======================================
-# Utility classes/functions for SBValues
-# ======================================
-
-class BasicFormatter(object):
- """The basic formatter inspects the value object and prints the value."""
- def format(self, value, buffer=None, indent=0):
- if not buffer:
- output = SixStringIO()
- else:
- output = buffer
- # If there is a summary, it suffices.
- val = value.GetSummary()
- # Otherwise, get the value.
- if val == None:
- val = value.GetValue()
- if val == None and value.GetNumChildren() > 0:
- val = "%s (location)" % value.GetLocation()
- print("{indentation}({type}) {name} = {value}".format(
- indentation = ' ' * indent,
- type = value.GetTypeName(),
- name = value.GetName(),
- value = val), file=output)
- return output.getvalue()
-
-class ChildVisitingFormatter(BasicFormatter):
- """The child visiting formatter prints the value and its immediate children.
-
- The constructor takes a keyword arg: indent_child, which defaults to 2.
- """
- def __init__(self, indent_child=2):
- """Default indentation of 2 SPC's for the children."""
- self.cindent = indent_child
- def format(self, value, buffer=None):
- if not buffer:
- output = SixStringIO()
- else:
- output = buffer
-
- BasicFormatter.format(self, value, buffer=output)
- for child in value:
- BasicFormatter.format(self, child, buffer=output, indent=self.cindent)
-
- return output.getvalue()
-
-class RecursiveDecentFormatter(BasicFormatter):
- """The recursive decent formatter prints the value and the decendents.
-
- The constructor takes two keyword args: indent_level, which defaults to 0,
- and indent_child, which defaults to 2. The current indentation level is
- determined by indent_level, while the immediate children has an additional
- indentation by inden_child.
- """
- def __init__(self, indent_level=0, indent_child=2):
- self.lindent = indent_level
- self.cindent = indent_child
- def format(self, value, buffer=None):
- if not buffer:
- output = SixStringIO()
- else:
- output = buffer
-
- BasicFormatter.format(self, value, buffer=output, indent=self.lindent)
- new_indent = self.lindent + self.cindent
- for child in value:
- if child.GetSummary() != None:
- BasicFormatter.format(self, child, buffer=output, indent=new_indent)
- else:
- if child.GetNumChildren() > 0:
- rdf = RecursiveDecentFormatter(indent_level=new_indent)
- rdf.format(child, buffer=output)
- else:
- BasicFormatter.format(self, child, buffer=output, indent=new_indent)
-
- return output.getvalue()
-
-# ===========================================================
-# Utility functions for path manipulation on remote platforms
-# ===========================================================
-
-def join_remote_paths(*paths):
- # TODO: update with actual platform name for remote windows once it exists
- if lldb.remote_platform.GetName() == 'remote-windows':
- return os.path.join(*paths).replace(os.path.sep, '\\')
- return os.path.join(*paths).replace(os.path.sep, '/')
-
-def append_to_process_working_directory(*paths):
- remote = lldb.remote_platform
- if remote:
- return join_remote_paths(remote.GetWorkingDirectory(), *paths)
- return os.path.join(os.getcwd(), *paths)
-
-# ==================================================
-# Utility functions to get the correct signal number
-# ==================================================
-
-import signal
-
-def get_signal_number(signal_name):
- platform = lldb.remote_platform
- if platform and platform.IsValid():
- signals = platform.GetUnixSignals()
- if signals.IsValid():
- signal_number = signals.GetSignalNumberFromName(signal_name)
- if signal_number > 0:
- return signal_number
- # No remote platform; fall back to using local python signals.
- return getattr(signal, signal_name)
-
-class PrintableRegex(object):
- def __init__(self, text):
- self.regex = re.compile(text)
- self.text = text
-
- def match(self, str):
- return self.regex.match(str)
-
- def __str__(self):
- return "%s" % (self.text)
-
- def __repr__(self):
- return "re.compile(%s) -> %s" % (self.text, self.regex)
-
-def skip_if_callable(test, callable, reason):
- if six.callable(test):
- test.skipTest(reason)
- return True
- return False
-
-def skip_if_library_missing(test, target, library):
- def find_library(target, library):
- for module in target.modules:
- filename = module.file.GetFilename()
- if isinstance(library, str):
- if library == filename:
- return False
- elif hasattr(library, 'match'):
- if library.match(filename):
- return False
- return True
- def find_library_callable(test):
- return find_library(target, library)
- return skip_if_callable(test, find_library_callable, "could not find library matching '%s' in target %s" % (library, target))
Removed: lldb/trunk/test/lock.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lock.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/lock.py (original)
+++ lldb/trunk/test/lock.py (removed)
@@ -1,27 +0,0 @@
-"""
-Interprocess mutex based on file locks
-"""
-
-import fcntl
-import os
-
-class Lock:
-
- def __init__(self, filename):
- self.filename = filename
- # This will create it if it does not exist already
- unbuffered = 0
- self.handle = open(filename, 'a+', unbuffered)
-
- def acquire(self):
- fcntl.flock(self.handle, fcntl.LOCK_EX)
-
- # will throw IOError if unavailable
- def try_acquire(self):
- fcntl.flock(self.handle, fcntl.LOCK_NB | fcntl.LOCK_EX)
-
- def release(self):
- fcntl.flock(self.handle, fcntl.LOCK_UN)
-
- def __del__(self):
- self.handle.close()
Removed: lldb/trunk/test/logging/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/logging/Makefile (original)
+++ lldb/trunk/test/logging/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/logging/TestLogging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/TestLogging.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/logging/TestLogging.py (original)
+++ lldb/trunk/test/logging/TestLogging.py (removed)
@@ -1,107 +0,0 @@
-"""
-Test lldb logging. This test just makes sure logging doesn't crash, and produces some output.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time, string
-import lldb
-from lldbtest import *
-
-class LogTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
- append_log_file = "lldb-commands-log-append.txt"
- truncate_log_file = "lldb-commands-log-truncate.txt"
-
- @classmethod
- def classCleanup(cls):
- """Cleanup the test byproducts."""
- cls.RemoveTempFile(cls.truncate_log_file)
- cls.RemoveTempFile(cls.append_log_file)
-
- def test (self):
- self.build()
- if self.debug_info == "dsym":
- self.command_log_tests ("dsym")
- else:
- self.command_log_tests ("dwarf")
-
- def command_log_tests (self, type):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
-
- log_file = os.path.join (os.getcwd(), "lldb-commands-log-%s-%s-%s.txt" % (type,
- os.path.basename(self.getCompiler()),
- self.getArchitecture()))
-
- if (os.path.exists (log_file)):
- os.remove (log_file)
-
- # By default, Debugger::EnableLog() will set log options to
- # PREPEND_THREAD_NAME + OPTION_THREADSAFE. We don't want the
- # threadnames here, so we enable just threadsafe (-t).
- self.runCmd ("log enable -t -f '%s' lldb commands" % (log_file))
-
- self.runCmd ("command alias bp breakpoint")
-
- self.runCmd ("bp set -n main")
-
- self.runCmd ("bp l")
-
- self.runCmd("log disable lldb")
-
- self.assertTrue (os.path.isfile (log_file))
-
- f = open (log_file)
- log_lines = f.readlines()
- f.close ()
- os.remove (log_file)
-
- self.assertTrue(log_lines > 0, "Something was written to the log file.")
-
- # Check that lldb truncates its log files
- @no_debug_info_test
- def test_log_truncate (self):
- if (os.path.exists (self.truncate_log_file)):
- os.remove (self.truncate_log_file)
-
- # put something in our log file
- with open(self.truncate_log_file, "w") as f:
- for i in range(1, 1000):
- f.write("bacon\n")
-
- self.runCmd ("log enable -t -f '%s' lldb commands" % (self.truncate_log_file))
- self.runCmd ("help log")
- self.runCmd ("log disable lldb")
-
- self.assertTrue (os.path.isfile (self.truncate_log_file))
- with open(self.truncate_log_file, "r") as f:
- contents = f.read ()
-
- # check that it got removed
- self.assertTrue(string.find(contents, "bacon") == -1)
-
- # Check that lldb can append to a log file
- @no_debug_info_test
- def test_log_append (self):
- if (os.path.exists (self.append_log_file)):
- os.remove (self.append_log_file)
-
- # put something in our log file
- with open(self.append_log_file, "w") as f:
- f.write("bacon\n")
-
- self.runCmd ("log enable -t -a -f '%s' lldb commands" % (self.append_log_file))
- self.runCmd ("help log")
- self.runCmd ("log disable lldb")
-
- self.assertTrue (os.path.isfile (self.append_log_file))
- with open(self.append_log_file, "r") as f:
- contents = f.read ()
-
- # check that it is still there
- self.assertTrue(string.find(contents, "bacon") == 0)
Removed: lldb/trunk/test/logging/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/logging/main.cpp (original)
+++ lldb/trunk/test/logging/main.cpp (removed)
@@ -1,62 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdlib>
-#include <string>
-#include <fstream>
-#include <iostream>
-
-int
-product (int x, int y)
-{
- int result = x * y;
- return result;
-}
-
-int
-sum (int a, int b)
-{
- int result = a + b;
- return result;
-}
-
-int
-strange_max (int m, int n)
-{
- if (m > n)
- return m;
- else if (n > m)
- return n;
- else
- return 0;
-}
-
-int
-foo (int i, int j)
-{
- if (strange_max (i, j) == i)
- return product (i, j);
- else if (strange_max (i, j) == j)
- return sum (i, j);
- else
- return product (sum (i, i), sum (j, j));
-}
-
-int
-main(int argc, char const *argv[])
-{
-
- int array[3];
-
- array[0] = foo (1238, 78392);
- array[1] = foo (379265, 23674);
- array[2] = foo (872934, 234);
-
- return 0;
-}
Removed: lldb/trunk/test/macosx/add-dsym/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/Makefile (original)
+++ lldb/trunk/test/macosx/add-dsym/Makefile (removed)
@@ -1,11 +0,0 @@
-CC ?= clang
-
-all: clean
- mkdir hide.app
- mkdir hide.app/Contents
- $(CC) -g main.c
- mv a.out.dSYM hide.app/Contents
- strip -x a.out
-
-clean:
- rm -rf a.out a.out.dSYM hide.app
Removed: lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py (original)
+++ lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py (removed)
@@ -1,45 +0,0 @@
-"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-import sys
-from lldbtest import *
-
- at skipUnlessDarwin
-class AddDsymMidExecutionCommandCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- self.source = 'main.c'
-
- @no_debug_info_test # Prevent the genaration of the dwarf version of this test
- def test_add_dsym_mid_execution(self):
- """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
- self.buildDsym(clean=True)
- exe = os.path.join(os.getcwd(), "a.out")
-
- self.target = self.dbg.CreateTarget(exe)
- self.assertTrue(self.target, VALID_TARGET)
-
- main_bp = self.target.BreakpointCreateByName ("main", "a.out")
- self.assertTrue(main_bp, VALID_BREAKPOINT)
-
- self.runCmd("settings set target.disable-aslr false")
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(self.process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- self.assertTrue(self.process.GetState() == lldb.eStateStopped,
- STOPPED_DUE_TO_BREAKPOINT)
-
- self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
-
- self.expect("frame select",
- substrs = ['a.out`main at main.c'])
Removed: lldb/trunk/test/macosx/add-dsym/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/main.c (original)
+++ lldb/trunk/test/macosx/add-dsym/main.c (removed)
@@ -1,7 +0,0 @@
-#include <stdio.h>
-static int var = 5;
-int main ()
-{
- printf ("%p is %d\n", &var, var); // break on this line
- return ++var;
-}
Removed: lldb/trunk/test/macosx/debug-info/apple_types/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/Makefile (original)
+++ lldb/trunk/test/macosx/debug-info/apple_types/Makefile (removed)
@@ -1,6 +0,0 @@
-LEVEL = ../../../make
-
-C_SOURCES := main.c
-MAKE_DSYM := NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py (original)
+++ lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py (removed)
@@ -1,67 +0,0 @@
-"""
-Test that clang produces the __apple accelerator tables, for example, __apple_types, correctly.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-from lldbtest import *
-from lldbutil import symbol_type_to_str
-
-class AppleTypesTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- #rdar://problem/11166975
- @skipUnlessDarwin
- def test_debug_info_for_apple_types(self):
- """Test that __apple_types section does get produced by clang."""
-
- if not self.getCompiler().endswith('clang'):
- self.skipTest("clang compiler only test")
-
- self.build()
- if self.debug_info == "dsym":
- exe = os.path.join(os.getcwd(), "a.out.dSYM/Contents/Resources/DWARF/a.out")
- else:
- exe = os.path.join(os.getcwd(), "main.o")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.assertTrue(target.GetNumModules() > 0)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print("Number of modules for the target: %d" % target.GetNumModules())
- for module in target.module_iter():
- print(module)
-
- # Get the executable module at index 0.
- exe_module = target.GetModuleAtIndex(0)
-
- dwarf_section = exe_module.FindSection("__DWARF")
- self.assertTrue(dwarf_section)
- print("__DWARF section:", dwarf_section)
- print("Number of sub-sections: %d" % dwarf_section.GetNumSubSections())
- INDENT = ' ' * 4
- for subsec in dwarf_section:
- print(INDENT + str(subsec))
-
- debug_str_sub_section = dwarf_section.FindSubSection("__debug_str")
- self.assertTrue(debug_str_sub_section)
- print("__debug_str sub-section:", debug_str_sub_section)
-
- # Find our __apple_types section by name.
- apple_types_sub_section = dwarf_section.FindSubSection("__apple_types")
- self.assertTrue(apple_types_sub_section)
- print("__apple_types sub-section:", apple_types_sub_section)
-
- # These other three all important subsections should also be present.
- self.assertTrue(dwarf_section.FindSubSection("__apple_names") and
- dwarf_section.FindSubSection("__apple_namespac") and
- dwarf_section.FindSubSection("__apple_objc"))
Removed: lldb/trunk/test/macosx/debug-info/apple_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/main.c (original)
+++ lldb/trunk/test/macosx/debug-info/apple_types/main.c (removed)
@@ -1,27 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-int main (int argc, char const *argv[])
-{
- struct point_tag {
- int x;
- int y;
- }; // Set break point at this line.
-
- struct rect_tag {
- struct point_tag bottom_left;
- struct point_tag top_right;
- };
- struct point_tag pt = { 2, 3 }; // This is the first executable statement.
- struct rect_tag rect = {{1,2}, {3,4}};
- pt.x = argc;
- pt.y = argc * argc;
- rect.top_right.x = rect.top_right.x + argc;
- rect.top_right.y = rect.top_right.y + argc;
- return 0;
-}
Removed: lldb/trunk/test/macosx/indirect_symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/Makefile (original)
+++ lldb/trunk/test/macosx/indirect_symbol/Makefile (removed)
@@ -1,48 +0,0 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
- OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
- DS := dsymutil
- LD_FLAGS := -dynamiclib
- LIB_INDIRECT := $(LIB_PREFIX)indirect.dylib
- LIB_REEXPORT := $(LIB_PREFIX)reexport.dylib
- EXEC_PATH := "@executable_path"
- EXEC_PATH_INDIRECT := -install_name $(EXEC_PATH)/$(LIB_INDIRECT)
- EXEC_PATH_REEXPORT := -install_name $(EXEC_PATH)/$(LIB_REEXPORT)
-endif
-
-all: a.out $(LIB_INDIRECT) $(LIB_REEXPORT)
-
-a.out: main.o $(LIB_INDIRECT) $(LIB_REEXPORT)
- $(CC) $(CFLAGS) -o a.out main.o -L. $(LIB_INDIRECT) $(LIB_REEXPORT)
-
-main.o: main.c
- $(CC) $(CFLAGS) -c main.c
-
-$(LIB_INDIRECT): indirect.o
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_INDIRECT) -o $(LIB_INDIRECT) indirect.o
- if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_INDIRECT); fi
-
-indirect.o: indirect.c
- $(CC) $(CFLAGS) -c indirect.c
-
-$(LIB_REEXPORT): reexport.o $(LIB_INDIRECT)
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) reexport.o -L. -lindirect -Wl,-alias_list,$(CWD)/alias.list
- if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_REEXPORT); fi
-
-reexport.o: reexport.c
- $(CC) $(CFLAGS) -c reexport.c
-clean:
- rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
Removed: lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py (original)
+++ lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py (removed)
@@ -1,88 +0,0 @@
-"""Test stepping and setting breakpoints in indirect and re-exported symbols."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-import lldbutil
-from lldbtest import *
-
-class TestIndirectFunctions(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers that we will step to in main:
- self.main_source = "main.c"
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api(self):
- """Test stepping and setting breakpoints in indirect and re-exported symbols."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
-
- break1 = target.BreakpointCreateBySourceRegex ("Set breakpoint here to step in indirect.", self.main_source_spec)
- self.assertTrue(break1, VALID_BREAKPOINT)
-
- break2 = target.BreakpointCreateBySourceRegex ("Set breakpoint here to step in reexported.", self.main_source_spec)
- self.assertTrue(break2, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
- if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
-
- thread = threads[0]
-
- # Now do a step-into, and we should end up in the hidden target of this indirect function.
- thread.StepInto()
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
-
- # Now set a breakpoint using the indirect symbol name, and make sure we get to that:
- break_indirect = target.BreakpointCreateByName ("call_through_indirect");
- self.assertTrue (break_indirect, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect symbol:
-
- threads = lldbutil.continue_to_breakpoint (process, break_indirect)
- self.assertTrue (len(threads) == 1, "Stopped at breakpoint in indirect function.")
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
-
- # Delete this breakpoint so it won't get in the way:
- target.BreakpointDelete (break_indirect.GetID())
-
- # Now continue to the site of the first re-exported function call in main:
- threads = lldbutil.continue_to_breakpoint (process, break2)
-
- # This is stepping Into through a re-exported symbol to an indirect symbol:
- thread.StepInto()
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
-
- # And the last bit is to set a breakpoint on the re-exported symbol and make sure we are again in out target function.
- break_reexported = target.BreakpointCreateByName ("reexport_to_indirect");
- self.assertTrue (break_reexported, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect symbol:
-
- threads = lldbutil.continue_to_breakpoint (process, break_reexported)
- self.assertTrue (len(threads) == 1, "Stopped at breakpoint in reexported function target.")
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
Removed: lldb/trunk/test/macosx/indirect_symbol/alias.list
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/alias.list?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/alias.list (original)
+++ lldb/trunk/test/macosx/indirect_symbol/alias.list (removed)
@@ -1 +0,0 @@
-_call_through_indirect _reexport_to_indirect
\ No newline at end of file
Removed: lldb/trunk/test/macosx/indirect_symbol/indirect.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/indirect.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/indirect.c (original)
+++ lldb/trunk/test/macosx/indirect_symbol/indirect.c (removed)
@@ -1,14 +0,0 @@
-#define MakeResolver(name) \
- void * name ## Resolver(void) __asm__("_" #name); \
- void * name ## Resolver(void) { \
- __asm__(".symbol_resolver _" #name); \
- return name ## _hidden; \
- }
-
-int
-call_through_indirect_hidden(int arg)
-{
- return arg + 5;
-}
-
-MakeResolver(call_through_indirect)
Removed: lldb/trunk/test/macosx/indirect_symbol/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/main.c (original)
+++ lldb/trunk/test/macosx/indirect_symbol/main.c (removed)
@@ -1,14 +0,0 @@
-extern int call_through_indirect(int);
-extern int reexport_to_indirect(int);
-
-int
-main ()
-{
- int indirect_result = call_through_indirect(20); // Set breakpoint here to step in indirect.
- indirect_result = call_through_indirect(30);
-
- int reexport_result = reexport_to_indirect (20); // Set breakpoint here to step in reexported.
- reexport_result = reexport_to_indirect (30);
-
- return 0;
-}
Removed: lldb/trunk/test/macosx/indirect_symbol/reexport.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/reexport.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/indirect_symbol/reexport.c (original)
+++ lldb/trunk/test/macosx/indirect_symbol/reexport.c (removed)
@@ -1,7 +0,0 @@
-extern int call_through_indirect(int);
-
-int
-fake_call_through_reexport(int value)
-{
- return value + 10;
-}
Removed: lldb/trunk/test/macosx/order/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/order/Makefile (original)
+++ lldb/trunk/test/macosx/order/Makefile (removed)
@@ -1,7 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker ./order-file
-MAKE_DSYM := NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/macosx/order/TestOrderFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/TestOrderFile.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/order/TestOrderFile.py (original)
+++ lldb/trunk/test/macosx/order/TestOrderFile.py (removed)
@@ -1,36 +0,0 @@
-"""
-Test that debug symbols have the correct order as specified by the order file.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-
-class OrderFileTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipUnlessDarwin
- def test(self):
- """Test debug symbols follow the correct order by the order file."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Test that the debug symbols have Function f3 before Function f1.
- # Use "-s address" option to sort by address.
- self.runCmd("image dump symtab -s address a.out")
- output = self.res.GetOutput()
- mo_f3 = re.search("Code +.+f3", output)
- mo_f1 = re.search("Code +.+f1", output)
-
- # Match objects for f3 and f1 must exist and f3 must come before f1.
- self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(),
- "Symbols have correct order by the order file")
-
- self.runCmd("run", RUN_COMPLETED)
Removed: lldb/trunk/test/macosx/order/cmds.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/cmds.txt?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/order/cmds.txt (original)
+++ lldb/trunk/test/macosx/order/cmds.txt (removed)
@@ -1,3 +0,0 @@
-b main.c:41
-c
-lines -shlib a.out main.c
Removed: lldb/trunk/test/macosx/order/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/order/main.c (original)
+++ lldb/trunk/test/macosx/order/main.c (removed)
@@ -1,54 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-
-int f1 (char *s);
-int f2 (char *s);
-int f3 (char *s);
-
-
-// We want f1 to start on line 20
-int f1 (char *s)
-{
- return printf("f1: %s\n", s);
-}
-
-
-
-
-
-// We want f2 to start on line 30
-int f2 (char *s)
-{
- return printf("f2: %s\n", s);
-}
-
-
-
-
-
-// We want f3 to start on line 40
-int f3 (char *s)
-{
- return printf("f3: %s\n", s);
-}
-
-
-
-
-
-// We want main to start on line 50
-int main (int argc, const char * argv[])
-{
- f1("carp");
- f2("ding");
- f3("dong");
- return 0;
-}
Removed: lldb/trunk/test/macosx/order/order-file
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/order-file?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/order/order-file (original)
+++ lldb/trunk/test/macosx/order/order-file (removed)
@@ -1,4 +0,0 @@
-main.o:_f3
-main.o:_main
-main.o:_f2
-main.o:_f1
Removed: lldb/trunk/test/macosx/queues/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/queues/Makefile (original)
+++ lldb/trunk/test/macosx/queues/Makefile (removed)
@@ -1,28 +0,0 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
- OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
-endif
-
-all: a.out
-
-a.out: main.o
- $(CC) $(CFLAGS) -o a.out main.o
-
-main.o: main.c
- $(CC) $(CFLAGS) -c main.c
-
-clean:
- rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
Removed: lldb/trunk/test/macosx/queues/TestQueues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/TestQueues.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/queues/TestQueues.py (original)
+++ lldb/trunk/test/macosx/queues/TestQueues.py (removed)
@@ -1,243 +0,0 @@
-"""Test queues inspection SB APIs."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import os, time
-import lldb
-import lldbutil
-from lldbtest import *
-
-class TestQueues(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- @unittest2.expectedFailure("rdar://22531180")
- def test_with_python_api(self):
- """Test queues inspection SB APIs."""
- self.build()
- self.queues()
- self.queues_with_libBacktraceRecording()
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers that we will step to in main:
- self.main_source = "main.c"
-
- def check_queue_for_valid_queue_id(self, queue):
- self.assertTrue(queue.GetQueueID() != 0, "Check queue %s for valid QueueID (got 0x%x)" % (queue.GetName(), queue.GetQueueID()))
-
- def check_running_and_pending_items_on_queue(self, queue, expected_running, expected_pending):
- self.assertTrue(queue.GetNumPendingItems() == expected_pending, "queue %s should have %d pending items, instead has %d pending items" % (queue.GetName(), expected_pending, (queue.GetNumPendingItems())))
- self.assertTrue(queue.GetNumRunningItems() == expected_running, "queue %s should have %d running items, instead has %d running items" % (queue.GetName(), expected_running, (queue.GetNumRunningItems())))
-
- def check_number_of_threads_owned_by_queue(self, queue, number_threads):
- self.assertTrue(queue.GetNumThreads() == number_threads, "queue %s should have %d thread executing, but has %d" % (queue.GetName(), number_threads, queue.GetNumThreads()))
-
- def check_queue_kind (self, queue, kind):
- expected_kind_string = "Unknown"
- if kind == lldb.eQueueKindSerial:
- expected_kind_string = "Serial queue"
- if kind == lldb.eQueueKindConcurrent:
- expected_kind_string = "Concurrent queue"
- actual_kind_string = "Unknown"
- if queue.GetKind() == lldb.eQueueKindSerial:
- actual_kind_string = "Serial queue"
- if queue.GetKind() == lldb.eQueueKindConcurrent:
- actual_kind_string = "Concurrent queue"
- self.assertTrue(queue.GetKind() == kind, "queue %s is expected to be a %s but it is actually a %s" % (queue.GetName(), expected_kind_string, actual_kind_string))
-
- def check_queues_threads_match_queue(self, queue):
- for idx in range(0, queue.GetNumThreads()):
- t = queue.GetThreadAtIndex(idx)
- self.assertTrue(t.IsValid(), "Queue %s's thread #%d must be valid" % (queue.GetName(), idx))
- self.assertTrue(t.GetQueueID() == queue.GetQueueID(), "Queue %s has a QueueID of %d but its thread #%d has a QueueID of %d" % (queue.GetName(), queue.GetQueueID(), idx, t.GetQueueID()))
- self.assertTrue(t.GetQueueName() == queue.GetName(), "Queue %s has a QueueName of %s but its thread #%d has a QueueName of %s" % (queue.GetName(), queue.GetName(), idx, t.GetQueueName()))
- self.assertTrue(t.GetQueue().GetQueueID() == queue.GetQueueID(), "Thread #%d's Queue's QueueID of %d is not the same as the QueueID of its owning queue %d" % (idx, t.GetQueue().GetQueueID(), queue.GetQueueID()))
-
- def queues(self):
- """Test queues inspection SB APIs without libBacktraceRecording."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
- self.assertTrue(break1, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
- if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
-
- queue_submittor_1 = lldb.SBQueue()
- queue_performer_1 = lldb.SBQueue()
- queue_performer_2 = lldb.SBQueue()
- queue_performer_3 = lldb.SBQueue()
- for idx in range (0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(), "Got all four expected queues: %s %s %s %s" % (queue_submittor_1.IsValid(), queue_performer_1.IsValid(), queue_performer_2.IsValid(), queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id (queue_submittor_1)
- self.check_queue_for_valid_queue_id (queue_performer_1)
- self.check_queue_for_valid_queue_id (queue_performer_2)
- self.check_queue_for_valid_queue_id (queue_performer_3)
-
- self.check_number_of_threads_owned_by_queue (queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_3, 4)
-
- self.check_queue_kind (queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_3, lldb.eQueueKindConcurrent)
-
- self.check_queues_threads_match_queue (queue_submittor_1)
- self.check_queues_threads_match_queue (queue_performer_1)
- self.check_queues_threads_match_queue (queue_performer_2)
- self.check_queues_threads_match_queue (queue_performer_3)
-
-
-
- # We have threads running with all the different dispatch QoS service
- # levels - find those threads and check that we can get the correct
- # QoS name for each of them.
-
- user_initiated_thread = lldb.SBThread()
- user_interactive_thread = lldb.SBThread()
- utility_thread = lldb.SBThread()
- unspecified_thread = lldb.SBThread()
- background_thread = lldb.SBThread()
- for th in process.threads:
- if th.GetName() == "user initiated QoS":
- user_initiated_thread = th
- if th.GetName() == "user interactive QoS":
- user_interactive_thread = th
- if th.GetName() == "utility QoS":
- utility_thread = th
- if th.GetName() == "unspecified QoS":
- unspecified_thread = th
- if th.GetName() == "background QoS":
- background_thread = th
-
- self.assertTrue(user_initiated_thread.IsValid(), "Found user initiated QoS thread")
- self.assertTrue(user_interactive_thread.IsValid(), "Found user interactive QoS thread")
- self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
- self.assertTrue(unspecified_thread.IsValid(), "Found unspecified QoS thread")
- self.assertTrue(background_thread.IsValid(), "Found background QoS thread")
-
- stream = lldb.SBStream()
- self.assertTrue(user_initiated_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user initiated QoS thread")
- self.assertTrue(stream.GetData() == "User Initiated", "user initiated QoS thread name is valid")
- stream.Clear()
- self.assertTrue(user_interactive_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user interactive QoS thread")
- self.assertTrue(stream.GetData() == "User Interactive", "user interactive QoS thread name is valid")
- stream.Clear()
- self.assertTrue(utility_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for utility QoS thread")
- self.assertTrue(stream.GetData() == "Utility", "utility QoS thread name is valid")
- stream.Clear()
- self.assertTrue(unspecified_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for unspecified QoS thread")
- self.assertTrue(stream.GetData() == "User Initiated", "unspecified QoS thread name is valid")
- stream.Clear()
- self.assertTrue(background_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for background QoS thread")
- self.assertTrue(stream.GetData() == "Background", "background QoS thread name is valid")
-
- def queues_with_libBacktraceRecording(self):
- """Test queues inspection SB APIs with libBacktraceRecording present."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- if not os.path.isfile('/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib'):
- self.skipTest ("Skipped because libBacktraceRecording.dylib was present on the system.")
-
- if not os.path.isfile('/usr/lib/system/introspection/libdispatch.dylib'):
- self.skipTest ("Skipped because introspection libdispatch dylib is not present.")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
-
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
- self.assertTrue(break1, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, ['DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib', 'DYLD_LIBRARY_PATH=/usr/lib/system/introspection'], self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
- if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
-
- libbtr_module_filespec = lldb.SBFileSpec("libBacktraceRecording.dylib")
- libbtr_module = target.FindModule (libbtr_module_filespec)
- if not libbtr_module.IsValid():
- self.skipTest ("Skipped because libBacktraceRecording.dylib was not loaded into the process.")
-
- self.assertTrue(process.GetNumQueues() >= 4, "Found the correct number of queues.")
-
- queue_submittor_1 = lldb.SBQueue()
- queue_performer_1 = lldb.SBQueue()
- queue_performer_2 = lldb.SBQueue()
- queue_performer_3 = lldb.SBQueue()
- for idx in range (0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(), "Got all four expected queues: %s %s %s %s" % (queue_submittor_1.IsValid(), queue_performer_1.IsValid(), queue_performer_2.IsValid(), queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id (queue_submittor_1)
- self.check_queue_for_valid_queue_id (queue_performer_1)
- self.check_queue_for_valid_queue_id (queue_performer_2)
- self.check_queue_for_valid_queue_id (queue_performer_3)
-
- self.check_running_and_pending_items_on_queue (queue_submittor_1, 1, 0)
- self.check_running_and_pending_items_on_queue (queue_performer_1, 1, 3)
- self.check_running_and_pending_items_on_queue (queue_performer_2, 1, 9999)
- self.check_running_and_pending_items_on_queue (queue_performer_3, 4, 0)
-
- self.check_number_of_threads_owned_by_queue (queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_3, 4)
-
- self.check_queue_kind (queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_3, lldb.eQueueKindConcurrent)
-
-
- self.check_queues_threads_match_queue (queue_submittor_1)
- self.check_queues_threads_match_queue (queue_performer_1)
- self.check_queues_threads_match_queue (queue_performer_2)
- self.check_queues_threads_match_queue (queue_performer_3)
-
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).IsValid(), "queue 2's pending item #0 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol().GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(queue_performer_2.GetNumPendingItems() == 9999, "verify that queue 2 still has 9999 pending items")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).IsValid(), "queue 2's pending item #9998 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol().GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
Removed: lldb/trunk/test/macosx/queues/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/queues/main.c (original)
+++ lldb/trunk/test/macosx/queues/main.c (removed)
@@ -1,133 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <dispatch/dispatch.h>
-#include <pthread.h>
-
-void
-doing_the_work_1(void *in)
-{
- while (1)
- sleep (1);
-}
-
-void
-submit_work_1a(void *in)
-{
- dispatch_queue_t *work_performer_1 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
-}
-
-void
-submit_work_1b(void *in)
-{
- dispatch_queue_t *work_performer_1 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- while (1)
- sleep (1);
-}
-
-void
-doing_the_work_2(void *in)
-{
- while (1)
- sleep (1);
-}
-
-void
-submit_work_2(void *in)
-{
- dispatch_queue_t *work_performer_2 = (dispatch_queue_t*) in;
- int i = 0;
- while (i++ < 5000)
- {
- dispatch_async_f (*work_performer_2, NULL, doing_the_work_2);
- dispatch_async_f (*work_performer_2, NULL, doing_the_work_2);
- }
-}
-
-
-void
-doing_the_work_3(void *in)
-{
- while (1)
- sleep(1);
-}
-
-void
-submit_work_3(void *in)
-{
- dispatch_queue_t *work_performer_3 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
-}
-
-
-void
-stopper ()
-{
- while (1)
- sleep (1);
-}
-
-int main ()
-{
- dispatch_queue_t work_submittor_1 = dispatch_queue_create ("com.apple.work_submittor_1", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_submittor_2 = dispatch_queue_create ("com.apple.work_submittor_and_quit_2", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_submittor_3 = dispatch_queue_create ("com.apple.work_submittor_3", DISPATCH_QUEUE_SERIAL);
-
- dispatch_queue_t work_performer_1 = dispatch_queue_create ("com.apple.work_performer_1", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_performer_2 = dispatch_queue_create ("com.apple.work_performer_2", DISPATCH_QUEUE_SERIAL);
-
- dispatch_queue_t work_performer_3 = dispatch_queue_create ("com.apple.work_performer_3", DISPATCH_QUEUE_CONCURRENT);
-
- dispatch_async_f (work_submittor_1, (void*) &work_performer_1, submit_work_1a);
- dispatch_async_f (work_submittor_1, (void*) &work_performer_1, submit_work_1b);
-
- dispatch_async_f (work_submittor_2, (void*) &work_performer_2, submit_work_2);
-
- dispatch_async_f (work_submittor_3, (void*) &work_performer_3, submit_work_3);
-
-
- // Spin up threads with each of the different libdispatch QoS values.
-
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
- pthread_setname_np ("user initiated QoS");
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- pthread_setname_np ("user interactive QoS");
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
- pthread_setname_np ("default QoS");
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
- pthread_setname_np ("utility QoS");
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
- pthread_setname_np ("background QoS");
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0), ^{
- pthread_setname_np ("unspecified QoS");
- while (1)
- sleep (10);
- });
-
-
- sleep (1);
- stopper ();
-
-}
-
Removed: lldb/trunk/test/macosx/safe-to-func-call/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/safe-to-func-call/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/safe-to-func-call/Makefile (original)
+++ lldb/trunk/test/macosx/safe-to-func-call/Makefile (removed)
@@ -1,28 +0,0 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
- OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
-endif
-
-all: a.out
-
-a.out: main.o
- $(CC) $(CFLAGS) -o a.out main.o
-
-main.o: main.c
- $(CC) $(CFLAGS) -c main.c
-
-clean:
- rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
Removed: lldb/trunk/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/safe-to-func-call/TestSafeFuncCalls.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/safe-to-func-call/TestSafeFuncCalls.py (original)
+++ lldb/trunk/test/macosx/safe-to-func-call/TestSafeFuncCalls.py (removed)
@@ -1,63 +0,0 @@
-"""Test function call thread safety."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-import lldbutil
-from lldbtest import *
-
-class TestSafeFuncCalls(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers that we will step to in main:
- self.main_source = "main.c"
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api(self):
- """Test function call thread safety."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
- self.assertTrue(break1, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
- if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
-
- self.check_number_of_threads(process)
-
- main_thread = lldb.SBThread()
- select_thread = lldb.SBThread()
- for idx in range (0, process.GetNumThreads()):
- t = process.GetThreadAtIndex (idx)
- if t.GetName() == "main thread":
- main_thread = t
- if t.GetName() == "select thread":
- select_thread = t
-
- self.assertTrue(main_thread.IsValid() and select_thread.IsValid(), "Got both expected threads")
-
- self.safe_to_call_func_on_main_thread (main_thread)
- self.safe_to_call_func_on_select_thread (select_thread)
-
- def check_number_of_threads(self, process):
- self.assertTrue(process.GetNumThreads() == 2, "Check that the process has two threads when sitting at the stopper() breakpoint")
-
- def safe_to_call_func_on_main_thread (self, main_thread):
- self.assertTrue(main_thread.SafeToCallFunctions() == True, "It is safe to call functions on the main thread")
-
- def safe_to_call_func_on_select_thread (self, select_thread):
- self.assertTrue(select_thread.SafeToCallFunctions() == False, "It is not safe to call functions on the select thread")
Removed: lldb/trunk/test/macosx/safe-to-func-call/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/safe-to-func-call/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/safe-to-func-call/main.c (original)
+++ lldb/trunk/test/macosx/safe-to-func-call/main.c (removed)
@@ -1,30 +0,0 @@
-#include <sys/select.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
-
-void *
-select_thread (void *in)
-{
- pthread_setname_np ("select thread");
- fd_set fdset;
- FD_SET (STDIN_FILENO, &fdset);
- while (1)
- select (2, &fdset, NULL, NULL, NULL);
- return NULL;
-}
-
-void stopper ()
-{
- while (1)
- sleep(1); // break here
-}
-
-int main ()
-{
- pthread_setname_np ("main thread");
- pthread_t other_thread;
- pthread_create (&other_thread, NULL, select_thread, NULL);
- sleep (1);
- stopper();
-}
Removed: lldb/trunk/test/macosx/universal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/universal/Makefile (original)
+++ lldb/trunk/test/macosx/universal/Makefile (removed)
@@ -1,19 +0,0 @@
-CC ?= clang
-
-testit: testit.i386 testit.x86_64
- lipo -create -o testit testit.i386 testit.x86_64
-
-testit.i386: testit.i386.o
- $(CC) -arch i386 -o testit.i386 testit.i386.o
-
-testit.x86_64: testit.x86_64.o
- $(CC) -arch x86_64 -o testit.x86_64 testit.x86_64.o
-
-testit.i386.o: main.c
- $(CC) -g -O0 -arch i386 -c -o testit.i386.o main.c
-
-testit.x86_64.o: main.c
- $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o main.c
-
-clean:
- rm -rf $(wildcard testit* *~)
Removed: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py (removed)
@@ -1,107 +0,0 @@
-"""Test aspects of lldb commands on universal binaries."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import os, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class UniversalTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number('main.c', '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- @skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
- "requires i386 or x86_64")
- def test_sbdebugger_create_target_with_file_and_target_triple(self):
- """Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
- # Invoke the default build rule.
- self.build()
-
- # Note that "testit" is a universal binary.
- exe = os.path.join(os.getcwd(), "testit")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple(exe, "i386-apple-macosx")
- self.assertTrue(target, VALID_TARGET)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- @skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
- "requires i386 or x86_64")
- def test_process_launch_for_universal(self):
- """Test process launch of a universal binary."""
- from lldbutil import print_registers
-
- # Invoke the default build rule.
- self.build()
-
- # Note that "testit" is a universal binary.
- exe = os.path.join(os.getcwd(), "testit")
-
- # By default, x86_64 is assumed if no architecture is specified.
- self.expect("file " + exe, CURRENT_EXECUTABLE_SET,
- startstr = "Current executable set to ",
- substrs = ["testit' (x86_64)."])
-
- # Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
- # We should be able to launch the x86_64 executable.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Check whether we have a 64-bit process launched.
- target = self.dbg.GetSelectedTarget()
- process = target.GetProcess()
- self.assertTrue(target and process and
- self.invoke(process, 'GetAddressByteSize') == 8,
- "64-bit process launched")
-
- frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
- registers = print_registers(frame, string_buffer=True)
- self.expect(registers, exe=False,
- substrs = ['Name: rax'])
-
- self.runCmd("continue")
-
- # Now specify i386 as the architecture for "testit".
- self.expect("file -a i386 " + exe, CURRENT_EXECUTABLE_SET,
- startstr = "Current executable set to ",
- substrs = ["testit' (i386)."])
-
- # Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
- # We should be able to launch the i386 executable as well.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Check whether we have a 32-bit process launched.
- target = self.dbg.GetSelectedTarget()
- process = target.GetProcess()
- self.assertTrue(target and process,
- "32-bit process launched")
-
- pointerSize = self.invoke(process, 'GetAddressByteSize')
- self.assertTrue(pointerSize == 4,
- "AddressByteSize of 32-bit process should be 4, got %d instead." % pointerSize)
-
- frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
- registers = print_registers(frame, string_buffer=True)
- self.expect(registers, exe=False,
- substrs = ['Name: eax'])
-
- self.runCmd("continue")
Removed: lldb/trunk/test/macosx/universal/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/macosx/universal/main.c (original)
+++ lldb/trunk/test/macosx/universal/main.c (removed)
@@ -1,7 +0,0 @@
-#include <stdio.h>
-int
-main (int argc, char **argv)
-{
- printf ("Hello there!\n"); // Set break point at this line.
- return 0;
-}
Removed: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules (removed)
@@ -1,585 +0,0 @@
-#----------------------------------------------------------------------
-# Clients fill in the source files to build
-#----------------------------------------------------------------------
-# C_SOURCES := main.c
-# CXX_SOURCES :=
-# OBJC_SOURCES :=
-# OBJCXX_SOURCES :=
-# DYLIB_C_SOURCES :=
-# DYLIB_CXX_SOURCES :=
-#
-# Specifying DYLIB_ONLY has the effect of building dylib only, skipping
-# the building of the a.out executable program. For example,
-# DYLIB_ONLY := YES
-#
-# Also might be of interest:
-# FRAMEWORK_INCLUDES (Darwin only) :=
-# CFLAGS_EXTRAS :=
-# LD_EXTRAS :=
-# SPLIT_DEBUG_SYMBOLS := YES
-# CROSS_COMPILE :=
-#
-# And test/functionalities/archives/Makefile:
-# MAKE_DSYM := NO
-# ARCHIVE_NAME := libfoo.a
-# ARCHIVE_C_SOURCES := a.c b.c
-
-# Uncomment line below for debugging shell commands
-# SHELL = /bin/sh -x
-
-THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
-LLDB_BASE_DIR := $(THIS_FILE_DIR)../../
-
-
-#----------------------------------------------------------------------
-# If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
-# from the triple alone
-#----------------------------------------------------------------------
-TRIPLE_CFLAGS :=
-ifneq "$(TRIPLE)" ""
- triple_space = $(subst -, ,$(TRIPLE))
- ARCH =$(word 1, $(triple_space))
- TRIPLE_VENDOR =$(word 2, $(triple_space))
- triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed -e 's/\(.*\)\([0-9]\.[0-9]\).*/\1 \2/')
- TRIPLE_OS =$(word 1, $(triple_os_and_version))
- TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
- ifeq "$(TRIPLE_VENDOR)" "apple"
- ifeq "$(TRIPLE_OS)" "ios"
- ifeq "$(SDKROOT)" ""
- # Set SDKROOT if it wasn't set
- ifneq (,$(findstring arm,$(ARCH)))
- SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path)
- ifeq "$(TRIPLE_VERSION)" ""
- TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
- endif
- TRIPLE_CFLAGS :=-mios-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
- else
- SDKROOT = $(shell xcrun --sdk iphonesimulator --show-sdk-path)
- ifeq "$(TRIPLE_VERSION)" ""
- TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
- endif
- TRIPLE_CFLAGS :=-mios-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
- endif
- endif
- endif
- endif
-endif
-
-#----------------------------------------------------------------------
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# uname on Windows gives "windows32", but most environments standardize
-# on "Windows_NT", so we'll make it consistent here. When running
-# tests from Visual Studio, the environment variable isn't inherited
-# all the way down to the process spawned for make.
-#----------------------------------------------------------------------
-HOST_OS = $(shell uname -s)
-ifeq "$(HOST_OS)" "windows32"
- HOST_OS = Windows_NT
-endif
-ifeq "$(OS)" ""
- OS = $(HOST_OS)
-endif
-
-#----------------------------------------------------------------------
-# If ARCH is not defined, default to x86_64.
-#----------------------------------------------------------------------
-ifeq "$(ARCH)" ""
-ifeq "$(OS)" "Windows_NT"
- ARCH = x86
-else
- ARCH = x86_64
-endif
-endif
-
-#----------------------------------------------------------------------
-# CC defaults to clang.
-#
-# If you change the defaults of CC, be sure to also change it in the file
-# test/plugins/builder_base.py, which provides a Python way to return the
-# value of the make variable CC -- getCompiler().
-#
-# See also these functions:
-# o cxx_compiler
-# o cxx_linker
-#----------------------------------------------------------------------
-CC ?= clang
-ifeq "$(CC)" "cc"
- ifneq "$(shell which clang)" ""
- CC = clang
- else ifneq "$(shell which clang-3.5)" ""
- CC = clang-3.5
- else ifneq "$(shell which gcc)" ""
- CC = gcc
- endif
-endif
-
-#----------------------------------------------------------------------
-# ARCHFLAG is the flag used to tell the compiler which architecture
-# to compile for. The default is the flag that clang accepts.
-#----------------------------------------------------------------------
-ARCHFLAG ?= -arch
-
-#----------------------------------------------------------------------
-# Change any build/tool options needed
-#----------------------------------------------------------------------
-ifeq "$(OS)" "Darwin"
- DS := $(shell xcrun -find -toolchain default dsymutil)
- DSFLAGS =
- DSYM = $(EXE).dSYM
- AR := $(CROSS_COMPILE)libtool
- ARFLAGS := -static -o
-else
- AR := $(CROSS_COMPILE)ar
- # On non-Apple platforms, -arch becomes -m
- ARCHFLAG := -m
-
- # i386, i686, x86 -> 32
- # amd64, x86_64, x64 -> 64
- ifeq "$(ARCH)" "amd64"
- override ARCH := $(subst amd64,64,$(ARCH))
- endif
- ifeq "$(ARCH)" "x86_64"
- override ARCH := $(subst x86_64,64,$(ARCH))
- endif
- ifeq "$(ARCH)" "x64"
- override ARCH := $(subst x64,64,$(ARCH))
- endif
- ifeq "$(ARCH)" "x86"
- override ARCH := $(subst x86,32,$(ARCH))
- endif
- ifeq "$(ARCH)" "i386"
- override ARCH := $(subst i386,32,$(ARCH))
- endif
- ifeq "$(ARCH)" "i686"
- override ARCH := $(subst i686,32,$(ARCH))
- endif
- ifeq "$(ARCH)" "powerpc"
- override ARCH := $(subst powerpc,32,$(ARCH))
- endif
- ifeq "$(ARCH)" "powerpc64"
- override ARCH := $(subst powerpc64,64,$(ARCH))
- endif
- ifeq "$(ARCH)" "aarch64"
- override ARCH :=
- override ARCHFLAG :=
- endif
-
- ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
- DSYM = $(EXE).debug
- endif
-endif
-
-LIMIT_DEBUG_INFO_FLAGS =
-ifneq (,$(findstring clang,$(CC)))
- LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
-endif
-
-CFLAGS ?= -g -O0 -fno-builtin
-ifeq "$(OS)" "Darwin"
- CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
-else
- CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
-endif
-CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS)
-
-# Use this one if you want to build one part of the result without debug information:
-ifeq "$(OS)" "Darwin"
- CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS)
-else
- CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS)
-endif
-
-ifeq "$(MAKE_DWO)" "YES"
- CFLAGS += -gsplit-dwarf
-endif
-
-CXXFLAGS += -std=c++11
-CXXFLAGS += $(CFLAGS)
-LD = $(CC)
-LDFLAGS ?= $(CFLAGS)
-LDFLAGS += $(LD_EXTRAS)
-ifeq (,$(filter $(OS), Windows_NT Android))
- ifneq (,$(filter YES,$(ENABLE_THREADS) $(ENABLE_STD_THREADS)))
- LDFLAGS += -pthread
- endif
-endif
-OBJECTS =
-EXE ?= a.out
-
-ifneq "$(DYLIB_NAME)" ""
- ifeq "$(OS)" "Darwin"
- DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
- DYLIB_EXECUTABLE_PATH ?= @executable_path
- else ifeq "$(OS)" "Windows_NT"
- DYLIB_FILENAME = $(DYLIB_NAME).dll
- else
- DYLIB_FILENAME = lib$(DYLIB_NAME).so
- endif
-endif
-
-# Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
- $(subst icc,icpc,$(1)), \
- $(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
- $(subst gcc,g++,$(1)), \
- $(subst cc,c++,$(1))))))
-cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1)))
-
-# Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
- $(subst icc,icpc,$(1)), \
- $(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
- $(subst gcc,g++,$(1)), \
- $(subst cc,c++,$(1))))))
-cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1)))
-
-OBJCOPY := $(CROSS_COMPILE)objcopy
-
-#----------------------------------------------------------------------
-# Windows specific options
-#----------------------------------------------------------------------
-ifeq "$(OS)" "Windows_NT"
- ifneq (,$(findstring clang,$(CC)))
- # Clang for Windows doesn't support C++ Exceptions
- CXXFLAGS += -fno-exceptions
- CXXFLAGS += -D_HAS_EXCEPTIONS=0
- # The MSVC linker doesn't understand long section names
- # generated by the clang compiler.
- LDFLAGS += -fuse-ld=lld
- endif
-endif
-
-#----------------------------------------------------------------------
-# Android specific options
-#----------------------------------------------------------------------
-ifeq "$(OS)" "Android"
- ifdef PIE
- LDFLAGS += -pie
- endif
- replace_with = $(if $(findstring clang,$(1)), \
- $(subst clang,$(2),$(1)), \
- $(if $(findstring gcc,$(1)), \
- $(subst gcc,$(2),$(1)), \
- $(subst cc,$(2),$(1))))
- ifeq "$(notdir $(CC))" "$(CC)"
- replace_cc_with = $(call replace_with,$(CC),$(1))
- else
- replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir $(CC)),$(1)))
- endif
- OBJCOPY = $(call replace_cc_with,objcopy)
- AR = $(call replace_cc_with,ar)
-endif
-
-#----------------------------------------------------------------------
-# C++ standard library options
-#----------------------------------------------------------------------
-ifeq (1,$(USE_LIBSTDCPP))
- # Clang requires an extra flag: -stdlib=libstdc++
- ifneq (,$(findstring clang,$(CC)))
- CXXFLAGS += -stdlib=libstdc++
- LDFLAGS += -stdlib=libstdc++
- endif
-endif
-
-ifeq (1,$(USE_LIBCPP))
- # Clang requires an extra flag: -stdlib=libstdc++
- ifneq (,$(findstring clang,$(CC)))
- ifeq "$(OS)" "Linux"
- # This is the default install location on Ubuntu 14.04
- ifneq ($(wildcard /usr/include/c++/v1/.),)
- CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
- LDFLAGS += -stdlib=libc++
- CXXFLAGS += -I/usr/include/c++/v1
- endif
- else
- CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
- LDFLAGS += -stdlib=libc++
- endif
- endif
-endif
-
-#----------------------------------------------------------------------
-# dylib settings
-#----------------------------------------------------------------------
-ifneq "$(strip $(DYLIB_C_SOURCES))" ""
- DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o))
-endif
-
-ifneq "$(strip $(DYLIB_OBJC_SOURCES))" ""
- DYLIB_OBJECTS +=$(strip $(DYLIB_OBJC_SOURCES:.m=.o))
-endif
-
-ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
- DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
- CXX = $(call cxx_compiler,$(CC))
- LD = $(call cxx_linker,$(CC))
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any C source files
-#----------------------------------------------------------------------
-ifneq "$(strip $(C_SOURCES))" ""
- OBJECTS +=$(strip $(C_SOURCES:.c=.o))
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any C++ source files
-#----------------------------------------------------------------------
-ifneq "$(strip $(CXX_SOURCES))" ""
- OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
- CXX = $(call cxx_compiler,$(CC))
- LD = $(call cxx_linker,$(CC))
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any ObjC source files
-#----------------------------------------------------------------------
-ifneq "$(strip $(OBJC_SOURCES))" ""
- OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
- LDFLAGS +=-lobjc
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any ObjC++ source files
-#----------------------------------------------------------------------
-ifneq "$(strip $(OBJCXX_SOURCES))" ""
- OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
- CXX = $(call cxx_compiler,$(CC))
- LD = $(call cxx_linker,$(CC))
- ifeq "$(findstring lobjc,$(LDFLAGS))" ""
- LDFLAGS +=-lobjc
- endif
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any C source files for archive
-#----------------------------------------------------------------------
-ifneq "$(strip $(ARCHIVE_C_SOURCES))" ""
- ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_C_SOURCES:.c=.o))
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any C++ source files for archive
-#----------------------------------------------------------------------
-ifneq "$(strip $(ARCHIVE_CXX_SOURCES))" ""
- ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_CXX_SOURCES:.cpp=.o))
- CXX = $(call cxx_compiler,$(CC))
- LD = $(call cxx_linker,$(CC))
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any ObjC source files for archive
-#----------------------------------------------------------------------
-ifneq "$(strip $(ARCHIVE_OBJC_SOURCES))" ""
- ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJC_SOURCES:.m=.o))
- LDFLAGS +=-lobjc
-endif
-
-#----------------------------------------------------------------------
-# Check if we have any ObjC++ source files for archive
-#----------------------------------------------------------------------
-ifneq "$(strip $(ARCHIVE_OBJCXX_SOURCES))" ""
- ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJCXX_SOURCES:.mm=.o))
- CXX = $(call cxx_compiler,$(CC))
- LD = $(call cxx_linker,$(CC))
- ifeq "$(findstring lobjc,$(LDFLAGS))" ""
- LDFLAGS +=-lobjc
- endif
-endif
-
-#----------------------------------------------------------------------
-# Check if we are compiling with gcc 4.6
-#----------------------------------------------------------------------
-ifneq "$(strip $(CXX_SOURCES) $(OBJCXX_SOURCES))" ""
-ifneq "$(filter g++,$(CXX))" ""
- CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3)
- ifeq "$(CXXVERSION)" "4.6"
- # GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
- # instead. FIXME: remove once GCC version is upgraded.
- override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
- endif
-endif
-endif
-
-#----------------------------------------------------------------------
-# DYLIB_ONLY variable can be used to skip the building of a.out.
-# See the sections below regarding dSYM file as well as the building of
-# EXE from all the objects.
-#----------------------------------------------------------------------
-
-#----------------------------------------------------------------------
-# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
-#----------------------------------------------------------------------
-ifneq "$(DYLIB_ONLY)" "YES"
-$(DSYM) : $(EXE)
-ifeq "$(OS)" "Darwin"
-ifneq "$(MAKE_DSYM)" "NO"
- "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
-endif
-else
-ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
- $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
- $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
-endif
-endif
-endif
-
-#----------------------------------------------------------------------
-# Compile the executable from all the objects.
-#----------------------------------------------------------------------
-ifneq "$(DYLIB_NAME)" ""
-ifeq "$(DYLIB_ONLY)" ""
-$(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME)
- $(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o "$(EXE)"
-else
-EXE = $(DYLIB_FILENAME)
-endif
-else
-$(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
- $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
-endif
-
-#----------------------------------------------------------------------
-# Make the archive
-#----------------------------------------------------------------------
-ifneq "$(ARCHIVE_NAME)" ""
-ifeq "$(OS)" "Darwin"
-$(ARCHIVE_NAME) : $(ARCHIVE_OBJECTS)
- $(AR) $(ARFLAGS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
- $(RM) $(ARCHIVE_OBJECTS)
-else
-$(ARCHIVE_NAME) : $(foreach ar_obj,$(ARCHIVE_OBJECTS),$(ARCHIVE_NAME)($(ar_obj)))
-endif
-endif
-
-#----------------------------------------------------------------------
-# Make the dylib
-#----------------------------------------------------------------------
-$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
-
-$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
-ifeq "$(OS)" "Darwin"
- $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
-ifneq "$(MAKE_DSYM)" "NO"
-ifneq "$(DS)" ""
- "$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)"
-endif
-endif
-else
- $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
-ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
- $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
- $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
-endif
-endif
-
-#----------------------------------------------------------------------
-# Automatic variables based on items already entered. Below we create
-# an object's lists from the list of sources by replacing all entries
-# that end with .c with .o, and we also create a list of prerequisite
-# files by replacing all .c files with .d.
-#----------------------------------------------------------------------
-PREREQS := $(OBJECTS:.o=.d)
-DWOS := $(OBJECTS:.o=.dwo) $(ARCHIVE_OBJECTS:.o=.dwo)
-ifneq "$(DYLIB_NAME)" ""
- DYLIB_PREREQS := $(DYLIB_OBJECTS:.o=.d)
- DYLIB_DWOS := $(DYLIB_OBJECTS:.o=.dwo)
-endif
-
-#----------------------------------------------------------------------
-# Rule for Generating Prerequisites Automatically using .d files and
-# the compiler -MM option. The -M option will list all system headers,
-# and the -MM option will list all non-system dependencies.
-#----------------------------------------------------------------------
-ifeq "$(HOST_OS)" "Windows_NT"
- JOIN_CMD = &
- QUOTE = "
-else
- JOIN_CMD = ;
- QUOTE = '
-endif
-
-%.d: %.c
- @rm -f $@ $(JOIN_CMD) \
- $(CC) -M $(CFLAGS) $< > $@.tmp && \
- sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
- rm -f $@.tmp
-
-%.d: %.cpp
- @rm -f $@ $(JOIN_CMD) \
- $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
- sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
- rm -f $@.tmp
-
-%.d: %.m
- @rm -f $@ $(JOIN_CMD) \
- $(CC) -M $(CFLAGS) $< > $@.tmp && \
- sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
- rm -f $@.tmp
-
-%.d: %.mm
- @rm -f $@ $(JOIN_CMD) \
- $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
- sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
- rm -f $@.tmp
-
-#----------------------------------------------------------------------
-# Include all of the makefiles for each source file so we don't have
-# to manually track all of the prerequisites for each source file.
-#----------------------------------------------------------------------
-sinclude $(PREREQS)
-ifneq "$(DYLIB_NAME)" ""
- sinclude $(DYLIB_PREREQS)
-endif
-
-# Define a suffix rule for .mm -> .o
-.SUFFIXES: .mm .o
-.mm.o:
- $(CXX) $(CXXFLAGS) -c $<
-
-.PHONY: clean
-dsym: $(DSYM)
-all: $(EXE) $(DSYM)
-clean::
- $(RM) $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
-ifneq "$(DYLIB_NAME)" ""
- $(RM) -r $(DYLIB_FILENAME).dSYM
- $(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug
-endif
-ifneq "$(DSYM)" ""
- $(RM) -r "$(DSYM)"
-endif
-ifeq "$(OS)" "Windows_NT"
-# http://llvm.org/pr24589
- IF EXIST "$(EXE)" del "$(EXE)"
- $(RM) $(wildcard *.manifest *.pdb *.ilk)
-ifneq "$(DYLIB_NAME)" ""
- $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp
-endif
-else
- $(RM) "$(EXE)"
-endif
-
-#----------------------------------------------------------------------
-# From http://blog.melski.net/tag/debugging-makefiles/
-#
-# Usage: make print-CC print-CXX print-LD
-#----------------------------------------------------------------------
-print-%:
- @echo '$*=$($*)'
- @echo ' origin = $(origin $*)'
- @echo ' flavor = $(flavor $*)'
- @echo ' value = $(value $*)'
-
-### Local Variables: ###
-### mode:makefile ###
-### End: ###
Removed: lldb/trunk/test/make/test_common.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/test_common.h?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/make/test_common.h (original)
+++ lldb/trunk/test/make/test_common.h (removed)
@@ -1,19 +0,0 @@
-// This header is included in all the test programs (C and C++) and provides a
-// hook for dealing with platform-specifics.
-#if defined(_WIN32) || defined(_WIN64)
-#ifdef COMPILING_LLDB_TEST_DLL
-#define LLDB_TEST_API __declspec(dllexport)
-#else
-#define LLDB_TEST_API __declspec(dllimport)
-#endif
-#else
-#define LLDB_TEST_API
-#endif
-
-#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
-// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all
-// calls to __uncaught_exception. Unfortunately, it does seem to eliminate
-// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is
-// declared. This may not be necessary after MSVC 12.
-#include <eh.h>
-#endif
Removed: lldb/trunk/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_base.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/plugins/builder_base.py (original)
+++ lldb/trunk/test/plugins/builder_base.py (removed)
@@ -1,137 +0,0 @@
-"""
-If the build* function is passed the compiler argument, for example, 'llvm-gcc',
-it is passed as a make variable to the make command. Otherwise, we check the
-LLDB_CC environment variable; if it is defined, it is passed as a make variable
-to the make command.
-
-If neither the compiler keyword argument nor the LLDB_CC environment variable is
-specified, no CC make variable is passed to the make command. The Makefile gets
-to define the default CC being used.
-
-Same idea holds for LLDB_ARCH environment variable, which maps to the ARCH make
-variable.
-"""
-
-import os, sys
-import platform
-import lldbtest
-
-def getArchitecture():
- """Returns the architecture in effect the test suite is running with."""
- return os.environ["ARCH"] if "ARCH" in os.environ else ""
-
-def getCompiler():
- """Returns the compiler in effect the test suite is running with."""
- return os.environ["CC"] if "CC" in os.environ else "clang"
-
-def getArchFlag():
- """Returns the flag required to specify the arch"""
- compiler = getCompiler()
- if compiler is None:
- return ""
- elif "gcc" in compiler:
- archflag = "-m"
- elif "clang" in compiler:
- archflag = "-arch"
- else:
- archflag = None
-
- return ("ARCHFLAG=" + archflag) if archflag else ""
-
-def getMake():
- """Returns the name for GNU make"""
- if platform.system() == "FreeBSD":
- return "gmake"
- else:
- return "make"
-
-def getArchSpec(architecture):
- """
- Helper function to return the key-value string to specify the architecture
- used for the make system.
- """
- arch = architecture if architecture else None
- if not arch and "ARCH" in os.environ:
- arch = os.environ["ARCH"]
-
- return ("ARCH=" + arch) if arch else ""
-
-def getCCSpec(compiler):
- """
- Helper function to return the key-value string to specify the compiler
- used for the make system.
- """
- cc = compiler if compiler else None
- if not cc and "CC" in os.environ:
- cc = os.environ["CC"]
- if cc:
- return "CC=\"%s\"" % cc
- else:
- return ""
-
-def getCmdLine(d):
- """
- Helper function to return a properly formatted command line argument(s)
- string used for the make system.
- """
-
- # If d is None or an empty mapping, just return an empty string.
- if not d:
- return ""
- pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'"
-
- def setOrAppendVariable(k, v):
- append_vars = ["CFLAGS_EXTRAS", "LD_EXTRAS"]
- if k in append_vars and k in os.environ:
- v = os.environ[k] + " " + v
- return pattern % (k, v)
- cmdline = " ".join([setOrAppendVariable(k, v) for k, v in list(d.items())])
-
- return cmdline
-
-
-def buildDefault(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- """Build the binaries the default way."""
- commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
-
- lldbtest.system(commands, sender=sender)
-
- # True signifies that we can handle building default.
- return True
-
-def buildDwarf(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- """Build the binaries with dwarf debug info."""
- commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
-
- lldbtest.system(commands, sender=sender)
- # True signifies that we can handle building dwarf.
- return True
-
-def buildDwo(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- """Build the binaries with dwarf debug info."""
- commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
-
- lldbtest.system(commands, sender=sender)
- # True signifies that we can handle building dwo.
- return True
-
-def cleanup(sender=None, dictionary=None):
- """Perform a platform-specific cleanup after the test."""
- #import traceback
- #traceback.print_stack()
- commands = []
- if os.path.isfile("Makefile"):
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
-
- lldbtest.system(commands, sender=sender)
- # True signifies that we can handle cleanup.
- return True
Removed: lldb/trunk/test/plugins/builder_darwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_darwin.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/plugins/builder_darwin.py (original)
+++ lldb/trunk/test/plugins/builder_darwin.py (removed)
@@ -1,21 +0,0 @@
-
-from __future__ import print_function
-import os
-import lldbtest
-
-from builder_base import *
-
-#print("Hello, darwin plugin!")
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- """Build the binaries with dsym debug info."""
- commands = []
-
- if clean:
- commands.append(["make", "clean", getCmdLine(dictionary)])
- commands.append(["make", "MAKE_DSYM=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
-
- lldbtest.system(commands, sender=sender)
-
- # True signifies that we can handle building dsym.
- return True
Removed: lldb/trunk/test/plugins/builder_freebsd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_freebsd.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/plugins/builder_freebsd.py (original)
+++ lldb/trunk/test/plugins/builder_freebsd.py (removed)
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- return False
Removed: lldb/trunk/test/plugins/builder_linux2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_linux2.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/plugins/builder_linux2.py (original)
+++ lldb/trunk/test/plugins/builder_linux2.py (removed)
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- return False
Removed: lldb/trunk/test/plugins/builder_win32.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_win32.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/plugins/builder_win32.py (original)
+++ lldb/trunk/test/plugins/builder_win32.py (removed)
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- return False
Removed: lldb/trunk/test/python_api/.categories
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/.categories?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/.categories (original)
+++ lldb/trunk/test/python_api/.categories (removed)
@@ -1 +0,0 @@
-pyapi
Removed: lldb/trunk/test/python_api/breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/breakpoint/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/breakpoint/Makefile (original)
+++ lldb/trunk/test/python_api/breakpoint/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/breakpoint/TestBreakpointAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/breakpoint/TestBreakpointAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/breakpoint/TestBreakpointAPI.py (original)
+++ lldb/trunk/test/python_api/breakpoint/TestBreakpointAPI.py (removed)
@@ -1,44 +0,0 @@
-"""
-Test SBBreakpoint APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class BreakpointAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_breakpoint_is_valid(self):
- """Make sure that if an SBBreakpoint gets deleted its IsValid returns false."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'AFunction'.
- breakpoint = target.BreakpointCreateByName('AFunction', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now delete it:
- did_delete = target.BreakpointDelete(breakpoint.GetID())
- self.assertTrue (did_delete, "Did delete the breakpoint we just created.")
-
- # Make sure we can't find it:
- del_bkpt = target.FindBreakpointByID (breakpoint.GetID())
- self.assertTrue (not del_bkpt, "We did delete the breakpoint.")
-
- # Finally make sure the original breakpoint is no longer valid.
- self.assertTrue (not breakpoint, "Breakpoint we deleted is no longer valid.")
Removed: lldb/trunk/test/python_api/breakpoint/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/breakpoint/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/breakpoint/main.c (original)
+++ lldb/trunk/test/python_api/breakpoint/main.c (removed)
@@ -1,14 +0,0 @@
-#include <stdio.h>
-
-void
-AFunction()
-{
- printf ("I am a function.\n");
-}
-
-int
-main ()
-{
- AFunction();
- return 0;
-}
Removed: lldb/trunk/test/python_api/class_members/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/class_members/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/class_members/Makefile (original)
+++ lldb/trunk/test/python_api/class_members/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-OBJCXX_SOURCES := main.mm
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/class_members/TestSBTypeClassMembers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/class_members/TestSBTypeClassMembers.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/class_members/TestSBTypeClassMembers.py (original)
+++ lldb/trunk/test/python_api/class_members/TestSBTypeClassMembers.py (removed)
@@ -1,76 +0,0 @@
-"""
-Test SBType APIs to fetch member function types.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class SBTypeMemberFunctionsTest(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # We'll use the test method name as the exe_name.
- self.exe_name = self.testMethodName
- # Find the line number to break at.
- self.source = 'main.mm'
- self.line = line_number(self.source, '// set breakpoint here')
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test(self):
- """Test SBType APIs to fetch member function types."""
- d = {'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
-
- variable = frame0.FindVariable("d")
- Derived = variable.GetType()
- Base = Derived.GetDirectBaseClassAtIndex(0).GetType()
-
- self.assertTrue(Derived.GetNumberOfMemberFunctions() == 2, "Derived declares two methods")
- self.assertTrue(Derived.GetMemberFunctionAtIndex(0).GetType().GetFunctionReturnType().GetName() == "int", "Derived::dImpl returns int")
-
- self.assertTrue(Base.GetNumberOfMemberFunctions() == 4, "Base declares three methods")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetType().GetFunctionArgumentTypes().GetSize() == 3, "Base::sfunc takes three arguments")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetName() == "sfunc", "Base::sfunc not found")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetKind() == lldb.eMemberFunctionKindStaticMethod, "Base::sfunc is a static")
- self.assertTrue(Base.GetMemberFunctionAtIndex(2).GetType().GetFunctionArgumentTypes().GetSize() == 0, "Base::dat takes no arguments")
- self.assertTrue(Base.GetMemberFunctionAtIndex(1).GetType().GetFunctionArgumentTypes().GetTypeAtIndex(1).GetName() == "char", "Base::bar takes a second 'char' argument")
- self.assertTrue(Base.GetMemberFunctionAtIndex(1).GetName() == "bar", "Base::bar not found")
-
- variable = frame0.FindVariable("thingy")
- Thingy = variable.GetType()
-
- self.assertTrue(Thingy.GetNumberOfMemberFunctions() == 2, "Thingy declares two methods")
-
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(0).GetReturnType().GetName() == "id", "Thingy::init returns an id")
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments() == 2, "Thingy::foo takes two arguments")
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(0).GetName() == "int", "Thingy::foo takes an int")
Removed: lldb/trunk/test/python_api/class_members/main.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/class_members/main.mm?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/class_members/main.mm (original)
+++ lldb/trunk/test/python_api/class_members/main.mm (removed)
@@ -1,47 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#import <Foundation/Foundation.h>
-
-class Base {
-public:
- int foo(int x, int y) { return 1; }
- char bar(int x, char y) { return 2; }
- void dat() {}
- static int sfunc(char, int, float) { return 3; }
-};
-
-class Derived: public Base {
-protected:
- int dImpl() { return 1; }
-public:
- float baz(float b) { return b + 1.0; }
-};
-
- at interface Thingy: NSObject {
-}
-- (id)init;
-- (id)fooWithBar: (int)bar andBaz:(id)baz;
- at end
-
- at implementation Thingy {
-}
-- (id)init {
- return (self = [super init]);
-}
-- (id)fooWithBar: (int)bar andBaz:(id)baz {
- return nil;
-}
- at end
-
-int main() {
- Derived d;
- Thingy *thingy = [[Thingy alloc] init];
- return 0; // set breakpoint here
-}
Removed: lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py (original)
+++ lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py (removed)
@@ -1,40 +0,0 @@
-"""
-Test Debugger APIs.
-"""
-
-import os
-import lldb
-from lldbtest import *
-
-
-class DebuggerAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_debugger_api_boundary_condition(self):
- """Exercise SBDebugger APIs with boundary conditions."""
- self.dbg.HandleCommand(None)
- self.dbg.SetDefaultArchitecture(None)
- self.dbg.GetScriptingLanguage(None)
- self.dbg.CreateTarget(None)
- self.dbg.CreateTarget(None, None, None, True, lldb.SBError())
- self.dbg.CreateTargetWithFileAndTargetTriple(None, None)
- self.dbg.CreateTargetWithFileAndArch(None, None)
- self.dbg.FindTargetWithFileAndArch(None, None)
- self.dbg.SetInternalVariable(None, None, None)
- self.dbg.GetInternalVariableValue(None, None)
- # FIXME (filcab): We must first allow for the swig bindings to know if
- # a Python callback is set. (Check python-typemaps.swig)
- #self.dbg.SetLoggingCallback(None)
- self.dbg.SetPrompt(None)
- self.dbg.SetCurrentPlatform(None)
- self.dbg.SetCurrentPlatformSDKRoot(None)
-
- @add_test_categories(['pyapi'])
- def test_debugger_delete_invalid_target(self):
- """SBDebugger.DeleteTarget() should not crash LLDB given and invalid target."""
- target = lldb.SBTarget()
- self.assertFalse(target.IsValid())
- self.dbg.DeleteTarget(target)
Removed: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (removed)
@@ -1,392 +0,0 @@
-"""
-Test lldb Python API object's default constructor and make sure it is invalid
-after initial construction.
-
-There are also some cases of boundary condition testings sprinkled throughout
-the tests where None is passed to SB API which expects (const char *) in the
-C++ API counterpart. Passing None should not crash lldb!
-
-There are three exceptions to the above general rules, though; API objects
-SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects
-after default construction.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class APIDefaultConstructorTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBAddress(self):
- obj = lldb.SBAddress()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_address
- sb_address.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBBlock(self):
- obj = lldb.SBBlock()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_block
- sb_block.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBBreakpoint(self):
- obj = lldb.SBBreakpoint()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_breakpoint
- sb_breakpoint.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBBreakpointLocation(self):
- obj = lldb.SBBreakpointLocation()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_breakpointlocation
- sb_breakpointlocation.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBBroadcaster(self):
- obj = lldb.SBBroadcaster()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_broadcaster
- sb_broadcaster.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBCommandReturnObject(self):
- """SBCommandReturnObject object is valid after default construction."""
- obj = lldb.SBCommandReturnObject()
- if self.TraceOn():
- print(obj)
- self.assertTrue(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBCommunication(self):
- obj = lldb.SBCommunication()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_communication
- sb_communication.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBCompileUnit(self):
- obj = lldb.SBCompileUnit()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_compileunit
- sb_compileunit.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBDebugger(self):
- obj = lldb.SBDebugger()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_debugger
- sb_debugger.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail with 2.0.12 http://llvm.org/pr23488
- def test_SBError(self):
- obj = lldb.SBError()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_error
- sb_error.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBEvent(self):
- obj = lldb.SBEvent()
- # This is just to test that typemap, as defined in lldb.swig, works.
- obj2 = lldb.SBEvent(0, "abc")
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_event
- sb_event.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- def test_SBFileSpec(self):
- obj = lldb.SBFileSpec()
- # This is just to test that FileSpec(None) does not crash.
- obj2 = lldb.SBFileSpec(None, True)
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_filespec
- sb_filespec.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBFrame(self):
- obj = lldb.SBFrame()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_frame
- sb_frame.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBFunction(self):
- obj = lldb.SBFunction()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_function
- sb_function.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBInstruction(self):
- obj = lldb.SBInstruction()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_instruction
- sb_instruction.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBInstructionList(self):
- obj = lldb.SBInstructionList()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_instructionlist
- sb_instructionlist.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBLineEntry(self):
- obj = lldb.SBLineEntry()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_lineentry
- sb_lineentry.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBListener(self):
- obj = lldb.SBListener()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_listener
- sb_listener.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBModule(self):
- obj = lldb.SBModule()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_module
- sb_module.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBProcess(self):
- obj = lldb.SBProcess()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_process
- sb_process.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBSection(self):
- obj = lldb.SBSection()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_section
- sb_section.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBStream(self):
- """SBStream object is valid after default construction."""
- obj = lldb.SBStream()
- if self.TraceOn():
- print(obj)
- self.assertTrue(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBStringList(self):
- obj = lldb.SBStringList()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_stringlist
- sb_stringlist.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBSymbol(self):
- obj = lldb.SBSymbol()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_symbol
- sb_symbol.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBSymbolContext(self):
- obj = lldb.SBSymbolContext()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_symbolcontext
- sb_symbolcontext.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBSymbolContextList(self):
- """SBSymbolContextList object is valid after default construction."""
- obj = lldb.SBSymbolContextList()
- if self.TraceOn():
- print(obj)
- self.assertTrue(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBTarget(self):
- obj = lldb.SBTarget()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_target
- sb_target.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBThread(self):
- obj = lldb.SBThread()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_thread
- sb_thread.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBType(self):
- try:
- obj = lldb.SBType()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # If we reach here, the test fails.
- self.fail("lldb.SBType() should fail, not succeed!")
- except:
- # Exception is expected.
- return
-
- # Unreachable code because lldb.SBType() should fail.
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_type
- sb_type.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBTypeList(self):
- """SBTypeList object is valid after default construction."""
- obj = lldb.SBTypeList()
- if self.TraceOn():
- print(obj)
- self.assertTrue(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBValue(self):
- obj = lldb.SBValue()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_value
- sb_value.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBValueList(self):
- obj = lldb.SBValueList()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_valuelist
- sb_valuelist.fuzz_obj(obj)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_SBWatchpoint(self):
- obj = lldb.SBWatchpoint()
- if self.TraceOn():
- print(obj)
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_watchpoint
- sb_watchpoint.fuzz_obj(obj)
Removed: lldb/trunk/test/python_api/default-constructor/sb_address.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_address.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_address.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_address.py (removed)
@@ -1,22 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetFileAddress()
- obj.GetLoadAddress(lldb.SBTarget())
- obj.SetLoadAddress(0xffff, lldb.SBTarget())
- obj.OffsetAddress(sys.maxsize)
- obj.GetDescription(lldb.SBStream())
- obj.GetSection()
- obj.GetSymbolContext(lldb.eSymbolContextEverything)
- obj.GetModule()
- obj.GetCompileUnit()
- obj.GetFunction()
- obj.GetBlock()
- obj.GetSymbol()
- obj.GetLineEntry()
- obj.Clear()
Removed: lldb/trunk/test/python_api/default-constructor/sb_block.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_block.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_block.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_block.py (removed)
@@ -1,17 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.IsInlined()
- obj.GetInlinedName()
- obj.GetInlinedCallSiteFile()
- obj.GetInlinedCallSiteLine()
- obj.GetInlinedCallSiteColumn()
- obj.GetParent()
- obj.GetSibling()
- obj.GetFirstChild()
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py (removed)
@@ -1,36 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetID()
- obj.ClearAllBreakpointSites()
- obj.FindLocationByAddress(sys.maxsize)
- obj.FindLocationIDByAddress(sys.maxsize)
- obj.FindLocationByID(0)
- obj.GetLocationAtIndex(0)
- obj.SetEnabled(True)
- obj.IsEnabled()
- obj.GetHitCount()
- obj.SetIgnoreCount(1)
- obj.GetIgnoreCount()
- obj.SetCondition("i >= 10")
- obj.GetCondition()
- obj.SetThreadID(0)
- obj.GetThreadID()
- obj.SetThreadIndex(0)
- obj.GetThreadIndex()
- obj.SetThreadName("worker thread")
- obj.GetThreadName()
- obj.SetQueueName("my queue")
- obj.GetQueueName()
- obj.SetScriptCallbackFunction(None)
- obj.SetScriptCallbackBody (None)
- obj.GetNumResolvedLocations()
- obj.GetNumLocations()
- obj.GetDescription(lldb.SBStream())
- for bp_loc in obj:
- s = str(bp_loc)
Removed: lldb/trunk/test/python_api/default-constructor/sb_breakpointlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_breakpointlocation.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_breakpointlocation.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_breakpointlocation.py (removed)
@@ -1,28 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetAddress()
- obj.GetLoadAddress()
- obj.SetEnabled(True)
- obj.IsEnabled()
- obj.SetCondition("i >= 10")
- obj.GetCondition()
- obj.SetThreadID(0)
- obj.GetThreadID()
- obj.SetThreadIndex(0)
- obj.GetThreadIndex()
- obj.SetThreadName("worker thread")
- obj.GetThreadName()
- obj.SetQueueName("my queue")
- obj.GetQueueName()
- obj.IsResolved()
- obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose)
- breakpoint = obj.GetBreakpoint()
- # Do fuzz testing on the breakpoint obj, it should not crash lldb.
- import sb_breakpoint
- sb_breakpoint.fuzz_obj(breakpoint)
Removed: lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py (removed)
@@ -1,20 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True)
- obj.BroadcastEvent(lldb.SBEvent(), False)
- listener = lldb.SBListener("fuzz_testing")
- obj.AddInitialEventsToListener(listener, 0xffffffff)
- obj.AddInitialEventsToListener(listener, 0)
- obj.AddListener(listener, 0xffffffff)
- obj.AddListener(listener, 0)
- obj.GetName()
- obj.EventTypeHasListeners(0)
- obj.RemoveListener(listener, 0xffffffff)
- obj.RemoveListener(listener, 0)
- obj.Clear()
Removed: lldb/trunk/test/python_api/default-constructor/sb_communication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_communication.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_communication.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_communication.py (removed)
@@ -1,28 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- broadcaster = obj.GetBroadcaster()
- # Do fuzz testing on the broadcaster obj, it should not crash lldb.
- import sb_broadcaster
- sb_broadcaster.fuzz_obj(broadcaster)
- obj.AdoptFileDesriptor(0, False)
- obj.AdoptFileDesriptor(1, False)
- obj.AdoptFileDesriptor(2, False)
- obj.Connect("file:/tmp/myfile")
- obj.Connect(None)
- obj.Disconnect()
- obj.IsConnected()
- obj.GetCloseOnEOF()
- obj.SetCloseOnEOF(True)
- obj.SetCloseOnEOF(False)
- #obj.Write(None, sys.maxint, None)
- #obj.Read(None, sys.maxint, 0xffffffff, None)
- obj.ReadThreadStart()
- obj.ReadThreadStop()
- obj.ReadThreadIsRunning()
- obj.SetReadThreadBytesReceivedCallback(None, None)
Removed: lldb/trunk/test/python_api/default-constructor/sb_compileunit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_compileunit.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_compileunit.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_compileunit.py (removed)
@@ -1,15 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetFileSpec()
- obj.GetNumLineEntries()
- obj.GetLineEntryAtIndex(0xffffffff)
- obj.FindLineEntryIndex(0, 0xffffffff, None)
- obj.GetDescription(lldb.SBStream())
- for line_entry in obj:
- s = str(line_entry)
Removed: lldb/trunk/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_debugger.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_debugger.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_debugger.py (removed)
@@ -1,56 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.SetAsync(True)
- obj.SetAsync(False)
- obj.GetAsync()
- obj.SkipLLDBInitFiles(True)
- obj.SetInputFileHandle(None, True)
- obj.SetOutputFileHandle(None, True)
- obj.SetErrorFileHandle(None, True)
- obj.GetInputFileHandle()
- obj.GetOutputFileHandle()
- obj.GetErrorFileHandle()
- obj.GetCommandInterpreter()
- obj.HandleCommand("nothing here")
- listener = obj.GetListener()
- obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
- obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
- obj.CreateTargetWithFileAndArch("b.out", "arm")
- obj.CreateTarget("c.out")
- obj.DeleteTarget(lldb.SBTarget())
- obj.GetTargetAtIndex(0xffffffff)
- obj.FindTargetWithProcessID(0)
- obj.FindTargetWithFileAndArch("a.out", "arm")
- obj.GetNumTargets()
- obj.GetSelectedTarget()
- obj.GetSourceManager()
- obj.SetSelectedTarget(lldb.SBTarget())
- obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
- try:
- obj.DispatchInput(None)
- except Exception:
- pass
- obj.DispatchInputInterrupt()
- obj.DispatchInputEndOfFile()
- obj.GetInstanceName()
- obj.GetDescription(lldb.SBStream())
- obj.GetTerminalWidth()
- obj.SetTerminalWidth(0xffffffff)
- obj.GetID()
- obj.GetPrompt()
- obj.SetPrompt("Hi, Mom!")
- obj.GetScriptLanguage()
- obj.SetScriptLanguage(lldb.eScriptLanguageNone)
- obj.SetScriptLanguage(lldb.eScriptLanguagePython)
- obj.GetCloseInputOnEOF()
- obj.SetCloseInputOnEOF(True)
- obj.SetCloseInputOnEOF(False)
- obj.Clear()
- for target in obj:
- s = str(target)
Removed: lldb/trunk/test/python_api/default-constructor/sb_error.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_error.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_error.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_error.py (removed)
@@ -1,25 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetCString()
- obj.Fail()
- obj.Success()
- obj.GetError()
- obj.GetType()
- obj.SetError(5, lldb.eErrorTypeGeneric)
- obj.SetErrorToErrno()
- obj.SetErrorToGenericError()
- obj.SetErrorString("xyz")
- obj.SetErrorString(None)
- obj.SetErrorStringWithFormat("%s!", "error")
- obj.SetErrorStringWithFormat(None)
- obj.SetErrorStringWithFormat("error")
- obj.SetErrorStringWithFormat("%s %s", "warning", "danger")
- obj.SetErrorStringWithFormat("%s %s %s", "danger", "will", "robinson")
- obj.GetDescription(lldb.SBStream())
- obj.Clear()
Removed: lldb/trunk/test/python_api/default-constructor/sb_event.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_event.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_event.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_event.py (removed)
@@ -1,17 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetDataFlavor()
- obj.GetType()
- broadcaster = obj.GetBroadcaster()
- # Do fuzz testing on the broadcaster obj, it should not crash lldb.
- import sb_broadcaster
- sb_broadcaster.fuzz_obj(broadcaster)
- obj.BroadcasterMatchesRef(broadcaster)
- obj.GetDescription(lldb.SBStream())
- obj.Clear()
Removed: lldb/trunk/test/python_api/default-constructor/sb_filespec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_filespec.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_filespec.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_filespec.py (removed)
@@ -1,14 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.Exists()
- obj.ResolveExecutableLocation()
- obj.GetFilename()
- obj.GetDirectory()
- obj.GetPath(None, 0)
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_frame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_frame.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_frame.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_frame.py (removed)
@@ -1,37 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetFrameID()
- obj.GetPC()
- obj.SetPC(0xffffffff)
- obj.GetSP()
- obj.GetFP()
- obj.GetPCAddress()
- obj.GetSymbolContext(0)
- obj.GetModule()
- obj.GetCompileUnit()
- obj.GetFunction()
- obj.GetSymbol()
- obj.GetBlock()
- obj.GetFunctionName()
- obj.IsInlined()
- obj.EvaluateExpression("x + y")
- obj.EvaluateExpression("x + y", lldb.eDynamicCanRunTarget)
- obj.GetFrameBlock()
- obj.GetLineEntry()
- obj.GetThread()
- obj.Disassemble()
- obj.GetVariables(True, True, True, True)
- obj.GetVariables(True, True, True, False, lldb.eDynamicCanRunTarget)
- obj.GetRegisters()
- obj.FindVariable("my_var")
- obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
- obj.FindValue("your_var", lldb.eValueTypeVariableGlobal)
- obj.FindValue("your_var", lldb.eValueTypeVariableStatic, lldb.eDynamicCanRunTarget)
- obj.GetDescription(lldb.SBStream())
- obj.Clear()
Removed: lldb/trunk/test/python_api/default-constructor/sb_function.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_function.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_function.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_function.py (removed)
@@ -1,19 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetName()
- obj.GetMangledName()
- obj.GetInstructions(lldb.SBTarget())
- sa = obj.GetStartAddress()
- ea = obj.GetEndAddress()
- # Do fuzz testing on the address obj, it should not crash lldb.
- import sb_address
- sb_address.fuzz_obj(sa)
- sb_address.fuzz_obj(ea)
- obj.GetPrologueByteSize
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_instruction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_instruction.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_instruction.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_instruction.py (removed)
@@ -1,16 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetAddress()
- obj.GetByteSize()
- obj.DoesBranch()
- obj.Print(None)
- obj.GetDescription(lldb.SBStream())
- obj.EmulateWithFrame(lldb.SBFrame(), 0)
- obj.DumpEmulation("armv7")
- obj.TestEmulation(lldb.SBStream(), "my-file")
Removed: lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py (removed)
@@ -1,17 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetSize()
- obj.GetInstructionAtIndex(0xffffffff)
- obj.AppendInstruction(lldb.SBInstruction())
- obj.Print(None)
- obj.GetDescription(lldb.SBStream())
- obj.DumpEmulationForAllInstructions("armv7")
- obj.Clear()
- for inst in obj:
- s = str(inst)
Removed: lldb/trunk/test/python_api/default-constructor/sb_lineentry.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_lineentry.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_lineentry.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_lineentry.py (removed)
@@ -1,14 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetStartAddress()
- obj.GetEndAddress()
- obj.GetFileSpec()
- obj.GetLine()
- obj.GetColumn()
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_listener.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_listener.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_listener.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_listener.py (removed)
@@ -1,23 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.AddEvent(lldb.SBEvent())
- obj.StartListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
- obj.StopListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
- event = lldb.SBEvent()
- broadcaster = lldb.SBBroadcaster()
- obj.WaitForEvent(5, event)
- obj.WaitForEventForBroadcaster(5, broadcaster, event)
- obj.WaitForEventForBroadcasterWithType(5, broadcaster, 0xffffffff, event)
- obj.PeekAtNextEvent(event)
- obj.PeekAtNextEventForBroadcaster(broadcaster, event)
- obj.PeekAtNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event)
- obj.GetNextEvent(event)
- obj.GetNextEventForBroadcaster(broadcaster, event)
- obj.GetNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event)
- obj.HandleBroadcastEvent(event)
Removed: lldb/trunk/test/python_api/default-constructor/sb_module.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_module.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_module.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_module.py (removed)
@@ -1,29 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetFileSpec()
- obj.GetPlatformFileSpec()
- obj.SetPlatformFileSpec(lldb.SBFileSpec())
- obj.GetUUIDString()
- obj.ResolveFileAddress(sys.maxsize)
- obj.ResolveSymbolContextForAddress(lldb.SBAddress(), 0)
- obj.GetDescription(lldb.SBStream())
- obj.GetNumSymbols()
- obj.GetSymbolAtIndex(sys.maxsize)
- sc_list = obj.FindFunctions("my_func")
- sc_list = obj.FindFunctions("my_func", lldb.eFunctionNameTypeAny)
- obj.FindGlobalVariables(lldb.SBTarget(), "my_global_var", 1)
- for section in obj.section_iter():
- s = str(section)
- for symbol in obj.symbol_in_section_iter(lldb.SBSection()):
- s = str(symbol)
- for symbol in obj:
- s = str(symbol)
- obj.GetAddressByteSize()
- obj.GetByteOrder()
- obj.GetTriple()
Removed: lldb/trunk/test/python_api/default-constructor/sb_process.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_process.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_process.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_process.py (removed)
@@ -1,49 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetTarget()
- obj.GetByteOrder()
- obj.PutSTDIN("my data")
- obj.GetSTDOUT(6)
- obj.GetSTDERR(6)
- event = lldb.SBEvent()
- obj.ReportEventState(event, None)
- obj.AppendEventStateReport(event, lldb.SBCommandReturnObject())
- error = lldb.SBError()
- obj.RemoteAttachToProcessWithID(123, error)
- obj.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
- obj.GetNumThreads()
- obj.GetThreadAtIndex(0)
- obj.GetThreadByID(0)
- obj.GetSelectedThread()
- obj.SetSelectedThread(lldb.SBThread())
- obj.SetSelectedThreadByID(0)
- obj.GetState()
- obj.GetExitStatus()
- obj.GetExitDescription()
- obj.GetProcessID()
- obj.GetAddressByteSize()
- obj.Destroy()
- obj.Continue()
- obj.Stop()
- obj.Kill()
- obj.Detach()
- obj.Signal(7)
- obj.ReadMemory(0x0000ffff, 10, error)
- obj.WriteMemory(0x0000ffff, "hi data", error)
- obj.ReadCStringFromMemory(0x0, 128, error)
- obj.ReadUnsignedFromMemory(0xff, 4, error)
- obj.ReadPointerFromMemory(0xff, error)
- obj.GetBroadcaster()
- obj.GetDescription(lldb.SBStream())
- obj.LoadImage(lldb.SBFileSpec(), error)
- obj.UnloadImage(0)
- obj.Clear()
- obj.GetNumSupportedHardwareWatchpoints(error)
- for thread in obj:
- s = str(thread)
Removed: lldb/trunk/test/python_api/default-constructor/sb_section.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_section.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_section.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_section.py (removed)
@@ -1,22 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.IsValid()
- obj.GetName()
- obj.FindSubSection("hello_section_name")
- obj.GetNumSubSections()
- obj.GetSubSectionAtIndex(600)
- obj.GetFileAddress()
- obj.GetByteSize()
- obj.GetFileOffset()
- obj.GetFileByteSize()
- obj.GetSectionData(1000, 100)
- obj.GetSectionType()
- obj.GetDescription(lldb.SBStream())
- for subsec in obj:
- s = str(subsec)
Removed: lldb/trunk/test/python_api/default-constructor/sb_stringlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_stringlist.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_stringlist.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_stringlist.py (removed)
@@ -1,17 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.AppendString("another string")
- obj.AppendString(None)
- obj.AppendList(None, 0)
- obj.AppendList(lldb.SBStringList())
- obj.GetSize()
- obj.GetStringAtIndex(0xffffffff)
- obj.Clear()
- for n in obj:
- s = str(n)
Removed: lldb/trunk/test/python_api/default-constructor/sb_symbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_symbol.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_symbol.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_symbol.py (removed)
@@ -1,16 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetName()
- obj.GetMangledName()
- obj.GetInstructions(lldb.SBTarget())
- obj.GetStartAddress()
- obj.GetEndAddress()
- obj.GetPrologueByteSize()
- obj.GetType()
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_symbolcontext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_symbolcontext.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_symbolcontext.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_symbolcontext.py (removed)
@@ -1,15 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetModule()
- obj.GetCompileUnit()
- obj.GetFunction()
- obj.GetBlock()
- obj.GetLineEntry()
- obj.GetSymbol()
- obj.GetDescription(lldb.SBStream())
Removed: lldb/trunk/test/python_api/default-constructor/sb_target.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_target.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_target.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_target.py (removed)
@@ -1,65 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetProcess()
- listener = lldb.SBListener()
- error = lldb.SBError()
- obj.Launch(listener, None, None, None, None, None, None, 0, True, error)
- obj.LaunchSimple(None, None, None)
- obj.AttachToProcessWithID(listener, 123, error)
- obj.AttachToProcessWithName(listener, 'lldb', False, error)
- obj.ConnectRemote(listener, "connect://to/here", None, error)
- obj.GetExecutable()
- obj.GetNumModules()
- obj.GetModuleAtIndex(0xffffffff)
- obj.GetDebugger()
- filespec = lldb.SBFileSpec()
- obj.FindModule(filespec)
- sc_list = obj.FindFunctions("the_func")
- sc_list = obj.FindFunctions("the_func", lldb.eFunctionNameTypeAny)
- obj.FindFirstType("dont_care")
- obj.FindTypes("dont_care")
- obj.FindFirstType(None)
- obj.GetInstructions(lldb.SBAddress(), bytearray())
- obj.GetSourceManager()
- obj.FindGlobalVariables("my_global_var", 1)
- address = obj.ResolveLoadAddress(0xffff)
- obj.ResolveSymbolContextForAddress(address, 0)
- obj.BreakpointCreateByLocation("filename", 20)
- obj.BreakpointCreateByLocation(filespec, 20)
- obj.BreakpointCreateByName("func", None)
- obj.BreakpointCreateByRegex("func.", None)
- obj.BreakpointCreateByAddress(0xf0f0)
- obj.GetNumBreakpoints()
- obj.GetBreakpointAtIndex(0)
- obj.BreakpointDelete(0)
- obj.FindBreakpointByID(0)
- obj.EnableAllBreakpoints()
- obj.DisableAllBreakpoints()
- obj.DeleteAllBreakpoints()
- obj.GetNumWatchpoints()
- obj.GetWatchpointAtIndex(0)
- obj.DeleteWatchpoint(0)
- obj.FindWatchpointByID(0)
- obj.EnableAllWatchpoints()
- obj.DisableAllWatchpoints()
- obj.DeleteAllWatchpoints()
- obj.GetAddressByteSize()
- obj.GetByteOrder()
- obj.GetTriple()
- error = lldb.SBError()
- obj.WatchAddress(123, 8, True, True, error)
- obj.GetBroadcaster()
- obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
- obj.Clear()
- for module in obj.module_iter():
- s = str(module)
- for bp in obj.breakpoint_iter():
- s = str(bp)
- for wp in obj.watchpoint_iter():
- s = str(wp)
Removed: lldb/trunk/test/python_api/default-constructor/sb_thread.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_thread.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_thread.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_thread.py (removed)
@@ -1,37 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetStopReason()
- obj.GetStopReasonDataCount()
- obj.GetStopReasonDataAtIndex(100)
- obj.GetStopDescription(256)
- obj.GetThreadID()
- obj.GetIndexID()
- obj.GetName()
- obj.GetQueueName()
- obj.StepOver(lldb.eOnlyDuringStepping)
- obj.StepInto(lldb.eOnlyDuringStepping)
- obj.StepOut()
- frame = lldb.SBFrame()
- obj.StepOutOfFrame(frame)
- obj.StepInstruction(True)
- filespec = lldb.SBFileSpec()
- obj.StepOverUntil(frame, filespec, 1234)
- obj.RunToAddress(0xabcd)
- obj.Suspend()
- obj.Resume()
- obj.IsSuspended()
- obj.GetNumFrames()
- obj.GetFrameAtIndex(200)
- obj.GetSelectedFrame()
- obj.SetSelectedFrame(999)
- obj.GetProcess()
- obj.GetDescription(lldb.SBStream())
- obj.Clear()
- for frame in obj:
- s = str(frame)
Removed: lldb/trunk/test/python_api/default-constructor/sb_type.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_type.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_type.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_type.py (removed)
@@ -1,22 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetName()
- obj.GetByteSize()
- #obj.GetEncoding(5)
- obj.GetNumberChildren(True)
- member = lldb.SBTypeMember()
- obj.GetChildAtIndex(True, 0, member)
- obj.GetChildIndexForName(True, "_member_field")
- obj.IsAPointerType()
- obj.GetPointeeType()
- obj.GetDescription(lldb.SBStream())
- obj.IsPointerType(None)
- lldb.SBType.IsPointerType(None)
- for child_type in obj:
- s = str(child_type)
Removed: lldb/trunk/test/python_api/default-constructor/sb_value.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_value.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_value.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_value.py (removed)
@@ -1,67 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetError()
- obj.GetID()
- obj.GetName()
- obj.GetTypeName()
- obj.GetByteSize()
- obj.IsInScope()
- obj.GetFormat()
- obj.SetFormat(lldb.eFormatBoolean)
- obj.GetValue()
- obj.GetValueType()
- obj.GetValueDidChange()
- obj.GetSummary()
- obj.GetObjectDescription()
- obj.GetLocation()
- obj.SetValueFromCString("my_new_value")
- obj.GetChildAtIndex(1)
- obj.GetChildAtIndex(2, lldb.eNoDynamicValues, False)
- obj.GetIndexOfChildWithName("my_first_child")
- obj.GetChildMemberWithName("my_first_child")
- obj.GetChildMemberWithName("my_first_child", lldb.eNoDynamicValues)
- obj.GetNumChildren()
- obj.GetOpaqueType()
- obj.Dereference()
- obj.TypeIsPointerType()
- stream = lldb.SBStream()
- obj.GetDescription(stream)
- obj.GetExpressionPath(stream)
- obj.GetExpressionPath(stream, True)
- error = lldb.SBError()
- obj.Watch(True, True, False, error)
- obj.WatchPointee(True, False, True, error)
- for child_val in obj:
- s = str(child_val)
- error = lldb.SBError()
- obj.GetValueAsSigned (error, 0)
- obj.GetValueAsUnsigned (error, 0)
- obj.GetValueAsSigned(0)
- obj.GetValueAsUnsigned(0)
- obj.GetDynamicValue (lldb.eNoDynamicValues)
- obj.GetStaticValue ()
- obj.IsDynamic()
- invalid_type = lldb.SBType()
- obj.CreateChildAtOffset ("a", 12, invalid_type)
- obj.Cast (invalid_type)
- obj.CreateValueFromExpression ("pt->x", "pt->x")
- obj.CreateValueFromAddress ("x", 0x123, invalid_type)
- invalid_data = lldb.SBData()
- obj.CreateValueFromData ("x", invalid_data, invalid_type)
- obj.GetValueForExpressionPath("[0]")
- obj.AddressOf()
- obj.GetLoadAddress()
- obj.GetAddress()
- obj.GetPointeeData (0, 1)
- obj.GetData ()
- obj.GetTarget()
- obj.GetProcess()
- obj.GetThread()
- obj.GetFrame()
- obj.GetType()
Removed: lldb/trunk/test/python_api/default-constructor/sb_valuelist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_valuelist.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_valuelist.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_valuelist.py (removed)
@@ -1,14 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.Append(lldb.SBValue())
- obj.GetSize()
- obj.GetValueAtIndex(100)
- obj.FindValueObjectByUID(200)
- for val in obj:
- s = str(val)
Removed: lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py (removed)
@@ -1,21 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.GetID()
- obj.IsValid()
- obj.GetHardwareIndex()
- obj.GetWatchAddress()
- obj.GetWatchSize()
- obj.SetEnabled(True)
- obj.IsEnabled()
- obj.GetHitCount()
- obj.GetIgnoreCount()
- obj.SetIgnoreCount(5)
- obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose)
- obj.SetCondition("shouldWeStop()")
- obj.GetCondition()
Removed: lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py (original)
+++ lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py (removed)
@@ -1,38 +0,0 @@
-"""
-Use lldb Python API to disassemble raw machine code bytes
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class DisassembleRawDataTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_disassemble_raw_data(self):
- """Test disassembling raw bytes with the API."""
- # Create a target from the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "x86_64")
- self.assertTrue(target, VALID_TARGET)
-
- raw_bytes = bytearray([0x48, 0x89, 0xe5])
-
- insts = target.GetInstructions(lldb.SBAddress(0, target), raw_bytes)
-
- inst = insts.GetInstructionAtIndex(0)
-
- if self.TraceOn():
- print()
- print("Raw bytes: ", [hex(x) for x in raw_bytes])
- print("Disassembled%s" % str(inst))
-
- self.assertTrue (inst.GetMnemonic(target) == "movq")
- self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
Removed: lldb/trunk/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py (original)
+++ lldb/trunk/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py (removed)
@@ -1,57 +0,0 @@
-"""
-Use lldb Python API to disassemble raw machine code bytes
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class Disassemble_VST1_64(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIf(True) # llvm.org/pr24575: all tests get ERRORs in dotest.py after this
- @add_test_categories(['pyapi'])
- @no_debug_info_test
- def test_disassemble_invalid_vst_1_64_raw_data(self):
- """Test disassembling invalid vst1.64 raw bytes with the API."""
- # Create a target from the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "thumbv7")
- self.assertTrue(target, VALID_TARGET)
-
- raw_bytes = bytearray([0xf0, 0xb5, 0x03, 0xaf,
- 0x2d, 0xe9, 0x00, 0x0d,
- 0xad, 0xf1, 0x40, 0x04,
- 0x24, 0xf0, 0x0f, 0x04,
- 0xa5, 0x46])
-
- insts = target.GetInstructions(lldb.SBAddress(), raw_bytes)
-
- if self.TraceOn():
- print()
- for i in insts:
- print("Disassembled%s" % str(i))
-
- # Remove the following return statement when the radar is fixed.
- return
-
- # rdar://problem/11034702
- # VST1 (multiple single elements) encoding?
- # The disassembler should not crash!
- raw_bytes = bytearray([0x04, 0xf9, 0xed, 0x82])
-
- insts = target.GetInstructions(lldb.SBAddress(), raw_bytes)
-
- inst = insts.GetInstructionAtIndex(0)
-
- if self.TraceOn():
- print()
- print("Raw bytes: ", [hex(x) for x in raw_bytes])
- print("Disassembled%s" % str(inst))
-
- self.assertTrue (inst.GetMnemonic(target) == "vst1.64")
Removed: lldb/trunk/test/python_api/event/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/event/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/event/Makefile (original)
+++ lldb/trunk/test/python_api/event/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/event/TestEvents.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/event/TestEvents.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/event/TestEvents.py (original)
+++ lldb/trunk/test/python_api/event/TestEvents.py (removed)
@@ -1,285 +0,0 @@
-"""
-Test lldb Python event APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class EventAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Find the line number of function "c" here.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureLinux("llvm.org/pr23730") # Flaky, fails ~1/10 cases
- @skipIfLinux # skip to avoid crashes
- def test_listen_for_and_print_event(self):
- """Exercise SBEvent API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- self.dbg.SetAsync(True)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
-
- listener = lldb.SBListener("my listener")
-
- # Now launch the process, and do not stop at the entry point.
- error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
-
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
-
- # Create an empty event object.
- event = lldb.SBEvent()
-
- traceOn = self.TraceOn()
- if traceOn:
- lldbutil.print_stacktraces(process)
-
- # Create MyListeningThread class to wait for any kind of event.
- import threading
- class MyListeningThread(threading.Thread):
- def run(self):
- count = 0
- # Let's only try at most 4 times to retrieve any kind of event.
- # After that, the thread exits.
- while not count > 3:
- if traceOn:
- print("Try wait for event...")
- if listener.WaitForEvent(5, event):
- if traceOn:
- desc = lldbutil.get_description(event)
- print("Event description:", desc)
- print("Event data flavor:", event.GetDataFlavor())
- print("Process state:", lldbutil.state_type_to_str(process.GetState()))
- print()
- else:
- if traceOn:
- print("timeout occurred waiting for event...")
- count = count + 1
- return
-
- # Let's start the listening thread to retrieve the events.
- my_thread = MyListeningThread()
- my_thread.start()
-
- # Use Python API to continue the process. The listening thread should be
- # able to receive the state changed events.
- process.Continue()
-
- # Use Python API to kill the process. The listening thread should be
- # able to receive the state changed event, too.
- process.Kill()
-
- # Wait until the 'MyListeningThread' terminates.
- my_thread.join()
-
- @add_test_categories(['pyapi'])
- def test_wait_for_event(self):
- """Exercise SBListener.WaitForEvent() API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- self.dbg.SetAsync(True)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Get the debugger listener.
- listener = self.dbg.GetListener()
-
- # Now launch the process, and do not stop at entry point.
- error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
- self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
-
- # Create an empty event object.
- event = lldb.SBEvent()
- self.assertFalse(event, "Event should not be valid initially")
-
- # Create MyListeningThread to wait for any kind of event.
- import threading
- class MyListeningThread(threading.Thread):
- def run(self):
- count = 0
- # Let's only try at most 3 times to retrieve any kind of event.
- while not count > 3:
- if listener.WaitForEvent(5, event):
- #print("Got a valid event:", event)
- #print("Event data flavor:", event.GetDataFlavor())
- #print("Event type:", lldbutil.state_type_to_str(event.GetType()))
- return
- count = count + 1
- print("Timeout: listener.WaitForEvent")
-
- return
-
- # Use Python API to kill the process. The listening thread should be
- # able to receive a state changed event.
- process.Kill()
-
- # Let's start the listening thread to retrieve the event.
- my_thread = MyListeningThread()
- my_thread.start()
-
- # Wait until the 'MyListeningThread' terminates.
- my_thread.join()
-
- self.assertTrue(event,
- "My listening thread successfully received an event")
-
- @skipIfFreeBSD # llvm.org/pr21325
- @add_test_categories(['pyapi'])
- @expectedFlakeyLinux("llvm.org/pr23617") # Flaky, fails ~1/10 cases
- @expectedFailureWindows("llvm.org/pr24778")
- def test_add_listener_to_broadcaster(self):
- """Exercise some SBBroadcaster APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- self.dbg.SetAsync(True)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- listener = lldb.SBListener("my listener")
-
- # Now launch the process, and do not stop at the entry point.
- error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
-
- # Create an empty event object.
- event = lldb.SBEvent()
- self.assertFalse(event, "Event should not be valid initially")
-
-
- # The finite state machine for our custom listening thread, with an
- # initial state of None, which means no event has been received.
- # It changes to 'connected' after 'connected' event is received (for remote platforms)
- # It changes to 'running' after 'running' event is received (should happen only if the
- # currentstate is either 'None' or 'connected')
- # It changes to 'stopped' if a 'stopped' event is received (should happen only if the
- # current state is 'running'.)
- self.state = None
-
- # Create MyListeningThread to wait for state changed events.
- # By design, a "running" event is expected following by a "stopped" event.
- import threading
- class MyListeningThread(threading.Thread):
- def run(self):
- #print("Running MyListeningThread:", self)
-
- # Regular expression pattern for the event description.
- pattern = re.compile("data = {.*, state = (.*)}$")
-
- # Let's only try at most 6 times to retrieve our events.
- count = 0
- while True:
- if listener.WaitForEvent(5, event):
- desc = lldbutil.get_description(event)
- #print("Event description:", desc)
- match = pattern.search(desc)
- if not match:
- break;
- if match.group(1) == 'connected':
- # When debugging remote targets with lldb-server, we
- # first get the 'connected' event.
- self.context.assertTrue(self.context.state == None)
- self.context.state = 'connected'
- continue
- elif match.group(1) == 'running':
- self.context.assertTrue(self.context.state == None or self.context.state == 'connected')
- self.context.state = 'running'
- continue
- elif match.group(1) == 'stopped':
- self.context.assertTrue(self.context.state == 'running')
- # Whoopee, both events have been received!
- self.context.state = 'stopped'
- break
- else:
- break
- print("Timeout: listener.WaitForEvent")
- count = count + 1
- if count > 6:
- break
-
- return
-
- # Use Python API to continue the process. The listening thread should be
- # able to receive the state changed events.
- process.Continue()
-
- # Start the listening thread to receive the "running" followed by the
- # "stopped" events.
- my_thread = MyListeningThread()
- # Supply the enclosing context so that our listening thread can access
- # the 'state' variable.
- my_thread.context = self
- my_thread.start()
-
- # Wait until the 'MyListeningThread' terminates.
- my_thread.join()
-
- # The final judgement. :-)
- self.assertTrue(self.state == 'stopped',
- "Both expected state changed events received")
Removed: lldb/trunk/test/python_api/event/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/event/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/event/main.c (original)
+++ lldb/trunk/test/python_api/event/main.c (removed)
@@ -1,49 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API related to events.
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1)
- return b(val);
- else if (val >= 3)
- return c(val);
-
- return val;
-}
-
-int b(int val)
-{
- return c(val);
-}
-
-int c(int val)
-{
- return val + 3; // Find the line number of function "c" here.
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1); // a(1) -> b(1) -> c(1)
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2); // b(2) -> c(2)
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3); // a(3) -> c(3)
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py (original)
+++ lldb/trunk/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py (removed)
@@ -1,4 +0,0 @@
-import lldbinline
-import lldbtest
-
-lldbinline.MakeInlineTest(__file__, globals(), [lldbtest.skipIfFreeBSD,lldbtest.skipIfLinux,lldbtest.skipIfWindows])
Removed: lldb/trunk/test/python_api/exprpath_synthetic/main.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/exprpath_synthetic/main.mm?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/exprpath_synthetic/main.mm (original)
+++ lldb/trunk/test/python_api/exprpath_synthetic/main.mm (removed)
@@ -1,20 +0,0 @@
-//===-- main.mm --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#import <Cocoa/Cocoa.h>
-#include <vector>
-
-int main (int argc, char const *argv[])
-{
- std::vector<int> v{1,2,3,4,5};
- NSArray *a = @[@"Hello",@"World",@"From Me"];
- return 0; //% v = self.frame().FindVariable("v"); v0 = v.GetChildAtIndex(0); s = lldb.SBStream(); v0.GetExpressionPath(s);
- //% self.runCmd("expr %s = 12" % s.GetData()); self.assertTrue(v0.GetValueAsUnsigned() == 12, "value change via expr failed")
- //% a = self.frame().FindVariable("a"); a1 = a.GetChildAtIndex(1); s = lldb.SBStream(); a1.GetExpressionPath(s);
- //% self.expect("po %s" % s.GetData(), substrs = ["World"])
-}
Removed: lldb/trunk/test/python_api/findvalue_duplist/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/findvalue_duplist/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/findvalue_duplist/Makefile (original)
+++ lldb/trunk/test/python_api/findvalue_duplist/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-# Clean renamed executable on 'make clean'
-clean: OBJECTS+=no_synth
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/findvalue_duplist/TestSBFrameFindValue.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/findvalue_duplist/TestSBFrameFindValue.py (original)
+++ lldb/trunk/test/python_api/findvalue_duplist/TestSBFrameFindValue.py (removed)
@@ -1,50 +0,0 @@
-"""Test that SBFrame::FindValue finds things but does not duplicate the entire variables list"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class SBFrameFindValueTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_formatters_api(self):
- """Test that SBFrame::FindValue finds things but does not duplicate the entire variables list"""
- self.build()
- self.setTearDownCleanup()
-
- exe_name = "a.out"
- exe = os.path.join(os.getcwd(), exe_name)
-
- # Create the target
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Set the breakpoints
- breakpoint = target.BreakpointCreateBySourceRegex('Set breakpoint here', lldb.SBFileSpec("main.cpp"))
- self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be at our breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
-
- self.assertTrue(len(threads) == 1)
- self.thread = threads[0]
- self.frame = self.thread.frames[0]
- self.assertTrue(self.frame, "Frame 0 is valid.")
-
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off")
- self.assertFalse(self.frame.FindValue("NoSuchThing",lldb.eValueTypeVariableArgument,lldb.eDynamicCanRunTarget).IsValid(), "found something that should not be here")
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after failed FindValue()")
- self.assertTrue(self.frame.FindValue("a",lldb.eValueTypeVariableArgument,lldb.eDynamicCanRunTarget).IsValid(), "FindValue() didn't find an argument")
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after successful FindValue()")
Removed: lldb/trunk/test/python_api/findvalue_duplist/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/findvalue_duplist/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/findvalue_duplist/main.cpp (original)
+++ lldb/trunk/test/python_api/findvalue_duplist/main.cpp (removed)
@@ -1,7 +0,0 @@
-int foo(int a, int b) {
- return a + b; // Set breakpoint here
-}
-
-int main() {
- return foo(1,3);
-}
Removed: lldb/trunk/test/python_api/formatters/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/formatters/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/formatters/Makefile (original)
+++ lldb/trunk/test/python_api/formatters/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-# Clean renamed executable on 'make clean'
-clean: OBJECTS+=no_synth
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py (removed)
@@ -1,344 +0,0 @@
-"""Test Python APIs for working with formatters"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class SBFormattersAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- self.line = line_number('main.cpp', '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- def test_formatters_api(self):
- """Test Python APIs for working with formatters"""
- self.build()
- self.setTearDownCleanup()
-
- """Test Python APIs for working with formatters"""
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- self.runCmd('type format clear', check=False)
- self.runCmd('type summary clear', check=False)
- self.runCmd('type filter clear', check=False)
- self.runCmd('type synthetic clear', check=False)
- self.runCmd('type category delete foobar', check=False)
- self.runCmd('type category delete JASSynth', check=False)
- self.runCmd('type category delete newbar', check=False)
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
-
- format = lldb.SBTypeFormat(lldb.eFormatHex)
- category = self.dbg.GetDefaultCategory()
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"),format)
-
- self.expect("frame variable foo.A",
- substrs = ['0x00000001'])
- self.expect("frame variable foo.E", matching=False,
- substrs = ['b8cca70a'])
-
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("long"),format)
- self.expect("frame variable foo.A",
- substrs = ['0x00000001'])
- self.expect("frame variable foo.E",
- substrs = ['b8cca70a'])
-
- format.format = lldb.eFormatOctal
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"),format)
- self.expect("frame variable foo.A",
- substrs = ['01'])
- self.expect("frame variable foo.E",
- substrs = ['b8cca70a'])
-
- category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("int"))
- category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("long"))
- self.expect("frame variable foo.A", matching=False,
- substrs = ['01'])
- self.expect("frame variable foo.E", matching=False,
- substrs = ['b8cca70a'])
-
- summary = lldb.SBTypeSummary.CreateWithSummaryString("the hello world you'll never see")
- summary.SetSummaryString('hello world')
- new_category = self.dbg.GetCategory("foobar")
- self.assertFalse(new_category.IsValid(), "getting a non-existing category worked")
- new_category = self.dbg.CreateCategory("foobar")
- new_category.enabled = True
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("^.*t$",True),summary)
- self.expect("frame variable foo.A",
- substrs = ['hello world'])
- self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.B",
- substrs = ['hello world'])
- self.expect("frame variable foo.F",
- substrs = ['hello world'])
- new_category.enabled = False
- self.expect("frame variable foo.A", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.B", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.F", matching=False,
- substrs = ['hello world'])
- self.dbg.DeleteCategory(new_category.GetName())
- self.expect("frame variable foo.A", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.B", matching=False,
- substrs = ['hello world'])
- self.expect("frame variable foo.F", matching=False,
- substrs = ['hello world'])
-
- filter = lldb.SBTypeFilter(0)
- filter.AppendExpressionPath("A")
- filter.AppendExpressionPath("D")
- self.assertTrue(filter.GetNumberOfExpressionPaths() == 2, "filter with two items does not have two items")
-
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
- self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
- self.expect("frame variable foo", matching=False,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
-
- category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct",True))
- self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
- self.expect("frame variable foo", matching=False,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
-
- category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct",False))
- self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
- self.expect("frame variable foo", matching=True,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
-
- self.runCmd("command script import --allow-reload ./synth.py")
-
- self.expect("frame variable foo", matching=False,
- substrs = ['X = 1'])
-
- self.dbg.GetCategory("JASSynth").SetEnabled(True)
- self.expect("frame variable foo", matching=True,
- substrs = ['X = 1'])
-
- self.dbg.GetCategory("CCCSynth").SetEnabled(True)
- self.expect("frame variable ccc", matching=True,
- substrs = ['CCC object with leading value (int) a = 111', 'a = 111', 'b = 222', 'c = 333'])
-
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
- self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid')
-
- self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (synth)')
- self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 'foo_synth.X has wrong value (synth)')
- self.assertFalse(foo_var.GetChildMemberWithName('B').IsValid(), 'foo_synth.B is valid but should not (synth)')
-
- self.dbg.GetCategory("JASSynth").SetEnabled(False)
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
- self.assertTrue(foo_var.IsValid(), 'could not find foo')
-
- self.assertFalse(foo_var.GetNumChildren() == 2, 'still seeing synthetic value')
-
- filter = lldb.SBTypeFilter(0)
- filter.AppendExpressionPath("A")
- filter.AppendExpressionPath("D")
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
- self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
-
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
- self.assertTrue(foo_var.IsValid(), 'could not find foo')
-
- self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (filter)')
- self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 0, 'foo_synth.X has wrong value (filter)')
- self.assertTrue(foo_var.GetChildMemberWithName('A').GetValueAsUnsigned() == 1, 'foo_synth.A has wrong value (filter)')
-
- self.assertTrue(filter.ReplaceExpressionPathAtIndex(0,"C"), "failed to replace an expression path in filter")
- self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
- self.expect("frame variable foo",
- substrs = ["C = 'e'", 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("FooType"),filter)
- filter.ReplaceExpressionPathAtIndex(1,"F")
- self.expect("frame variable foo",
- substrs = ["C = 'e'", 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
- self.expect("frame variable foo",
- substrs = ["C = 'e'", 'F = 0'])
- self.expect("frame variable bar",
- substrs = ["C = 'e'", 'D = 6.28'])
-
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
- self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(foo_var.GetChildMemberWithName('C').GetValueAsUnsigned() == ord('e'), 'foo_synth.C has wrong value (filter)')
-
- chosen = self.dbg.GetFilterForType(lldb.SBTypeNameSpecifier("JustAStruct"))
- self.assertTrue(chosen.count == 2, "wrong filter found for JustAStruct")
- self.assertTrue(chosen.GetExpressionPathAtIndex(0) == 'C', "wrong item at index 0 for JustAStruct")
- self.assertTrue(chosen.GetExpressionPathAtIndex(1) == 'F', "wrong item at index 1 for JustAStruct")
-
- self.assertFalse(category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing filter worked")
- self.assertFalse(category.DeleteTypeSummary(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing summary worked")
- self.assertFalse(category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing format worked")
- self.assertFalse(category.DeleteTypeSynthetic(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing synthetic worked")
-
- self.assertFalse(category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("")),"deleting a filter for '' worked")
- self.assertFalse(category.DeleteTypeSummary(lldb.SBTypeNameSpecifier("")),"deleting a summary for '' worked")
- self.assertFalse(category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("")),"deleting a format for '' worked")
- self.assertFalse(category.DeleteTypeSynthetic(lldb.SBTypeNameSpecifier("")),"deleting a synthetic for '' worked")
-
- try:
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a summary valued None worked")
- except:
- pass
- else:
- self.assertFalse(True, "adding a summary valued None worked")
-
- try:
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a filter valued None worked")
- except:
- pass
- else:
- self.assertFalse(True, "adding a filter valued None worked")
-
- try:
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a synthetic valued None worked")
- except:
- pass
- else:
- self.assertFalse(True, "adding a synthetic valued None worked")
-
- try:
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a format valued None worked")
- except:
- pass
- else:
- self.assertFalse(True, "adding a format valued None worked")
-
-
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeSummary()), "adding a summary without value worked")
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeFilter()), "adding a filter without value worked")
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeSynthetic()), "adding a synthetic without value worked")
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeFormat()), "adding a format without value worked")
-
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier(""), lldb.SBTypeSummary.CreateWithSummaryString("")), "adding a summary for an invalid type worked")
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier(""), lldb.SBTypeFilter(0)), "adding a filter for an invalid type worked")
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier(""), lldb.SBTypeSynthetic.CreateWithClassName("")), "adding a synthetic for an invalid type worked")
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier(""), lldb.SBTypeFormat(lldb.eFormatHex)), "adding a format for an invalid type worked")
-
- new_category = self.dbg.CreateCategory("newbar")
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithScriptCode("return 'hello scripted world';"))
- self.expect("frame variable foo", matching=False,
- substrs = ['hello scripted world'])
- new_category.enabled = True
- self.expect("frame variable foo", matching=True,
- substrs = ['hello scripted world'])
-
- self.expect("frame variable foo_ptr", matching=True,
- substrs = ['hello scripted world'])
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithScriptCode("return 'hello scripted world';",
- lldb.eTypeOptionSkipPointers))
- self.expect("frame variable foo", matching=True,
- substrs = ['hello scripted world'])
-
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- foo_ptr = frame.FindVariable("foo_ptr")
- summary = foo_ptr.GetTypeSummary()
-
- self.assertFalse(summary.IsValid(), "summary found for foo* when none was planned")
-
- self.expect("frame variable foo_ptr", matching=False,
- substrs = ['hello scripted world'])
-
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithSummaryString("hello static world",
- lldb.eTypeOptionNone))
-
- summary = foo_ptr.GetTypeSummary()
-
- self.assertTrue(summary.IsValid(), "no summary found for foo* when one was in place")
- self.assertTrue(summary.GetData() == "hello static world", "wrong summary found for foo*")
-
- self.expect("frame variable e1", substrs=["I am an empty Empty1 {}"])
- self.expect("frame variable e2", substrs=["I am an empty Empty2"])
- self.expect("frame variable e2", substrs=["I am an empty Empty2 {}"], matching=False)
-
- @add_test_categories(['pyapi'])
- def test_force_synth_off(self):
- """Test that one can have the public API return non-synthetic SBValues if desired"""
- self.build(dictionary={'EXE':'no_synth'})
- self.setTearDownCleanup()
-
- self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- self.runCmd('type format clear', check=False)
- self.runCmd('type summary clear', check=False)
- self.runCmd('type filter clear', check=False)
- self.runCmd('type synthetic clear', check=False)
- self.runCmd('type category delete foobar', check=False)
- self.runCmd('type category delete JASSynth', check=False)
- self.runCmd('type category delete newbar', check=False)
- self.runCmd('settings set target.enable-synthetic-value true')
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- int_vector = frame.FindVariable("int_vector")
- if self.TraceOn():
- print(int_vector)
- self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is empty')
-
- self.runCmd('settings set target.enable-synthetic-value false')
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- int_vector = frame.FindVariable("int_vector")
- if self.TraceOn():
- print(int_vector)
- self.assertFalse(int_vector.GetNumChildren() == 0, '"physical" vector is not empty')
-
- self.runCmd('settings set target.enable-synthetic-value true')
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- int_vector = frame.FindVariable("int_vector")
- if self.TraceOn():
- print(int_vector)
- self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is still empty')
Removed: lldb/trunk/test/python_api/formatters/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/formatters/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/formatters/main.cpp (original)
+++ lldb/trunk/test/python_api/formatters/main.cpp (removed)
@@ -1,59 +0,0 @@
-#include <stdio.h>
-#include <vector>
-
-struct JustAStruct
-{
- int A;
- float B;
- char C;
- double D;
- long E;
- short F;
-};
-
-struct FooType
-{
- int A;
- float B;
- char C;
- double D;
- long E;
- short F;
-};
-
-struct CCC
-{
- int a, b, c;
-};
-
-struct Empty1 { void *data; };
-struct Empty2 { void *data; };
-
-
-int main(int argc, char const *argv[]) {
- JustAStruct foo;
- foo.A = 1;
- foo.B = 3.14;
- foo.C = 'e';
- foo.D = 6.28;
- foo.E = 3100419850;
- foo.F = 0;
-
- FooType bar;
- bar.A = 1;
- bar.B = 3.14;
- bar.C = 'e';
- bar.D = 6.28;
- bar.E = 3100419850;
- bar.F = 0;
- JustAStruct* foo_ptr = &foo;
-
- std::vector<int> int_vector;
-
- CCC ccc = {111, 222, 333};
-
- Empty1 e1;
- Empty2 e2;
-
- return 0; // Set break point at this line.
-}
Removed: lldb/trunk/test/python_api/formatters/synth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/formatters/synth.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/formatters/synth.py (original)
+++ lldb/trunk/test/python_api/formatters/synth.py (removed)
@@ -1,105 +0,0 @@
-import lldb
-
-class jasSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- def num_children(self):
- return 2;
- def get_child_at_index(self, index):
- child = None
- if index == 0:
- child = self.valobj.GetChildMemberWithName('A');
- if index == 1:
- child = self.valobj.CreateValueFromExpression('X', '(int)1')
- return child;
- def get_child_index(self, name):
- if name == 'A':
- return 0;
- if name == 'X':
- return 1;
- return None;
-
-
-def ccc_summary(sbvalue, internal_dict):
- sbvalue = sbvalue.GetNonSyntheticValue()
- # This tests that the SBValue.GetNonSyntheticValue() actually returns a
- # non-synthetic value. If it does not, then sbvalue.GetChildMemberWithName("a")
- # in the following statement will call the 'get_child_index' method of the
- # synthetic child provider CCCSynthProvider below (which raises an exception).
- return "CCC object with leading value " + str(sbvalue.GetChildMemberWithName("a"))
-
-
-class CCCSynthProvider(object):
- def __init__(self, sbvalue, internal_dict):
- self._sbvalue = sbvalue
-
- def num_children(self):
- return 3
-
- def get_child_index(self, name):
- raise RuntimeError("I don't want to be called!")
-
- def get_child_at_index(self, index):
- if index == 0:
- return self._sbvalue.GetChildMemberWithName("a")
- if index == 1:
- return self._sbvalue.GetChildMemberWithName("b")
- if index == 2:
- return self._sbvalue.GetChildMemberWithName("c")
-
-
-def empty1_summary(sbvalue, internal_dict):
- return "I am an empty Empty1"
-
-
-class Empty1SynthProvider(object):
- def __init__(self, sbvalue, internal_dict):
- self._sbvalue = sbvalue
-
- def num_children(self):
- return 0
-
- def get_child_at_index(self, index):
- return None
-
-
-def empty2_summary(sbvalue, internal_dict):
- return "I am an empty Empty2"
-
-
-class Empty2SynthProvider(object):
- def __init__(self, sbvalue, internal_dict):
- self._sbvalue = sbvalue
-
- def num_children(self):
- return 0
-
- def get_child_at_index(self, index):
- return None
-
-
-def __lldb_init_module(debugger,dict):
- debugger.CreateCategory("JASSynth").AddTypeSynthetic(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.jasSynthProvider"))
- cat = lldb.debugger.CreateCategory("CCCSynth")
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("CCC"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.CCCSynthProvider",
- lldb.eTypeOptionCascade))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("CCC"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.ccc_summary",
- lldb.eTypeOptionCascade))
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("Empty1"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty1SynthProvider"))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("Empty1"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.empty1_summary"))
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("Empty2"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty2SynthProvider"))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("Empty2"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.empty2_summary",
- lldb.eTypeOptionHideEmptyAggregates))
Removed: lldb/trunk/test/python_api/frame/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/Makefile (original)
+++ lldb/trunk/test/python_api/frame/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/frame/TestFrames.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/TestFrames.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/TestFrames.py (original)
+++ lldb/trunk/test/python_api/frame/TestFrames.py (removed)
@@ -1,203 +0,0 @@
-"""
-Use lldb Python SBFrame API to get the argument values of the call stacks.
-And other SBFrame API tests.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class FrameAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24778")
- def test_get_arg_vals_for_call_stack(self):
- """Exercise SBFrame.GetVariables() API to get argument vals."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
-
- # Keeps track of the number of times 'a' is called where it is within a
- # depth of 3 of the 'c' leaf function.
- callsOfA = 0
-
- from six import StringIO as SixStringIO
- session = SixStringIO()
- while process.GetState() == lldb.eStateStopped:
- thread = process.GetThreadAtIndex(0)
- # Inspect at most 3 frames.
- numFrames = min(3, thread.GetNumFrames())
- for i in range(numFrames):
- frame = thread.GetFrameAtIndex(i)
- if self.TraceOn():
- print("frame:", frame)
-
- name = frame.GetFunction().GetName()
- if name == 'a':
- callsOfA = callsOfA + 1
-
- # We'll inspect only the arguments for the current frame:
- #
- # arguments => True
- # locals => False
- # statics => False
- # in_scope_only => True
- valList = frame.GetVariables(True, False, False, True)
- argList = []
- for val in valList:
- argList.append("(%s)%s=%s" % (val.GetTypeName(),
- val.GetName(),
- val.GetValue()))
- print("%s(%s)" % (name, ", ".join(argList)), file=session)
-
- # Also check the generic pc & stack pointer. We can't test their absolute values,
- # but they should be valid. Uses get_GPRs() from the lldbutil module.
- gpr_reg_set = lldbutil.get_GPRs(frame)
- pc_value = gpr_reg_set.GetChildMemberWithName("pc")
- self.assertTrue (pc_value, "We should have a valid PC.")
- pc_value_str = pc_value.GetValue()
- self.assertTrue (pc_value_str, "We should have a valid PC string.")
- self.assertTrue (int(pc_value_str, 0) == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
- sp_value = gpr_reg_set.GetChildMemberWithName("sp")
- self.assertTrue (sp_value, "We should have a valid Stack Pointer.")
- self.assertTrue (int(sp_value.GetValue(), 0) == frame.GetSP(), "SP gotten as a value should equal frame's GetSP")
-
- print("---", file=session)
- process.Continue()
-
- # At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
-
- # Expect to find 'a' on the call stacks two times.
- self.assertTrue(callsOfA == 2,
- "Expect to find 'a' on the call stacks two times")
- # By design, the 'a' call frame has the following arg vals:
- # o a((int)val=1, (char)ch='A')
- # o a((int)val=3, (char)ch='A')
- if self.TraceOn():
- print("Full stack traces when stopped on the breakpoint 'c':")
- print(session.getvalue())
- self.expect(session.getvalue(), "Argugment values displayed correctly",
- exe=False,
- substrs = ["a((int)val=1, (char)ch='A')",
- "a((int)val=3, (char)ch='A')"])
-
- @add_test_categories(['pyapi'])
- def test_frame_api_boundary_condition(self):
- """Exercise SBFrame APIs with boundary condition inputs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
-
- thread = process.GetThreadAtIndex(0)
- frame = thread.GetFrameAtIndex(0)
- if self.TraceOn():
- print("frame:", frame)
-
- # Boundary condition testings.
- val1 = frame.FindVariable(None, True)
- val2 = frame.FindVariable(None, False)
- val3 = frame.FindValue(None, lldb.eValueTypeVariableGlobal)
- if self.TraceOn():
- print("val1:", val1)
- print("val2:", val2)
-
- frame.EvaluateExpression(None)
-
- @add_test_categories(['pyapi'])
- def test_frame_api_IsEqual(self):
- """Exercise SBFrame API IsEqual."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
-
- thread = process.GetThreadAtIndex(0)
- self.assertTrue(thread)
-
- frameEntered = thread.GetFrameAtIndex(0)
- if self.TraceOn():
- print(frameEntered)
- lldbutil.print_stacktrace(thread)
- self.assertTrue(frameEntered)
-
- # Doing two step overs while still inside c().
- thread.StepOver()
- thread.StepOver()
- self.assertTrue(thread)
- frameNow = thread.GetFrameAtIndex(0)
- if self.TraceOn():
- print(frameNow)
- lldbutil.print_stacktrace(thread)
- self.assertTrue(frameNow)
-
- # The latest two frames are considered equal.
- self.assertTrue(frameEntered.IsEqual(frameNow))
-
- # Now let's step out of frame c().
- thread.StepOutOfFrame(frameNow)
- frameOutOfC = thread.GetFrameAtIndex(0)
- if self.TraceOn():
- print(frameOutOfC)
- lldbutil.print_stacktrace(thread)
- self.assertTrue(frameOutOfC)
-
- # The latest two frames should not be equal.
- self.assertFalse(frameOutOfC.IsEqual(frameNow))
Removed: lldb/trunk/test/python_api/frame/inlines/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/inlines/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/inlines/Makefile (original)
+++ lldb/trunk/test/python_api/frame/inlines/Makefile (removed)
@@ -1,9 +0,0 @@
-LEVEL = ../../../make
-
-C_SOURCES := inlines.c
-
-ifneq (,$(findstring icc,$(CC)))
- CFLAGS += -debug inline-debug-info
-endif
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py (original)
+++ lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py (removed)
@@ -1,78 +0,0 @@
-"""
-Testlldb Python SBFrame APIs IsInlined() and GetFunctionName().
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class InlinedFrameAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.source = 'inlines.c'
- self.first_stop = line_number(self.source, '// This should correspond to the first break stop.')
- self.second_stop = line_number(self.source, '// This should correspond to the second break stop.')
-
- @add_test_categories(['pyapi'])
- def test_stop_at_outer_inline(self):
- """Exercise SBFrame.IsInlined() and SBFrame.GetFunctionName()."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by the name of 'inner_inline'.
- breakpoint = target.BreakpointCreateByName('inner_inline', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() > 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
-
- import lldbutil
- stack_traces1 = lldbutil.print_stacktraces(process, string_buffer=True)
- if self.TraceOn():
- print("Full stack traces when first stopped on the breakpoint 'inner_inline':")
- print(stack_traces1)
-
- # The first breakpoint should correspond to an inlined call frame.
- # If it's an inlined call frame, expect to find, in the stack trace,
- # that there is a frame which corresponds to the following call site:
- #
- # outer_inline (argc);
- #
- frame0 = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
- if frame0.IsInlined():
- filename = frame0.GetLineEntry().GetFileSpec().GetFilename()
- self.assertTrue(filename == self.source)
- self.expect(stack_traces1, "First stop at %s:%d" % (self.source, self.first_stop), exe=False,
- substrs = ['%s:%d' % (self.source, self.first_stop)])
-
- # Expect to break again for the second time.
- process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- stack_traces2 = lldbutil.print_stacktraces(process, string_buffer=True)
- if self.TraceOn():
- print("Full stack traces when stopped on the breakpoint 'inner_inline' for the second time:")
- print(stack_traces2)
- self.expect(stack_traces2, "Second stop at %s:%d" % (self.source, self.second_stop), exe=False,
- substrs = ['%s:%d' % (self.source, self.second_stop)])
Removed: lldb/trunk/test/python_api/frame/inlines/inlines.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/inlines/inlines.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/inlines/inlines.c (original)
+++ lldb/trunk/test/python_api/frame/inlines/inlines.c (removed)
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include "inlines.h"
-
-#define INLINE_ME __inline__ __attribute__((always_inline))
-
-int
-not_inlined_2 (int input)
-{
- printf ("Called in not_inlined_2 with : %d.\n", input);
- return input;
-}
-
-int
-not_inlined_1 (int input)
-{
- printf ("Called in not_inlined_1 with %d.\n", input);
- return not_inlined_2(input);
-}
-
-INLINE_ME int
-inner_inline (int inner_input, int mod_value)
-{
- int inner_result;
- inner_result = inner_input % mod_value;
- printf ("Returning: %d.\n", inner_result);
- return not_inlined_1 (inner_result);
-}
-
-INLINE_ME int
-outer_inline (int outer_input)
-{
- int outer_result;
-
- outer_result = inner_inline (outer_input, outer_input % 3);
- return outer_result;
-}
-
-int
-main (int argc, char **argv)
-{
- printf ("Starting...\n");
-
- int (*func_ptr) (int);
- func_ptr = outer_inline;
-
- outer_inline (argc); // This should correspond to the first break stop.
-
- func_ptr (argc); // This should correspond to the second break stop.
-
- return 0;
-}
-
-
Removed: lldb/trunk/test/python_api/frame/inlines/inlines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/inlines/inlines.h?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/inlines/inlines.h (original)
+++ lldb/trunk/test/python_api/frame/inlines/inlines.h (removed)
@@ -1,4 +0,0 @@
-int inner_inline (int inner_input, int mod_value);
-int outer_inline (int outer_input);
-int not_inlined_2 (int input);
-int not_inlined_1 (int input);
Removed: lldb/trunk/test/python_api/frame/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/frame/main.c (original)
+++ lldb/trunk/test/python_api/frame/main.c (removed)
@@ -1,58 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API related to frames.
-
-int a(int, char);
-int b(int, char);
-int c(int, char);
-
-int a(int val, char ch)
-{
- int my_val = val;
- char my_ch = ch;
- printf("a(val=%d, ch='%c')\n", val, ch);
- if (val <= 1)
- return b(val+1, ch+1);
- else if (val >= 3)
- return c(val+1, ch+1);
-
- return val;
-}
-
-int b(int val, char ch)
-{
- int my_val = val;
- char my_ch = ch;
- printf("b(val=%d, ch='%c')\n", val, ch);
- return c(val+1, ch+1);
-}
-
-int c(int val, char ch)
-{
- int my_val = val;
- char my_ch = ch;
- printf("c(val=%d, ch='%c')\n", val, ch);
- return val + 3 + ch;
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1, 'A'); // a(1, 'A') -> b(2, 'B') -> c(3, 'C')
- printf("a(1, 'A') returns %d\n", A1);
-
- int B2 = b(2, 'B'); // b(2, 'B') -> c(3, 'C')
- printf("b(2, 'B') returns %d\n", B2);
-
- int A3 = a(3, 'A'); // a(3, 'A') -> c(4, 'B')
- printf("a(3, 'A') returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/function_symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/Makefile (original)
+++ lldb/trunk/test/python_api/function_symbol/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py (original)
+++ lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py (removed)
@@ -1,110 +0,0 @@
-"""
-Test retrieval of SBAddress from function/symbol, disassembly, and SBAddress APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class DisasmAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
-
- @add_test_categories(['pyapi'])
- def test(self):
- """Exercise getting SBAddress objects, disassembly, and SBAddress APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create the two breakpoints inside function 'a'.
- breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1)
- breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2)
- #print("breakpoint1:", breakpoint1)
- #print("breakpoint2:", breakpoint2)
- self.assertTrue(breakpoint1 and
- breakpoint1.GetNumLocations() == 1,
- VALID_BREAKPOINT)
- self.assertTrue(breakpoint2 and
- breakpoint2.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line1)
-
- address1 = lineEntry.GetStartAddress()
- #print("address1:", address1)
-
- # Now call SBTarget.ResolveSymbolContextForAddress() with address1.
- context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything)
-
- self.assertTrue(context1)
- if self.TraceOn():
- print("context1:", context1)
-
- # Continue the inferior, the breakpoint 2 should be hit.
- process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line2)
-
- # Verify that the symbol and the function has the same address range per function 'a'.
- symbol = context1.GetSymbol()
- function = frame0.GetFunction()
- self.assertTrue(symbol and function)
-
- disasm_output = lldbutil.disassemble(target, symbol)
- if self.TraceOn():
- print("symbol:", symbol)
- print("disassembly=>\n", disasm_output)
-
- disasm_output = lldbutil.disassemble(target, function)
- if self.TraceOn():
- print("function:", function)
- print("disassembly=>\n", disasm_output)
-
- sa1 = symbol.GetStartAddress()
- #print("sa1:", sa1)
- #print("sa1.GetFileAddress():", hex(sa1.GetFileAddress()))
- #ea1 = symbol.GetEndAddress()
- #print("ea1:", ea1)
- sa2 = function.GetStartAddress()
- #print("sa2:", sa2)
- #print("sa2.GetFileAddress():", hex(sa2.GetFileAddress()))
- #ea2 = function.GetEndAddress()
- #print("ea2:", ea2)
- self.assertTrue(sa1 and sa2 and sa1 == sa2,
- "The two starting addresses should be the same")
-
- from lldbutil import get_description
- desc1 = get_description(sa1)
- desc2 = get_description(sa2)
- self.assertTrue(desc1 and desc2 and desc1 == desc2,
- "SBAddress.GetDescription() API of sa1 and sa2 should return the same string")
Removed: lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py (original)
+++ lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py (removed)
@@ -1,80 +0,0 @@
-"""
-Test newly added SBSymbol and SBAddress APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class SymbolAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24778")
- def test(self):
- """Exercise some SBSymbol and SBAddress APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create the two breakpoints inside function 'a'.
- breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1)
- breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2)
- #print("breakpoint1:", breakpoint1)
- #print("breakpoint2:", breakpoint2)
- self.assertTrue(breakpoint1 and
- breakpoint1.GetNumLocations() == 1,
- VALID_BREAKPOINT)
- self.assertTrue(breakpoint2 and
- breakpoint2.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
- symbol_line1 = frame0.GetSymbol()
- # We should have a symbol type of code.
- self.assertTrue(symbol_line1.GetType() == lldb.eSymbolTypeCode)
- addr_line1 = symbol_line1.GetStartAddress()
- # And a section type of code, too.
- self.assertTrue(addr_line1.GetSection().GetSectionType() == lldb.eSectionTypeCode)
-
- # Continue the inferior, the breakpoint 2 should be hit.
- process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
- symbol_line2 = frame0.GetSymbol()
- # We should have a symbol type of code.
- self.assertTrue(symbol_line2.GetType() == lldb.eSymbolTypeCode)
- addr_line2 = symbol_line2.GetStartAddress()
- # And a section type of code, too.
- self.assertTrue(addr_line2.GetSection().GetSectionType() == lldb.eSectionTypeCode)
-
- # Now verify that both addresses point to the same module.
- if self.TraceOn():
- print("UUID:", addr_line1.GetModule().GetUUIDString())
- self.assertTrue(addr_line1.GetModule().GetUUIDString() == addr_line2.GetModule().GetUUIDString())
Removed: lldb/trunk/test/python_api/function_symbol/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/main.c (original)
+++ lldb/trunk/test/python_api/function_symbol/main.c (removed)
@@ -1,60 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python APIs SBTarget, SBFrame,
-// SBFunction, SBSymbol, and SBAddress.
-//
-// When stopped on breakppint 1, we can get the line entry using SBFrame API
-// SBFrame.GetLineEntry(). We'll get the start address for the line entry
-// with the SBAddress type, resolve the symbol context using the SBTarget API
-// SBTarget.ResolveSymbolContextForAddress() in order to get the SBSymbol.
-//
-// We then stop at breakpoint 2, get the SBFrame, and the SBFunction object.
-//
-// The address from calling GetStartAddress() on the symbol and the function
-// should point to the same address, and we also verify that.
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1) // Find the line number for breakpoint 1 here.
- val = b(val);
- else if (val >= 3)
- val = c(val);
-
- return val; // Find the line number for breakpoint 2 here.
-}
-
-int b(int val)
-{
- return c(val);
-}
-
-int c(int val)
-{
- return val + 3;
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1); // a(1) -> b(1) -> c(1)
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2); // b(2) -> c(2)
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3); // a(3) -> c(3)
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/hello_world/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/hello_world/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/hello_world/Makefile (original)
+++ lldb/trunk/test/python_api/hello_world/Makefile (removed)
@@ -1,7 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-# See TestHelloWorld.py, which specifies the executable name with a dictionary.
-EXE := hello_world
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/hello_world/TestHelloWorld.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/test/python_api/hello_world/TestHelloWorld.py (removed)
@@ -1,142 +0,0 @@
-"""Test Python APIs for target (launch and attach), breakpoint, and process."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-import time
-from lldbtest import *
-
-class HelloWorldTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Get the full path to our executable to be attached/debugged.
- self.exe = os.path.join(os.getcwd(), self.testMethodName)
- self.d = {'EXE': self.testMethodName}
- # Find a couple of the line numbers within main.c.
- self.line1 = line_number('main.c', '// Set break point at this line.')
- self.line2 = line_number('main.c', '// Waiting to be attached...')
-
- def tearDown(self):
- # Destroy process before TestBase.tearDown()
- self.dbg.GetSelectedTarget().GetProcess().Destroy()
- # Call super's tearDown().
- TestBase.tearDown(self)
-
- @add_test_categories(['pyapi'])
- def test_with_process_launch_api(self):
- """Create target, breakpoint, launch a process, and then kill it."""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
- target = self.dbg.CreateTarget(self.exe)
-
- breakpoint = target.BreakpointCreateByLocation("main.c", self.line1)
-
- # The default state after breakpoint creation should be enabled.
- self.assertTrue(breakpoint.IsEnabled(),
- "Breakpoint should be enabled after creation")
-
- breakpoint.SetEnabled(False)
- self.assertTrue(not breakpoint.IsEnabled(),
- "Breakpoint.SetEnabled(False) works")
-
- breakpoint.SetEnabled(True)
- self.assertTrue(breakpoint.IsEnabled(),
- "Breakpoint.SetEnabled(True) works")
-
- # rdar://problem/8364687
- # SBTarget.Launch() issue (or is there some race condition)?
-
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- # The following isn't needed anymore, rdar://8364687 is fixed.
- #
- # Apply some dances after LaunchProcess() in order to break at "main".
- # It only works sometimes.
- #self.breakAfterLaunch(process, "main")
-
- process = target.GetProcess()
- self.assertTrue(process, PROCESS_IS_VALID)
-
- thread = process.GetThreadAtIndex(0)
- if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
- from lldbutil import stop_reason_to_str
- self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
- stop_reason_to_str(thread.GetStopReason()))
-
- # The breakpoint should have a hit count of 1.
- self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24600")
- def test_with_attach_to_process_with_id_api(self):
- """Create target, spawn a process, and attach to it with process id."""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
- target = self.dbg.CreateTarget(self.exe)
-
- # Spawn a new process
- popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
- self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the subprocess time to start and wait for user input
- time.sleep(0.25)
-
- listener = lldb.SBListener("my.attach.listener")
- error = lldb.SBError()
- process = target.AttachToProcessWithID(listener, popen.pid, error)
-
- self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
-
- # Let's check the stack traces of the attached process.
- import lldbutil
- stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
- self.expect(stacktraces, exe=False,
- substrs = ['main.c:%d' % self.line2,
- '(int)argc=3'])
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24600")
- def test_with_attach_to_process_with_name_api(self):
- """Create target, spawn a process, and attach to it with process name."""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
- target = self.dbg.CreateTarget(self.exe)
-
- # Spawn a new process
- popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
- self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the subprocess time to start and wait for user input
- time.sleep(0.25)
-
- listener = lldb.SBListener("my.attach.listener")
- error = lldb.SBError()
- # Pass 'False' since we don't want to wait for new instance of "hello_world" to be launched.
- name = os.path.basename(self.exe)
-
- # While we're at it, make sure that passing a None as the process name
- # does not hang LLDB.
- target.AttachToProcessWithName(listener, None, False, error)
- # Also boundary condition test ConnectRemote(), too.
- target.ConnectRemote(listener, None, None, error)
-
- process = target.AttachToProcessWithName(listener, name, False, error)
-
- self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
-
- # Verify that after attach, our selected target indeed matches name.
- self.expect(self.dbg.GetSelectedTarget().GetExecutable().GetFilename(), exe=False,
- startstr = name)
-
- # Let's check the stack traces of the attached process.
- import lldbutil
- stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
- self.expect(stacktraces, exe=False,
- substrs = ['main.c:%d' % self.line2,
- '(int)argc=3'])
Removed: lldb/trunk/test/python_api/hello_world/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/hello_world/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/hello_world/main.c (original)
+++ lldb/trunk/test/python_api/hello_world/main.c (removed)
@@ -1,35 +0,0 @@
-#include <stdio.h>
-
-#if defined(__linux__)
-#include <sys/prctl.h>
-#endif
-
-int main(int argc, char const *argv[]) {
-
-#if defined(__linux__)
- // Immediately enable any ptracer so that we can allow the stub attach
- // operation to succeed. Some Linux kernels are locked down so that
- // only an ancestor process can be a ptracer of a process. This disables that
- // restriction. Without it, attach-related stub tests will fail.
-#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY)
- int prctl_result;
-
- // For now we execute on best effort basis. If this fails for
- // some reason, so be it.
- prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
- (void) prctl_result;
-#endif
-#endif
-
- printf("Hello world.\n"); // Set break point at this line.
- if (argc == 1)
- return 0;
-
- // Waiting to be attached by the debugger, otherwise.
- char line[100];
- while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached...
- printf("input line=>%s\n", line);
- }
-
- printf("Exiting now\n");
-}
Removed: lldb/trunk/test/python_api/interpreter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/interpreter/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/interpreter/Makefile (original)
+++ lldb/trunk/test/python_api/interpreter/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py (original)
+++ lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py (removed)
@@ -1,73 +0,0 @@
-"""Test the SBCommandInterpreter APIs."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os
-import lldb
-from lldbtest import *
-
-class CommandInterpreterAPICase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break on inside main.cpp.
- self.line = line_number('main.c', 'Hello world.')
-
- @add_test_categories(['pyapi'])
- def test_with_process_launch_api(self):
- """Test the SBCommandInterpreter APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Retrieve the associated command interpreter from our debugger.
- ci = self.dbg.GetCommandInterpreter()
- self.assertTrue(ci, VALID_COMMAND_INTERPRETER)
-
- # Exercise some APIs....
-
- self.assertTrue(ci.HasCommands())
- self.assertTrue(ci.HasAliases())
- self.assertTrue(ci.HasAliasOptions())
- self.assertTrue(ci.CommandExists("breakpoint"))
- self.assertTrue(ci.CommandExists("target"))
- self.assertTrue(ci.CommandExists("platform"))
- self.assertTrue(ci.AliasExists("file"))
- self.assertTrue(ci.AliasExists("run"))
- self.assertTrue(ci.AliasExists("bt"))
-
- res = lldb.SBCommandReturnObject()
- ci.HandleCommand("breakpoint set -f main.c -l %d" % self.line, res)
- self.assertTrue(res.Succeeded())
- ci.HandleCommand("process launch", res)
- self.assertTrue(res.Succeeded())
-
- # Boundary conditions should not crash lldb!
- self.assertFalse(ci.CommandExists(None))
- self.assertFalse(ci.AliasExists(None))
- ci.HandleCommand(None, res)
- self.assertFalse(res.Succeeded())
- res.AppendMessage("Just appended a message.")
- res.AppendMessage(None)
- if self.TraceOn():
- print(res)
-
- process = ci.GetProcess()
- self.assertTrue(process)
-
- import lldbutil
- if process.GetState() != lldb.eStateStopped:
- self.fail("Process should be in the 'stopped' state, "
- "instead the actual state is: '%s'" %
- lldbutil.state_type_to_str(process.GetState()))
-
- if self.TraceOn():
- lldbutil.print_stacktraces(process)
Removed: lldb/trunk/test/python_api/interpreter/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/interpreter/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/interpreter/main.c (original)
+++ lldb/trunk/test/python_api/interpreter/main.c (removed)
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char const *argv[]) {
- printf("Hello world.\n");
- return 0;
-}
Removed: lldb/trunk/test/python_api/lldbutil/frame/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/frame/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/frame/Makefile (original)
+++ lldb/trunk/test/python_api/lldbutil/frame/Makefile (removed)
@@ -1,6 +0,0 @@
-LEVEL = ../../../make
-
-C_SOURCES := main.c
-MAKE_DSYM :=NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/lldbutil/frame/TestFrameUtils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/frame/TestFrameUtils.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/frame/TestFrameUtils.py (original)
+++ lldb/trunk/test/python_api/lldbutil/frame/TestFrameUtils.py (removed)
@@ -1,59 +0,0 @@
-"""
-Test utility functions for the frame object.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os
-import lldb
-from lldbtest import *
-
-class FrameUtilsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number('main.c',
- "// Find the line number here.")
-
- @add_test_categories(['pyapi'])
- def test_frame_utils(self):
- """Test utility functions for the frame object."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
-
- import lldbutil
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue (thread)
- frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0)
- frame1 = thread.GetFrameAtIndex(1)
- self.assertTrue (frame1)
- parent = lldbutil.get_parent_frame(frame0)
- self.assertTrue(parent and parent.GetFrameID() == frame1.GetFrameID())
- frame0_args = lldbutil.get_args_as_string(frame0)
- parent_args = lldbutil.get_args_as_string(parent)
- self.assertTrue(frame0_args and parent_args and "(int)val=1" in frame0_args)
- if self.TraceOn():
- lldbutil.print_stacktrace(thread)
- print("Current frame: %s" % frame0_args)
- print("Parent frame: %s" % parent_args)
Removed: lldb/trunk/test/python_api/lldbutil/frame/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/frame/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/frame/main.c (original)
+++ lldb/trunk/test/python_api/lldbutil/frame/main.c (removed)
@@ -1,47 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1)
- return b(val);
- else if (val >= 3)
- return c(val);
-
- return val;
-}
-
-int b(int val)
-{
- return c(val);
-}
-
-int c(int val)
-{
- return val + 3; // Find the line number here.
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1); // a(1) -> b(1) -> c(1)
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2); // b(2) -> c(2)
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3); // a(3) -> c(3)
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/lldbutil/iter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/Makefile (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../../make
-
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS
-ENABLE_THREADS := YES
-CXX_SOURCES := main.cpp
-MAKE_DSYM := NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/lldbutil/iter/TestLLDBIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/TestLLDBIterator.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/TestLLDBIterator.py (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/TestLLDBIterator.py (removed)
@@ -1,122 +0,0 @@
-"""
-Test the iteration protocol for some lldb container objects.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-
-class LLDBIteratorTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers to break inside main().
- self.line1 = line_number('main.cpp', '// Set break point at this line.')
- self.line2 = line_number('main.cpp', '// And that line.')
-
- @add_test_categories(['pyapi'])
- def test_lldb_iter_module(self):
- """Test module_iter works correctly for SBTarget -> SBModule."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
-
- from lldbutil import get_description
- yours = []
- for i in range(target.GetNumModules()):
- yours.append(target.GetModuleAtIndex(i))
- mine = []
- for m in target.module_iter():
- mine.append(m)
-
- self.assertTrue(len(yours) == len(mine))
- for i in range(len(yours)):
- if self.TraceOn():
- print("yours[%d]='%s'" % (i, get_description(yours[i])))
- print("mine[%d]='%s'" % (i, get_description(mine[i])))
- self.assertTrue(yours[i] == mine[i],
- "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))
-
- @add_test_categories(['pyapi'])
- def test_lldb_iter_breakpoint(self):
- """Test breakpoint_iter works correctly for SBTarget -> SBBreakpoint."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line2)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- self.assertTrue(target.GetNumBreakpoints() == 2)
-
- from lldbutil import get_description
- yours = []
- for i in range(target.GetNumBreakpoints()):
- yours.append(target.GetBreakpointAtIndex(i))
- mine = []
- for b in target.breakpoint_iter():
- mine.append(b)
-
- self.assertTrue(len(yours) == len(mine))
- for i in range(len(yours)):
- if self.TraceOn():
- print("yours[%d]='%s'" % (i, get_description(yours[i])))
- print("mine[%d]='%s'" % (i, get_description(mine[i])))
- self.assertTrue(yours[i] == mine[i],
- "ID of yours[{0}] and mine[{0}] matches".format(i))
-
- @add_test_categories(['pyapi'])
- def test_lldb_iter_frame(self):
- """Test iterator works correctly for SBProcess->SBThread->SBFrame."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
-
- from lldbutil import print_stacktrace
- stopped_due_to_breakpoint = False
- for thread in process:
- if self.TraceOn():
- print_stacktrace(thread)
- ID = thread.GetThreadID()
- if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
- stopped_due_to_breakpoint = True
- for frame in thread:
- self.assertTrue(frame.GetThread().GetThreadID() == ID)
- if self.TraceOn():
- print(frame)
-
- self.assertTrue(stopped_due_to_breakpoint)
Removed: lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py (removed)
@@ -1,94 +0,0 @@
-"""
-Test the iteration protocol for frame registers.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-
-class RegistersIteratorTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line1 = line_number('main.cpp', '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows # Test crashes
- def test_iter_registers(self):
- """Test iterator works correctly for lldbutil.iter_registers()."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
-
- import lldbutil
- for thread in process:
- if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
- for frame in thread:
- # Dump the registers of this frame using lldbutil.get_GPRs() and friends.
- if self.TraceOn():
- print(frame)
-
- REGs = lldbutil.get_GPRs(frame)
- num = len(REGs)
- if self.TraceOn():
- print("\nNumber of general purpose registers: %d" % num)
- for reg in REGs:
- self.assertTrue(reg)
- if self.TraceOn():
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
-
- REGs = lldbutil.get_FPRs(frame)
- num = len(REGs)
- if self.TraceOn():
- print("\nNumber of floating point registers: %d" % num)
- for reg in REGs:
- self.assertTrue(reg)
- if self.TraceOn():
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
-
- REGs = lldbutil.get_ESRs(frame)
- if self.platformIsDarwin():
- num = len(REGs)
- if self.TraceOn():
- print("\nNumber of exception state registers: %d" % num)
- for reg in REGs:
- self.assertTrue(reg)
- if self.TraceOn():
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
- else:
- self.assertIsNone(REGs)
-
- # And these should also work.
- for kind in ["General Purpose Registers",
- "Floating Point Registers"]:
- REGs = lldbutil.get_registers(frame, kind)
- self.assertTrue(REGs)
-
- REGs = lldbutil.get_registers(frame, "Exception State Registers")
- if self.platformIsDarwin():
- self.assertIsNotNone(REGs)
- else:
- self.assertIsNone(REGs)
-
- # We've finished dumping the registers for frame #0.
- break
Removed: lldb/trunk/test/python_api/lldbutil/iter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/main.cpp (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/main.cpp (removed)
@@ -1,134 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// C includes
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-// C++ includes
-#include <chrono>
-#include <mutex>
-#include <random>
-#include <thread>
-
-std::thread g_thread_1;
-std::thread g_thread_2;
-std::thread g_thread_3;
-std::mutex g_mask_mutex;
-
-typedef enum {
- eGet,
- eAssign,
- eClearBits
-} MaskAction;
-
-uint32_t mask_access (MaskAction action, uint32_t mask = 0);
-
-uint32_t
-mask_access (MaskAction action, uint32_t mask)
-{
- static uint32_t g_mask = 0;
-
- std::lock_guard<std::mutex> lock(g_mask_mutex);
- switch (action)
- {
- case eGet:
- break;
-
- case eAssign:
- g_mask |= mask;
- break;
-
- case eClearBits:
- g_mask &= ~mask;
- break;
- }
- return g_mask;
-}
-
-void *
-thread_func (void *arg)
-{
- uint32_t thread_index = *((uint32_t *)arg);
- uint32_t thread_mask = (1u << (thread_index));
- printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
-
- std::default_random_engine generator;
- std::uniform_int_distribution<int> distribution(0, 3000000);
-
- while (mask_access(eGet) & thread_mask)
- {
- // random micro second sleep from zero to 3 seconds
- int usec = distribution(generator);
- printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
-
- std::chrono::microseconds duration(usec);
- std::this_thread::sleep_for(duration);
- printf ("%s (thread = %u) after usleep ...\n", __FUNCTION__, thread_index); // Set break point at this line.
- }
- printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
- return NULL;
-}
-
-
-int main (int argc, char const *argv[])
-{
- uint32_t thread_index_1 = 1;
- uint32_t thread_index_2 = 2;
- uint32_t thread_index_3 = 3;
- uint32_t thread_mask_1 = (1u << thread_index_1);
- uint32_t thread_mask_2 = (1u << thread_index_2);
- uint32_t thread_mask_3 = (1u << thread_index_3);
-
- // Make a mask that will keep all threads alive
- mask_access (eAssign, thread_mask_1 | thread_mask_2 | thread_mask_3); // And that line.
-
- // Create 3 threads
- g_thread_1 = std::thread(thread_func, (void*)&thread_index_1);
- g_thread_2 = std::thread(thread_func, (void*)&thread_index_2);
- g_thread_3 = std::thread(thread_func, (void*)&thread_index_3);
-
- char line[64];
- while (mask_access(eGet) != 0)
- {
- printf ("Enter thread index to kill or ENTER for all:\n");
- fflush (stdout);
- // Kill threads by index, or ENTER for all threads
-
- if (fgets (line, sizeof(line), stdin))
- {
- if (line[0] == '\n' || line[0] == '\r' || line[0] == '\0')
- {
- printf ("Exiting all threads...\n");
- break;
- }
- int32_t index = strtoul (line, NULL, 0);
- switch (index)
- {
- case 1: mask_access (eClearBits, thread_mask_1); break;
- case 2: mask_access (eClearBits, thread_mask_2); break;
- case 3: mask_access (eClearBits, thread_mask_3); break;
- }
- continue;
- }
-
- break;
- }
-
- // Clear all thread bits to they all exit
- mask_access (eClearBits, UINT32_MAX);
-
- // Join all of our threads
- g_thread_1.join();
- g_thread_2.join();
- g_thread_3.join();
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/lldbutil/process/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/process/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/process/Makefile (original)
+++ lldb/trunk/test/python_api/lldbutil/process/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../../make
-
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS
-ENABLE_THREADS := YES
-CXX_SOURCES := main.cpp
-MAKE_DSYM :=NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/lldbutil/process/TestPrintStackTraces.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/process/TestPrintStackTraces.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/process/TestPrintStackTraces.py (original)
+++ lldb/trunk/test/python_api/lldbutil/process/TestPrintStackTraces.py (removed)
@@ -1,52 +0,0 @@
-"""
-Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-
-class ThreadsStackTracesTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number('main.cpp', '// Set break point at this line.')
-
- @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"]) # We are unable to produce a backtrace of the main thread when the thread is blocked in fgets
- @expectedFailureWindows("llvm.org/pr24778")
- @add_test_categories(['pyapi'])
- def test_stack_traces(self):
- """Test SBprocess and SBThread APIs with printing of the stack traces."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
-
- import lldbutil
- if process.GetState() != lldb.eStateStopped:
- self.fail("Process should be in the 'stopped' state, "
- "instead the actual state is: '%s'" %
- lldbutil.state_type_to_str(process.GetState()))
-
- stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
- self.expect(stacktraces, exe=False,
- substrs = ['(int)argc=3'])
Removed: lldb/trunk/test/python_api/lldbutil/process/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/process/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/process/main.cpp (original)
+++ lldb/trunk/test/python_api/lldbutil/process/main.cpp (removed)
@@ -1,136 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// C includes
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-// C++ includes
-#include <chrono>
-#include <mutex>
-#include <random>
-#include <thread>
-
-std::thread g_thread_1;
-std::thread g_thread_2;
-std::thread g_thread_3;
-std::mutex g_mask_mutex;
-
-typedef enum {
- eGet,
- eAssign,
- eClearBits
-} MaskAction;
-
-uint32_t mask_access (MaskAction action, uint32_t mask = 0);
-
-uint32_t
-mask_access (MaskAction action, uint32_t mask)
-{
- static uint32_t g_mask = 0;
-
- std::lock_guard<std::mutex> lock(g_mask_mutex);
- switch (action)
- {
- case eGet:
- break;
-
- case eAssign:
- g_mask |= mask;
- break;
-
- case eClearBits:
- g_mask &= ~mask;
- break;
- }
- return g_mask;
-}
-
-void *
-thread_func (void *arg)
-{
- uint32_t thread_index = *((uint32_t *)arg);
- uint32_t thread_mask = (1u << (thread_index));
- printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
-
- std::default_random_engine generator;
- std::uniform_int_distribution<int> distribution(0, 3000000);
-
- while (mask_access(eGet) & thread_mask)
- {
- // random micro second sleep from zero to 3 seconds
- int usec = distribution(generator);
-
- printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
- std::chrono::microseconds duration(usec);
- std::this_thread::sleep_for(duration);
- printf ("%s (thread = %u) after usleep ...\n", __FUNCTION__, thread_index); // Set break point at this line.
- }
- printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
- return NULL;
-}
-
-
-int main (int argc, char const *argv[])
-{
- int err;
- void *thread_result = NULL;
- uint32_t thread_index_1 = 1;
- uint32_t thread_index_2 = 2;
- uint32_t thread_index_3 = 3;
- uint32_t thread_mask_1 = (1u << thread_index_1);
- uint32_t thread_mask_2 = (1u << thread_index_2);
- uint32_t thread_mask_3 = (1u << thread_index_3);
-
- // Make a mask that will keep all threads alive
- mask_access (eAssign, thread_mask_1 | thread_mask_2 | thread_mask_3); // And that line.
-
- // Create 3 threads
- g_thread_1 = std::thread(thread_func, (void*)&thread_index_1);
- g_thread_2 = std::thread(thread_func, (void*)&thread_index_2);
- g_thread_3 = std::thread(thread_func, (void*)&thread_index_3);
-
- char line[64];
- while (mask_access(eGet) != 0)
- {
- printf ("Enter thread index to kill or ENTER for all:\n");
- fflush (stdout);
- // Kill threads by index, or ENTER for all threads
-
- if (fgets (line, sizeof(line), stdin))
- {
- if (line[0] == '\n' || line[0] == '\r' || line[0] == '\0')
- {
- printf ("Exiting all threads...\n");
- break;
- }
- int32_t index = strtoul (line, NULL, 0);
- switch (index)
- {
- case 1: mask_access (eClearBits, thread_mask_1); break;
- case 2: mask_access (eClearBits, thread_mask_2); break;
- case 3: mask_access (eClearBits, thread_mask_3); break;
- }
- continue;
- }
-
- break;
- }
-
- // Clear all thread bits to they all exit
- mask_access (eClearBits, UINT32_MAX);
-
- // Join all of our threads
- g_thread_1.join();
- g_thread_2.join();
- g_thread_3.join();
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/module_section/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/module_section/Makefile (original)
+++ lldb/trunk/test/python_api/module_section/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../make
-
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS
-ENABLE_THREADS := YES
-CXX_SOURCES := main.cpp b.cpp c.cpp
-MAKE_DSYM :=NO
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/module_section/TestModuleAndSection.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/TestModuleAndSection.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/module_section/TestModuleAndSection.py (original)
+++ lldb/trunk/test/python_api/module_section/TestModuleAndSection.py (removed)
@@ -1,127 +0,0 @@
-"""
-Test some SBModule and SBSection APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-from lldbutil import symbol_type_to_str
-
-class ModuleAndSectionAPIsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_module_and_section(self):
- """Test module and section APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.assertTrue(target.GetNumModules() > 0)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print("Number of modules for the target: %d" % target.GetNumModules())
- for module in target.module_iter():
- print(module)
-
- # Get the executable module at index 0.
- exe_module = target.GetModuleAtIndex(0)
-
- print("Exe module: %s" % str(exe_module))
- print("Number of sections: %d" % exe_module.GetNumSections())
- INDENT = ' ' * 4
- INDENT2 = INDENT * 2
- for sec in exe_module.section_iter():
- print(sec)
- print(INDENT + "Number of subsections: %d" % sec.GetNumSubSections())
- if sec.GetNumSubSections() == 0:
- for sym in exe_module.symbol_in_section_iter(sec):
- print(INDENT + str(sym))
- print(INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
- else:
- for subsec in sec:
- print(INDENT + str(subsec))
- # Now print the symbols belonging to the subsection....
- for sym in exe_module.symbol_in_section_iter(subsec):
- print(INDENT2 + str(sym))
- print(INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
-
- @add_test_categories(['pyapi'])
- def test_module_and_section_boundary_condition(self):
- """Test module and section APIs by passing None when it expects a Python string."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.assertTrue(target.GetNumModules() > 0)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print("Number of modules for the target: %d" % target.GetNumModules())
- for module in target.module_iter():
- print(module)
-
- # Get the executable module at index 0.
- exe_module = target.GetModuleAtIndex(0)
-
- print("Exe module: %s" % str(exe_module))
- print("Number of sections: %d" % exe_module.GetNumSections())
-
- # Boundary condition testings. Should not crash lldb!
- exe_module.FindFirstType(None)
- exe_module.FindTypes(None)
- exe_module.FindGlobalVariables(target, None, 1)
- exe_module.FindFunctions(None, 0)
- exe_module.FindSection(None)
-
- # Get the section at index 1.
- if exe_module.GetNumSections() > 1:
- sec1 = exe_module.GetSectionAtIndex(1)
- print(sec1)
- else:
- sec1 = None
-
- if sec1:
- sec1.FindSubSection(None)
-
- @add_test_categories(['pyapi'])
- def test_module_compile_unit_iter(self):
- """Test module's compile unit iterator APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.assertTrue(target.GetNumModules() > 0)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print("Number of modules for the target: %d" % target.GetNumModules())
- for module in target.module_iter():
- print(module)
-
- # Get the executable module at index 0.
- exe_module = target.GetModuleAtIndex(0)
-
- print("Exe module: %s" % str(exe_module))
- print("Number of compile units: %d" % exe_module.GetNumCompileUnits())
- INDENT = ' ' * 4
- INDENT2 = INDENT * 2
- for cu in exe_module.compile_unit_iter():
- print(cu)
-
Removed: lldb/trunk/test/python_api/module_section/b.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/b.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/module_section/b.cpp (original)
+++ lldb/trunk/test/python_api/module_section/b.cpp (removed)
@@ -1,3 +0,0 @@
-int b_function(int input) {
- return input * 2;
-}
Removed: lldb/trunk/test/python_api/module_section/c.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/c.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/module_section/c.cpp (original)
+++ lldb/trunk/test/python_api/module_section/c.cpp (removed)
@@ -1,3 +0,0 @@
-int c_function(int input) {
- return input * 3;
-}
Removed: lldb/trunk/test/python_api/module_section/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/module_section/main.cpp (original)
+++ lldb/trunk/test/python_api/module_section/main.cpp (removed)
@@ -1,136 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// C includes
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-// C++ includes
-#include <chrono>
-#include <mutex>
-#include <random>
-#include <thread>
-
-std::thread g_thread_1;
-std::thread g_thread_2;
-std::thread g_thread_3;
-std::mutex g_mask_mutex;
-
-typedef enum {
- eGet,
- eAssign,
- eClearBits
-} MaskAction;
-
-uint32_t mask_access (MaskAction action, uint32_t mask = 0);
-
-uint32_t
-mask_access (MaskAction action, uint32_t mask)
-{
- static uint32_t g_mask = 0;
-
- std::lock_guard<std::mutex> lock(g_mask_mutex);
- switch (action)
- {
- case eGet:
- break;
-
- case eAssign:
- g_mask |= mask;
- break;
-
- case eClearBits:
- g_mask &= ~mask;
- break;
- }
- return g_mask;
-}
-
-void *
-thread_func (void *arg)
-{
- uint32_t thread_index = *((uint32_t *)arg);
- uint32_t thread_mask = (1u << (thread_index));
- printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
-
- std::default_random_engine generator;
- std::uniform_int_distribution<int> distribution(0, 3000000);
-
- while (mask_access(eGet) & thread_mask)
- {
- // random micro second sleep from zero to 3 seconds
- int usec = distribution(generator);
-
- printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
- std::chrono::microseconds duration(usec);
- std::this_thread::sleep_for(duration);
- printf ("%s (thread = %u) after usleep ...\n", __FUNCTION__, thread_index); // Set break point at this line.
- }
- printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
- return NULL;
-}
-
-
-int main (int argc, char const *argv[])
-{
- int err;
- void *thread_result = NULL;
- uint32_t thread_index_1 = 1;
- uint32_t thread_index_2 = 2;
- uint32_t thread_index_3 = 3;
- uint32_t thread_mask_1 = (1u << thread_index_1);
- uint32_t thread_mask_2 = (1u << thread_index_2);
- uint32_t thread_mask_3 = (1u << thread_index_3);
-
- // Make a mask that will keep all threads alive
- mask_access (eAssign, thread_mask_1 | thread_mask_2 | thread_mask_3); // And that line.
-
- // Create 3 threads
- g_thread_1 = std::thread(thread_func, (void*)&thread_index_1);
- g_thread_2 = std::thread(thread_func, (void*)&thread_index_2);
- g_thread_3 = std::thread(thread_func, (void*)&thread_index_3);
-
- char line[64];
- while (mask_access(eGet) != 0)
- {
- printf ("Enter thread index to kill or ENTER for all:\n");
- fflush (stdout);
- // Kill threads by index, or ENTER for all threads
-
- if (fgets (line, sizeof(line), stdin))
- {
- if (line[0] == '\n' || line[0] == '\r' || line[0] == '\0')
- {
- printf ("Exiting all threads...\n");
- break;
- }
- int32_t index = strtoul (line, NULL, 0);
- switch (index)
- {
- case 1: mask_access (eClearBits, thread_mask_1); break;
- case 2: mask_access (eClearBits, thread_mask_2); break;
- case 3: mask_access (eClearBits, thread_mask_3); break;
- }
- continue;
- }
-
- break;
- }
-
- // Clear all thread bits to they all exit
- mask_access (eClearBits, UINT32_MAX);
-
- // Join all of our threads
- g_thread_1.join();
- g_thread_2.join();
- g_thread_3.join();
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/objc_type/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/objc_type/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/objc_type/Makefile (original)
+++ lldb/trunk/test/python_api/objc_type/Makefile (removed)
@@ -1,9 +0,0 @@
-LEVEL = ../../make
-
-OBJC_SOURCES := main.m
-
-CFLAGS_EXTRAS += -w
-
-include $(LEVEL)/Makefile.rules
-
-LDFLAGS += -framework Cocoa
Removed: lldb/trunk/test/python_api/objc_type/TestObjCType.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/objc_type/TestObjCType.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/objc_type/TestObjCType.py (original)
+++ lldb/trunk/test/python_api/objc_type/TestObjCType.py (removed)
@@ -1,63 +0,0 @@
-"""
-Test SBType for ObjC classes.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class ObjCSBTypeTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- self.line = line_number("main.m", '// Break at this line')
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test(self):
- """Test SBType for ObjC classes."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation("main.m", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
-
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
-
- aBar = self.frame().FindVariable("aBar")
- aBarType = aBar.GetType()
- self.assertTrue(aBarType.IsValid(), "Bar should be a valid data type")
- self.assertTrue(aBarType.GetName() == "Bar *", "Bar has the right name")
-
- self.assertTrue(aBarType.GetNumberOfDirectBaseClasses() == 1, "Bar has a superclass")
- aFooType = aBarType.GetDirectBaseClassAtIndex(0)
-
- self.assertTrue(aFooType.IsValid(), "Foo should be a valid data type")
- self.assertTrue(aFooType.GetName() == "Foo", "Foo has the right name")
-
- self.assertTrue(aBarType.GetNumberOfFields() == 1, "Bar has a field")
- aBarField = aBarType.GetFieldAtIndex(0)
-
- self.assertTrue(aBarField.GetName() == "_iVar", "The field has the right name")
Removed: lldb/trunk/test/python_api/objc_type/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/objc_type/main.m?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/objc_type/main.m (original)
+++ lldb/trunk/test/python_api/objc_type/main.m (removed)
@@ -1,52 +0,0 @@
-//===-- main.m ------------------------------------------------*- ObjC -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#import <Cocoa/Cocoa.h>
-
- at interface Foo: NSObject
-{}
-- (id) init;
- at end
-
- at interface Bar: Foo
-{
- int _iVar;
-}
-- (id) init;
- at end
-
- at implementation Foo
-
-- (id) init
-{
- self = [super init];
- return self;
-}
-
- at end
-
- at implementation Bar
-
-- (id) init
-{
- self = [super init];
- if (self)
- self->_iVar = 5;
- return self;
-}
-
- at end
-
-int main()
-{
- Bar* aBar = [Bar new];
- id nothing = [aBar noSuchSelector]; // Break at this line
- return 0;
-}
-
Removed: lldb/trunk/test/python_api/process/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/Makefile (original)
+++ lldb/trunk/test/python_api/process/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/TestProcessAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/trunk/test/python_api/process/TestProcessAPI.py (removed)
@@ -1,289 +0,0 @@
-"""
-Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-from lldbutil import get_stopped_thread, state_type_to_str
-from lldbtest import *
-
-class ProcessAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
-
- @add_test_categories(['pyapi'])
- def test_read_memory(self):
- """Test Python SBProcess.ReadMemory() API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- frame = thread.GetFrameAtIndex(0)
-
- # Get the SBValue for the global variable 'my_char'.
- val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
-
- # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and
- # expect to get a Python string as the result object!
- error = lldb.SBError()
- self.assertFalse(val.TypeIsPointerType())
- content = process.ReadMemory(val.AddressOf().GetValueAsUnsigned(), 1, error)
- if not error.Success():
- self.fail("SBProcess.ReadMemory() failed")
- if self.TraceOn():
- print("memory content:", content)
-
- self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'x'",
- exe=False,
- startstr = 'x')
-
- # Read (char *)my_char_ptr.
- val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
- cstring = process.ReadCStringFromMemory(val.GetValueAsUnsigned(), 256, error)
- if not error.Success():
- self.fail("SBProcess.ReadCStringFromMemory() failed")
- if self.TraceOn():
- print("cstring read is:", cstring)
-
- self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
- exe=False,
- startstr = 'Does it work?')
-
- # Get the SBValue for the global variable 'my_cstring'.
- val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
-
- # Due to the typemap magic (see lldb.swig), we pass in 256 to read at most 256 bytes
- # from the address, and expect to get a Python string as the result object!
- self.assertFalse(val.TypeIsPointerType())
- cstring = process.ReadCStringFromMemory(val.AddressOf().GetValueAsUnsigned(), 256, error)
- if not error.Success():
- self.fail("SBProcess.ReadCStringFromMemory() failed")
- if self.TraceOn():
- print("cstring read is:", cstring)
-
- self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
- exe=False,
- startstr = 'lldb.SBProcess.ReadCStringFromMemory() works!')
-
- # Get the SBValue for the global variable 'my_uint32'.
- val = frame.FindValue("my_uint32", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
-
- # Due to the typemap magic (see lldb.swig), we pass in 4 to read 4 bytes
- # from the address, and expect to get an int as the result!
- self.assertFalse(val.TypeIsPointerType())
- my_uint32 = process.ReadUnsignedFromMemory(val.AddressOf().GetValueAsUnsigned(), 4, error)
- if not error.Success():
- self.fail("SBProcess.ReadCStringFromMemory() failed")
- if self.TraceOn():
- print("uint32 read is:", my_uint32)
-
- if my_uint32 != 12345:
- self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
-
- @add_test_categories(['pyapi'])
- def test_write_memory(self):
- """Test Python SBProcess.WriteMemory() API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- frame = thread.GetFrameAtIndex(0)
-
- # Get the SBValue for the global variable 'my_char'.
- val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
-
- # If the variable does not have a load address, there's no sense continuing.
- if not val.GetLocation().startswith("0x"):
- return
-
- # OK, let's get the hex location of the variable.
- location = int(val.GetLocation(), 16)
-
- # The program logic makes the 'my_char' variable to have memory content as 'x'.
- # But we want to use the WriteMemory() API to assign 'a' to the variable.
-
- # Now use WriteMemory() API to write 'a' into the global variable.
- error = lldb.SBError()
- result = process.WriteMemory(location, 'a', error)
- if not error.Success() or result != 1:
- self.fail("SBProcess.WriteMemory() failed")
-
- # Read from the memory location. This time it should be 'a'.
- # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and
- # expect to get a Python string as the result object!
- content = process.ReadMemory(location, 1, error)
- if not error.Success():
- self.fail("SBProcess.ReadMemory() failed")
- if self.TraceOn():
- print("memory content:", content)
-
- self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'a'",
- exe=False,
- startstr = 'a')
-
- @add_test_categories(['pyapi'])
- def test_access_my_int(self):
- """Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- frame = thread.GetFrameAtIndex(0)
-
- # Get the SBValue for the global variable 'my_int'.
- val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
- self.DebugSBValue(val)
-
- # If the variable does not have a load address, there's no sense continuing.
- if not val.GetLocation().startswith("0x"):
- return
-
- # OK, let's get the hex location of the variable.
- location = int(val.GetLocation(), 16)
-
- # Note that the canonical from of the bytearray is little endian.
- from lldbutil import int_to_bytearray, bytearray_to_int
-
- byteSize = val.GetByteSize()
- bytes = int_to_bytearray(256, byteSize)
-
- byteOrder = process.GetByteOrder()
- if byteOrder == lldb.eByteOrderBig:
- bytes.reverse()
- elif byteOrder == lldb.eByteOrderLittle:
- pass
- else:
- # Neither big endian nor little endian? Return for now.
- # Add more logic here if we want to handle other types.
- return
-
- # The program logic makes the 'my_int' variable to have int type and value of 0.
- # But we want to use the WriteMemory() API to assign 256 to the variable.
-
- # Now use WriteMemory() API to write 256 into the global variable.
- new_value = str(bytes)
- error = lldb.SBError()
- result = process.WriteMemory(location, new_value, error)
- if not error.Success() or result != byteSize:
- self.fail("SBProcess.WriteMemory() failed")
-
- # Make sure that the val we got originally updates itself to notice the change:
- self.expect(val.GetValue(),
- "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
- exe=False,
- startstr = '256')
-
- # And for grins, get the SBValue for the global variable 'my_int' again, to make sure that also tracks the new value:
- val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
- self.expect(val.GetValue(),
- "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
- exe=False,
- startstr = '256')
-
- # Now read the memory content. The bytearray should have (byte)1 as the second element.
- content = process.ReadMemory(location, byteSize, error)
- if not error.Success():
- self.fail("SBProcess.ReadMemory() failed")
-
- # Use "ascii" as the encoding because each element of 'content' is in the range [0..255].
- new_bytes = bytearray(content, "ascii")
-
- # The bytearray_to_int utility function expects a little endian bytearray.
- if byteOrder == lldb.eByteOrderBig:
- new_bytes.reverse()
-
- new_value = bytearray_to_int(new_bytes, byteSize)
- if new_value != 256:
- self.fail("Memory content read from 'my_int' does not match (int)256")
-
- # Dump the memory content....
- if self.TraceOn():
- for i in new_bytes:
- print("byte:", i)
-
- @add_test_categories(['pyapi'])
- def test_remote_launch(self):
- """Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- if self.TraceOn():
- print("process state:", state_type_to_str(process.GetState()))
- self.assertTrue(process.GetState() != lldb.eStateConnected)
-
- error = lldb.SBError()
- success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
- self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected")
-
- @add_test_categories(['pyapi'])
- def test_get_num_supported_hardware_watchpoints(self):
- """Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- error = lldb.SBError();
- num = process.GetNumSupportedHardwareWatchpoints(error)
- if self.TraceOn() and error.Success():
- print("Number of supported hardware watchpoints: %d" % num)
-
Removed: lldb/trunk/test/python_api/process/io/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/io/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/io/Makefile (original)
+++ lldb/trunk/test/python_api/process/io/Makefile (removed)
@@ -1,6 +0,0 @@
-LEVEL = ../../../make
-
-C_SOURCES := main.c
-EXE := process_io
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/io/TestProcessIO.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/trunk/test/python_api/process/io/TestProcessIO.py (removed)
@@ -1,206 +0,0 @@
-"""Test Python APIs for process IO."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class ProcessIOTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Get the full path to our executable to be debugged.
- self.exe = os.path.join(os.getcwd(), "process_io")
- self.local_input_file = os.path.join(os.getcwd(), "input.txt")
- self.local_output_file = os.path.join(os.getcwd(), "output.txt")
- self.local_error_file = os.path.join(os.getcwd(), "error.txt")
-
- self.input_file = os.path.join(self.get_process_working_directory(), "input.txt")
- self.output_file = os.path.join(self.get_process_working_directory(), "output.txt")
- self.error_file = os.path.join(self.get_process_working_directory(), "error.txt")
- self.lines = ["Line 1", "Line 2", "Line 3"]
-
- @skipIfWindows # stdio manipulation unsupported on Windows
- @add_test_categories(['pyapi'])
- def test_stdin_by_api(self):
- """Exercise SBProcess.PutSTDIN()."""
- self.build()
- self.create_target()
- self.run_process(True)
- output = self.process.GetSTDOUT(1000)
- self.check_process_output(output, output)
-
- @skipIfWindows # stdio manipulation unsupported on Windows
- @add_test_categories(['pyapi'])
- def test_stdin_redirection(self):
- """Exercise SBLaunchInfo::AddOpenFileAction() for STDIN without specifying STDOUT or STDERR."""
- self.build()
- self.create_target()
- self.redirect_stdin()
- self.run_process(False)
- output = self.process.GetSTDOUT(1000)
- self.check_process_output(output, output)
-
- @skipIfWindows # stdio manipulation unsupported on Windows
- @add_test_categories(['pyapi'])
- def test_stdout_redirection(self):
- """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT without specifying STDIN or STDERR."""
- self.build()
- self.create_target()
- self.redirect_stdout()
- self.run_process(True)
- output = self.read_output_file_and_delete()
- error = self.process.GetSTDOUT(1000)
- self.check_process_output(output, error)
-
- @skipIfWindows # stdio manipulation unsupported on Windows
- @add_test_categories(['pyapi'])
- def test_stderr_redirection(self):
- """Exercise SBLaunchInfo::AddOpenFileAction() for STDERR without specifying STDIN or STDOUT."""
- self.build()
- self.create_target()
- self.redirect_stderr()
- self.run_process(True)
- output = self.process.GetSTDOUT(1000)
- error = self.read_error_file_and_delete()
- self.check_process_output(output, error)
-
- @skipIfWindows # stdio manipulation unsupported on Windows
- @add_test_categories(['pyapi'])
- def test_stdout_stderr_redirection(self):
- """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN."""
- self.build()
- self.create_target()
- self.redirect_stdout()
- self.redirect_stderr()
- self.run_process(True)
- output = self.read_output_file_and_delete()
- error = self.read_error_file_and_delete()
- self.check_process_output(output, error)
-
- # target_file - path on local file system or remote file system if running remote
- # local_file - path on local system
- def read_file_and_delete(self, target_file, local_file):
- if lldb.remote_platform:
- self.runCmd('platform get-file "{remote}" "{local}"'.format(
- remote=target_file, local=local_file))
-
- self.assertTrue(os.path.exists(local_file), 'Make sure "{local}" file exists'.format(local=local_file))
- f = open(local_file, 'r')
- contents = f.read()
- f.close()
-
- #TODO: add 'platform delete-file' file command
- #if lldb.remote_platform:
- # self.runCmd('platform delete-file "{remote}"'.format(remote=target_file))
- os.unlink(local_file)
- return contents
-
- def read_output_file_and_delete(self):
- return self.read_file_and_delete(self.output_file, self.local_output_file)
-
- def read_error_file_and_delete(self):
- return self.read_file_and_delete(self.error_file, self.local_error_file)
-
- def create_target(self):
- '''Create the target and launch info that will be used by all tests'''
- self.target = self.dbg.CreateTarget(self.exe)
- self.launch_info = lldb.SBLaunchInfo([self.exe])
- self.launch_info.SetWorkingDirectory(self.get_process_working_directory())
-
- def redirect_stdin(self):
- '''Redirect STDIN (file descriptor 0) to use our input.txt file
-
- Make the input.txt file to use when redirecting STDIN, setup a cleanup action
- to delete the input.txt at the end of the test in case exceptions are thrown,
- and redirect STDIN in the launch info.'''
- f = open(self.local_input_file, 'w')
- for line in self.lines:
- f.write(line + "\n")
- f.close()
-
- if lldb.remote_platform:
- self.runCmd('platform put-file "{local}" "{remote}"'.format(
- local=self.local_input_file, remote=self.input_file))
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- os.unlink(self.local_input_file)
- #TODO: add 'platform delete-file' file command
- #if lldb.remote_platform:
- # self.runCmd('platform delete-file "{remote}"'.format(remote=self.input_file))
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
- self.launch_info.AddOpenFileAction(0, self.input_file, True, False);
-
- def redirect_stdout(self):
- '''Redirect STDOUT (file descriptor 1) to use our output.txt file'''
- self.launch_info.AddOpenFileAction(1, self.output_file, False, True);
-
- def redirect_stderr(self):
- '''Redirect STDERR (file descriptor 2) to use our error.txt file'''
- self.launch_info.AddOpenFileAction(2, self.error_file, False, True);
-
- def run_process(self, put_stdin):
- '''Run the process to completion and optionally put lines to STDIN via the API if "put_stdin" is True'''
- # Set the breakpoints
- self.breakpoint = self.target.BreakpointCreateBySourceRegex('Set breakpoint here', lldb.SBFileSpec("main.c"))
- self.assertTrue(self.breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- error = lldb.SBError()
- # This should launch the process and it should exit by the time we get back
- # because we have synchronous mode enabled
- self.process = self.target.Launch (self.launch_info, error)
-
- self.assertTrue(error.Success(), "Make sure process launched successfully")
- self.assertTrue(self.process, PROCESS_IS_VALID)
-
- if self.TraceOn():
- print("process launched.")
-
- # Frame #0 should be at our breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, self.breakpoint)
-
- self.assertTrue(len(threads) == 1)
- self.thread = threads[0]
- self.frame = self.thread.frames[0]
- self.assertTrue(self.frame, "Frame 0 is valid.")
-
- if self.TraceOn():
- print("process stopped at breakpoint, sending STDIN via LLDB API.")
-
- # Write data to stdin via the public API if we were asked to
- if put_stdin:
- for line in self.lines:
- self.process.PutSTDIN(line + "\n")
-
- # Let process continue so it will exit
- self.process.Continue()
- state = self.process.GetState()
- self.assertTrue(state == lldb.eStateExited, PROCESS_IS_VALID)
-
- def check_process_output (self, output, error):
- # Since we launched the process without specifying stdin/out/err,
- # a pseudo terminal is used for stdout/err, and we are satisfied
- # once "input line=>1" appears in stdout.
- # See also main.c.
- if self.TraceOn():
- print("output = '%s'" % output)
- print("error = '%s'" % error)
-
- for line in self.lines:
- check_line = 'input line to stdout: %s' % (line)
- self.assertTrue(check_line in output, "verify stdout line shows up in STDOUT")
- for line in self.lines:
- check_line = 'input line to stderr: %s' % (line)
- self.assertTrue(check_line in error, "verify stderr line shows up in STDERR")
Removed: lldb/trunk/test/python_api/process/io/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/io/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/io/main.c (original)
+++ lldb/trunk/test/python_api/process/io/main.c (removed)
@@ -1,19 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char const *argv[]) {
- printf("Hello world.\n"); // Set breakpoint here
- char line[100];
- if (fgets(line, sizeof(line), stdin)) {
- fprintf(stdout, "input line to stdout: %s", line);
- fprintf(stderr, "input line to stderr: %s", line);
- }
- if (fgets(line, sizeof(line), stdin)) {
- fprintf(stdout, "input line to stdout: %s", line);
- fprintf(stderr, "input line to stderr: %s", line);
- }
- if (fgets(line, sizeof(line), stdin)) {
- fprintf(stdout, "input line to stdout: %s", line);
- fprintf(stderr, "input line to stderr: %s", line);
- }
- printf("Exiting now\n");
-}
Removed: lldb/trunk/test/python_api/process/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/process/main.cpp (original)
+++ lldb/trunk/test/python_api/process/main.cpp (removed)
@@ -1,31 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdint.h>
-
-// This simple program is to test the lldb Python API related to process.
-
-char my_char = 'u';
-char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!";
-char *my_char_ptr = (char *)"Does it work?";
-uint32_t my_uint32 = 12345;
-int my_int = 0;
-
-int main (int argc, char const *argv[])
-{
- for (int i = 0; i < 3; ++i) {
- printf("my_char='%c'\n", my_char);
- ++my_char;
- }
-
- printf("after the loop: my_char='%c'\n", my_char); // 'my_char' should print out as 'x'.
-
- return 0; // Set break point at this line and check variable 'my_char'.
- // Use lldb Python API to set memory content for my_int and check the result.
-}
Removed: lldb/trunk/test/python_api/rdar-12481949/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/rdar-12481949/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/rdar-12481949/Makefile (original)
+++ lldb/trunk/test/python_api/rdar-12481949/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/rdar-12481949/Test-rdar-12481949.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/rdar-12481949/Test-rdar-12481949.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/rdar-12481949/Test-rdar-12481949.py (original)
+++ lldb/trunk/test/python_api/rdar-12481949/Test-rdar-12481949.py (removed)
@@ -1,54 +0,0 @@
-"""
-Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class Radar12481949DataFormatterTestCase(TestBase):
-
- # test for rdar://problem/12481949
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break at.
- self.line = line_number('main.cpp', '// Set break point at this line.')
-
- def test_with_run_command(self):
- """Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1."""
- self.build()
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- self.runCmd('type format delete hex', check=False)
- self.runCmd('type summary clear', check=False)
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() == -1, "GetValueAsSigned() says -1")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF, "GetValueAsSigned() does not say 0xFFFFFFFF")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFFFFFFFFFF, "GetValueAsSigned() does not say 0xFFFFFFFFFFFFFFFF")
-
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1, "GetValueAsUnsigned() does not say -1")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFFFFFFFFFF, "GetValueAsUnsigned() says 0xFFFFFFFFFFFFFFFF")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF, "GetValueAsUnsigned() does not say 0xFFFFFFFF")
Removed: lldb/trunk/test/python_api/rdar-12481949/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/rdar-12481949/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/rdar-12481949/main.cpp (original)
+++ lldb/trunk/test/python_api/rdar-12481949/main.cpp (removed)
@@ -1,17 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <stdio.h>
-#include <stdint.h>
-int main ()
-{
- int32_t myvar = -1;
- printf ("%d\n", myvar); // Set break point at this line.
- return myvar+1;
-}
Removed: lldb/trunk/test/python_api/sbdata/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbdata/Makefile (original)
+++ lldb/trunk/test/python_api/sbdata/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/TestSBData.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/test/python_api/sbdata/TestSBData.py (removed)
@@ -1,348 +0,0 @@
-"""Test the SBData APIs."""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os
-import lldb
-from lldbtest import *
-from math import fabs
-import lldbutil
-
-class SBDataAPICase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break on inside main.cpp.
- self.line = line_number('main.cpp', '// set breakpoint here')
-
- @add_test_categories(['pyapi'])
- def test_with_run_command(self):
- """Test the SBData APIs."""
- self.build()
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- target = self.dbg.GetSelectedTarget()
-
- process = target.GetProcess()
-
- thread = process.GetThreadAtIndex(0)
-
- frame = thread.GetSelectedFrame()
- if self.TraceOn():
- print(frame)
- foobar = frame.FindVariable('foobar')
- self.assertTrue(foobar.IsValid())
- if self.TraceOn():
- print(foobar)
-
- data = foobar.GetPointeeData(0, 2)
-
- if self.TraceOn():
- print(data)
-
- offset = 0
- error = lldb.SBError()
-
- self.assert_data(data.GetUnsignedInt32, offset, 1)
- offset += 4
- low = data.GetSignedInt16(error, offset)
- self.assertTrue(error.Success())
- offset += 2
- high = data.GetSignedInt16(error, offset)
- self.assertTrue(error.Success())
- offset += 2
- self.assertTrue ((low == 9 and high == 0) or (low == 0 and high == 9), 'foo[0].b == 9')
- self.assertTrue( fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[0].c == 3.14')
- self.assertTrue(error.Success())
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 8)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 5)
- offset += 4
-
- self.runCmd("n")
-
- offset = 16
-
- self.assert_data(data.GetUnsignedInt32, offset, 5)
-
- data = foobar.GetPointeeData(1, 1)
-
- offset = 0
-
- self.assert_data(data.GetSignedInt32, offset, 8)
- offset += 4
- self.assert_data(data.GetSignedInt32, offset, 7)
- offset += 8
- self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
- self.assertTrue(not error.Success())
- error.Clear() # clear the error for the next test
-
- star_foobar = foobar.Dereference()
- self.assertTrue(star_foobar.IsValid())
-
- data = star_foobar.GetData()
-
- if self.TraceOn():
- print(data)
-
- offset = 0
- self.assert_data(data.GetUnsignedInt32, offset, 1)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 9)
-
- foobar_addr = star_foobar.GetLoadAddress()
- foobar_addr += 12
-
- # http://llvm.org/bugs/show_bug.cgi?id=11579
- # lldb::SBValue::CreateValueFromAddress does not verify SBType::GetPointerType succeeds
- # This should not crash LLDB.
- nothing = foobar.CreateValueFromAddress("nothing", foobar_addr, star_foobar.GetType().GetBasicType(lldb.eBasicTypeInvalid))
-
- new_foobar = foobar.CreateValueFromAddress("f00", foobar_addr, star_foobar.GetType())
- self.assertTrue(new_foobar.IsValid())
- if self.TraceOn():
- print(new_foobar)
-
- data = new_foobar.GetData()
-
- if self.TraceOn():
- print(data)
-
- self.assertTrue(data.uint32[0] == 8, 'then foo[1].a == 8')
- self.assertTrue(data.uint32[1] == 7, 'then foo[1].b == 7')
- self.assertTrue(fabs(data.float[2] - 3.14) < 1, 'foo[1].c == 3.14') # exploiting that sizeof(uint32) == sizeof(float)
-
- self.runCmd("n")
-
- offset = 0
- self.assert_data(data.GetUnsignedInt32, offset, 8)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 7)
- offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[1].c == 3.14')
- self.assertTrue(error.Success())
-
- data = new_foobar.GetData()
-
- if self.TraceOn():
- print(data)
-
- offset = 0
- self.assert_data(data.GetUnsignedInt32, offset, 8)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 7)
- offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 6.28) < 1, 'foo[1].c == 6.28')
- self.assertTrue(error.Success())
-
- self.runCmd("n")
-
- barfoo = frame.FindVariable('barfoo')
-
- data = barfoo.GetData()
-
- if self.TraceOn():
- print(barfoo)
-
- if self.TraceOn():
- print(data)
-
- offset = 0
- self.assert_data(data.GetUnsignedInt32, offset, 1)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 2)
- offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 3) < 1, 'barfoo[0].c == 3')
- self.assertTrue(error.Success())
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 4)
- offset += 4
- self.assert_data(data.GetUnsignedInt32, offset, 5)
- offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 6) < 1, 'barfoo[1].c == 6')
- self.assertTrue(error.Success())
-
- new_object = barfoo.CreateValueFromData("new_object",data,barfoo.GetType().GetBasicType(lldb.eBasicTypeInt))
-
- if self.TraceOn():
- print(new_object)
-
- self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
-
- data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
- self.assertTrue(error.Success())
-
- data2 = lldb.SBData()
- data2.SetData(error, 'BCD', data.GetByteOrder(), data.GetAddressByteSize())
- self.assertTrue(error.Success())
-
- data.Append(data2)
-
- if self.TraceOn():
- print(data)
-
- # this breaks on EBCDIC
- offset = 0
- self.assert_data(data.GetUnsignedInt32, offset, 65)
- offset += 4
- self.assert_data(data.GetUnsignedInt8, offset, 66)
- offset += 1
- self.assert_data(data.GetUnsignedInt8, offset, 67)
- offset += 1
- self.assert_data(data.GetUnsignedInt8, offset, 68)
- offset += 1
-
- # check the new API calls introduced per LLVM llvm.org/prenhancement request
- # 11619 (Allow creating SBData values from arrays or primitives in Python)
-
- hello_str = "hello!"
- data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),hello_str)
- self.assertTrue(len(data2.uint8) == len(hello_str))
- self.assertTrue(data2.uint8[0] == 104, 'h == 104')
- self.assertTrue(data2.uint8[1] == 101, 'e == 101')
- self.assertTrue(data2.uint8[2] == 108, 'l == 108')
- self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
- self.assertTrue(data2.uint8[4] == 111, 'o == 111')
- self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
-
- uint_lists = [ [1,2,3,4,5], [int(i) for i in [1, 2, 3, 4, 5]] ]
- int_lists = [ [2, -2], [int(i) for i in [2, -2]] ]
-
- for l in uint_lists:
- data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assert_data(data2.GetUnsignedInt64, 0, 1)
- self.assert_data(data2.GetUnsignedInt64, 8, 2)
- self.assert_data(data2.GetUnsignedInt64, 16, 3)
- self.assert_data(data2.GetUnsignedInt64, 24, 4)
- self.assert_data(data2.GetUnsignedInt64, 32, 5)
-
- self.assertTrue(data2.uint64s == [1,2,3,4,5], 'read_data_helper failure: data2 == [1,2,3,4,5]')
-
- for l in int_lists:
- data2 = lldb.SBData.CreateDataFromSInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assertTrue(data2.sint32[0:2] == [2,-2], 'signed32 data2 = [2,-2]')
-
- data2.Append(lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), int_lists[0]))
- self.assert_data(data2.GetSignedInt32, 0, 2)
- self.assert_data(data2.GetSignedInt32, 4, -2)
- self.assertTrue(data2.sint64[1:3] == [2,-2], 'signed64 data2 = [2,-2]')
-
- for l in int_lists:
- data2 = lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assert_data(data2.GetSignedInt64, 0, 2)
- self.assert_data(data2.GetSignedInt64, 8, -2)
- self.assertTrue(data2.sint64[0:2] == [2,-2], 'signed64 data2 = [2,-2]')
-
- for l in uint_lists:
- data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assert_data(data2.GetUnsignedInt32,0, 1)
- self.assert_data(data2.GetUnsignedInt32,4, 2)
- self.assert_data(data2.GetUnsignedInt32,8, 3)
- self.assert_data(data2.GetUnsignedInt32,12, 4)
- self.assert_data(data2.GetUnsignedInt32,16, 5)
-
- bool_list = [True, True, False, False, True, False]
-
- data2 = lldb.SBData.CreateDataFromSInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.sint32[0:6] == [1, 1, 0, 0, 1, 0], 'signed32 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.uint32[0:6] == [1, 1, 0, 0, 1, 0], 'unsigned32 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.sint64[0:6] == [1, 1, 0, 0, 1, 0], 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.uint64[0:6] == [1, 1, 0, 0, 1, 0], 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromDoubleArray(process.GetByteOrder(),process.GetAddressByteSize(),[3.14,6.28,2.71])
- self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'double data2[0] = 3.14')
- self.assertTrue(error.Success())
- self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'double data2[1] = 6.28')
- self.assertTrue(error.Success())
- self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'double data2[2] = 2.71')
- self.assertTrue(error.Success())
-
- data2 = lldb.SBData()
-
- data2.SetDataFromCString(hello_str)
- self.assertTrue(len(data2.uint8) == len(hello_str))
- self.assert_data(data2.GetUnsignedInt8, 0, 104)
- self.assert_data(data2.GetUnsignedInt8, 1, 101)
- self.assert_data(data2.GetUnsignedInt8, 2, 108)
- self.assert_data(data2.GetUnsignedInt8, 3, 108)
- self.assert_data(data2.GetUnsignedInt8, 4, 111)
- self.assert_data(data2.GetUnsignedInt8, 5, 33)
-
- data2.SetDataFromUInt64Array([1,2,3,4,5])
- self.assert_data(data2.GetUnsignedInt64, 0, 1)
- self.assert_data(data2.GetUnsignedInt64, 8, 2)
- self.assert_data(data2.GetUnsignedInt64, 16, 3)
- self.assert_data(data2.GetUnsignedInt64, 24, 4)
- self.assert_data(data2.GetUnsignedInt64, 32, 5)
-
- self.assertTrue(data2.uint64[0] == 1, 'read_data_helper failure: set data2[0] = 1')
- self.assertTrue(data2.uint64[1] == 2, 'read_data_helper failure: set data2[1] = 2')
- self.assertTrue(data2.uint64[2] == 3, 'read_data_helper failure: set data2[2] = 3')
- self.assertTrue(data2.uint64[3] == 4, 'read_data_helper failure: set data2[3] = 4')
- self.assertTrue(data2.uint64[4] == 5, 'read_data_helper failure: set data2[4] = 5')
-
- self.assertTrue(data2.uint64[0:2] == [1,2], 'read_data_helper failure: set data2[0:2] = [1,2]')
-
- data2.SetDataFromSInt32Array([2, -2])
- self.assert_data(data2.GetSignedInt32, 0, 2)
- self.assert_data(data2.GetSignedInt32, 4, -2)
-
- data2.SetDataFromSInt64Array([2, -2])
- self.assert_data(data2.GetSignedInt32, 0, 2)
- self.assert_data(data2.GetSignedInt32, 8, -2)
-
- data2.SetDataFromUInt32Array([1,2,3,4,5])
- self.assert_data(data2.GetUnsignedInt32, 0, 1)
- self.assert_data(data2.GetUnsignedInt32, 4, 2)
- self.assert_data(data2.GetUnsignedInt32, 8, 3)
- self.assert_data(data2.GetUnsignedInt32, 12, 4)
- self.assert_data(data2.GetUnsignedInt32, 16, 5)
-
- self.assertTrue(data2.uint32[0] == 1, 'read_data_helper failure: set 32-bit data2[0] = 1')
- self.assertTrue(data2.uint32[1] == 2, 'read_data_helper failure: set 32-bit data2[1] = 2')
- self.assertTrue(data2.uint32[2] == 3, 'read_data_helper failure: set 32-bit data2[2] = 3')
- self.assertTrue(data2.uint32[3] == 4, 'read_data_helper failure: set 32-bit data2[3] = 4')
- self.assertTrue(data2.uint32[4] == 5, 'read_data_helper failure: set 32-bit data2[4] = 5')
-
- data2.SetDataFromDoubleArray([3.14,6.28,2.71])
- self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'set double data2[0] = 3.14')
- self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'set double data2[1] = 6.28')
- self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'set double data2[2] = 2.71')
-
- self.assertTrue( fabs(data2.double[0] - 3.14) < 0.5, 'read_data_helper failure: set double data2[0] = 3.14')
- self.assertTrue( fabs(data2.double[1] - 6.28) < 0.5, 'read_data_helper failure: set double data2[1] = 6.28')
- self.assertTrue( fabs(data2.double[2] - 2.71) < 0.5, 'read_data_helper failure: set double data2[2] = 2.71')
-
- def assert_data(self, func, arg, expected):
- """ Asserts func(SBError error, arg) == expected. """
- error = lldb.SBError()
- result = func(error, arg)
- if not error.Success():
- stream = lldb.SBStream()
- error.GetDescription(stream)
- self.assertTrue(error.Success(),
- "%s(error, %s) did not succeed: %s" % (func.__name__,
- arg,
- stream.GetData()))
- self.assertTrue(expected == result, "%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected))
Removed: lldb/trunk/test/python_api/sbdata/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbdata/main.cpp (original)
+++ lldb/trunk/test/python_api/sbdata/main.cpp (removed)
@@ -1,43 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdint.h>
-
-struct foo
-{
- uint32_t a;
- uint32_t b;
- float c;
- foo() : a(0), b(1), c(3.14) {}
- foo(uint32_t A, uint32_t B, float C) :
- a(A),
- b(B),
- c(C)
- {}
-};
-
-int main (int argc, char const *argv[])
-{
- foo* foobar = new foo[2];
-
- foobar[0].a = 1;
- foobar[0].b = 9;
-
- foobar[1].a = 8;
- foobar[1].b = 5;
-
- foobar[1].b = 7; // set breakpoint here
-
- foobar[1].c = 6.28;
-
- foo barfoo[] = {foo(1,2,3), foo(4,5,6)};
-
- delete[] foobar;
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py (original)
+++ lldb/trunk/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py (removed)
@@ -1,4 +0,0 @@
-import lldbinline
-import lldbtest
-
-lldbinline.MakeInlineTest(__file__, globals(), [lldbtest.skipIfFreeBSD,lldbtest.skipIfLinux,lldbtest.skipIfWindows])
Removed: lldb/trunk/test/python_api/sbtype_typeclass/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbtype_typeclass/main.m?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbtype_typeclass/main.m (original)
+++ lldb/trunk/test/python_api/sbtype_typeclass/main.m (removed)
@@ -1,34 +0,0 @@
-//===-- main.m --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#import <Cocoa/Cocoa.h>
-
- at interface ThisClassTestsThings : NSObject
- at end
-
- at implementation ThisClassTestsThings
-- (int)doSomething {
-
- id s = self;
- NSLog(@"%@",s); //% s = self.frame().FindVariable("s"); s.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
- //% s_type = s.GetType()
- //% typeClass = s_type.GetTypeClass()
- //% condition = (typeClass == lldb.eTypeClassClass) or (typeClass ==lldb.eTypeClassObjCObject) or (typeClass == lldb.eTypeClassObjCInterface) or (typeClass == lldb.eTypeClassObjCObjectPointer) or (typeClass == lldb.eTypeClassPointer)
- //% self.assertTrue(condition, "s has the wrong TypeClass")
- return 0;
-}
-- (id)init {
- return (self = [super init]);
-}
- at end
-
-
-int main (int argc, char const *argv[])
-{
- return [[[ThisClassTestsThings alloc] init] doSomething];
-}
Removed: lldb/trunk/test/python_api/sbvalue_const_addrof/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_const_addrof/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_const_addrof/Makefile (original)
+++ lldb/trunk/test/python_api/sbvalue_const_addrof/Makefile (removed)
@@ -1,4 +0,0 @@
-LEVEL = ../../make
-CXX_SOURCES := main.cpp
-CXXFLAGS += -std=c++11
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py (original)
+++ lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py (removed)
@@ -1,3 +0,0 @@
-import lldbinline
-
-lldbinline.MakeInlineTest(__file__, globals())
Removed: lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp (original)
+++ lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp (removed)
@@ -1,40 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-
-struct RegisterContext
-{
- uintptr_t r0;
- uintptr_t r1;
- uintptr_t r2;
- uintptr_t r3;
- uintptr_t r4;
- uintptr_t pc;
- uintptr_t fp;
- uintptr_t sp;
-};
-
-struct ThreadInfo {
- uint32_t tid;
- const char *name;
- RegisterContext regs;
- ThreadInfo *next;
-};
-int main (int argc, char const *argv[], char const *envp[]);
-
-ThreadInfo g_thread2 = { 0x2222, "thread2", { 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, (uintptr_t)&main, 0x2006, 0x2007 }, NULL };
-ThreadInfo g_thread1 = { 0x1111, "thread1", { 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, (uintptr_t)&main, 0x1006, 0x1007 }, &g_thread2 };
-ThreadInfo *g_thread_list_ptr = &g_thread1;
-
-int main (int argc, char const *argv[], char const *envp[])
-{
- printf ("g_thread_list is %p\n", g_thread_list_ptr);
- return 0; //% v = lldb.target.FindFirstGlobalVariable('g_thread_list_ptr')
- //% v_gla = v.GetChildMemberWithName('regs').GetLoadAddress()
- //% v_aof = v.GetChildMemberWithName('regs').AddressOf().GetValueAsUnsigned(lldb.LLDB_INVALID_ADDRESS)
- //% expr = '(%s)0x%x' % (v.GetType().GetName(), v.GetValueAsUnsigned(0))
- //% e = v.CreateValueFromExpression('e', expr)
- //% e_gla = e.GetChildMemberWithName('regs').GetLoadAddress()
- //% e_aof = e.GetChildMemberWithName('regs').AddressOf().GetValueAsUnsigned(lldb.LLDB_INVALID_ADDRESS)
- //% self.assertTrue(v_gla == e_gla, "GetLoadAddress() differs")
- //% self.assertTrue(v_aof == e_aof, "AddressOf() differs")
-}
Removed: lldb/trunk/test/python_api/sbvalue_persist/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_persist/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_persist/Makefile (original)
+++ lldb/trunk/test/python_api/sbvalue_persist/Makefile (removed)
@@ -1,15 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-# Clean renamed executable on 'make clean'
-clean: OBJECTS+=no_synth
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/sbvalue_persist/TestSBValuePersist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_persist/TestSBValuePersist.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_persist/TestSBValuePersist.py (original)
+++ lldb/trunk/test/python_api/sbvalue_persist/TestSBValuePersist.py (removed)
@@ -1,74 +0,0 @@
-"""Test SBValue::Persist"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-from lldbtest import *
-import lldbutil
-
-class SBValuePersistTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24772")
- def test(self):
- """Test SBValue::Persist"""
- self.build()
- self.setTearDownCleanup()
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_source_regexp (self, "break here")
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- self.runCmd('type format clear', check=False)
- self.runCmd('type summary clear', check=False)
- self.runCmd('type filter clear', check=False)
- self.runCmd('type synthetic clear', check=False)
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
- foo = self.frame().FindVariable("foo")
- bar = self.frame().FindVariable("bar")
- baz = self.frame().FindVariable("baz")
-
- self.assertTrue(foo.IsValid(), "foo is not valid")
- self.assertTrue(bar.IsValid(), "bar is not valid")
- self.assertTrue(baz.IsValid(), "baz is not valid")
-
- fooPersist = foo.Persist()
- barPersist = bar.Persist()
- bazPersist = baz.Persist()
-
- self.assertTrue(fooPersist.IsValid(), "fooPersist is not valid")
- self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
- self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
-
- self.assertTrue(fooPersist.GetValueAsUnsigned(0) == 10, "fooPersist != 10")
- self.assertTrue(barPersist.GetPointeeData().sint32[0] == 4, "barPersist != 4")
- self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
-
- self.runCmd("continue")
-
- self.assertTrue(fooPersist.IsValid(), "fooPersist is not valid")
- self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
- self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
-
- self.assertTrue(fooPersist.GetValueAsUnsigned(0) == 10, "fooPersist != 10")
- self.assertTrue(barPersist.GetPointeeData().sint32[0] == 4, "barPersist != 4")
- self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
-
- self.expect("expr *(%s)" % (barPersist.GetName()), substrs = ['= 4'])
Removed: lldb/trunk/test/python_api/sbvalue_persist/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_persist/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_persist/main.cpp (original)
+++ lldb/trunk/test/python_api/sbvalue_persist/main.cpp (removed)
@@ -1,14 +0,0 @@
-#include <vector>
-#include <string>
-
-void f() {}
-
-int main() {
- int foo = 10;
- int *bar = new int(4);
- std::string baz = "85";
-
- f(); // break here
- f(); // break here
- return 0;
-}
\ No newline at end of file
Removed: lldb/trunk/test/python_api/section/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/section/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/section/Makefile (original)
+++ lldb/trunk/test/python_api/section/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/section/TestSectionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/section/TestSectionAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/section/TestSectionAPI.py (original)
+++ lldb/trunk/test/python_api/section/TestSectionAPI.py (removed)
@@ -1,41 +0,0 @@
-"""
-Test SBSection APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-from lldbtest import *
-
-class SectionAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_get_target_byte_size(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), 'b.out')
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # find the .data section of the main module
- mod = target.GetModuleAtIndex(0)
- data_section = None
- for s in mod.sections:
- sect_type = s.GetSectionType()
- if sect_type == lldb.eSectionTypeData:
- data_section = s
- break
- elif sect_type == lldb.eSectionTypeContainer:
- for i in range(s.GetNumSubSections()):
- ss = s.GetSubSectionAtIndex(i)
- sect_type = ss.GetSectionType()
- if sect_type == lldb.eSectionTypeData:
- data_section = ss
- break
-
- self.assertIsNotNone(data_section)
- self.assertEqual(data_section.target_byte_size, 1)
Removed: lldb/trunk/test/python_api/section/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/section/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/section/main.c (original)
+++ lldb/trunk/test/python_api/section/main.c (removed)
@@ -1,28 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <string.h>
-
-// This simple program is to test the lldb Python API SBSection. It includes
-// somes global data, and so the build process produces a DATA section, which
-// the test code can use to query for the target byte size
-
-char my_global_var_of_char_type = 'X';
-
-int main (int argc, char const *argv[])
-{
- // this code just "does something" with the global so that it is not
- // optimised away
- if (argc > 1 && strlen(argv[1]))
- {
- my_global_var_of_char_type += argv[1][0];
- }
-
- return my_global_var_of_char_type;
-}
Removed: lldb/trunk/test/python_api/signals/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/signals/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/signals/Makefile (original)
+++ lldb/trunk/test/python_api/signals/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/signals/TestSignalsAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/signals/TestSignalsAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/signals/TestSignalsAPI.py (original)
+++ lldb/trunk/test/python_api/signals/TestSignalsAPI.py (removed)
@@ -1,47 +0,0 @@
-"""
-Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-from lldbutil import get_stopped_thread, state_type_to_str
-from lldbtest import *
-
-class SignalsAPITestCase(TestBase):
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- @expectedFlakeyLinux # this test fails 1/100 dosep runs
- @skipIfWindows # Windows doesn't have signals
- def test_ignore_signal(self):
- """Test Python SBUnixSignals.Suppress/Stop/Notify() API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- line = line_number("main.cpp", "// Set break point at this line and setup signal ignores.")
- breakpoint = target.BreakpointCreateByLocation("main.cpp", line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
-
- unix_signals = process.GetUnixSignals()
- sigint = unix_signals.GetSignalNumberFromName("SIGINT")
- unix_signals.SetShouldSuppress(sigint, True)
- unix_signals.SetShouldStop(sigint, False)
- unix_signals.SetShouldNotify(sigint, False)
-
- process.Continue()
- self.assertTrue(process.state == lldb.eStateExited, "The process should have exited")
- self.assertTrue(process.GetExitStatus() == 0, "The process should have returned 0")
Removed: lldb/trunk/test/python_api/signals/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/signals/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/signals/main.cpp (original)
+++ lldb/trunk/test/python_api/signals/main.cpp (removed)
@@ -1,28 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <sys/types.h>
-#if defined(_WIN32)
-#include <windows.h>
-#else
-#include <unistd.h>
-#include <signal.h>
-#endif
-
-// This simple program is to test the lldb Python API related to process.
-
-int main (int argc, char const *argv[])
-{
-#if defined(_WIN32)
- ::ExitProcess(1);
-#else
- kill(getpid(), SIGINT); // Set break point at this line and setup signal ignores.
-#endif
- return 0;
-}
Removed: lldb/trunk/test/python_api/symbol-context/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/symbol-context/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/symbol-context/Makefile (original)
+++ lldb/trunk/test/python_api/symbol-context/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py (original)
+++ lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py (removed)
@@ -1,88 +0,0 @@
-"""
-Test SBSymbolContext APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class SymbolContextAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Find the line number of function "c" here.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24778")
- def test(self):
- """Exercise SBSymbolContext API extensively."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateByName('c', 'a.out')
- #print("breakpoint:", breakpoint)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.line.
- from lldbutil import get_stopped_thread
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
-
- # Now get the SBSymbolContext from this frame. We want everything. :-)
- context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
- self.assertTrue(context)
-
- # Get the description of this module.
- module = context.GetModule()
- desc = lldbutil.get_description(module)
- self.expect(desc, "The module should match", exe=False,
- substrs = [os.path.join(self.mydir, 'a.out')])
-
- compileUnit = context.GetCompileUnit()
- self.expect(str(compileUnit), "The compile unit should match", exe=False,
- substrs = [os.path.join(self.mydir, 'main.c')])
-
- function = context.GetFunction()
- self.assertTrue(function)
- #print("function:", function)
-
- block = context.GetBlock()
- self.assertTrue(block)
- #print("block:", block)
-
- lineEntry = context.GetLineEntry()
- #print("line entry:", lineEntry)
- self.expect(lineEntry.GetFileSpec().GetDirectory(), "The line entry should have the correct directory",
- exe=False,
- substrs = [self.mydir])
- self.expect(lineEntry.GetFileSpec().GetFilename(), "The line entry should have the correct filename",
- exe=False,
- substrs = ['main.c'])
- self.assertTrue(lineEntry.GetLine() == self.line,
- "The line entry's line number should match ")
-
- symbol = context.GetSymbol()
- self.assertTrue(function.GetName() == symbol.GetName() and symbol.GetName() == 'c',
- "The symbol name should be 'c'")
Removed: lldb/trunk/test/python_api/symbol-context/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/symbol-context/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/symbol-context/main.c (original)
+++ lldb/trunk/test/python_api/symbol-context/main.c (removed)
@@ -1,51 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API SBSymbolContext.
-// When stopped on a frame, we can get the symbol context using the SBFrame API
-// SBFrame.GetSymbolContext().
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1)
- return b(val);
- else if (val >= 3)
- return c(val);
-
- return val;
-}
-
-int b(int val)
-{
- return c(val);
-}
-
-int c(int val)
-{
- return val + 3; // Find the line number of function "c" here.
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1); // a(1) -> b(1) -> c(1)
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2); // b(2) -> c(2)
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3); // a(3) -> c(3)
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/target/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/target/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/target/Makefile (original)
+++ lldb/trunk/test/python_api/target/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/target/TestTargetAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/trunk/test/python_api/target/TestTargetAPI.py (removed)
@@ -1,371 +0,0 @@
-"""
-Test SBTarget APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class TargetAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
- self.line_main = line_number("main.c", "// Set a break at entry to main.")
-
- #rdar://problem/9700873
- # Find global variable value fails for dwarf if inferior not started
- # (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
- #
- # It does not segfaults now. But for dwarf, the variable value is None if
- # the inferior process does not exist yet. The radar has been updated.
- #@unittest232.skip("segmentation fault -- skipping")
- @add_test_categories(['pyapi'])
- def test_find_global_variables(self):
- """Exercise SBTarget.FindGlobalVariables() API."""
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.find_global_variables('b.out')
-
- @add_test_categories(['pyapi'])
- @expectedFailureWindows("llvm.org/pr24778")
- def test_find_functions(self):
- """Exercise SBTarget.FindFunctions() API."""
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.find_functions('b.out')
-
- @add_test_categories(['pyapi'])
- def test_get_description(self):
- """Exercise SBTarget.GetDescription() API."""
- self.build()
- self.get_description()
-
- @add_test_categories(['pyapi'])
- def test_launch_new_process_and_redirect_stdout(self):
- """Exercise SBTarget.Launch() API."""
- self.build()
- self.launch_new_process_and_redirect_stdout()
-
- @add_test_categories(['pyapi'])
- def test_resolve_symbol_context_with_address(self):
- """Exercise SBTarget.ResolveSymbolContextForAddress() API."""
- self.build()
- self.resolve_symbol_context_with_address()
-
- @add_test_categories(['pyapi'])
- def test_get_platform(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- target = self.create_simple_target('b.out')
- platform = target.platform
- self.assertTrue(platform, VALID_PLATFORM)
-
- @add_test_categories(['pyapi'])
- def test_get_data_byte_size(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- target = self.create_simple_target('b.out')
- self.assertEqual(target.data_byte_size, 1)
-
- @add_test_categories(['pyapi'])
- def test_get_code_byte_size(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- target = self.create_simple_target('b.out')
- self.assertEqual(target.code_byte_size, 1)
-
- @add_test_categories(['pyapi'])
- def test_resolve_file_address(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- target = self.create_simple_target('b.out')
-
- # find the file address in the .data section of the main
- # module
- data_section = self.find_data_section(target)
- data_section_addr = data_section.file_addr
-
- # resolve the above address, and compare the address produced
- # by the resolution against the original address/section
- res_file_addr = target.ResolveFileAddress(data_section_addr)
- self.assertTrue(res_file_addr.IsValid())
-
- self.assertEqual(data_section_addr, res_file_addr.file_addr)
-
- data_section2 = res_file_addr.section
- self.assertIsNotNone(data_section2)
- self.assertEqual(data_section.name, data_section2.name)
-
- @add_test_categories(['pyapi'])
- def test_read_memory(self):
- d = {'EXE': 'b.out'}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- target = self.create_simple_target('b.out')
-
- breakpoint = target.BreakpointCreateByLocation("main.c", self.line_main)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Put debugger into synchronous mode so when we target.LaunchSimple returns
- # it will guaranteed to be at the breakpoint
- self.dbg.SetAsync(False)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # find the file address in the .data section of the main
- # module
- data_section = self.find_data_section(target)
- sb_addr = lldb.SBAddress(data_section, 0)
- error = lldb.SBError()
- content = target.ReadMemory(sb_addr, 1, error)
- self.assertTrue(error.Success(), "Make sure memory read succeeded")
- self.assertEqual(len(content), 1)
-
- def create_simple_target(self, fn):
- exe = os.path.join(os.getcwd(), fn)
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- return target
-
- def find_data_section(self, target):
- mod = target.GetModuleAtIndex(0)
- data_section = None
- for s in mod.sections:
- sect_type = s.GetSectionType()
- if sect_type == lldb.eSectionTypeData:
- data_section = s
- break
- elif sect_type == lldb.eSectionTypeContainer:
- for i in range(s.GetNumSubSections()):
- ss = s.GetSubSectionAtIndex(i)
- sect_type = ss.GetSectionType()
- if sect_type == lldb.eSectionTypeData:
- data_section = ss
- break
-
- self.assertIsNotNone(data_section)
- return data_section
-
- def find_global_variables(self, exe_name):
- """Exercise SBTaget.FindGlobalVariables() API."""
- exe = os.path.join(os.getcwd(), exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- #rdar://problem/9700873
- # Find global variable value fails for dwarf if inferior not started
- # (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
- #
- # Remove the lines to create a breakpoint and to start the inferior
- # which are workarounds for the dwarf case.
-
- breakpoint = target.BreakpointCreateByLocation('main.c', self.line1)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
- # Make sure we hit our breakpoint:
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
-
- value_list = target.FindGlobalVariables('my_global_var_of_char_type', 3)
- self.assertTrue(value_list.GetSize() == 1)
- my_global_var = value_list.GetValueAtIndex(0)
- self.DebugSBValue(my_global_var)
- self.assertTrue(my_global_var)
- self.expect(my_global_var.GetName(), exe=False,
- startstr = "my_global_var_of_char_type")
- self.expect(my_global_var.GetTypeName(), exe=False,
- startstr = "char")
- self.expect(my_global_var.GetValue(), exe=False,
- startstr = "'X'")
-
- # While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API.
- for m in target.module_iter():
- if os.path.normpath(m.GetFileSpec().GetDirectory()) == os.getcwd() and m.GetFileSpec().GetFilename() == exe_name:
- value_list = m.FindGlobalVariables(target, 'my_global_var_of_char_type', 3)
- self.assertTrue(value_list.GetSize() == 1)
- self.assertTrue(value_list.GetValueAtIndex(0).GetValue() == "'X'")
- break
-
- def find_functions(self, exe_name):
- """Exercise SBTaget.FindFunctions() API."""
- exe = os.path.join(os.getcwd(), exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- list = target.FindFunctions('c', lldb.eFunctionNameTypeAuto)
- self.assertTrue(list.GetSize() == 1)
-
- for sc in list:
- self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
- self.assertTrue(sc.GetSymbol().GetName() == 'c')
-
- def get_description(self):
- """Exercise SBTaget.GetDescription() API."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- from lldbutil import get_description
-
- # get_description() allows no option to mean lldb.eDescriptionLevelBrief.
- desc = get_description(target)
- #desc = get_description(target, option=lldb.eDescriptionLevelBrief)
- if not desc:
- self.fail("SBTarget.GetDescription() failed")
- self.expect(desc, exe=False,
- substrs = ['a.out'])
- self.expect(desc, exe=False, matching=False,
- substrs = ['Target', 'Module', 'Breakpoint'])
-
- desc = get_description(target, option=lldb.eDescriptionLevelFull)
- if not desc:
- self.fail("SBTarget.GetDescription() failed")
- self.expect(desc, exe=False,
- substrs = ['a.out', 'Target', 'Module', 'Breakpoint'])
-
- @not_remote_testsuite_ready
- def launch_new_process_and_redirect_stdout(self):
- """Exercise SBTaget.Launch() API with redirected stdout."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Add an extra twist of stopping the inferior in a breakpoint, and then continue till it's done.
- # We should still see the entire stdout redirected once the process is finished.
- line = line_number('main.c', '// a(3) -> c(3)')
- breakpoint = target.BreakpointCreateByLocation('main.c', line)
-
- # Now launch the process, do not stop at entry point, and redirect stdout to "stdout.txt" file.
- # The inferior should run to completion after "process.Continue()" call.
- local_path = "stdout.txt";
- if lldb.remote_platform:
- stdout_path = lldbutil.append_to_process_working_directory("lldb-stdout-redirect.txt")
- else:
- stdout_path = local_path
- error = lldb.SBError()
- process = target.Launch (self.dbg.GetListener(), None, None, None, stdout_path, None, None, 0, False, error)
- process.Continue()
- #self.runCmd("process status")
- if lldb.remote_platform:
- # copy output file to host
- lldb.remote_platform.Get(lldb.SBFileSpec(stdout_path), lldb.SBFileSpec(local_path))
-
- # The 'stdout.txt' file should now exist.
- self.assertTrue(os.path.isfile("stdout.txt"),
- "'stdout.txt' exists due to redirected stdout via SBTarget.Launch() API.")
-
- # Read the output file produced by running the program.
- with open('stdout.txt', 'r') as f:
- output = f.read()
-
- # Let's delete the 'stdout.txt' file as a cleanup step.
- try:
- os.remove("stdout.txt")
- pass
- except OSError:
- pass
-
- self.expect(output, exe=False,
- substrs = ["a(1)", "b(2)", "a(3)"])
-
-
- def resolve_symbol_context_with_address(self):
- """Exercise SBTaget.ResolveSymbolContextForAddress() API."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create the two breakpoints inside function 'a'.
- breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1)
- breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2)
- #print("breakpoint1:", breakpoint1)
- #print("breakpoint2:", breakpoint2)
- self.assertTrue(breakpoint1 and
- breakpoint1.GetNumLocations() == 1,
- VALID_BREAKPOINT)
- self.assertTrue(breakpoint2 and
- breakpoint2.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.line1.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- #self.runCmd("process status")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line1)
-
- address1 = lineEntry.GetStartAddress()
-
- # Continue the inferior, the breakpoint 2 should be hit.
- process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- #self.runCmd("process status")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.line2)
-
- address2 = lineEntry.GetStartAddress()
-
- #print("address1:", address1)
- #print("address2:", address2)
-
- # Now call SBTarget.ResolveSymbolContextForAddress() with the addresses from our line entry.
- context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything)
- context2 = target.ResolveSymbolContextForAddress(address2, lldb.eSymbolContextEverything)
-
- self.assertTrue(context1 and context2)
- #print("context1:", context1)
- #print("context2:", context2)
-
- # Verify that the context point to the same function 'a'.
- symbol1 = context1.GetSymbol()
- symbol2 = context2.GetSymbol()
- self.assertTrue(symbol1 and symbol2)
- #print("symbol1:", symbol1)
- #print("symbol2:", symbol2)
-
- from lldbutil import get_description
- desc1 = get_description(symbol1)
- desc2 = get_description(symbol2)
- self.assertTrue(desc1 and desc2 and desc1 == desc2,
- "The two addresses should resolve to the same symbol")
Removed: lldb/trunk/test/python_api/target/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/target/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/target/main.c (original)
+++ lldb/trunk/test/python_api/target/main.c (removed)
@@ -1,60 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API SBTarget.
-//
-// When stopped on breakppint 1, and then 2, we can get the line entries using
-// SBFrame API SBFrame.GetLineEntry(). We'll get the start addresses for the
-// two line entries; with the start address (of SBAddress type), we can then
-// resolve the symbol context using the SBTarget API
-// SBTarget.ResolveSymbolContextForAddress().
-//
-// The two symbol context should point to the same symbol, i.e., 'a' function.
-
-char my_global_var_of_char_type = 'X'; // Test SBTarget.FindGlobalVariables(...).
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1) // Find the line number for breakpoint 1 here.
- val = b(val);
- else if (val >= 3)
- val = c(val);
-
- return val; // Find the line number for breakpoint 2 here.
-}
-
-int b(int val)
-{
- return c(val);
-}
-
-int c(int val)
-{
- return val + 3;
-}
-
-int main (int argc, char const *argv[])
-{
- // Set a break at entry to main.
- int A1 = a(1); // a(1) -> b(1) -> c(1)
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2); // b(2) -> c(2)
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3); // a(3) -> c(3)
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/thread/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/thread/Makefile (original)
+++ lldb/trunk/test/python_api/thread/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES ?= main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/test/python_api/thread/TestThreadAPI.py (removed)
@@ -1,245 +0,0 @@
-"""
-Test SBThread APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-from lldbutil import get_stopped_thread, get_caller_symbol
-from lldbtest import *
-
-class ThreadAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_get_process(self):
- """Test Python SBThread.GetProcess() API."""
- self.build()
- self.get_process()
-
- @add_test_categories(['pyapi'])
- def test_get_stop_description(self):
- """Test Python SBThread.GetStopDescription() API."""
- self.build()
- self.get_stop_description()
-
- @add_test_categories(['pyapi'])
- def test_run_to_address(self):
- """Test Python SBThread.RunToAddress() API."""
- # We build a different executable than the default build() does.
- d = {'CXX_SOURCES': 'main2.cpp', 'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.run_to_address(self.exe_name)
-
- @add_test_categories(['pyapi'])
- @expectedFailureFreeBSD # llvm.org/pr20476
- @expectedFailureWindows # Test crashes
- def test_step_out_of_malloc_into_function_b(self):
- """Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
- # We build a different executable than the default build() does.
- d = {'CXX_SOURCES': 'main2.cpp', 'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.step_out_of_malloc_into_function_b(self.exe_name)
-
- @add_test_categories(['pyapi'])
- def test_step_over_3_times(self):
- """Test Python SBThread.StepOver() API."""
- # We build a different executable than the default build() does.
- d = {'CXX_SOURCES': 'main2.cpp', 'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.step_over_3_times(self.exe_name)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number within main.cpp to break inside main().
- self.break_line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
- # Find the line numbers within main2.cpp for step_out_of_malloc_into_function_b() and step_over_3_times().
- self.step_out_of_malloc = line_number("main2.cpp", "// thread step-out of malloc into function b.")
- self.after_3_step_overs = line_number("main2.cpp", "// we should reach here after 3 step-over's.")
-
- # We'll use the test method name as the exe_name for executable comppiled from main2.cpp.
- self.exe_name = self.testMethodName
-
- def get_process(self):
- """Test Python SBThread.GetProcess() API."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.runCmd("breakpoint list")
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- self.runCmd("process status")
-
- proc_of_thread = thread.GetProcess()
- #print("proc_of_thread:", proc_of_thread)
- self.assertTrue(proc_of_thread.GetProcessID() == process.GetProcessID())
-
- def get_stop_description(self):
- """Test Python SBThread.GetStopDescription() API."""
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
- #self.runCmd("breakpoint list")
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- #self.runCmd("process status")
-
- # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
- # and expect to get a Python string as the return object!
- # The 100 is just an arbitrary number specifying the buffer size.
- stop_description = thread.GetStopDescription(100)
- self.expect(stop_description, exe=False,
- startstr = 'breakpoint')
-
- def step_out_of_malloc_into_function_b(self, exe_name):
- """Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
- exe = os.path.join(os.getcwd(), exe_name)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByName('malloc')
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- while True:
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
- caller_symbol = get_caller_symbol(thread)
- if not caller_symbol:
- self.fail("Test failed: could not locate the caller symbol of malloc")
-
- # Our top frame may be an inlined function in malloc() (e.g., on
- # FreeBSD). Apply a simple heuristic of stepping out until we find
- # a non-malloc caller
- while caller_symbol.startswith("malloc"):
- thread.StepOut()
- self.assertTrue(thread.IsValid(), "Thread valid after stepping to outer malloc")
- caller_symbol = get_caller_symbol(thread)
-
- if caller_symbol == "b(int)":
- break
- process.Continue()
-
- # On Linux malloc calls itself in some case. Remove the breakpoint because we don't want
- # to hit it during step-out.
- target.BreakpointDelete(breakpoint.GetID())
-
- thread.StepOut()
- self.runCmd("thread backtrace")
- self.assertTrue(thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
- "step out of malloc into function b is successful")
-
- def step_over_3_times(self, exe_name):
- """Test Python SBThread.StepOver() API."""
- exe = os.path.join(os.getcwd(), exe_name)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.runCmd("breakpoint list")
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.step_out_of_malloc.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- self.runCmd("thread backtrace")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc)
-
- thread.StepOver()
- thread.StepOver()
- thread.StepOver()
- self.runCmd("thread backtrace")
-
- # Verify that we are stopped at the correct source line number in main2.cpp.
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
- # Expected failure with clang as the compiler.
- # rdar://problem/9223880
- #
- # Which has been fixed on the lldb by compensating for inaccurate line
- # table information with r140416.
- self.assertTrue(lineEntry.GetLine() == self.after_3_step_overs)
-
- def run_to_address(self, exe_name):
- """Test Python SBThread.RunToAddress() API."""
- exe = os.path.join(os.getcwd(), exe_name)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.runCmd("breakpoint list")
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Frame #0 should be on self.step_out_of_malloc.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- self.runCmd("thread backtrace")
- frame0 = thread.GetFrameAtIndex(0)
- lineEntry = frame0.GetLineEntry()
- self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc)
-
- # Get the start/end addresses for this line entry.
- start_addr = lineEntry.GetStartAddress().GetLoadAddress(target)
- end_addr = lineEntry.GetEndAddress().GetLoadAddress(target)
- if self.TraceOn():
- print("start addr:", hex(start_addr))
- print("end addr:", hex(end_addr))
-
- # Disable the breakpoint.
- self.assertTrue(target.DisableAllBreakpoints())
- self.runCmd("breakpoint list")
-
- thread.StepOver()
- thread.StepOver()
- thread.StepOver()
- self.runCmd("thread backtrace")
-
- # Now ask SBThread to run to the address 'start_addr' we got earlier, which
- # corresponds to self.step_out_of_malloc line entry's start address.
- thread.RunToAddress(start_addr)
- self.runCmd("process status")
- #self.runCmd("thread backtrace")
Removed: lldb/trunk/test/python_api/thread/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/thread/main.cpp (original)
+++ lldb/trunk/test/python_api/thread/main.cpp (removed)
@@ -1,26 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API related to thread.
-
-char my_char = 'u';
-int my_int = 0;
-
-int main (int argc, char const *argv[])
-{
- for (int i = 0; i < 3; ++i) {
- printf("my_char='%c'\n", my_char);
- ++my_char;
- }
-
- printf("after the loop: my_char='%c'\n", my_char); // 'my_char' should print out as 'x'.
-
- return 0; // Set break point at this line and check variable 'my_char'.
-}
Removed: lldb/trunk/test/python_api/thread/main2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/main2.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/thread/main2.cpp (original)
+++ lldb/trunk/test/python_api/thread/main2.cpp (removed)
@@ -1,54 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdlib.h>
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1)
- return b(val);
- else if (val >= 3)
- return c(val);
-
- return val;
-}
-
-int b(int val)
-{
- int rc = c(val);
- void *ptr = malloc(1024); // thread step-out of malloc into function b.
- if (!ptr)
- return -1;
- else
- printf("ptr=%p\n", ptr);
- return rc; // we should reach here after 3 step-over's.
-}
-
-int c(int val)
-{
- return val + 3;
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1);
- printf("a(1) returns %d\n", A1);
-
- int B2 = b(2);
- printf("b(2) returns %d\n", B2);
-
- int A3 = a(3);
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/type/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/Makefile (original)
+++ lldb/trunk/test/python_api/type/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/TestTypeList.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/TestTypeList.py (original)
+++ lldb/trunk/test/python_api/type/TestTypeList.py (removed)
@@ -1,110 +0,0 @@
-"""
-Test SBType and SBTypeList API.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class TypeAndTypeListTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # We'll use the test method name as the exe_name.
- self.exe_name = self.testMethodName
- # Find the line number to break at.
- self.source = 'main.cpp'
- self.line = line_number(self.source, '// Break at this line')
-
- @add_test_categories(['pyapi'])
- def test(self):
- """Exercise SBType and SBTypeList API."""
- d = {'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
-
- # Get the type 'Task'.
- type_list = target.FindTypes('Task')
- if self.TraceOn():
- print("Size of type_list from target.FindTypes('Task') query: %d" % type_list.GetSize())
- self.assertTrue(len(type_list) >= 1) # a second Task make be scared up by the Objective-C runtime
- for type in type_list:
- self.assertTrue(type)
- self.DebugSBType(type)
- for field in type.fields:
- if field.name == "type":
- for enum_member in field.type.enum_members:
- self.assertTrue(enum_member)
- self.DebugSBType(enum_member.type)
-
- # Pass an empty string. LLDB should not crash. :-)
- fuzz_types = target.FindTypes(None)
- fuzz_type = target.FindFirstType(None)
-
- # Now use the SBTarget.FindFirstType() API to find 'Task'.
- task_type = target.FindFirstType('Task')
- self.assertTrue(task_type)
- self.DebugSBType(task_type)
-
- # Get the reference type of 'Task', just for fun.
- task_ref_type = task_type.GetReferenceType()
- self.assertTrue(task_ref_type)
- self.DebugSBType(task_ref_type)
-
- # Get the pointer type of 'Task', which is the same as task_head's type.
- task_pointer_type = task_type.GetPointerType()
- self.assertTrue(task_pointer_type)
- self.DebugSBType(task_pointer_type)
-
- # Get variable 'task_head'.
- task_head = frame0.FindVariable('task_head')
- self.assertTrue(task_head, VALID_VARIABLE)
- self.DebugSBValue(task_head)
- task_head_type = task_head.GetType()
- self.DebugSBType(task_head_type)
- self.assertTrue(task_head_type.IsPointerType())
-
- self.assertTrue(task_head_type == task_pointer_type)
-
- # Get the pointee type of 'task_head'.
- task_head_pointee_type = task_head_type.GetPointeeType()
- self.DebugSBType(task_head_pointee_type)
-
- self.assertTrue(task_type == task_head_pointee_type)
-
- # We'll now get the child member 'id' from 'task_head'.
- id = task_head.GetChildMemberWithName('id')
- self.DebugSBValue(id)
- id_type = id.GetType()
- self.DebugSBType(id_type)
-
- # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
- int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
- self.assertTrue(id_type == int_type)
Removed: lldb/trunk/test/python_api/type/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/main.cpp (original)
+++ lldb/trunk/test/python_api/type/main.cpp (removed)
@@ -1,54 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-class Task {
-public:
- int id;
- Task *next;
- enum {
- TASK_TYPE_1,
- TASK_TYPE_2
- } type;
- Task(int i, Task *n):
- id(i),
- next(n),
- type(TASK_TYPE_1)
- {}
-};
-
-
-int main (int argc, char const *argv[])
-{
- Task *task_head = new Task(-1, NULL);
- Task *task1 = new Task(1, NULL);
- Task *task2 = new Task(2, NULL);
- Task *task3 = new Task(3, NULL); // Orphaned.
- Task *task4 = new Task(4, NULL);
- Task *task5 = new Task(5, NULL);
-
- task_head->next = task1;
- task1->next = task2;
- task2->next = task4;
- task4->next = task5;
-
- int total = 0;
- Task *t = task_head;
- while (t != NULL) {
- if (t->id >= 0)
- ++total;
- t = t->next;
- }
- printf("We have a total number of %d tasks\n", total);
-
- // This corresponds to an empty task list.
- Task *empty_task_head = new Task(-1, NULL);
-
- return 0; // Break at this line
-}
Removed: lldb/trunk/test/python_api/value/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/Makefile (original)
+++ lldb/trunk/test/python_api/value/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/value/TestValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/TestValueAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/TestValueAPI.py (original)
+++ lldb/trunk/test/python_api/value/TestValueAPI.py (removed)
@@ -1,134 +0,0 @@
-"""
-Test some SBValue APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class ValueAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # We'll use the test method name as the exe_name.
- self.exe_name = self.testMethodName
- # Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Break at this line')
-
- @expectedFailureWindows("llvm.org/pr24772")
- @add_test_categories(['pyapi'])
- def test(self):
- """Exercise some SBValue APIs."""
- d = {'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
-
- # Get global variable 'days_of_week'.
- list = target.FindGlobalVariables('days_of_week', 1)
- days_of_week = list.GetValueAtIndex(0)
- self.assertTrue(days_of_week, VALID_VARIABLE)
- self.assertTrue(days_of_week.GetNumChildren() == 7, VALID_VARIABLE)
- self.DebugSBValue(days_of_week)
-
- # Get global variable 'weekdays'.
- list = target.FindGlobalVariables('weekdays', 1)
- weekdays = list.GetValueAtIndex(0)
- self.assertTrue(weekdays, VALID_VARIABLE)
- self.assertTrue(weekdays.GetNumChildren() == 5, VALID_VARIABLE)
- self.DebugSBValue(weekdays)
-
- # Get global variable 'g_table'.
- list = target.FindGlobalVariables('g_table', 1)
- g_table = list.GetValueAtIndex(0)
- self.assertTrue(g_table, VALID_VARIABLE)
- self.assertTrue(g_table.GetNumChildren() == 2, VALID_VARIABLE)
- self.DebugSBValue(g_table)
-
- fmt = lldbutil.BasicFormatter()
- cvf = lldbutil.ChildVisitingFormatter(indent_child=2)
- rdf = lldbutil.RecursiveDecentFormatter(indent_child=2)
- if self.TraceOn():
- print(fmt.format(days_of_week))
- print(cvf.format(days_of_week))
- print(cvf.format(weekdays))
- print(rdf.format(g_table))
-
- # Get variable 'my_int_ptr'.
- value = frame0.FindVariable('my_int_ptr')
- self.assertTrue(value, VALID_VARIABLE)
- self.DebugSBValue(value)
-
- # Get what 'my_int_ptr' points to.
- pointed = value.GetChildAtIndex(0)
- self.assertTrue(pointed, VALID_VARIABLE)
- self.DebugSBValue(pointed)
-
- # While we are at it, verify that 'my_int_ptr' points to 'g_my_int'.
- symbol = target.ResolveLoadAddress(int(pointed.GetLocation(), 0)).GetSymbol()
- self.assertTrue(symbol)
- self.expect(symbol.GetName(), exe=False,
- startstr = 'g_my_int')
-
- # Get variable 'str_ptr'.
- value = frame0.FindVariable('str_ptr')
- self.assertTrue(value, VALID_VARIABLE)
- self.DebugSBValue(value)
-
- # SBValue::TypeIsPointerType() should return true.
- self.assertTrue(value.TypeIsPointerType())
-
- # Verify the SBValue::GetByteSize() API is working correctly.
- arch = self.getArchitecture()
- if arch == 'i386':
- self.assertTrue(value.GetByteSize() == 4)
- elif arch == 'x86_64':
- self.assertTrue(value.GetByteSize() == 8)
-
- # Get child at index 5 => 'Friday'.
- child = value.GetChildAtIndex(5, lldb.eNoDynamicValues, True)
- self.assertTrue(child, VALID_VARIABLE)
- self.DebugSBValue(child)
-
- self.expect(child.GetSummary(), exe=False,
- substrs = ['Friday'])
-
- # Now try to get at the same variable using GetValueForExpressionPath().
- # These two SBValue objects should have the same value.
- val2 = value.GetValueForExpressionPath('[5]')
- self.assertTrue(val2, VALID_VARIABLE)
- self.DebugSBValue(val2)
- self.assertTrue(child.GetValue() == val2.GetValue() and
- child.GetSummary() == val2.GetSummary())
-
- val_i = target.EvaluateExpression('i')
- val_s = target.EvaluateExpression('s')
- val_a = target.EvaluateExpression('a')
- self.assertTrue(val_s.GetChildMemberWithName('a').AddressOf(), VALID_VARIABLE)
- self.assertTrue(val_a.Cast(val_i.GetType()).AddressOf(), VALID_VARIABLE)
Removed: lldb/trunk/test/python_api/value/change_values/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/Makefile (original)
+++ lldb/trunk/test/python_api/value/change_values/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py (removed)
@@ -1,147 +0,0 @@
-"""
-Test some SBValue APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class ChangeValueAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # We'll use the test method name as the exe_name.
- self.exe_name = self.testMethodName
- # Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Stop here and set values')
- self.check_line = line_number('main.c', '// Stop here and check values')
- self.end_line = line_number ('main.c', '// Set a breakpoint here at the end')
-
- @expectedFailureWindows("llvm.org/pr24772")
- @add_test_categories(['pyapi'])
- def test_change_value(self):
- """Exercise the SBValue::SetValueFromCString API."""
- d = {'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Create the breakpoint inside the function 'main'
- check_breakpoint = target.BreakpointCreateByLocation('main.c', self.check_line)
- self.assertTrue(check_breakpoint, VALID_BREAKPOINT)
-
- # Create the breakpoint inside function 'main'.
- end_breakpoint = target.BreakpointCreateByLocation('main.c', self.end_line)
- self.assertTrue(end_breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0.IsValid(), "Got a valid frame.")
-
- # Get the val variable and change it:
- error = lldb.SBError()
-
- val_value = frame0.FindVariable ("val")
- self.assertTrue (val_value.IsValid(), "Got the SBValue for val")
- actual_value = val_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a value from val")
- self.assertTrue (actual_value == 100, "Got the right value from val")
-
- result = val_value.SetValueFromCString ("12345")
- self.assertTrue (result, "Setting val returned True.")
- actual_value = val_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from val")
- self.assertTrue (actual_value == 12345, "Got the right changed value from val")
-
- # Now check that we can set a structure element:
-
- mine_value = frame0.FindVariable ("mine")
- self.assertTrue (mine_value.IsValid(), "Got the SBValue for mine")
-
- mine_second_value = mine_value.GetChildMemberWithName ("second_val")
- self.assertTrue (mine_second_value.IsValid(), "Got second_val from mine")
- actual_value = mine_second_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got an unsigned value for second_val")
- self.assertTrue (actual_value == 5555)
-
- result = mine_second_value.SetValueFromCString ("98765")
- self.assertTrue (result, "Success setting mine.second_value.")
- actual_value = mine_second_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from mine.second_val")
- self.assertTrue (actual_value == 98765, "Got the right changed value from mine.second_val")
-
- # Next do the same thing with the pointer version.
- ptr_value = frame0.FindVariable ("ptr")
- self.assertTrue (ptr_value.IsValid(), "Got the SBValue for ptr")
-
- ptr_second_value = ptr_value.GetChildMemberWithName ("second_val")
- self.assertTrue (ptr_second_value.IsValid(), "Got second_val from ptr")
- actual_value = ptr_second_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got an unsigned value for ptr->second_val")
- self.assertTrue (actual_value == 6666)
-
- result = ptr_second_value.SetValueFromCString ("98765")
- self.assertTrue (result, "Success setting ptr->second_value.")
- actual_value = ptr_second_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from ptr->second_val")
- self.assertTrue (actual_value == 98765, "Got the right changed value from ptr->second_val")
-
- # gcc may set multiple locations for breakpoint
- breakpoint.SetEnabled(False)
-
- # Now continue, grab the stdout and make sure we changed the real values as well...
- process.Continue();
-
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
-
- expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
- stdout = process.GetSTDOUT(1000)
- self.assertTrue (expected_value in stdout, "STDOUT showed changed values.")
-
- # Finally, change the stack pointer to 0, and we should not make it to our end breakpoint.
- frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0.IsValid(), "Second time: got a valid frame.")
- sp_value = frame0.FindValue ("sp", lldb.eValueTypeRegister);
- self.assertTrue (sp_value.IsValid(), "Got a stack pointer value")
- result = sp_value.SetValueFromCString("1")
- self.assertTrue (result, "Setting sp returned true.")
- actual_value = sp_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got a changed value for sp")
- self.assertTrue (actual_value == 1, "Got the right changed value for sp.")
-
- # Boundary condition test the SBValue.CreateValueFromExpression() API.
- # LLDB should not crash!
- nosuchval = mine_value.CreateValueFromExpression(None, None)
-
- process.Continue()
-
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread == None, "We should not have managed to hit our second breakpoint with sp == 1")
-
- process.Kill()
Removed: lldb/trunk/test/python_api/value/change_values/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/main.c (original)
+++ lldb/trunk/test/python_api/value/change_values/main.c (removed)
@@ -1,29 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct foo
-{
- uint8_t first_val;
- uint32_t second_val;
- uint64_t third_val;
-};
-
-int main ()
-{
- int val = 100;
- struct foo mine = {55, 5555, 55555555};
- struct foo *ptr = (struct foo *) malloc (sizeof (struct foo));
- ptr->first_val = 66;
- ptr->second_val = 6666;
- ptr->third_val = 66666666;
-
- // Stop here and set values
- printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", val,
- mine.first_val, mine.second_val, mine.third_val,
- ptr->first_val, ptr->second_val, ptr->third_val);
-
- // Stop here and check values
- printf ("This is just another call which we won't make it over %d.", val);
- return 0; // Set a breakpoint here at the end
-}
Removed: lldb/trunk/test/python_api/value/linked_list/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/linked_list/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/linked_list/Makefile (original)
+++ lldb/trunk/test/python_api/value/linked_list/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/value/linked_list/TestValueAPILinkedList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/linked_list/TestValueAPILinkedList.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/linked_list/TestValueAPILinkedList.py (original)
+++ lldb/trunk/test/python_api/value/linked_list/TestValueAPILinkedList.py (removed)
@@ -1,132 +0,0 @@
-"""
-Test SBValue API linked_list_iter which treats the SBValue as a linked list and
-supports iteration till the end of list is reached.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class ValueAsLinkedListTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # We'll use the test method name as the exe_name.
- self.exe_name = self.testMethodName
- # Find the line number to break at.
- self.line = line_number('main.cpp', '// Break at this line')
-
- @add_test_categories(['pyapi'])
- def test(self):
- """Exercise SBValue API linked_list_iter."""
- d = {'EXE': self.exe_name}
- self.build(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint inside function 'main'.
- breakpoint = target.BreakpointCreateByLocation('main.cpp', self.line)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Get Frame #0.
- self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- frame0 = thread.GetFrameAtIndex(0)
-
- # Get variable 'task_head'.
- task_head = frame0.FindVariable('task_head')
- self.assertTrue(task_head, VALID_VARIABLE)
- self.DebugSBValue(task_head)
-
- # By design (see main.cpp), the visited id's are: [1, 2, 4, 5].
- visitedIDs = [1, 2, 4, 5]
- list = []
-
- cvf = lldbutil.ChildVisitingFormatter(indent_child=2)
- for t in task_head.linked_list_iter('next'):
- self.assertTrue(t, VALID_VARIABLE)
- # Make sure that 'next' corresponds to an SBValue with pointer type.
- self.assertTrue(t.TypeIsPointerType())
- if self.TraceOn():
- print(cvf.format(t))
- list.append(int(t.GetChildMemberWithName("id").GetValue()))
-
- # Sanity checks that the we visited all the items (no more, no less).
- if self.TraceOn():
- print("visited IDs:", list)
- self.assertTrue(visitedIDs == list)
-
- # Let's exercise the linked_list_iter() API again, this time supplying
- # our end of list test function.
- def eol(val):
- """Test function to determine end of list."""
- # End of list is reached if either the value object is invalid
- # or it corresponds to a null pointer.
- if not val or int(val.GetValue(), 16) == 0:
- return True
- # Also check the "id" for correct semantics. If id <= 0, the item
- # is corrupted, let's return True to signify end of list.
- if int(val.GetChildMemberWithName("id").GetValue(), 0) <= 0:
- return True
-
- # Otherwise, return False.
- return False
-
- list = []
- for t in task_head.linked_list_iter('next', eol):
- self.assertTrue(t, VALID_VARIABLE)
- # Make sure that 'next' corresponds to an SBValue with pointer type.
- self.assertTrue(t.TypeIsPointerType())
- if self.TraceOn():
- print(cvf.format(t))
- list.append(int(t.GetChildMemberWithName("id").GetValue()))
-
- # Sanity checks that the we visited all the items (no more, no less).
- if self.TraceOn():
- print("visited IDs:", list)
- self.assertTrue(visitedIDs == list)
-
- # Get variable 'empty_task_head'.
- empty_task_head = frame0.FindVariable('empty_task_head')
- self.assertTrue(empty_task_head, VALID_VARIABLE)
- self.DebugSBValue(empty_task_head)
-
- list = []
- # There is no iterable item from empty_task_head.linked_list_iter().
- for t in empty_task_head.linked_list_iter('next', eol):
- if self.TraceOn():
- print(cvf.format(t))
- list.append(int(t.GetChildMemberWithName("id").GetValue()))
-
- self.assertTrue(len(list) == 0)
-
- # Get variable 'task_evil'.
- task_evil = frame0.FindVariable('task_evil')
- self.assertTrue(task_evil, VALID_VARIABLE)
- self.DebugSBValue(task_evil)
-
- list = []
- # There 3 iterable items from task_evil.linked_list_iter(). :-)
- for t in task_evil.linked_list_iter('next'):
- if self.TraceOn():
- print(cvf.format(t))
- list.append(int(t.GetChildMemberWithName("id").GetValue()))
-
- self.assertTrue(len(list) == 3)
Removed: lldb/trunk/test/python_api/value/linked_list/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/linked_list/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/linked_list/main.cpp (original)
+++ lldb/trunk/test/python_api/value/linked_list/main.cpp (removed)
@@ -1,56 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-class Task {
-public:
- int id;
- Task *next;
- Task(int i, Task *n):
- id(i),
- next(n)
- {}
-};
-
-
-int main (int argc, char const *argv[])
-{
- Task *task_head = NULL;
- Task *task1 = new Task(1, NULL);
- Task *task2 = new Task(2, NULL);
- Task *task3 = new Task(3, NULL); // Orphaned.
- Task *task4 = new Task(4, NULL);
- Task *task5 = new Task(5, NULL);
-
- task_head = task1;
- task1->next = task2;
- task2->next = task4;
- task4->next = task5;
-
- int total = 0;
- Task *t = task_head;
- while (t != NULL) {
- if (t->id >= 0)
- ++total;
- t = t->next;
- }
- printf("We have a total number of %d tasks\n", total);
-
- // This corresponds to an empty task list.
- Task *empty_task_head = NULL;
-
- Task *task_evil = new Task(1, NULL);
- Task *task_2 = new Task(2, NULL);
- Task *task_3 = new Task(3, NULL);
- task_evil->next = task_2;
- task_2->next = task_3;
- task_3->next = task_evil; // In order to cause inifinite loop. :-)
-
- return 0; // Break at this line
-}
Removed: lldb/trunk/test/python_api/value/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value/main.c (original)
+++ lldb/trunk/test/python_api/value/main.c (removed)
@@ -1,52 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-// This simple program is to test the lldb Python API SBValue.GetChildAtIndex().
-
-int g_my_int = 100;
-
-const char *days_of_week[7] = { "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday" };
-
-const char *weekdays[5] = { "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday" };
-
-const char **g_table[2] = { days_of_week, weekdays };
-
-typedef int MyInt;
-
-struct MyStruct
-{
- int a;
- int b;
-};
-
-int main (int argc, char const *argv[])
-{
- int i;
- MyInt a = 12345;
- struct MyStruct s = { 11, 22 };
- int *my_int_ptr = &g_my_int;
- printf("my_int_ptr points to location %p\n", my_int_ptr);
- const char **str_ptr = days_of_week;
- for (i = 0; i < 7; ++i)
- printf("%s\n", str_ptr[i]); // Break at this line
- // and do str_ptr_val.GetChildAtIndex(5, lldb.eNoDynamicValues, True).
-
- return 0;
-}
Removed: lldb/trunk/test/python_api/value_var_update/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value_var_update/Makefile (original)
+++ lldb/trunk/test/python_api/value_var_update/Makefile (removed)
@@ -1,8 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-CFLAGS_EXTRAS += -std=c99
-# See TestHelloWorld.py, which specifies the executable name with a dictionary.
-EXE := hello_world
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py (original)
+++ lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py (removed)
@@ -1,59 +0,0 @@
-"""Test SBValue::GetValueDidChange"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, sys, time
-import lldb
-import time
-from lldbtest import *
-
-class HelloWorldTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Get the full path to our executable to be attached/debugged.
- self.exe = os.path.join(os.getcwd(), self.testMethodName)
- self.d = {'EXE': self.testMethodName}
-
- @add_test_categories(['pyapi'])
- def test_with_process_launch_api(self):
- """Test SBValue::GetValueDidChange"""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
- target = self.dbg.CreateTarget(self.exe)
-
- breakpoint = target.BreakpointCreateBySourceRegex("break here", lldb.SBFileSpec("main.c"))
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- i = self.frame().FindVariable("i")
- i_val = i.GetValueAsUnsigned(0)
- c = self.frame().FindVariable("c")
-
- # Update any values from the SBValue objects so we can ask them if they changed after a continue
- i.GetValueDidChange()
- c.GetChildAtIndex(1).GetValueDidChange()
- c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
-
- if self.TraceOn(): self.runCmd("frame variable")
-
- self.runCmd("continue")
-
- if self.TraceOn(): self.runCmd("frame variable")
-
- self.assertTrue(i_val != i.GetValueAsUnsigned(0), "GetValue() is saying a lie")
- self.assertTrue(i.GetValueDidChange(), "GetValueDidChange() is saying a lie")
-
- # Check complex type
- self.assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange() and
- not c.GetChildAtIndex(1).GetValueDidChange(), "GetValueDidChange() is saying a lie")
Removed: lldb/trunk/test/python_api/value_var_update/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/value_var_update/main.c (original)
+++ lldb/trunk/test/python_api/value_var_update/main.c (removed)
@@ -1,15 +0,0 @@
-struct complex_type {
- struct { long l; } inner;
- struct complex_type *complex_ptr;
-};
-
-int main() {
- int i = 0;
- struct complex_type c = { { 1L }, &c };
- for (int j = 3; j < 20; j++)
- {
- c.inner.l += (i += j);
- i = i - 1; // break here
- }
- return i;
-}
Removed: lldb/trunk/test/python_api/watchpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/Makefile (original)
+++ lldb/trunk/test/python_api/watchpoint/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py (removed)
@@ -1,92 +0,0 @@
-"""
-Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class SetWatchpointAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.c'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows
- def test_watch_val(self):
- """Exercise SBValue.Watch() API to set a watchpoint."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- # Watch 'global' for read and write.
- value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
- watchpoint = value.Watch(True, True, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the variable and set a watchpoint")
- self.DebugSBValue(value)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print(watchpoint)
-
- # Continue. Expect the program to stop due to the variable being written to.
- process.Continue()
-
- if (self.TraceOn()):
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
-
- # Continue. Expect the program to stop due to the variable being read from.
- process.Continue()
-
- if (self.TraceOn()):
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
-
- # Continue the process. We don't expect the program to be stopped again.
- process.Continue()
-
- # At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
Removed: lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py (removed)
@@ -1,88 +0,0 @@
-"""
-Use lldb Python SBWatchpoint API to set the ignore count.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class WatchpointIgnoreCountTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.c'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows
- def test_set_watch_ignore_count(self):
- """Test SBWatchpoint.SetIgnoreCount() API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create a breakpoint on main.c in order to set our watchpoint later.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- # Watch 'global' for read and write.
- value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
- watchpoint = value.Watch(True, True, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the variable and set a watchpoint")
- self.DebugSBValue(value)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- # There should be only 1 watchpoint location under the target.
- self.assertTrue(target.GetNumWatchpoints() == 1)
- watchpoint = target.GetWatchpointAtIndex(0)
- self.assertTrue(watchpoint.IsEnabled())
- self.assertTrue(watchpoint.GetIgnoreCount() == 0)
- watch_id = watchpoint.GetID()
- self.assertTrue(watch_id != 0)
- print(watchpoint)
-
- # Now immediately set the ignore count to 2. When we continue, expect the
- # inferior to run to its completion without stopping due to watchpoint.
- watchpoint.SetIgnoreCount(2)
- print(watchpoint)
- process.Continue()
-
- # At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
-
- # Verify some vital statistics.
- self.assertTrue(watchpoint)
- self.assertTrue(watchpoint.GetWatchSize() == 4)
- self.assertTrue(watchpoint.GetHitCount() == 2)
- print(watchpoint)
Removed: lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py (removed)
@@ -1,114 +0,0 @@
-"""
-Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class WatchpointIteratorTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.c'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows
- def test_watch_iter(self):
- """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create a breakpoint on main.c in order to set our watchpoint later.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- # Watch 'global' for read and write.
- value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
- watchpoint = value.Watch(True, True, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the variable and set a watchpoint")
- self.DebugSBValue(value)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- # There should be only 1 watchpoint location under the target.
- self.assertTrue(target.GetNumWatchpoints() == 1)
- self.assertTrue(watchpoint.IsEnabled())
- watch_id = watchpoint.GetID()
- self.assertTrue(watch_id != 0)
-
- # Continue. Expect the program to stop due to the variable being written to.
- process.Continue()
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- # Print the stack traces.
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
-
- # We currently only support hardware watchpoint. Verify that we have a
- # meaningful hardware index at this point. Exercise the printed repr of
- # SBWatchpointLocation.
- print(watchpoint)
- self.assertTrue(watchpoint.GetHardwareIndex() != -1)
-
- # SBWatchpoint.GetDescription() takes a description level arg.
- print(lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull))
-
- # Now disable the 'rw' watchpoint. The program won't stop when it reads
- # 'global' next.
- watchpoint.SetEnabled(False)
- self.assertTrue(watchpoint.GetHardwareIndex() == -1)
- self.assertFalse(watchpoint.IsEnabled())
-
- # Continue. The program does not stop again when the variable is being
- # read from because the watchpoint location has been disabled.
- process.Continue()
-
- # At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
-
- # Verify some vital statistics and exercise the iterator API.
- for watchpoint in target.watchpoint_iter():
- self.assertTrue(watchpoint)
- self.assertTrue(watchpoint.GetWatchSize() == 4)
- self.assertTrue(watchpoint.GetHitCount() == 1)
- print(watchpoint)
-
Removed: lldb/trunk/test/python_api/watchpoint/condition/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/condition/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/condition/Makefile (original)
+++ lldb/trunk/test/python_api/watchpoint/condition/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py (original)
+++ lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py (removed)
@@ -1,89 +0,0 @@
-"""
-Test watchpoint condition API.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import lldb
-import lldbutil
-from lldbtest import *
-
-class WatchpointConditionAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.cpp'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- # And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
- self.exe_name = self.testMethodName
- self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @skipIfWindows # Watchpoints not supported on Windows, and this test hangs
- def test_watchpoint_cond_api(self):
- """Test watchpoint condition API."""
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
- exe = os.path.join(os.getcwd(), self.exe_name)
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- # Watch 'global' for write.
- value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
- watchpoint = value.Watch(True, False, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the variable and set a watchpoint")
- self.DebugSBValue(value)
-
- # Now set the condition as "global==5".
- watchpoint.SetCondition('global==5')
- self.expect(watchpoint.GetCondition(), exe=False,
- startstr = 'global==5')
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print(watchpoint)
-
- # Continue. Expect the program to stop due to the variable being written to.
- process.Continue()
-
- if (self.TraceOn()):
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
-
- # Verify that the condition is met.
- self.assertTrue(value.GetValueAsUnsigned() == 5)
Removed: lldb/trunk/test/python_api/watchpoint/condition/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/condition/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/condition/main.cpp (original)
+++ lldb/trunk/test/python_api/watchpoint/condition/main.cpp (removed)
@@ -1,28 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdint.h>
-
-int32_t global = 0; // Watchpoint variable declaration.
-
-static void modify(int32_t &var) {
- ++var;
-}
-
-int main(int argc, char** argv) {
- int local = 0;
- printf("&global=%p\n", &global);
- printf("about to write to 'global'...\n"); // Set break point at this line.
- // When stopped, watch 'global',
- // for the condition "global == 5".
- for (int i = 0; i < 10; ++i)
- modify(global);
-
- printf("global=%d\n", global);
-}
Removed: lldb/trunk/test/python_api/watchpoint/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/main.c (original)
+++ lldb/trunk/test/python_api/watchpoint/main.c (removed)
@@ -1,24 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdint.h>
-
-int32_t global = 10; // Watchpoint variable declaration.
-
-int main(int argc, char** argv) {
- int local = 0;
- printf("&global=%p\n", &global);
- printf("about to write to 'global'...\n"); // Set break point at this line.
- // When stopped, watch 'global' for read&write.
- global = 20;
- local += argc;
- ++local;
- printf("local: %d\n", local);
- printf("global=%d\n", global);
-}
Removed: lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile (removed)
@@ -1,6 +0,0 @@
-LEVEL = ../../../make
-
-ENABLE_STD_THREADS := YES
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (removed)
@@ -1,89 +0,0 @@
-"""
-Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '*g_char_ptr'.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class SetWatchlocationAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.cpp'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- # This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows
- def test_watch_location(self):
- """Exercise SBValue.WatchPointee() API to set a watchpoint."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- value = frame0.FindValue('g_char_ptr',
- lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
- # Watch for write to *g_char_ptr.
- error = lldb.SBError();
- watchpoint = value.WatchPointee(True, False, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the pointer and set a watchpoint")
- self.DebugSBValue(value)
- self.DebugSBValue(pointee)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print(watchpoint)
-
- # Continue. Expect the program to stop due to the variable being written to.
- process.Continue()
-
- if (self.TraceOn()):
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
- self.DebugSBValue(pointee)
-
- self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False,
- substrs = [self.violating_func])
-
- # This finishes our test.
Removed: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (removed)
@@ -1,129 +0,0 @@
-"""
-Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of '*g_char_ptr'.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb, lldbutil
-from lldbtest import *
-
-class TargetWatchAddressAPITestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.cpp'
- # Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- # This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureWindows("llvm.org/pr24446")
- def test_watch_address(self):
- """Exercise SBTarget.WatchAddress() API to set a watchpoint."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- value = frame0.FindValue('g_char_ptr',
- lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
- # Watch for write to *g_char_ptr.
- error = lldb.SBError();
- watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 1, False, True, error)
- self.assertTrue(value and watchpoint,
- "Successfully found the pointer and set a watchpoint")
- self.DebugSBValue(value)
- self.DebugSBValue(pointee)
-
- # Hide stdout if not running with '-t' option.
- if not self.TraceOn():
- self.HideStdout()
-
- print(watchpoint)
-
- # Continue. Expect the program to stop due to the variable being written to.
- process.Continue()
-
- if (self.TraceOn()):
- lldbutil.print_stacktraces(process)
-
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
- self.assertTrue(thread, "The thread stopped due to watchpoint")
- self.DebugSBValue(value)
- self.DebugSBValue(pointee)
-
- self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False,
- substrs = [self.violating_func])
-
- # This finishes our test.
-
- @add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches
- def test_watch_address_with_invalid_watch_size(self):
- """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Now create a breakpoint on main.c.
- breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- # We should be stopped due to the breakpoint. Get frame #0.
- process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- frame0 = thread.GetFrameAtIndex(0)
-
- value = frame0.FindValue('g_char_ptr',
- lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
- # Watch for write to *g_char_ptr.
- error = lldb.SBError();
- watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 365, False, True, error)
- self.assertFalse(watchpoint)
- self.expect(error.GetCString(), exe=False,
- substrs = ['watch size of %d is not supported' % 365])
Removed: lldb/trunk/test/python_api/watchpoint/watchlocation/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/main.cpp (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/main.cpp (removed)
@@ -1,104 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <chrono>
-#include <condition_variable>
-#include <cstdio>
-#include <random>
-#include <thread>
-
-std::default_random_engine g_random_engine{std::random_device{}()};
-std::uniform_int_distribution<> g_distribution{0, 3000000};
-std::condition_variable g_condition_variable;
-std::mutex g_mutex;
-int g_count;
-
-char *g_char_ptr = nullptr;
-
-void
-barrier_wait()
-{
- std::unique_lock<std::mutex> lock{g_mutex};
- if (--g_count > 0)
- g_condition_variable.wait(lock);
- else
- g_condition_variable.notify_all();
-}
-
-void
-do_bad_thing_with_location(char *char_ptr, char new_val)
-{
- *char_ptr = new_val;
-}
-
-uint32_t
-access_pool (bool flag = false)
-{
- static std::mutex g_access_mutex;
- if (!flag)
- g_access_mutex.lock();
-
- char old_val = *g_char_ptr;
- if (flag)
- do_bad_thing_with_location(g_char_ptr, old_val + 1);
-
- if (!flag)
- g_access_mutex.unlock();
- return *g_char_ptr;
-}
-
-void
-thread_func (uint32_t thread_index)
-{
- printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
-
- barrier_wait();
-
- uint32_t count = 0;
- uint32_t val;
- while (count++ < 15)
- {
- // random micro second sleep from zero to 3 seconds
- int usec = g_distribution(g_random_engine);
- printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
- std::this_thread::sleep_for(std::chrono::microseconds{usec});
-
- if (count < 7)
- val = access_pool ();
- else
- val = access_pool (true);
-
- printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count);
- }
- printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
-}
-
-
-int main (int argc, char const *argv[])
-{
- g_count = 4;
- std::thread threads[3];
-
- g_char_ptr = new char{};
-
- // Create 3 threads
- for (auto &thread : threads)
- thread = std::thread{thread_func, std::distance(threads, &thread)};
-
- printf ("Before turning all three threads loose...\n"); // Set break point at this line.
- barrier_wait();
-
- // Join all of our threads
- for (auto &thread : threads)
- thread.join();
-
- delete g_char_ptr;
-
- return 0;
-}
Removed: lldb/trunk/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/redo.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/redo.py (original)
+++ lldb/trunk/test/redo.py (removed)
@@ -1,195 +0,0 @@
-#!/usr/bin/env python
-
-"""
-A simple utility to redo the failed/errored tests.
-
-You need to specify the session directory in order for this script to locate the
-tests which need to be re-run.
-
-See also dotest.py, the test driver running the test suite.
-
-Type:
-
-./dotest.py -h
-
-for help.
-"""
-
-from __future__ import print_function
-
-import os, sys, datetime
-import re
-
-# If True, redo with no '-t' option for the test driver.
-no_trace = False
-
-# To be filled with the filterspecs found in the session logs.
-redo_specs = []
-
-# The filename components to match for. Only files with the contained component names
-# will be considered for re-run. Examples: ['X86_64', 'clang'].
-filename_components = []
-
-do_delay = False
-
-# There is a known bug with respect to comp_specs and arch_specs, in that if we
-# encountered "-C clang" and "-C gcc" when visiting the session files, both
-# compilers will end up in the invocation of the test driver when rerunning.
-# That is: ./dotest -v -C clang^gcc ... -f ...". Ditto for "-A" flags.
-
-# The "-C compiler" for comp_specs.
-comp_specs = set()
-# The "-A arch" for arch_specs.
-arch_specs = set()
-
-def usage():
- print("""\
-Usage: redo.py [-F filename_component] [-n] [session_dir] [-d]
-where options:
--F : only consider the test for re-run if the session filename contains the filename component
- for example: -F x86_64
--n : when running the tests, do not turn on trace mode, i.e, no '-t' option
- is passed to the test driver (this will run the tests faster)
--d : pass -d down to the test driver (introduces a delay so you can attach with a debugger)
-
-and session_dir specifies the session directory which contains previously
-recorded session infos for all the test cases which either failed or errored.
-
-If sessin_dir is left unspecified, this script uses the heuristic to find the
-possible session directories with names starting with %Y-%m-%d- (for example,
-2012-01-23-) and employs the one with the latest timestamp.""")
- sys.exit(0)
-
-def where(session_dir, test_dir):
- """Returns the full path to the session directory; None if non-existent."""
- abspath = os.path.abspath(session_dir)
- if os.path.isdir(abspath):
- return abspath
-
- session_dir_path = os.path.join(test_dir, session_dir)
- if os.path.isdir(session_dir_path):
- return session_dir_path
-
- return None
-
-# This is the pattern for the line from the log file to redo a test.
-# We want the filter spec.
-filter_pattern = re.compile("^\./dotest\.py.*-f (.*)$")
-comp_pattern = re.compile(" -C ([^ ]+) ")
-arch_pattern = re.compile(" -A ([^ ]+) ")
-def redo(suffix, dir, names):
- """Visitor function for os.path.walk(path, visit, arg)."""
- global redo_specs
- global comp_specs
- global arch_specs
- global filter_pattern
- global comp_pattern
- global arch_pattern
- global filename_components
- global do_delay
-
- for name in names:
- if name.endswith(suffix):
- #print("Find a log file:", name)
- if name.startswith("Error") or name.startswith("Failure"):
- if filename_components:
- if not all([comp in name for comp in filename_components]):
- continue
- with open(os.path.join(dir, name), 'r') as log:
- content = log.read()
- for line in content.splitlines():
- match = filter_pattern.match(line)
- if match:
- filterspec = match.group(1)
- print("adding filterspec:", filterspec)
- redo_specs.append(filterspec)
- comp = comp_pattern.search(line)
- if comp:
- comp_specs.add(comp.group(1))
- arch = arch_pattern.search(line)
- if arch:
- arch_specs.add(arch.group(1))
- else:
- continue
-
-def main():
- """Read the session directory and run the failed test cases one by one."""
- global no_trace
- global redo_specs
- global filename_components
- global do_delay
-
- test_dir = sys.path[0]
- if not test_dir:
- test_dir = os.getcwd()
- if not test_dir.endswith('test'):
- print("This script expects to reside in lldb's test directory.")
- sys.exit(-1)
-
- index = 1
- while index < len(sys.argv):
- if sys.argv[index].startswith('-h') or sys.argv[index].startswith('--help'):
- usage()
-
- if sys.argv[index].startswith('-'):
- # We should continue processing...
- pass
- else:
- # End of option processing.
- break
-
- if sys.argv[index] == '-F':
- # Increment by 1 to fetch the filename component spec.
- index += 1
- if index >= len(sys.argv) or sys.argv[index].startswith('-'):
- usage()
- filename_components.append(sys.argv[index])
- elif sys.argv[index] == '-n':
- no_trace = True
- elif sys.argv[index] == '-d':
- do_delay = True
-
- index += 1
-
- if index < len(sys.argv):
- # Get the specified session directory.
- session_dir = sys.argv[index]
- else:
- # Use heuristic to find the latest session directory.
- name = datetime.datetime.now().strftime("%Y-%m-%d-")
- dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
- if len(dirs) == 0:
- print("No default session directory found, please specify it explicitly.")
- usage()
- session_dir = max(dirs, key=os.path.getmtime)
- if not session_dir or not os.path.exists(session_dir):
- print("No default session directory found, please specify it explicitly.")
- usage()
-
- #print("The test directory:", test_dir)
- session_dir_path = where(session_dir, test_dir)
-
- print("Using session dir path:", session_dir_path)
- os.chdir(test_dir)
- os.path.walk(session_dir_path, redo, ".log")
-
- if not redo_specs:
- print("No failures/errors recorded within the session directory, please specify a different session directory.\n")
- usage()
-
- filters = " -f ".join(redo_specs)
- compilers = ''
- for comp in comp_specs:
- compilers += " -C %s" % (comp)
- archs = ''
- for arch in arch_specs:
- archs += "--arch %s " % (arch)
-
- command = "./dotest.py %s %s -v %s %s -f " % (compilers, archs, "" if no_trace else "-t", "-d" if do_delay else "")
-
-
- print("Running %s" % (command + filters))
- os.system(command + filters)
-
-if __name__ == '__main__':
- main()
Removed: lldb/trunk/test/settings/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/Makefile (original)
+++ lldb/trunk/test/settings/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py (removed)
@@ -1,495 +0,0 @@
-"""
-Test lldb settings command.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time, re
-import lldb
-from lldbtest import *
-
-class SettingsCommandTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @classmethod
- def classCleanup(cls):
- """Cleanup the test byproducts."""
- cls.RemoveTempFile("output1.txt")
- cls.RemoveTempFile("output2.txt")
- cls.RemoveTempFile("stderr.txt")
- cls.RemoveTempFile("stdout.txt")
-
- @no_debug_info_test
- def test_apropos_should_also_search_settings_description(self):
- """Test that 'apropos' command should also search descriptions for the settings variables."""
-
- self.expect("apropos 'environment variable'",
- substrs = ["target.env-vars",
- "environment variables",
- "executable's environment"])
-
- @no_debug_info_test
- def test_append_target_env_vars(self):
- """Test that 'append target.run-args' works."""
- # Append the env-vars.
- self.runCmd('settings append target.env-vars MY_ENV_VAR=YES')
- # And add hooks to restore the settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.env-vars"))
-
- # Check it immediately!
- self.expect('settings show target.env-vars',
- substrs = ['MY_ENV_VAR=YES'])
-
- @no_debug_info_test
- def test_insert_before_and_after_target_run_args(self):
- """Test that 'insert-before/after target.run-args' works."""
- # Set the run-args first.
- self.runCmd('settings set target.run-args a b c')
- # And add hooks to restore the settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.run-args"))
-
- # Now insert-before the index-0 element with '__a__'.
- self.runCmd('settings insert-before target.run-args 0 __a__')
- # And insert-after the index-1 element with '__A__'.
- self.runCmd('settings insert-after target.run-args 1 __A__')
- # Check it immediately!
- self.expect('settings show target.run-args',
- substrs = ['target.run-args',
- '[0]: "__a__"',
- '[1]: "a"',
- '[2]: "__A__"',
- '[3]: "b"',
- '[4]: "c"'])
-
- @no_debug_info_test
- def test_replace_target_run_args(self):
- """Test that 'replace target.run-args' works."""
- # Set the run-args and then replace the index-0 element.
- self.runCmd('settings set target.run-args a b c')
- # And add hooks to restore the settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.run-args"))
-
- # Now replace the index-0 element with 'A', instead.
- self.runCmd('settings replace target.run-args 0 A')
- # Check it immediately!
- self.expect('settings show target.run-args',
- substrs = ['target.run-args (arguments) =',
- '[0]: "A"',
- '[1]: "b"',
- '[2]: "c"'])
-
- @no_debug_info_test
- def test_set_prompt(self):
- """Test that 'set prompt' actually changes the prompt."""
-
- # Set prompt to 'lldb2'.
- self.runCmd("settings set prompt 'lldb2 '")
-
- # Immediately test the setting.
- self.expect("settings show prompt", SETTING_MSG("prompt"),
- startstr = 'prompt (string) = "lldb2 "')
-
- # The overall display should also reflect the new setting.
- self.expect("settings show", SETTING_MSG("prompt"),
- substrs = ['prompt (string) = "lldb2 "'])
-
- # Use '-r' option to reset to the original default prompt.
- self.runCmd("settings clear prompt")
-
- @no_debug_info_test
- def test_set_term_width(self):
- """Test that 'set term-width' actually changes the term-width."""
-
- self.runCmd("settings set term-width 70")
-
- # Immediately test the setting.
- self.expect("settings show term-width", SETTING_MSG("term-width"),
- startstr = "term-width (int) = 70")
-
- # The overall display should also reflect the new setting.
- self.expect("settings show", SETTING_MSG("term-width"),
- substrs = ["term-width (int) = 70"])
-
- #rdar://problem/10712130
- def test_set_frame_format(self):
- """Test that 'set frame-format' with a backtick char in the format string works as well as fullpath."""
- self.build()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- def cleanup():
- self.runCmd("settings set frame-format %s" % self.format_string, check=False)
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
- self.runCmd("settings show frame-format")
- m = re.match(
- '^frame-format \(format-string\) = "(.*)\"$',
- self.res.GetOutput())
- self.assertTrue(m, "Bad settings string")
- self.format_string = m.group(1)
-
- # Change the default format to print function.name rather than function.name-with-args
- format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n"
- self.runCmd("settings set frame-format %s" % format_string)
-
- # Immediately test the setting.
- self.expect("settings show frame-format", SETTING_MSG("frame-format"),
- substrs = [format_string])
-
- self.runCmd("breakpoint set -n main")
- self.runCmd("run")
- self.expect("thread backtrace",
- substrs = ["`main", os.getcwd()])
-
- def test_set_auto_confirm(self):
- """Test that after 'set auto-confirm true', manual confirmation should not kick in."""
- self.build()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- self.runCmd("settings set auto-confirm true")
-
- # Immediately test the setting.
- self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
- startstr = "auto-confirm (boolean) = true")
-
- # Now 'breakpoint delete' should just work fine without confirmation
- # prompt from the command interpreter.
- self.runCmd("breakpoint set -n main")
- self.expect("breakpoint delete",
- startstr = "All breakpoints removed")
-
- # Restore the original setting of auto-confirm.
- self.runCmd("settings clear auto-confirm")
- self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
- startstr = "auto-confirm (boolean) = false")
-
- @skipUnlessArch(['x86_64', 'i386', 'i686'])
- def test_disassembler_settings(self):
- """Test that user options for the disassembler take effect."""
- self.build()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # AT&T syntax
- self.runCmd("settings set target.x86-disassembly-flavor att")
- self.runCmd("settings set target.use-hex-immediates false")
- self.expect("disassemble -n numberfn",
- substrs = ["$90"])
- self.runCmd("settings set target.use-hex-immediates true")
- self.runCmd("settings set target.hex-immediate-style c")
- self.expect("disassemble -n numberfn",
- substrs = ["$0x5a"])
- self.runCmd("settings set target.hex-immediate-style asm")
- self.expect("disassemble -n numberfn",
- substrs = ["$5ah"])
-
- # Intel syntax
- self.runCmd("settings set target.x86-disassembly-flavor intel")
- self.runCmd("settings set target.use-hex-immediates false")
- self.expect("disassemble -n numberfn",
- substrs = ["90"])
- self.runCmd("settings set target.use-hex-immediates true")
- self.runCmd("settings set target.hex-immediate-style c")
- self.expect("disassemble -n numberfn",
- substrs = ["0x5a"])
- self.runCmd("settings set target.hex-immediate-style asm")
- self.expect("disassemble -n numberfn",
- substrs = ["5ah"])
-
- @expectedFailureWindows("llvm.org/pr24579")
- def test_run_args_and_env_vars(self):
- """Test that run-args and env-vars are passed to the launched process."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Set the run-args and the env-vars.
- # And add hooks to restore the settings during tearDown().
- self.runCmd('settings set target.run-args A B C')
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.run-args"))
- self.runCmd('settings set target.env-vars ["MY_ENV_VAR"]=YES')
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.env-vars"))
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Read the output file produced by running the program.
- if lldb.remote_platform:
- self.runCmd('platform get-file "output2.txt" "output2.txt"')
- with open('output2.txt', 'r') as f:
- output = f.read()
-
- self.expect(output, exe=False,
- substrs = ["argv[1] matches",
- "argv[2] matches",
- "argv[3] matches",
- "Environment variable 'MY_ENV_VAR' successfully passed."])
-
- @skipIfRemote # it doesn't make sense to send host env to remote target
- def test_pass_host_env_vars(self):
- """Test that the host env vars are passed to the launched process."""
- self.build()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # By default, inherit-env is 'true'.
- self.expect('settings show target.inherit-env', "Default inherit-env is 'true'",
- startstr = "target.inherit-env (boolean) = true")
-
- # Set some host environment variables now.
- os.environ["MY_HOST_ENV_VAR1"] = "VAR1"
- os.environ["MY_HOST_ENV_VAR2"] = "VAR2"
-
- # This is the function to unset the two env variables set above.
- def unset_env_variables():
- os.environ.pop("MY_HOST_ENV_VAR1")
- os.environ.pop("MY_HOST_ENV_VAR2")
-
- self.addTearDownHook(unset_env_variables)
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Read the output file produced by running the program.
- if lldb.remote_platform:
- self.runCmd('platform get-file "output1.txt" "output1.txt"')
- with open('output1.txt', 'r') as f:
- output = f.read()
-
- self.expect(output, exe=False,
- substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
- "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
-
- def test_set_error_output_path(self):
- """Test that setting target.error/output-path for the launched process works."""
- self.build()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Set the error-path and output-path and verify both are set.
- self.runCmd("settings set target.error-path stderr.txt")
- self.runCmd("settings set target.output-path stdout.txt")
- # And add hooks to restore the original settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.output-path"))
- self.addTearDownHook(
- lambda: self.runCmd("settings clear target.error-path"))
-
- self.expect("settings show target.error-path",
- SETTING_MSG("target.error-path"),
- substrs = ['target.error-path (file) = "stderr.txt"'])
-
- self.expect("settings show target.output-path",
- SETTING_MSG("target.output-path"),
- substrs = ['target.output-path (file) = "stdout.txt"'])
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- if lldb.remote_platform:
- self.runCmd('platform get-file "stderr.txt" "stderr.txt"')
- self.runCmd('platform get-file "stdout.txt" "stdout.txt"')
-
-
- # The 'stderr.txt' file should now exist.
- self.assertTrue(os.path.isfile("stderr.txt"),
- "'stderr.txt' exists due to target.error-path.")
-
- # Read the output file produced by running the program.
- with open('stderr.txt', 'r') as f:
- output = f.read()
-
- self.expect(output, exe=False,
- startstr = "This message should go to standard error.")
-
- # The 'stdout.txt' file should now exist.
- self.assertTrue(os.path.isfile("stdout.txt"),
- "'stdout.txt' exists due to target.output-path.")
-
- # Read the output file produced by running the program.
- with open('stdout.txt', 'r') as f:
- output = f.read()
-
- self.expect(output, exe=False,
- startstr = "This message should go to standard out.")
-
- @no_debug_info_test
- def test_print_dictionary_setting(self):
- self.runCmd ("settings clear target.env-vars")
- self.runCmd ("settings set target.env-vars [\"MY_VAR\"]=some-value")
- self.expect ("settings show target.env-vars",
- substrs = [ "MY_VAR=some-value" ])
- self.runCmd ("settings clear target.env-vars")
-
- @no_debug_info_test
- def test_print_array_setting(self):
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings set target.run-args gobbledy-gook")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "gobbledy-gook"' ])
- self.runCmd ("settings clear target.run-args")
-
- @no_debug_info_test
- def test_settings_with_quotes (self):
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings set target.run-args a b c")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "a"',
- '[1]: "b"',
- '[2]: "c"' ])
- self.runCmd ("settings set target.run-args 'a b c'")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "a b c"' ])
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings clear target.env-vars")
- self.runCmd ('settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
- self.expect ("settings show target.env-vars",
- substrs = [ 'MY_FILE=this is a file name with spaces.txt' ])
- self.runCmd ("settings clear target.env-vars")
- # Test and make sure that setting "format-string" settings obeys quotes if they are provided
- self.runCmd ("settings set thread-format 'abc def' ")
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def"')
- self.runCmd ('settings set thread-format "abc def" ')
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def"')
- # Make sure when no quotes are provided that we maintain any trailing spaces
- self.runCmd ('settings set thread-format abc def ')
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def "')
- self.runCmd ('settings clear thread-format')
-
- @no_debug_info_test
- def test_settings_with_trailing_whitespace (self):
-
- # boolean
- self.runCmd ("settings set target.skip-prologue true") # Set to known value
- self.runCmd ("settings set target.skip-prologue false ") # Set to new value with trailing whitespace
- # Make sure the setting was correctly set to "false"
- self.expect ("settings show target.skip-prologue", SETTING_MSG("target.skip-prologue"),
- startstr = "target.skip-prologue (boolean) = false")
- self.runCmd("settings clear target.skip-prologue", check=False)
- # integer
- self.runCmd ("settings set term-width 70") # Set to known value
- self.runCmd ("settings set term-width 60 \t") # Set to new value with trailing whitespaces
- self.expect ("settings show term-width", SETTING_MSG("term-width"),
- startstr = "term-width (int) = 60")
- self.runCmd("settings clear term-width", check=False)
- # string
- self.runCmd ("settings set target.arg0 abc") # Set to known value
- self.runCmd ("settings set target.arg0 cde\t ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.arg0", SETTING_MSG("target.arg0"),
- startstr = 'target.arg0 (string) = "cde"')
- self.runCmd("settings clear target.arg0", check=False)
- # file
- path1 = os.path.join(os.getcwd(), "path1.txt")
- path2 = os.path.join(os.getcwd(), "path2.txt")
- self.runCmd ("settings set target.output-path %s" % path1) # Set to known value
- self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
- startstr = 'target.output-path (file) = ', substrs=[path1])
- self.runCmd ("settings set target.output-path %s " % path2) # Set to new value with trailing whitespaces
- self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
- startstr = 'target.output-path (file) = ', substrs=[path2])
- self.runCmd("settings clear target.output-path", check=False)
- # enum
- self.runCmd ("settings set stop-disassembly-display never") # Set to known value
- self.runCmd ("settings set stop-disassembly-display always ") # Set to new value with trailing whitespaces
- self.expect ("settings show stop-disassembly-display", SETTING_MSG("stop-disassembly-display"),
- startstr = 'stop-disassembly-display (enum) = always')
- self.runCmd("settings clear stop-disassembly-display", check=False)
- # language
- self.runCmd ("settings set target.language c89") # Set to known value
- self.runCmd ("settings set target.language go ") # Set to new value with trailing whitespace
- self.expect ("settings show target.language", SETTING_MSG("target.language"),
- startstr = "target.language (language) = go")
- self.runCmd("settings clear target.language", check=False)
- # arguments
- self.runCmd ("settings set target.run-args 1 2 3") # Set to known value
- self.runCmd ("settings set target.run-args 3 4 5 ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
- substrs = [ 'target.run-args (arguments) =',
- '[0]: "3"',
- '[1]: "4"',
- '[2]: "5"' ])
- self.runCmd ("settings set target.run-args 1 2 3") # Set to known value
- self.runCmd ("settings set target.run-args 3 \ \ ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
- substrs = [ 'target.run-args (arguments) =',
- '[0]: "3"',
- '[1]: " "',
- '[2]: " "' ])
- self.runCmd("settings clear target.run-args", check=False)
- # dictionaries
- self.runCmd ("settings clear target.env-vars") # Set to known value
- self.runCmd ("settings set target.env-vars A=B C=D\t ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.env-vars", SETTING_MSG("target.env-vars"),
- substrs = [ 'target.env-vars (dictionary of strings) =',
- 'A=B',
- 'C=D'])
- self.runCmd("settings clear target.env-vars", check=False)
- # regex
- self.runCmd ("settings clear target.process.thread.step-avoid-regexp") # Set to known value
- self.runCmd ("settings set target.process.thread.step-avoid-regexp foo\\ ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.process.thread.step-avoid-regexp",
- SETTING_MSG("target.process.thread.step-avoid-regexp"),
- substrs = [ 'target.process.thread.step-avoid-regexp (regex) = foo\\ '])
- self.runCmd("settings clear target.process.thread.step-avoid-regexp", check=False)
- # format-string
- self.runCmd ("settings clear disassembly-format") # Set to known value
- self.runCmd ("settings set disassembly-format foo ") # Set to new value with trailing whitespaces
- self.expect ("settings show disassembly-format",
- SETTING_MSG("disassembly-format"),
- substrs = [ 'disassembly-format (format-string) = "foo "'])
- self.runCmd("settings clear disassembly-format", check=False)
-
- @no_debug_info_test
- def test_all_settings_exist (self):
- self.expect ("settings show",
- substrs = [ "auto-confirm",
- "frame-format",
- "notify-void",
- "prompt",
- "script-lang",
- "stop-disassembly-count",
- "stop-disassembly-display",
- "stop-line-count-after",
- "stop-line-count-before",
- "term-width",
- "thread-format",
- "use-external-editor",
- "target.default-arch",
- "target.move-to-nearest-code",
- "target.expr-prefix",
- "target.language",
- "target.prefer-dynamic-value",
- "target.enable-synthetic-value",
- "target.skip-prologue",
- "target.source-map",
- "target.exec-search-paths",
- "target.max-children-count",
- "target.max-string-summary-length",
- "target.breakpoints-use-platform-avoid-list",
- "target.run-args",
- "target.env-vars",
- "target.inherit-env",
- "target.input-path",
- "target.output-path",
- "target.error-path",
- "target.disable-aslr",
- "target.disable-stdio",
- "target.x86-disassembly-flavor",
- "target.use-hex-immediates",
- "target.hex-immediate-style",
- "target.process.disable-memory-cache",
- "target.process.extra-startup-command",
- "target.process.thread.step-avoid-regexp",
- "target.process.thread.trace-thread"])
Removed: lldb/trunk/test/settings/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/main.cpp (original)
+++ lldb/trunk/test/settings/main.cpp (removed)
@@ -1,75 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdlib>
-#include <string>
-#include <fstream>
-#include <iostream>
-
-int numberfn()
-{
- return 0x5a;
-}
-
-int
-main(int argc, char const *argv[])
-{
- // The program writes its output to the following file:
- //
- // o "output1.txt" for test_pass_host_env_vars() test case
- // o "output2.txt" for test_run_args_and_env_vars_with_dsym() test case
- // o "output2.txt" for test_run_args_and_env_vars_with_dwarf() test case
- std::ofstream outfile;
- if (argc == 1)
- outfile.open("output1.txt");
- else
- outfile.open("output2.txt");
-
- for (unsigned i = 0; i < argc; ++i) {
- std::string theArg(argv[i]);
- if (i == 1 && "A" == theArg)
- outfile << "argv[1] matches\n";
-
- if (i == 2 && "B" == theArg)
- outfile << "argv[2] matches\n";
-
- if (i == 3 && "C" == theArg)
- outfile << "argv[3] matches\n";
- }
-
- // For passing environment vars from the debugger to the launched process.
- if (::getenv("MY_ENV_VAR")) {
- std::string MY_ENV_VAR(getenv("MY_ENV_VAR"));
- if ("YES" == MY_ENV_VAR) {
- outfile << "Environment variable 'MY_ENV_VAR' successfully passed.\n";
- }
- }
-
-
- // For passing host environment vars to the launched process.
- if (::getenv("MY_HOST_ENV_VAR1")) {
- std::string MY_HOST_ENV_VAR1(getenv("MY_HOST_ENV_VAR1"));
- if ("VAR1" == MY_HOST_ENV_VAR1) {
- outfile << "The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.\n";
- }
- }
-
- if (::getenv("MY_HOST_ENV_VAR2")) {
- std::string MY_HOST_ENV_VAR2(getenv("MY_HOST_ENV_VAR2"));
- if ("VAR2" == MY_HOST_ENV_VAR2) {
- outfile << "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed.\n";
- }
- }
-
- std::cerr << "This message should go to standard error.\n";
- std::cout << "This message should go to standard out.\n";
-
- outfile.close();
- return numberfn();
-}
Removed: lldb/trunk/test/settings/quoting/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/quoting/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/quoting/Makefile (original)
+++ lldb/trunk/test/settings/quoting/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/settings/quoting/TestQuoting.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/quoting/TestQuoting.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/quoting/TestQuoting.py (original)
+++ lldb/trunk/test/settings/quoting/TestQuoting.py (removed)
@@ -1,92 +0,0 @@
-"""
-Test quoting of arguments to lldb commands
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time, re
-import lldb
-from lldbtest import *
-
-class SettingsCommandTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @classmethod
- def classCleanup(cls):
- """Cleanup the test byproducts."""
- cls.RemoveTempFile("stdout.txt")
-
- @no_debug_info_test
- def test_no_quote(self):
- self.do_test_args("a b c", "a\0b\0c\0")
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_single_quote(self):
- self.do_test_args("'a b c'", "a b c\0")
-
- @no_debug_info_test
- def test_double_quote(self):
- self.do_test_args('"a b c"', "a b c\0")
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_single_quote_escape(self):
- self.do_test_args("'a b\\' c", "a b\\\0c\0")
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_double_quote_escape(self):
- self.do_test_args('"a b\\" c"', 'a b" c\0')
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_double_quote_escape2(self):
- self.do_test_args('"a b\\\\" c', 'a b\\\0c\0')
-
- @no_debug_info_test
- def test_single_in_double(self):
- self.do_test_args('"a\'b"', "a'b\0")
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_double_in_single(self):
- self.do_test_args("'a\"b'", 'a"b\0')
-
- @no_debug_info_test
- def test_combined(self):
- self.do_test_args('"a b"c\'d e\'', 'a bcd e\0')
-
- @no_debug_info_test
- def test_bare_single(self):
- self.do_test_args("a\\'b", "a'b\0")
-
- @expectedFailureWindows("http://llvm.org/pr24557")
- @no_debug_info_test
- def test_bare_double(self):
- self.do_test_args('a\\"b', 'a"b\0')
-
- def do_test_args(self, args_in, args_out):
- """Test argument parsing. Run the program with args_in. The program dumps its arguments
- to stdout. Compare the stdout with args_out."""
- self.buildDefault()
-
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- self.runCmd("process launch -o stdout.txt -- " + args_in)
-
- if lldb.remote_platform:
- src_file_spec = lldb.SBFileSpec('stdout.txt', False)
- dst_file_spec = lldb.SBFileSpec('stdout.txt', True)
- lldb.remote_platform.Get(src_file_spec, dst_file_spec)
-
- with open('stdout.txt', 'r') as f:
- output = f.read()
-
- self.RemoveTempFile("stdout.txt")
-
- self.assertEqual(output, args_out)
Removed: lldb/trunk/test/settings/quoting/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/quoting/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/settings/quoting/main.c (original)
+++ lldb/trunk/test/settings/quoting/main.c (removed)
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/* This program writes its arguments (separated by '\0') to stdout. */
-int
-main(int argc, char const *argv[])
-{
- int i;
- for (i = 1; i < argc; ++i)
- fwrite(argv[i], strlen(argv[i])+1, 1, stdout);
-
- return 0;
-}
Removed: lldb/trunk/test/source-manager/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/source-manager/Makefile (original)
+++ lldb/trunk/test/source-manager/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/TestSourceManager.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/test/source-manager/TestSourceManager.py (removed)
@@ -1,173 +0,0 @@
-"""
-Test lldb core component: SourceManager.
-
-Test cases:
-
-o test_display_source_python:
- Test display of source using the SBSourceManager API.
-o test_modify_source_file_while_debugging:
- Test the caching mechanism of the source manager.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldb
-from lldbtest import *
-import lldbutil
-
-class SourceManagerTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number('main.c', '// Set break point at this line.')
- lldb.skip_build_and_cleanup = False
-
- @add_test_categories(['pyapi'])
- def test_display_source_python(self):
- """Test display of source using the SBSourceManager API."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
-
- #
- # Exercise Python APIs to display source lines.
- #
-
- # Create the filespec for 'main.c'.
- filespec = lldb.SBFileSpec('main.c', False)
- source_mgr = self.dbg.GetSourceManager()
- # Use a string stream as the destination.
- stream = lldb.SBStream()
- source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
- self.line,
- 2, # context before
- 2, # context after
- "=>", # prefix for current line
- stream)
-
- # 2
- # 3 int main(int argc, char const *argv[]) {
- # => 4 printf("Hello world.\n"); // Set break point at this line.
- # 5 return 0;
- # 6 }
- self.expect(stream.GetData(), "Source code displayed correctly",
- exe=False,
- patterns = ['=> %d.*Hello world' % self.line])
-
- # Boundary condition testings for SBStream(). LLDB should not crash!
- stream.Print(None)
- stream.RedirectToFile(None, True)
-
- def test_move_and_then_display_source(self):
- """Test that target.source-map settings work by moving main.c to hidden/main.c."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Move main.c to hidden/main.c.
- main_c = "main.c"
- main_c_hidden = os.path.join("hidden", main_c)
- os.rename(main_c, main_c_hidden)
-
- if self.TraceOn():
- system([["ls"]])
- system([["ls", "hidden"]])
-
- # Restore main.c after the test.
- self.addTearDownHook(lambda: os.rename(main_c_hidden, main_c))
-
- # Set target.source-map settings.
- self.runCmd("settings set target.source-map %s %s" % (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
- # And verify that the settings work.
- self.expect("settings show target.source-map",
- substrs = [os.getcwd(), os.path.join(os.getcwd(), "hidden")])
-
- # Display main() and verify that the source mapping has been kicked in.
- self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello world'])
-
- def test_modify_source_file_while_debugging(self):
- """Modify a source file while debugging the executable."""
- self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'main.c:%d' % self.line,
- 'stop reason = breakpoint'])
-
- # Display some source code.
- self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello world'])
-
- # The '-b' option shows the line table locations from the debug information
- # that indicates valid places to set source level breakpoints.
-
- # The file to display is implicit in this case.
- self.runCmd("source list -l %d -c 3 -b" % self.line)
- output = self.res.GetOutput().splitlines()[0]
-
- # If the breakpoint set command succeeded, we should expect a positive number
- # of breakpoints for the current line, i.e., self.line.
- import re
- m = re.search('^\[(\d+)\].*// Set break point at this line.', output)
- if not m:
- self.fail("Fail to display source level breakpoints")
- self.assertTrue(int(m.group(1)) > 0)
-
- # Read the main.c file content.
- with open('main.c', 'r') as f:
- original_content = f.read()
- if self.TraceOn():
- print("original content:", original_content)
-
- # Modify the in-memory copy of the original source code.
- new_content = original_content.replace('Hello world', 'Hello lldb', 1)
-
- # This is the function to restore the original content.
- def restore_file():
- #print("os.path.getmtime() before restore:", os.path.getmtime('main.c'))
- time.sleep(1)
- with open('main.c', 'wb') as f:
- f.write(original_content)
- if self.TraceOn():
- with open('main.c', 'r') as f:
- print("content restored to:", f.read())
- # Touch the file just to be sure.
- os.utime('main.c', None)
- if self.TraceOn():
- print("os.path.getmtime() after restore:", os.path.getmtime('main.c'))
-
-
-
- # Modify the source code file.
- with open('main.c', 'wb') as f:
- time.sleep(1)
- f.write(new_content)
- if self.TraceOn():
- print("new content:", new_content)
- print("os.path.getmtime() after writing new content:", os.path.getmtime('main.c'))
- # Add teardown hook to restore the file to the original content.
- self.addTearDownHook(restore_file)
-
- # Display the source code again. We should see the updated line.
- self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello lldb'])
Removed: lldb/trunk/test/source-manager/hidden/.keep
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/hidden/.keep?rev=251531&view=auto
==============================================================================
(empty)
Removed: lldb/trunk/test/source-manager/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/main.c?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/source-manager/main.c (original)
+++ lldb/trunk/test/source-manager/main.c (removed)
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char const *argv[]) {
- printf("Hello world.\n"); // Set break point at this line.
- return 0;
-}
Removed: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original)
+++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (removed)
@@ -1,121 +0,0 @@
-"""
-Test that 'stty -a' displays the same output before and after running the lldb command.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os
-import lldb
-from lldbtest import *
-
-class CommandLineCompletionTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @classmethod
- def classCleanup(cls):
- """Cleanup the test byproducts."""
- cls.RemoveTempFile("child_send1.txt")
- cls.RemoveTempFile("child_read1.txt")
- cls.RemoveTempFile("child_send2.txt")
- cls.RemoveTempFile("child_read2.txt")
-
- @expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @no_debug_info_test
- def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
- """Test that 'stty -a' displays the same output before and after running the lldb command."""
- import pexpect
- if not which('expect'):
- self.skipTest("The 'expect' program cannot be located, skip the test")
-
- # The expect prompt.
- expect_prompt = "expect[0-9.]+> "
- # The default lldb prompt.
- lldb_prompt = "(lldb) "
-
- # So that the child gets torn down after the test.
- self.child = pexpect.spawn('expect')
- child = self.child
-
- child.expect(expect_prompt)
- child.setecho(True)
- if self.TraceOn():
- child.logfile = sys.stdout
-
- if self.platformIsDarwin():
- child.sendline('set env(TERM) xterm')
- else:
- child.sendline('set env(TERM) vt100')
- child.expect(expect_prompt)
- child.sendline('puts $env(TERM)')
- child.expect(expect_prompt)
-
- # Turn on loggings for input/output to/from the child.
- with open('child_send1.txt', 'w') as f_send1:
- with open('child_read1.txt', 'w') as f_read1:
- child.logfile_send = f_send1
- child.logfile_read = f_read1
-
- child.sendline('stty -a')
- child.expect(expect_prompt)
-
- # Now that the stage1 logging is done, restore logfile to None to
- # stop further logging.
- child.logfile_send = None
- child.logfile_read = None
-
- # Invoke the lldb command.
- child.sendline('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
- child.expect_exact(lldb_prompt)
-
- # Immediately quit.
- child.sendline('quit')
- child.expect(expect_prompt)
-
- with open('child_send2.txt', 'w') as f_send2:
- with open('child_read2.txt', 'w') as f_read2:
- child.logfile_send = f_send2
- child.logfile_read = f_read2
-
- child.sendline('stty -a')
- child.expect(expect_prompt)
-
- child.sendline('exit')
-
- # Now that the stage2 logging is done, restore logfile to None to
- # stop further logging.
- child.logfile_send = None
- child.logfile_read = None
-
- with open('child_send1.txt', 'r') as fs:
- if self.TraceOn():
- print("\n\nContents of child_send1.txt:")
- print(fs.read())
- with open('child_read1.txt', 'r') as fr:
- from_child1 = fr.read()
- if self.TraceOn():
- print("\n\nContents of child_read1.txt:")
- print(from_child1)
-
- with open('child_send2.txt', 'r') as fs:
- if self.TraceOn():
- print("\n\nContents of child_send2.txt:")
- print(fs.read())
- with open('child_read2.txt', 'r') as fr:
- from_child2 = fr.read()
- if self.TraceOn():
- print("\n\nContents of child_read2.txt:")
- print(from_child2)
-
- stty_output1_lines = from_child1.splitlines()
- stty_output2_lines = from_child2.splitlines()
- zipped = list(zip(stty_output1_lines, stty_output2_lines))
- for tuple in zipped:
- if self.TraceOn():
- print("tuple->%s" % str(tuple))
- # Every line should compare equal until the first blank line.
- if len(tuple[0]) == 0:
- break
- self.assertTrue(tuple[0] == tuple[1])
Removed: lldb/trunk/test/test_categories.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_categories.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_categories.py (original)
+++ lldb/trunk/test/test_categories.py (removed)
@@ -1,48 +0,0 @@
-"""
-Provides definitions for various lldb test categories
-"""
-
-import sys
-
-all_categories = {
- 'dataformatters': 'Tests related to the type command and the data formatters subsystem',
- 'expression' : 'Tests related to the expression parser',
- 'objc' : 'Tests related to the Objective-C programming language support',
- 'pyapi' : 'Tests related to the Python API',
- 'basic_process' : 'Basic process execution sniff tests.',
- 'cmdline' : 'Tests related to the LLDB command-line interface',
- 'dyntype' : 'Tests related to dynamic type support',
- 'stresstest' : 'Tests related to stressing lldb limits',
- 'flakey' : 'Flakey test cases, i.e. tests that do not reliably pass at each execution',
- 'lldb-mi' : 'lldb-mi tests'
-}
-
-def unique_string_match(yourentry, list):
- candidate = None
- for item in list:
- if not item.startswith(yourentry):
- continue
- if candidate:
- return None
- candidate = item
- return candidate
-
-def validate(categories, exact_match):
- """
- For each category in categories, ensure that it's a valid category (if exact_match is false,
- unique prefixes are also accepted). If a category is invalid, print a message and quit.
- If all categories are valid, return the list of categories. Prefixes are expanded in the
- returned list.
- """
- result = []
- for category in categories:
- origCategory = category
- if category not in all_categories and not exact_match:
- category = unique_string_match(category, all_categories)
- if (category not in all_categories) or category == None:
- print("fatal error: category '" + origCategory + "' is not a valid category")
- print("if you have added a new category, please edit test_categories.py, adding your new category to all_categories")
- print("else, please specify one or more of the following: " + str(list(all_categories.keys())))
- sys.exit(1)
- result.append(category)
- return result
Removed: lldb/trunk/test/test_results.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_results.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_results.py (original)
+++ lldb/trunk/test/test_results.py (removed)
@@ -1,988 +0,0 @@
-"""
- The LLVM Compiler Infrastructure
-
-This file is distributed under the University of Illinois Open Source
-License. See LICENSE.TXT for details.
-
-Provides classes used by the test results reporting infrastructure
-within the LLDB test suite.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import argparse
-import inspect
-import os
-import pprint
-import re
-import sys
-import threading
-import time
-import traceback
-import xml.sax.saxutils
-
-import six
-from six.moves import cPickle
-
-
-class EventBuilder(object):
- """Helper class to build test result event dictionaries."""
-
- BASE_DICTIONARY = None
-
- @staticmethod
- def _get_test_name_info(test):
- """Returns (test-class-name, test-method-name) from a test case instance.
-
- @param test a unittest.TestCase instance.
-
- @return tuple containing (test class name, test method name)
- """
- test_class_components = test.id().split(".")
- test_class_name = ".".join(test_class_components[:-1])
- test_name = test_class_components[-1]
- return (test_class_name, test_name)
-
- @staticmethod
- def bare_event(event_type):
- """Creates an event with default additions, event type and timestamp.
-
- @param event_type the value set for the "event" key, used
- to distinguish events.
-
- @returns an event dictionary with all default additions, the "event"
- key set to the passed in event_type, and the event_time value set to
- time.time().
- """
- if EventBuilder.BASE_DICTIONARY is not None:
- # Start with a copy of the "always include" entries.
- event = dict(EventBuilder.BASE_DICTIONARY)
- else:
- event = {}
-
- event.update({
- "event": event_type,
- "event_time": time.time()
- })
- return event
-
- @staticmethod
- def _event_dictionary_common(test, event_type):
- """Returns an event dictionary setup with values for the given event type.
-
- @param test the unittest.TestCase instance
-
- @param event_type the name of the event type (string).
-
- @return event dictionary with common event fields set.
- """
- test_class_name, test_name = EventBuilder._get_test_name_info(test)
-
- event = EventBuilder.bare_event(event_type)
- event.update({
- "test_class": test_class_name,
- "test_name": test_name,
- "test_filename": inspect.getfile(test.__class__)
- })
- return event
-
- @staticmethod
- def _error_tuple_class(error_tuple):
- """Returns the unittest error tuple's error class as a string.
-
- @param error_tuple the error tuple provided by the test framework.
-
- @return the error type (typically an exception) raised by the
- test framework.
- """
- type_var = error_tuple[0]
- module = inspect.getmodule(type_var)
- if module:
- return "{}.{}".format(module.__name__, type_var.__name__)
- else:
- return type_var.__name__
-
- @staticmethod
- def _error_tuple_message(error_tuple):
- """Returns the unittest error tuple's error message.
-
- @param error_tuple the error tuple provided by the test framework.
-
- @return the error message provided by the test framework.
- """
- return str(error_tuple[1])
-
- @staticmethod
- def _error_tuple_traceback(error_tuple):
- """Returns the unittest error tuple's error message.
-
- @param error_tuple the error tuple provided by the test framework.
-
- @return the error message provided by the test framework.
- """
- return error_tuple[2]
-
- @staticmethod
- def _event_dictionary_test_result(test, status):
- """Returns an event dictionary with common test result fields set.
-
- @param test a unittest.TestCase instance.
-
- @param status the status/result of the test
- (e.g. "success", "failure", etc.)
-
- @return the event dictionary
- """
- event = EventBuilder._event_dictionary_common(test, "test_result")
- event["status"] = status
- return event
-
- @staticmethod
- def _event_dictionary_issue(test, status, error_tuple):
- """Returns an event dictionary with common issue-containing test result
- fields set.
-
- @param test a unittest.TestCase instance.
-
- @param status the status/result of the test
- (e.g. "success", "failure", etc.)
-
- @param error_tuple the error tuple as reported by the test runner.
- This is of the form (type<error>, error).
-
- @return the event dictionary
- """
- event = EventBuilder._event_dictionary_test_result(test, status)
- event["issue_class"] = EventBuilder._error_tuple_class(error_tuple)
- event["issue_message"] = EventBuilder._error_tuple_message(error_tuple)
- backtrace = EventBuilder._error_tuple_traceback(error_tuple)
- if backtrace is not None:
- event["issue_backtrace"] = traceback.format_tb(backtrace)
- return event
-
- @staticmethod
- def event_for_start(test):
- """Returns an event dictionary for the test start event.
-
- @param test a unittest.TestCase instance.
-
- @return the event dictionary
- """
- return EventBuilder._event_dictionary_common(test, "test_start")
-
- @staticmethod
- def event_for_success(test):
- """Returns an event dictionary for a successful test.
-
- @param test a unittest.TestCase instance.
-
- @return the event dictionary
- """
- return EventBuilder._event_dictionary_test_result(test, "success")
-
- @staticmethod
- def event_for_unexpected_success(test, bugnumber):
- """Returns an event dictionary for a test that succeeded but was
- expected to fail.
-
- @param test a unittest.TestCase instance.
-
- @param bugnumber the issue identifier for the bug tracking the
- fix request for the test expected to fail (but is in fact
- passing here).
-
- @return the event dictionary
-
- """
- event = EventBuilder._event_dictionary_test_result(
- test, "unexpected_success")
- if bugnumber:
- event["bugnumber"] = str(bugnumber)
- return event
-
- @staticmethod
- def event_for_failure(test, error_tuple):
- """Returns an event dictionary for a test that failed.
-
- @param test a unittest.TestCase instance.
-
- @param error_tuple the error tuple as reported by the test runner.
- This is of the form (type<error>, error).
-
- @return the event dictionary
- """
- return EventBuilder._event_dictionary_issue(
- test, "failure", error_tuple)
-
- @staticmethod
- def event_for_expected_failure(test, error_tuple, bugnumber):
- """Returns an event dictionary for a test that failed as expected.
-
- @param test a unittest.TestCase instance.
-
- @param error_tuple the error tuple as reported by the test runner.
- This is of the form (type<error>, error).
-
- @param bugnumber the issue identifier for the bug tracking the
- fix request for the test expected to fail.
-
- @return the event dictionary
-
- """
- event = EventBuilder._event_dictionary_issue(
- test, "expected_failure", error_tuple)
- if bugnumber:
- event["bugnumber"] = str(bugnumber)
- return event
-
- @staticmethod
- def event_for_skip(test, reason):
- """Returns an event dictionary for a test that was skipped.
-
- @param test a unittest.TestCase instance.
-
- @param reason the reason why the test is being skipped.
-
- @return the event dictionary
- """
- event = EventBuilder._event_dictionary_test_result(test, "skip")
- event["skip_reason"] = reason
- return event
-
- @staticmethod
- def event_for_error(test, error_tuple):
- """Returns an event dictionary for a test that hit a test execution error.
-
- @param test a unittest.TestCase instance.
-
- @param error_tuple the error tuple as reported by the test runner.
- This is of the form (type<error>, error).
-
- @return the event dictionary
- """
- return EventBuilder._event_dictionary_issue(test, "error", error_tuple)
-
- @staticmethod
- def event_for_cleanup_error(test, error_tuple):
- """Returns an event dictionary for a test that hit a test execution error
- during the test cleanup phase.
-
- @param test a unittest.TestCase instance.
-
- @param error_tuple the error tuple as reported by the test runner.
- This is of the form (type<error>, error).
-
- @return the event dictionary
- """
- event = EventBuilder._event_dictionary_issue(
- test, "error", error_tuple)
- event["issue_phase"] = "cleanup"
- return event
-
- @staticmethod
- def add_entries_to_all_events(entries_dict):
- """Specifies a dictionary of entries to add to all test events.
-
- This provides a mechanism for, say, a parallel test runner to
- indicate to each inferior dotest.py that it should add a
- worker index to each.
-
- Calling this method replaces all previous entries added
- by a prior call to this.
-
- Event build methods will overwrite any entries that collide.
- Thus, the passed in dictionary is the base, which gets merged
- over by event building when keys collide.
-
- @param entries_dict a dictionary containing key and value
- pairs that should be merged into all events created by the
- event generator. May be None to clear out any extra entries.
- """
- EventBuilder.BASE_DICTIONARY = dict(entries_dict)
-
-
-class ResultsFormatter(object):
-
- """Provides interface to formatting test results out to a file-like object.
-
- This class allows the LLDB test framework's raw test-realted
- events to be processed and formatted in any manner desired.
- Test events are represented by python dictionaries, formatted
- as in the EventBuilder class above.
-
- ResultFormatter instances are given a file-like object in which
- to write their results.
-
- ResultFormatter lifetime looks like the following:
-
- # The result formatter is created.
- # The argparse options dictionary is generated from calling
- # the SomeResultFormatter.arg_parser() with the options data
- # passed to dotest.py via the "--results-formatter-options"
- # argument. See the help on that for syntactic requirements
- # on getting that parsed correctly.
- formatter = SomeResultFormatter(file_like_object, argpared_options_dict)
-
- # Single call to session start, before parsing any events.
- formatter.begin_session()
-
- formatter.handle_event({"event":"initialize",...})
-
- # Zero or more calls specified for events recorded during the test session.
- # The parallel test runner manages getting results from all the inferior
- # dotest processes, so from a new format perspective, don't worry about
- # that. The formatter will be presented with a single stream of events
- # sandwiched between a single begin_session()/end_session() pair in the
- # parallel test runner process/thread.
- for event in zero_or_more_test_events():
- formatter.handle_event(event)
-
- # Single call to terminate/wrap-up. Formatters that need all the
- # data before they can print a correct result (e.g. xUnit/JUnit),
- # this is where the final report can be generated.
- formatter.handle_event({"event":"terminate",...})
-
- It is not the formatter's responsibility to close the file_like_object.
- (i.e. do not close it).
-
- The lldb test framework passes these test events in real time, so they
- arrive as they come in.
-
- In the case of the parallel test runner, the dotest inferiors
- add a 'pid' field to the dictionary that indicates which inferior
- pid generated the event.
-
- Note more events may be added in the future to support richer test
- reporting functionality. One example: creating a true flaky test
- result category so that unexpected successes really mean the test
- is marked incorrectly (either should be marked flaky, or is indeed
- passing consistently now and should have the xfail marker
- removed). In this case, a flaky_success and flaky_fail event
- likely will be added to capture these and support reporting things
- like percentages of flaky test passing so we can see if we're
- making some things worse/better with regards to failure rates.
-
- Another example: announcing all the test methods that are planned
- to be run, so we can better support redo operations of various kinds
- (redo all non-run tests, redo non-run tests except the one that
- was running [perhaps crashed], etc.)
-
- Implementers are expected to override all the public methods
- provided in this class. See each method's docstring to see
- expectations about when the call should be chained.
-
- """
-
- @classmethod
- def arg_parser(cls):
- """@return arg parser used to parse formatter-specific options."""
- parser = argparse.ArgumentParser(
- description='{} options'.format(cls.__name__),
- usage=('dotest.py --results-formatter-options='
- '"--option1 value1 [--option2 value2 [...]]"'))
- return parser
-
- def __init__(self, out_file, options):
- super(ResultsFormatter, self).__init__()
- self.out_file = out_file
- self.options = options
- self.using_terminal = False
- if not self.out_file:
- raise Exception("ResultsFormatter created with no file object")
- self.start_time_by_test = {}
- self.terminate_called = False
-
- # Lock that we use while mutating inner state, like the
- # total test count and the elements. We minimize how
- # long we hold the lock just to keep inner state safe, not
- # entirely consistent from the outside.
- self.lock = threading.Lock()
-
- def handle_event(self, test_event):
- """Handles the test event for collection into the formatter output.
-
- Derived classes may override this but should call down to this
- implementation first.
-
- @param test_event the test event as formatted by one of the
- event_for_* calls.
- """
- # Keep track of whether terminate was received. We do this so
- # that a process can call the 'terminate' event on its own, to
- # close down a formatter at the appropriate time. Then the
- # atexit() cleanup can call the "terminate if it hasn't been
- # called yet".
- if test_event is not None:
- if test_event.get("event", "") == "terminate":
- self.terminate_called = True
-
- def track_start_time(self, test_class, test_name, start_time):
- """Tracks the start time of a test so elapsed time can be computed.
-
- This alleviates the need for test results to be processed serially
- by test. It will save the start time for the test so that
- elapsed_time_for_test() can compute the elapsed time properly.
- """
- if test_class is None or test_name is None:
- return
-
- test_key = "{}.{}".format(test_class, test_name)
- with self.lock:
- self.start_time_by_test[test_key] = start_time
-
- def elapsed_time_for_test(self, test_class, test_name, end_time):
- """Returns the elapsed time for a test.
-
- This function can only be called once per test and requires that
- the track_start_time() method be called sometime prior to calling
- this method.
- """
- if test_class is None or test_name is None:
- return -2.0
-
- test_key = "{}.{}".format(test_class, test_name)
- with self.lock:
- if test_key not in self.start_time_by_test:
- return -1.0
- else:
- start_time = self.start_time_by_test[test_key]
- del self.start_time_by_test[test_key]
- return end_time - start_time
-
- def is_using_terminal(self):
- """Returns True if this results formatter is using the terminal and
- output should be avoided."""
- return self.using_terminal
-
- def send_terminate_as_needed(self):
- """Sends the terminate event if it hasn't been received yet."""
- if not self.terminate_called:
- terminate_event = EventBuilder.bare_event("terminate")
- self.handle_event(terminate_event)
-
-
-class XunitFormatter(ResultsFormatter):
- """Provides xUnit-style formatted output.
- """
-
- # Result mapping arguments
- RM_IGNORE = 'ignore'
- RM_SUCCESS = 'success'
- RM_FAILURE = 'failure'
- RM_PASSTHRU = 'passthru'
-
- @staticmethod
- def _build_illegal_xml_regex():
- """Contructs a regex to match all illegal xml characters.
-
- Expects to be used against a unicode string."""
- # Construct the range pairs of invalid unicode chareacters.
- illegal_chars_u = [
- (0x00, 0x08), (0x0B, 0x0C), (0x0E, 0x1F), (0x7F, 0x84),
- (0x86, 0x9F), (0xFDD0, 0xFDDF), (0xFFFE, 0xFFFF)]
-
- # For wide builds, we have more.
- if sys.maxunicode >= 0x10000:
- illegal_chars_u.extend(
- [(0x1FFFE, 0x1FFFF), (0x2FFFE, 0x2FFFF), (0x3FFFE, 0x3FFFF),
- (0x4FFFE, 0x4FFFF), (0x5FFFE, 0x5FFFF), (0x6FFFE, 0x6FFFF),
- (0x7FFFE, 0x7FFFF), (0x8FFFE, 0x8FFFF), (0x9FFFE, 0x9FFFF),
- (0xAFFFE, 0xAFFFF), (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF),
- (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF), (0xFFFFE, 0xFFFFF),
- (0x10FFFE, 0x10FFFF)])
-
- # Build up an array of range expressions.
- illegal_ranges = [
- "%s-%s" % (six.unichr(low), six.unichr(high))
- for (low, high) in illegal_chars_u]
-
- # Compile the regex
- return re.compile(six.u('[%s]') % six.u('').join(illegal_ranges))
-
- @staticmethod
- def _quote_attribute(text):
- """Returns the given text in a manner safe for usage in an XML attribute.
-
- @param text the text that should appear within an XML attribute.
- @return the attribute-escaped version of the input text.
- """
- return xml.sax.saxutils.quoteattr(text)
-
- def _replace_invalid_xml(self, str_or_unicode):
- """Replaces invalid XML characters with a '?'.
-
- @param str_or_unicode a string to replace invalid XML
- characters within. Can be unicode or not. If not unicode,
- assumes it is a byte string in utf-8 encoding.
-
- @returns a utf-8-encoded byte string with invalid
- XML replaced with '?'.
- """
- # Get the content into unicode
- if isinstance(str_or_unicode, str):
- unicode_content = str_or_unicode.decode('utf-8')
- else:
- unicode_content = str_or_unicode
- return self.invalid_xml_re.sub(six.u('?'), unicode_content).encode('utf-8')
-
- @classmethod
- def arg_parser(cls):
- """@return arg parser used to parse formatter-specific options."""
- parser = super(XunitFormatter, cls).arg_parser()
-
- # These are valid choices for results mapping.
- results_mapping_choices = [
- XunitFormatter.RM_IGNORE,
- XunitFormatter.RM_SUCCESS,
- XunitFormatter.RM_FAILURE,
- XunitFormatter.RM_PASSTHRU]
- parser.add_argument(
- "--assert-on-unknown-events",
- action="store_true",
- help=('cause unknown test events to generate '
- 'a python assert. Default is to ignore.'))
- parser.add_argument(
- "--ignore-skip-name",
- "-n",
- metavar='PATTERN',
- action="append",
- dest='ignore_skip_name_patterns',
- help=('a python regex pattern, where '
- 'any skipped test with a test method name where regex '
- 'matches (via search) will be ignored for xUnit test '
- 'result purposes. Can be specified multiple times.'))
- parser.add_argument(
- "--ignore-skip-reason",
- "-r",
- metavar='PATTERN',
- action="append",
- dest='ignore_skip_reason_patterns',
- help=('a python regex pattern, where '
- 'any skipped test with a skip reason where the regex '
- 'matches (via search) will be ignored for xUnit test '
- 'result purposes. Can be specified multiple times.'))
- parser.add_argument(
- "--xpass", action="store", choices=results_mapping_choices,
- default=XunitFormatter.RM_FAILURE,
- help=('specify mapping from unexpected success to jUnit/xUnit '
- 'result type'))
- parser.add_argument(
- "--xfail", action="store", choices=results_mapping_choices,
- default=XunitFormatter.RM_IGNORE,
- help=('specify mapping from expected failure to jUnit/xUnit '
- 'result type'))
- return parser
-
- @staticmethod
- def _build_regex_list_from_patterns(patterns):
- """Builds a list of compiled regexes from option value.
-
- @param option string containing a comma-separated list of regex
- patterns. Zero-length or None will produce an empty regex list.
-
- @return list of compiled regular expressions, empty if no
- patterns provided.
- """
- regex_list = []
- if patterns is not None:
- for pattern in patterns:
- regex_list.append(re.compile(pattern))
- return regex_list
-
- def __init__(self, out_file, options):
- """Initializes the XunitFormatter instance.
- @param out_file file-like object where formatted output is written.
- @param options_dict specifies a dictionary of options for the
- formatter.
- """
- # Initialize the parent
- super(XunitFormatter, self).__init__(out_file, options)
- self.text_encoding = "UTF-8"
- self.invalid_xml_re = XunitFormatter._build_illegal_xml_regex()
- self.total_test_count = 0
- self.ignore_skip_name_regexes = (
- XunitFormatter._build_regex_list_from_patterns(
- options.ignore_skip_name_patterns))
- self.ignore_skip_reason_regexes = (
- XunitFormatter._build_regex_list_from_patterns(
- options.ignore_skip_reason_patterns))
-
- self.elements = {
- "successes": [],
- "errors": [],
- "failures": [],
- "skips": [],
- "unexpected_successes": [],
- "expected_failures": [],
- "all": []
- }
-
- self.status_handlers = {
- "success": self._handle_success,
- "failure": self._handle_failure,
- "error": self._handle_error,
- "skip": self._handle_skip,
- "expected_failure": self._handle_expected_failure,
- "unexpected_success": self._handle_unexpected_success
- }
-
- def handle_event(self, test_event):
- super(XunitFormatter, self).handle_event(test_event)
-
- event_type = test_event["event"]
- if event_type is None:
- return
-
- if event_type == "terminate":
- self._finish_output()
- elif event_type == "test_start":
- self.track_start_time(
- test_event["test_class"],
- test_event["test_name"],
- test_event["event_time"])
- elif event_type == "test_result":
- self._process_test_result(test_event)
- else:
- # This is an unknown event.
- if self.options.assert_on_unknown_events:
- raise Exception("unknown event type {} from {}\n".format(
- event_type, test_event))
-
- def _handle_success(self, test_event):
- """Handles a test success.
- @param test_event the test event to handle.
- """
- result = self._common_add_testcase_entry(test_event)
- with self.lock:
- self.elements["successes"].append(result)
-
- def _handle_failure(self, test_event):
- """Handles a test failure.
- @param test_event the test event to handle.
- """
- message = self._replace_invalid_xml(test_event["issue_message"])
- backtrace = self._replace_invalid_xml(
- "".join(test_event.get("issue_backtrace", [])))
-
- result = self._common_add_testcase_entry(
- test_event,
- inner_content=(
- '<failure type={} message={}><![CDATA[{}]]></failure>'.format(
- XunitFormatter._quote_attribute(test_event["issue_class"]),
- XunitFormatter._quote_attribute(message),
- backtrace)
- ))
- with self.lock:
- self.elements["failures"].append(result)
-
- def _handle_error(self, test_event):
- """Handles a test error.
- @param test_event the test event to handle.
- """
- message = self._replace_invalid_xml(test_event["issue_message"])
- backtrace = self._replace_invalid_xml(
- "".join(test_event.get("issue_backtrace", [])))
-
- result = self._common_add_testcase_entry(
- test_event,
- inner_content=(
- '<error type={} message={}><![CDATA[{}]]></error>'.format(
- XunitFormatter._quote_attribute(test_event["issue_class"]),
- XunitFormatter._quote_attribute(message),
- backtrace)
- ))
- with self.lock:
- self.elements["errors"].append(result)
-
- @staticmethod
- def _ignore_based_on_regex_list(test_event, test_key, regex_list):
- """Returns whether to ignore a test event based on patterns.
-
- @param test_event the test event dictionary to check.
- @param test_key the key within the dictionary to check.
- @param regex_list a list of zero or more regexes. May contain
- zero or more compiled regexes.
-
- @return True if any o the regex list match based on the
- re.search() method; false otherwise.
- """
- for regex in regex_list:
- match = regex.search(test_event.get(test_key, ''))
- if match:
- return True
- return False
-
- def _handle_skip(self, test_event):
- """Handles a skipped test.
- @param test_event the test event to handle.
- """
-
- # Are we ignoring this test based on test name?
- if XunitFormatter._ignore_based_on_regex_list(
- test_event, 'test_name', self.ignore_skip_name_regexes):
- return
-
- # Are we ignoring this test based on skip reason?
- if XunitFormatter._ignore_based_on_regex_list(
- test_event, 'skip_reason', self.ignore_skip_reason_regexes):
- return
-
- # We're not ignoring this test. Process the skip.
- reason = self._replace_invalid_xml(test_event.get("skip_reason", ""))
- result = self._common_add_testcase_entry(
- test_event,
- inner_content='<skipped message={} />'.format(
- XunitFormatter._quote_attribute(reason)))
- with self.lock:
- self.elements["skips"].append(result)
-
- def _handle_expected_failure(self, test_event):
- """Handles a test that failed as expected.
- @param test_event the test event to handle.
- """
- if self.options.xfail == XunitFormatter.RM_PASSTHRU:
- # This is not a natively-supported junit/xunit
- # testcase mode, so it might fail a validating
- # test results viewer.
- if "bugnumber" in test_event:
- bug_id_attribute = 'bug-id={} '.format(
- XunitFormatter._quote_attribute(test_event["bugnumber"]))
- else:
- bug_id_attribute = ''
-
- result = self._common_add_testcase_entry(
- test_event,
- inner_content=(
- '<expected-failure {}type={} message={} />'.format(
- bug_id_attribute,
- XunitFormatter._quote_attribute(
- test_event["issue_class"]),
- XunitFormatter._quote_attribute(
- test_event["issue_message"]))
- ))
- with self.lock:
- self.elements["expected_failures"].append(result)
- elif self.options.xfail == XunitFormatter.RM_SUCCESS:
- result = self._common_add_testcase_entry(test_event)
- with self.lock:
- self.elements["successes"].append(result)
- elif self.options.xfail == XunitFormatter.RM_FAILURE:
- result = self._common_add_testcase_entry(
- test_event,
- inner_content='<failure type={} message={} />'.format(
- XunitFormatter._quote_attribute(test_event["issue_class"]),
- XunitFormatter._quote_attribute(
- test_event["issue_message"])))
- with self.lock:
- self.elements["failures"].append(result)
- elif self.options.xfail == XunitFormatter.RM_IGNORE:
- pass
- else:
- raise Exception(
- "unknown xfail option: {}".format(self.options.xfail))
-
- def _handle_unexpected_success(self, test_event):
- """Handles a test that passed but was expected to fail.
- @param test_event the test event to handle.
- """
- if self.options.xpass == XunitFormatter.RM_PASSTHRU:
- # This is not a natively-supported junit/xunit
- # testcase mode, so it might fail a validating
- # test results viewer.
- result = self._common_add_testcase_entry(
- test_event,
- inner_content=("<unexpected-success />"))
- with self.lock:
- self.elements["unexpected_successes"].append(result)
- elif self.options.xpass == XunitFormatter.RM_SUCCESS:
- # Treat the xpass as a success.
- result = self._common_add_testcase_entry(test_event)
- with self.lock:
- self.elements["successes"].append(result)
- elif self.options.xpass == XunitFormatter.RM_FAILURE:
- # Treat the xpass as a failure.
- if "bugnumber" in test_event:
- message = "unexpected success (bug_id:{})".format(
- test_event["bugnumber"])
- else:
- message = "unexpected success (bug_id:none)"
- result = self._common_add_testcase_entry(
- test_event,
- inner_content='<failure type={} message={} />'.format(
- XunitFormatter._quote_attribute("unexpected_success"),
- XunitFormatter._quote_attribute(message)))
- with self.lock:
- self.elements["failures"].append(result)
- elif self.options.xpass == XunitFormatter.RM_IGNORE:
- # Ignore the xpass result as far as xUnit reporting goes.
- pass
- else:
- raise Exception("unknown xpass option: {}".format(
- self.options.xpass))
-
- def _process_test_result(self, test_event):
- """Processes the test_event known to be a test result.
-
- This categorizes the event appropriately and stores the data needed
- to generate the final xUnit report. This method skips events that
- cannot be represented in xUnit output.
- """
- if "status" not in test_event:
- raise Exception("test event dictionary missing 'status' key")
-
- status = test_event["status"]
- if status not in self.status_handlers:
- raise Exception("test event status '{}' unsupported".format(
- status))
-
- # Call the status handler for the test result.
- self.status_handlers[status](test_event)
-
- def _common_add_testcase_entry(self, test_event, inner_content=None):
- """Registers a testcase result, and returns the text created.
-
- The caller is expected to manage failure/skip/success counts
- in some kind of appropriate way. This call simply constructs
- the XML and appends the returned result to the self.all_results
- list.
-
- @param test_event the test event dictionary.
-
- @param inner_content if specified, gets included in the <testcase>
- inner section, at the point before stdout and stderr would be
- included. This is where a <failure/>, <skipped/>, <error/>, etc.
- could go.
-
- @return the text of the xml testcase element.
- """
-
- # Get elapsed time.
- test_class = test_event["test_class"]
- test_name = test_event["test_name"]
- event_time = test_event["event_time"]
- time_taken = self.elapsed_time_for_test(
- test_class, test_name, event_time)
-
- # Plumb in stdout/stderr once we shift over to only test results.
- test_stdout = ''
- test_stderr = ''
-
- # Formulate the output xml.
- if not inner_content:
- inner_content = ""
- result = (
- '<testcase classname="{}" name="{}" time="{:.3f}">'
- '{}{}{}</testcase>'.format(
- test_class,
- test_name,
- time_taken,
- inner_content,
- test_stdout,
- test_stderr))
-
- # Save the result, update total test count.
- with self.lock:
- self.total_test_count += 1
- self.elements["all"].append(result)
-
- return result
-
- def _finish_output_no_lock(self):
- """Flushes out the report of test executions to form valid xml output.
-
- xUnit output is in XML. The reporting system cannot complete the
- formatting of the output without knowing when there is no more input.
- This call addresses notifcation of the completed test run and thus is
- when we can finish off the report output.
- """
-
- # Figure out the counts line for the testsuite. If we have
- # been counting either unexpected successes or expected
- # failures, we'll output those in the counts, at the risk of
- # being invalidated by a validating test results viewer.
- # These aren't counted by default so they won't show up unless
- # the user specified a formatter option to include them.
- xfail_count = len(self.elements["expected_failures"])
- xpass_count = len(self.elements["unexpected_successes"])
- if xfail_count > 0 or xpass_count > 0:
- extra_testsuite_attributes = (
- ' expected-failures="{}"'
- ' unexpected-successes="{}"'.format(xfail_count, xpass_count))
- else:
- extra_testsuite_attributes = ""
-
- # Output the header.
- self.out_file.write(
- '<?xml version="1.0" encoding="{}"?>\n'
- '<testsuites>'
- '<testsuite name="{}" tests="{}" errors="{}" failures="{}" '
- 'skip="{}"{}>\n'.format(
- self.text_encoding,
- "LLDB test suite",
- self.total_test_count,
- len(self.elements["errors"]),
- len(self.elements["failures"]),
- len(self.elements["skips"]),
- extra_testsuite_attributes))
-
- # Output each of the test result entries.
- for result in self.elements["all"]:
- self.out_file.write(result + '\n')
-
- # Close off the test suite.
- self.out_file.write('</testsuite></testsuites>\n')
-
- def _finish_output(self):
- """Finish writing output as all incoming events have arrived."""
- with self.lock:
- self._finish_output_no_lock()
-
-
-class RawPickledFormatter(ResultsFormatter):
- """Formats events as a pickled stream.
-
- The parallel test runner has inferiors pickle their results and send them
- over a socket back to the parallel test. The parallel test runner then
- aggregates them into the final results formatter (e.g. xUnit).
- """
-
- @classmethod
- def arg_parser(cls):
- """@return arg parser used to parse formatter-specific options."""
- parser = super(RawPickledFormatter, cls).arg_parser()
- return parser
-
- def __init__(self, out_file, options):
- super(RawPickledFormatter, self).__init__(out_file, options)
- self.pid = os.getpid()
-
- def handle_event(self, test_event):
- super(RawPickledFormatter, self).handle_event(test_event)
-
- # Convert initialize/terminate events into job_begin/job_end events.
- event_type = test_event["event"]
- if event_type is None:
- return
-
- if event_type == "initialize":
- test_event["event"] = "job_begin"
- elif event_type == "terminate":
- test_event["event"] = "job_end"
-
- # Tack on the pid.
- test_event["pid"] = self.pid
-
- # Send it as {serialized_length_of_serialized_bytes}#{serialized_bytes}
- pickled_message = cPickle.dumps(test_event)
- self.out_file.send(
- "{}#{}".format(len(pickled_message), pickled_message))
-
-
-class DumpFormatter(ResultsFormatter):
- """Formats events to the file as their raw python dictionary format."""
-
- def handle_event(self, test_event):
- super(DumpFormatter, self).handle_event(test_event)
- self.out_file.write("\n" + pprint.pformat(test_event) + "\n")
Removed: lldb/trunk/test/test_runner/README.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/README.txt?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_runner/README.txt (original)
+++ lldb/trunk/test/test_runner/README.txt (removed)
@@ -1,5 +0,0 @@
-This directory contains source and tests for the lldb test runner
-architecture. This directory is not for lldb python tests. It
-is the test runner. The tests under this diretory are test-runner
-tests (i.e. tests that verify the test runner itself runs properly).
-
Removed: lldb/trunk/test/test_runner/lib/lldb_utils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/lib/lldb_utils.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_runner/lib/lldb_utils.py (original)
+++ lldb/trunk/test/test_runner/lib/lldb_utils.py (removed)
@@ -1,66 +0,0 @@
-"""
-The LLVM Compiler Infrastructure
-
-This file is distributed under the University of Illinois Open Source
-License. See LICENSE.TXT for details.
-
-Provides classes used by the test results reporting infrastructure
-within the LLDB test suite.
-
-
-This module contains utilities used by the lldb test framwork.
-"""
-
-
-class OptionalWith(object):
- # pylint: disable=too-few-public-methods
- # This is a wrapper - it is not meant to provide any extra methods.
- """Provides a wrapper for objects supporting "with", allowing None.
-
- This lets a user use the "with object" syntax for resource usage
- (e.g. locks) even when the wrapped with object is None.
-
- e.g.
-
- wrapped_lock = OptionalWith(thread.Lock())
- with wrapped_lock:
- # Do something while the lock is obtained.
- pass
-
- might_be_none = None
- wrapped_none = OptionalWith(might_be_none)
- with wrapped_none:
- # This code here still works.
- pass
-
- This prevents having to write code like this when
- a lock is optional:
-
- if lock:
- lock.acquire()
-
- try:
- code_fragament_always_run()
- finally:
- if lock:
- lock.release()
-
- And I'd posit it is safer, as it becomes impossible to
- forget the try/finally using OptionalWith(), since
- the with syntax can be used.
- """
- def __init__(self, wrapped_object):
- self.wrapped_object = wrapped_object
-
- def __enter__(self):
- if self.wrapped_object is not None:
- return self.wrapped_object.__enter__()
- else:
- return self
-
- def __exit__(self, the_type, value, traceback):
- if self.wrapped_object is not None:
- return self.wrapped_object.__exit__(the_type, value, traceback)
- else:
- # Don't suppress any exceptions
- return False
Removed: lldb/trunk/test/test_runner/lib/process_control.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/lib/process_control.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_runner/lib/process_control.py (original)
+++ lldb/trunk/test/test_runner/lib/process_control.py (removed)
@@ -1,658 +0,0 @@
-"""
-The LLVM Compiler Infrastructure
-
-This file is distributed under the University of Illinois Open Source
-License. See LICENSE.TXT for details.
-
-Provides classes used by the test results reporting infrastructure
-within the LLDB test suite.
-
-
-This module provides process-management support for the LLDB test
-running infrasructure.
-"""
-
-# System imports
-import os
-import re
-import signal
-import subprocess
-import sys
-import threading
-
-
-class CommunicatorThread(threading.Thread):
- """Provides a thread class that communicates with a subprocess."""
- def __init__(self, process, event, output_file):
- super(CommunicatorThread, self).__init__()
- # Don't let this thread prevent shutdown.
- self.daemon = True
- self.process = process
- self.pid = process.pid
- self.event = event
- self.output_file = output_file
- self.output = None
-
- def run(self):
- try:
- # Communicate with the child process.
- # This will not complete until the child process terminates.
- self.output = self.process.communicate()
- except Exception as exception: # pylint: disable=broad-except
- if self.output_file:
- self.output_file.write(
- "exception while using communicate() for pid: {}\n".format(
- exception))
- finally:
- # Signal that the thread's run is complete.
- self.event.set()
-
-
-# Provides a regular expression for matching gtimeout-based durations.
-TIMEOUT_REGEX = re.compile(r"(^\d+)([smhd])?$")
-
-
-def timeout_to_seconds(timeout):
- """Converts timeout/gtimeout timeout values into seconds.
-
- @param timeout a timeout in the form of xm representing x minutes.
-
- @return None if timeout is None, or the number of seconds as a float
- if a valid timeout format was specified.
- """
- if timeout is None:
- return None
- else:
- match = TIMEOUT_REGEX.match(timeout)
- if match:
- value = float(match.group(1))
- units = match.group(2)
- if units is None:
- # default is seconds. No conversion necessary.
- return value
- elif units == 's':
- # Seconds. No conversion necessary.
- return value
- elif units == 'm':
- # Value is in minutes.
- return 60.0 * value
- elif units == 'h':
- # Value is in hours.
- return (60.0 * 60.0) * value
- elif units == 'd':
- # Value is in days.
- return 24 * (60.0 * 60.0) * value
- else:
- raise Exception("unexpected units value '{}'".format(units))
- else:
- raise Exception("could not parse TIMEOUT spec '{}'".format(
- timeout))
-
-
-class ProcessHelper(object):
- """Provides an interface for accessing process-related functionality.
-
- This class provides a factory method that gives the caller a
- platform-specific implementation instance of the class.
-
- Clients of the class should stick to the methods provided in this
- base class.
-
- @see ProcessHelper.process_helper()
- """
- def __init__(self):
- super(ProcessHelper, self).__init__()
-
- @classmethod
- def process_helper(cls):
- """Returns a platform-specific ProcessHelper instance.
- @return a ProcessHelper instance that does the right thing for
- the current platform.
- """
-
- # If you add a new platform, create an instance here and
- # return it.
- if os.name == "nt":
- return WindowsProcessHelper()
- else:
- # For all POSIX-like systems.
- return UnixProcessHelper()
-
- def create_piped_process(self, command, new_process_group=True):
- # pylint: disable=no-self-use,unused-argument
- # As expected. We want derived classes to implement this.
- """Creates a subprocess.Popen-based class with I/O piped to the parent.
-
- @param command the command line list as would be passed to
- subprocess.Popen(). Use the list form rather than the string form.
-
- @param new_process_group indicates if the caller wants the
- process to be created in its own process group. Each OS handles
- this concept differently. It provides a level of isolation and
- can simplify or enable terminating the process tree properly.
-
- @return a subprocess.Popen-like object.
- """
- raise Exception("derived class must implement")
-
- def supports_soft_terminate(self):
- # pylint: disable=no-self-use
- # As expected. We want derived classes to implement this.
- """Indicates if the platform supports soft termination.
-
- Soft termination is the concept of a terminate mechanism that
- allows the target process to shut down nicely, but with the
- catch that the process might choose to ignore it.
-
- Platform supporter note: only mark soft terminate as supported
- if the target process has some way to evade the soft terminate
- request; otherwise, just support the hard terminate method.
-
- @return True if the platform supports a soft terminate mechanism.
- """
- # By default, we do not support a soft terminate mechanism.
- return False
-
- def soft_terminate(self, popen_process, log_file=None, want_core=True):
- # pylint: disable=no-self-use,unused-argument
- # As expected. We want derived classes to implement this.
- """Attempts to terminate the process in a polite way.
-
- This terminate method is intended to give the child process a
- chance to clean up and exit on its own, possibly with a request
- to drop a core file or equivalent (i.e. [mini-]crashdump, crashlog,
- etc.) If new_process_group was set in the process creation method
- and the platform supports it, this terminate call will attempt to
- kill the whole process tree rooted in this child process.
-
- @param popen_process the subprocess.Popen-like object returned
- by one of the process-creation methods of this class.
-
- @param log_file file-like object used to emit error-related
- logging info. May be None if no error-related info is desired.
-
- @param want_core True if the caller would like to get a core
- dump (or the analogous crash report) from the terminated process.
- """
- popen_process.terminate()
-
- def hard_terminate(self, popen_process, log_file=None):
- # pylint: disable=no-self-use,unused-argument
- # As expected. We want derived classes to implement this.
- """Attempts to terminate the process immediately.
-
- This terminate method is intended to kill child process in
- a manner in which the child process has no ability to block,
- and also has no ability to clean up properly. If new_process_group
- was specified when creating the process, and if the platform
- implementation supports it, this will attempt to kill the
- whole process tree rooted in the child process.
-
- @param popen_process the subprocess.Popen-like object returned
- by one of the process-creation methods of this class.
-
- @param log_file file-like object used to emit error-related
- logging info. May be None if no error-related info is desired.
- """
- popen_process.kill()
-
- def was_soft_terminate(self, returncode, with_core):
- # pylint: disable=no-self-use,unused-argument
- # As expected. We want derived classes to implement this.
- """Returns if Popen-like object returncode matches soft terminate.
-
- @param returncode the returncode from the Popen-like object that
- terminated with a given return code.
-
- @param with_core indicates whether the returncode should match
- a core-generating return signal.
-
- @return True when the returncode represents what the system would
- issue when a soft_terminate() with the given with_core arg occurred;
- False otherwise.
- """
- if not self.supports_soft_terminate():
- # If we don't support soft termination on this platform,
- # then this should always be False.
- return False
- else:
- # Once a platform claims to support soft terminate, it
- # needs to be able to identify it by overriding this method.
- raise Exception("platform needs to implement")
-
- def was_hard_terminate(self, returncode):
- # pylint: disable=no-self-use,unused-argument
- # As expected. We want derived classes to implement this.
- """Returns if Popen-like object returncode matches that of a hard
- terminate attempt.
-
- @param returncode the returncode from the Popen-like object that
- terminated with a given return code.
-
- @return True when the returncode represents what the system would
- issue when a hard_terminate() occurred; False
- otherwise.
- """
- raise Exception("platform needs to implement")
-
- def soft_terminate_signals(self):
- # pylint: disable=no-self-use
- """Retrieve signal numbers that can be sent to soft terminate.
- @return a list of signal numbers that can be sent to soft terminate
- a process, or None if not applicable.
- """
- return None
-
-
-class UnixProcessHelper(ProcessHelper):
- """Provides a ProcessHelper for Unix-like operating systems.
-
- This implementation supports anything that looks Posix-y
- (e.g. Darwin, Linux, *BSD, etc.)
- """
- def __init__(self):
- super(UnixProcessHelper, self).__init__()
-
- @classmethod
- def _create_new_process_group(cls):
- """Creates a new process group for the calling process."""
- os.setpgid(os.getpid(), os.getpid())
-
- def create_piped_process(self, command, new_process_group=True):
- # Determine what to run after the fork but before the exec.
- if new_process_group:
- preexec_func = self._create_new_process_group
- else:
- preexec_func = None
-
- # Create the process.
- process = subprocess.Popen(
- command,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- close_fds=True,
- preexec_fn=preexec_func)
-
- # Remember whether we're using process groups for this
- # process.
- process.using_process_groups = new_process_group
- return process
-
- def supports_soft_terminate(self):
- # POSIX does support a soft terminate via:
- # * SIGTERM (no core requested)
- # * SIGQUIT (core requested if enabled, see ulimit -c)
- return True
-
- @classmethod
- def _validate_pre_terminate(cls, popen_process, log_file):
- # Validate args.
- if popen_process is None:
- raise ValueError("popen_process is None")
-
- # Ensure we have something that looks like a valid process.
- if popen_process.pid < 1:
- if log_file:
- log_file.write("skipping soft_terminate(): no process id")
- return False
-
- # We only do the process liveness check if we're not using
- # process groups. With process groups, checking if the main
- # inferior process is dead and short circuiting here is no
- # good - children of it in the process group could still be
- # alive, and they should be killed during a timeout.
- if not popen_process.using_process_groups:
- # Don't kill if it's already dead.
- popen_process.poll()
- if popen_process.returncode is not None:
- # It has a returncode. It has already stopped.
- if log_file:
- log_file.write(
- "requested to terminate pid {} but it has already "
- "terminated, returncode {}".format(
- popen_process.pid, popen_process.returncode))
- # Move along...
- return False
-
- # Good to go.
- return True
-
- def _kill_with_signal(self, popen_process, log_file, signum):
- # Validate we're ready to terminate this.
- if not self._validate_pre_terminate(popen_process, log_file):
- return
-
- # Choose kill mechanism based on whether we're targeting
- # a process group or just a process.
- if popen_process.using_process_groups:
- # if log_file:
- # log_file.write(
- # "sending signum {} to process group {} now\n".format(
- # signum, popen_process.pid))
- os.killpg(popen_process.pid, signum)
- else:
- # if log_file:
- # log_file.write(
- # "sending signum {} to process {} now\n".format(
- # signum, popen_process.pid))
- os.kill(popen_process.pid, signum)
-
- def soft_terminate(self, popen_process, log_file=None, want_core=True):
- # Choose signal based on desire for core file.
- if want_core:
- # SIGQUIT will generate core by default. Can be caught.
- signum = signal.SIGQUIT
- else:
- # SIGTERM is the traditional nice way to kill a process.
- # Can be caught, doesn't generate a core.
- signum = signal.SIGTERM
-
- self._kill_with_signal(popen_process, log_file, signum)
-
- def hard_terminate(self, popen_process, log_file=None):
- self._kill_with_signal(popen_process, log_file, signal.SIGKILL)
-
- def was_soft_terminate(self, returncode, with_core):
- if with_core:
- return returncode == -signal.SIGQUIT
- else:
- return returncode == -signal.SIGTERM
-
- def was_hard_terminate(self, returncode):
- return returncode == -signal.SIGKILL
-
- def soft_terminate_signals(self):
- return [signal.SIGQUIT, signal.SIGTERM]
-
-
-class WindowsProcessHelper(ProcessHelper):
- """Provides a Windows implementation of the ProcessHelper class."""
- def __init__(self):
- super(WindowsProcessHelper, self).__init__()
-
- def create_piped_process(self, command, new_process_group=True):
- if new_process_group:
- # We need this flag if we want os.kill() to work on the subprocess.
- creation_flags = subprocess.CREATE_NEW_PROCESS_GROUP
- else:
- creation_flags = 0
-
- return subprocess.Popen(
- command,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- creationflags=creation_flags)
-
- def was_hard_terminate(self, returncode):
- return returncode != 0
-
-
-class ProcessDriver(object):
- """Drives a child process, notifies on important events, and can timeout.
-
- Clients are expected to derive from this class and override the
- on_process_started and on_process_exited methods if they want to
- hook either of those.
-
- This class supports timing out the child process in a platform-agnostic
- way. The on_process_exited method is informed if the exit was natural
- or if it was due to a timeout.
- """
- def __init__(self, soft_terminate_timeout=10.0):
- super(ProcessDriver, self).__init__()
- self.process_helper = ProcessHelper.process_helper()
- self.pid = None
- # Create the synchronization event for notifying when the
- # inferior dotest process is complete.
- self.done_event = threading.Event()
- self.io_thread = None
- self.process = None
- # Number of seconds to wait for the soft terminate to
- # wrap up, before moving to more drastic measures.
- # Might want this longer if core dumps are generated and
- # take a long time to write out.
- self.soft_terminate_timeout = soft_terminate_timeout
- # Number of seconds to wait for the hard terminate to
- # wrap up, before giving up on the io thread. This should
- # be fast.
- self.hard_terminate_timeout = 5.0
- self.returncode = None
-
- # =============================================
- # Methods for subclasses to override if desired.
- # =============================================
-
- def on_process_started(self):
- pass
-
- def on_process_exited(self, command, output, was_timeout, exit_status):
- pass
-
- def write(self, content):
- # pylint: disable=no-self-use
- # Intended - we want derived classes to be able to override
- # this and use any self state they may contain.
- sys.stdout.write(content)
-
- # ==============================================================
- # Operations used to drive processes. Clients will want to call
- # one of these.
- # ==============================================================
-
- def run_command(self, command):
- # Start up the child process and the thread that does the
- # communication pump.
- self._start_process_and_io_thread(command)
-
- # Wait indefinitely for the child process to finish
- # communicating. This indicates it has closed stdout/stderr
- # pipes and is done.
- self.io_thread.join()
- self.returncode = self.process.wait()
- if self.returncode is None:
- raise Exception(
- "no exit status available for pid {} after the "
- " inferior dotest.py should have completed".format(
- self.process.pid))
-
- # Notify of non-timeout exit.
- self.on_process_exited(
- command,
- self.io_thread.output,
- False,
- self.returncode)
-
- def run_command_with_timeout(self, command, timeout, want_core):
- # Figure out how many seconds our timeout description is requesting.
- timeout_seconds = timeout_to_seconds(timeout)
-
- # Start up the child process and the thread that does the
- # communication pump.
- self._start_process_and_io_thread(command)
-
- self._wait_with_timeout(timeout_seconds, command, want_core)
-
- # ================
- # Internal details.
- # ================
-
- def _start_process_and_io_thread(self, command):
- # Create the process.
- self.process = self.process_helper.create_piped_process(command)
- self.pid = self.process.pid
- self.on_process_started()
-
- # Ensure the event is cleared that is used for signaling
- # from the communication() thread when communication is
- # complete (i.e. the inferior process has finished).
- self.done_event.clear()
-
- self.io_thread = CommunicatorThread(
- self.process, self.done_event, self.write)
- self.io_thread.start()
-
- def _attempt_soft_kill(self, want_core):
- # The inferior dotest timed out. Attempt to clean it
- # with a non-drastic method (so it can clean up properly
- # and/or generate a core dump). Often the OS can't guarantee
- # that the process will really terminate after this.
- self.process_helper.soft_terminate(
- self.process,
- want_core=want_core,
- log_file=self)
-
- # Now wait up to a certain timeout period for the io thread
- # to say that the communication ended. If that wraps up
- # within our soft terminate timeout, we're all done here.
- self.io_thread.join(self.soft_terminate_timeout)
- if not self.io_thread.is_alive():
- # stdout/stderr were closed on the child process side. We
- # should be able to wait and reap the child process here.
- self.returncode = self.process.wait()
- # We terminated, and the done_trying result is n/a
- terminated = True
- done_trying = None
- else:
- self.write("soft kill attempt of process {} timed out "
- "after {} seconds\n".format(
- self.process.pid, self.soft_terminate_timeout))
- terminated = False
- done_trying = False
- return terminated, done_trying
-
- def _attempt_hard_kill(self):
- # Instruct the process to terminate and really force it to
- # happen. Don't give the process a chance to ignore.
- self.process_helper.hard_terminate(
- self.process,
- log_file=self)
-
- # Reap the child process. This should not hang as the
- # hard_kill() mechanism is supposed to really kill it.
- # Improvement option:
- # If this does ever hang, convert to a self.process.poll()
- # loop checking on self.process.returncode until it is not
- # None or the timeout occurs.
- self.returncode = self.process.wait()
-
- # Wait a few moments for the io thread to finish...
- self.io_thread.join(self.hard_terminate_timeout)
- if self.io_thread.is_alive():
- # ... but this is not critical if it doesn't end for some
- # reason.
- self.write(
- "hard kill of process {} timed out after {} seconds waiting "
- "for the io thread (ignoring)\n".format(
- self.process.pid, self.hard_terminate_timeout))
-
- # Set if it terminated. (Set up for optional improvement above).
- terminated = self.returncode is not None
- # Nothing else to try.
- done_trying = True
-
- return terminated, done_trying
-
- def _attempt_termination(self, attempt_count, want_core):
- if self.process_helper.supports_soft_terminate():
- # When soft termination is supported, we first try to stop
- # the process with a soft terminate. Failing that, we try
- # the hard terminate option.
- if attempt_count == 1:
- return self._attempt_soft_kill(want_core)
- elif attempt_count == 2:
- return self._attempt_hard_kill()
- else:
- # We don't have anything else to try.
- terminated = self.returncode is not None
- done_trying = True
- return terminated, done_trying
- else:
- # We only try the hard terminate option when there
- # is no soft terminate available.
- if attempt_count == 1:
- return self._attempt_hard_kill()
- else:
- # We don't have anything else to try.
- terminated = self.returncode is not None
- done_trying = True
- return terminated, done_trying
-
- def _wait_with_timeout(self, timeout_seconds, command, want_core):
- # Allow up to timeout seconds for the io thread to wrap up.
- # If that completes, the child process should be done.
- completed_normally = self.done_event.wait(timeout_seconds)
- if completed_normally:
- # Reap the child process here.
- self.returncode = self.process.wait()
- else:
- # Prepare to stop the process
- process_terminated = completed_normally
- terminate_attempt_count = 0
-
- # Try as many attempts as we support for trying to shut down
- # the child process if it's not already shut down.
- while not process_terminated:
- terminate_attempt_count += 1
- # Attempt to terminate.
- process_terminated, done_trying = self._attempt_termination(
- terminate_attempt_count, want_core)
- # Check if there's nothing more to try.
- if done_trying:
- # Break out of our termination attempt loop.
- break
-
- # At this point, we're calling it good. The process
- # finished gracefully, was shut down after one or more
- # attempts, or we failed but gave it our best effort.
- self.on_process_exited(
- command,
- self.io_thread.output,
- not completed_normally,
- self.returncode)
-
-
-def patched_init(self, *args, **kwargs):
- self.original_init(*args, **kwargs)
- # Initialize our condition variable that protects wait()/poll().
- self.wait_condition = threading.Condition()
-
-
-def patched_wait(self):
- self.wait_condition.acquire()
- try:
- result = self.original_wait()
- # The process finished. Signal the condition.
- self.wait_condition.notify_all()
- return result
- finally:
- self.wait_condition.release()
-
-
-def patched_poll(self):
- self.wait_condition.acquire()
- try:
- result = self.original_poll()
- if self.returncode is not None:
- # We did complete, and we have the return value.
- # Signal the event to indicate we're done.
- self.wait_condition.notify_all()
- return result
- finally:
- self.wait_condition.release()
-
-
-def patch_up_subprocess_popen():
- subprocess.Popen.original_init = subprocess.Popen.__init__
- subprocess.Popen.__init__ = patched_init
-
- subprocess.Popen.original_wait = subprocess.Popen.wait
- subprocess.Popen.wait = patched_wait
-
- subprocess.Popen.original_poll = subprocess.Popen.poll
- subprocess.Popen.poll = patched_poll
-
-# Replace key subprocess.Popen() threading-unprotected methods with
-# threading-protected versions.
-patch_up_subprocess_popen()
Removed: lldb/trunk/test/test_runner/test/inferior.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/test/inferior.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_runner/test/inferior.py (original)
+++ lldb/trunk/test/test_runner/test/inferior.py (removed)
@@ -1,146 +0,0 @@
-#!/usr/bin/env python
-"""Inferior program used by process control tests."""
-
-from __future__ import print_function
-
-import argparse
-import datetime
-import signal
-import subprocess
-import sys
-import time
-
-
-def parse_args(command_line):
- """Parses the command line arguments given to it.
-
- @param command_line a list of command line arguments to be parsed.
-
- @return the argparse options dictionary.
- """
- parser = argparse.ArgumentParser()
- parser.add_argument(
- "--ignore-signal",
- "-i",
- dest="ignore_signals",
- metavar="SIGNUM",
- action="append",
- type=int,
- default=[],
- help="ignore the given signal number (if possible)")
- parser.add_argument(
- "--launch-child-share-handles",
- action="store_true",
- help=("launch a child inferior.py that shares stdout/stderr/stdio and "
- "never returns"))
- parser.add_argument(
- "--never-return",
- action="store_true",
- help="run in an infinite loop, never return")
- parser.add_argument(
- "--return-code",
- "-r",
- type=int,
- default=0,
- help="specify the return code for the inferior upon exit")
- parser.add_argument(
- "--sleep",
- "-s",
- metavar="SECONDS",
- dest="sleep_seconds",
- type=float,
- help="sleep for SECONDS seconds before returning")
- parser.add_argument(
- "--verbose", "-v", action="store_true",
- help="log verbose operation details to stdout")
- return parser.parse_args(command_line)
-
-
-def handle_ignore_signals(options, signals):
- """Ignores any signals provided to it.
-
- @param options the command line options parsed by the program.
- General used to check flags for things like verbosity.
-
- @param signals the list of signals to ignore. Can be None or zero-length.
- Entries should be type int.
- """
- if signals is None:
- return
-
- for signum in signals:
- if options.verbose:
- print("disabling signum {}".format(signum))
- signal.signal(signum, signal.SIG_IGN)
-
-
-def handle_sleep(options, sleep_seconds):
- """Sleeps the number of seconds specified, restarting as needed.
-
- @param options the command line options parsed by the program.
- General used to check flags for things like verbosity.
-
- @param sleep_seconds the number of seconds to sleep. If None
- or <= 0, no sleeping will occur.
- """
- if sleep_seconds is None:
- return
-
- if sleep_seconds <= 0:
- return
-
- end_time = datetime.datetime.now() + datetime.timedelta(0, sleep_seconds)
- if options.verbose:
- print("sleep end time: {}".format(end_time))
-
- # Do sleep in a loop: signals can interrupt.
- while datetime.datetime.now() < end_time:
- # We'll wrap this in a try/catch so we don't encounter
- # a race if a signal (ignored) knocks us out of this
- # loop and causes us to return.
- try:
- sleep_interval = end_time - datetime.datetime.now()
- sleep_seconds = sleep_interval.total_seconds()
- if sleep_seconds > 0:
- time.sleep(sleep_seconds)
- except: # pylint: disable=bare-except
- pass
-
-
-def handle_launch_children(options):
- if options.launch_child_share_handles:
- # Launch the child, share our file handles.
- # We won't bother reaping it since it will likely outlive us.
- subprocess.Popen([sys.executable, __file__, "--never-return"])
-
-
-def handle_never_return(options):
- if not options.never_return:
- return
-
- # Loop forever.
- while True:
- try:
- time.sleep(10)
- except: # pylint: disable=bare-except
- # Ignore
- pass
-
-
-def main(command_line):
- """Drives the main operation of the inferior test program.
-
- @param command_line the command line options to process.
-
- @return the exit value (program return code) for the process.
- """
- options = parse_args(command_line)
- handle_ignore_signals(options, options.ignore_signals)
- handle_launch_children(options)
- handle_sleep(options, options.sleep_seconds)
- handle_never_return(options)
-
- return options.return_code
-
-if __name__ == "__main__":
- sys.exit(main(sys.argv[1:]))
Removed: lldb/trunk/test/test_runner/test/process_control_tests.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/test/process_control_tests.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/test_runner/test/process_control_tests.py (original)
+++ lldb/trunk/test/test_runner/test/process_control_tests.py (removed)
@@ -1,235 +0,0 @@
-#!/usr/bin/env python
-"""
-The LLVM Compiler Infrastructure
-
-This file is distributed under the University of Illinois Open Source
-License. See LICENSE.TXT for details.
-
-Provides classes used by the test results reporting infrastructure
-within the LLDB test suite.
-
-
-Tests the process_control module.
-"""
-
-# System imports.
-import os
-import platform
-import unittest
-import sys
-import threading
-
-# Add lib dir to pythonpath
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
-
-# Our imports.
-import process_control
-
-
-class TestInferiorDriver(process_control.ProcessDriver):
- def __init__(self, soft_terminate_timeout=None):
- super(TestInferiorDriver, self).__init__(
- soft_terminate_timeout=soft_terminate_timeout)
- self.started_event = threading.Event()
- self.started_event.clear()
-
- self.completed_event = threading.Event()
- self.completed_event.clear()
-
- self.was_timeout = False
- self.returncode = None
- self.output = None
-
- def write(self, content):
- # We'll swallow this to keep tests non-noisy.
- # Uncomment the following line if you want to see it.
- # sys.stdout.write(content)
- pass
-
- def on_process_started(self):
- self.started_event.set()
-
- def on_process_exited(self, command, output, was_timeout, exit_status):
- self.returncode = exit_status
- self.was_timeout = was_timeout
- self.output = output
- self.returncode = exit_status
- self.completed_event.set()
-
-
-class ProcessControlTests(unittest.TestCase):
- @classmethod
- def _suppress_soft_terminate(cls, command):
- # Do the right thing for your platform here.
- # Right now only POSIX-y systems are reporting
- # soft terminate support, so this is set up for
- # those.
- helper = process_control.ProcessHelper.process_helper()
- signals = helper.soft_terminate_signals()
- if signals is not None:
- for signum in helper.soft_terminate_signals():
- command.extend(["--ignore-signal", str(signum)])
-
- @classmethod
- def inferior_command(
- cls,
- ignore_soft_terminate=False,
- options=None):
-
- # Base command.
- command = ([sys.executable, "inferior.py"])
-
- if ignore_soft_terminate:
- cls._suppress_soft_terminate(command)
-
- # Handle options as string or list.
- if isinstance(options, str):
- command.extend(options.split())
- elif isinstance(options, list):
- command.extend(options)
-
- # Return full command.
- return command
-
-
-class ProcessControlNoTimeoutTests(ProcessControlTests):
- """Tests the process_control module."""
- def test_run_completes(self):
- """Test that running completes and gets expected stdout/stderr."""
- driver = TestInferiorDriver()
- driver.run_command(self.inferior_command())
- self.assertTrue(
- driver.completed_event.wait(5), "process failed to complete")
- self.assertEqual(driver.returncode, 0, "return code does not match")
-
- def test_run_completes_with_code(self):
- """Test that running completes and gets expected stdout/stderr."""
- driver = TestInferiorDriver()
- driver.run_command(self.inferior_command(options="-r10"))
- self.assertTrue(
- driver.completed_event.wait(5), "process failed to complete")
- self.assertEqual(driver.returncode, 10, "return code does not match")
-
-
-class ProcessControlTimeoutTests(ProcessControlTests):
- def test_run_completes(self):
- """Test that running completes and gets expected return code."""
- driver = TestInferiorDriver()
- timeout_seconds = 5
- driver.run_command_with_timeout(
- self.inferior_command(),
- "{}s".format(timeout_seconds),
- False)
- self.assertTrue(
- driver.completed_event.wait(2*timeout_seconds),
- "process failed to complete")
- self.assertEqual(driver.returncode, 0)
-
- def _soft_terminate_works(self, with_core):
- # Skip this test if the platform doesn't support soft ti
- helper = process_control.ProcessHelper.process_helper()
- if not helper.supports_soft_terminate():
- self.skipTest("soft terminate not supported by platform")
-
- driver = TestInferiorDriver()
- timeout_seconds = 5
-
- driver.run_command_with_timeout(
- # Sleep twice as long as the timeout interval. This
- # should force a timeout.
- self.inferior_command(
- options="--sleep {}".format(timeout_seconds*2)),
- "{}s".format(timeout_seconds),
- with_core)
-
- # We should complete, albeit with a timeout.
- self.assertTrue(
- driver.completed_event.wait(2*timeout_seconds),
- "process failed to complete")
-
- # Ensure we received a timeout.
- self.assertTrue(driver.was_timeout, "expected to end with a timeout")
-
- self.assertTrue(
- helper.was_soft_terminate(driver.returncode, with_core),
- ("timeout didn't return expected returncode "
- "for soft terminate with core: {}").format(driver.returncode))
-
- def test_soft_terminate_works_core(self):
- """Driver uses soft terminate (with core request) when process times out.
- """
- self._soft_terminate_works(True)
-
- def test_soft_terminate_works_no_core(self):
- """Driver uses soft terminate (no core request) when process times out.
- """
- self._soft_terminate_works(False)
-
- def test_hard_terminate_works(self):
- """Driver falls back to hard terminate when soft terminate is ignored.
- """
-
- driver = TestInferiorDriver(soft_terminate_timeout=2.0)
- timeout_seconds = 1
-
- driver.run_command_with_timeout(
- # Sleep much longer than the timeout interval,forcing a
- # timeout. Do whatever is needed to have the inferior
- # ignore soft terminate calls.
- self.inferior_command(
- ignore_soft_terminate=True,
- options="--never-return"),
- "{}s".format(timeout_seconds),
- True)
-
- # We should complete, albeit with a timeout.
- self.assertTrue(
- driver.completed_event.wait(60),
- "process failed to complete")
-
- # Ensure we received a timeout.
- self.assertTrue(driver.was_timeout, "expected to end with a timeout")
-
- helper = process_control.ProcessHelper.process_helper()
- self.assertTrue(
- helper.was_hard_terminate(driver.returncode),
- ("timeout didn't return expected returncode "
- "for hard teriminate: {} ({})").format(
- driver.returncode,
- driver.output))
-
- def test_inferior_exits_with_live_child_shared_handles(self):
- """inferior exit detected when inferior children are live with shared
- stdout/stderr handles.
- """
- # Requires review D13362 or equivalent to be implemented.
- self.skipTest("http://reviews.llvm.org/D13362")
-
- driver = TestInferiorDriver()
-
- # Create the inferior (I1), and instruct it to create a child (C1)
- # that shares the stdout/stderr handles with the inferior.
- # C1 will then loop forever.
- driver.run_command_with_timeout(
- self.inferior_command(
- options="--launch-child-share-handles --return-code 3"),
- "5s",
- False)
-
- # We should complete without a timetout. I1 should end
- # immediately after launching C1.
- self.assertTrue(
- driver.completed_event.wait(5),
- "process failed to complete")
-
- # Ensure we didn't receive a timeout.
- self.assertFalse(
- driver.was_timeout, "inferior should have completed normally")
-
- self.assertEqual(
- driver.returncode, 3,
- "expected inferior process to end with expected returncode")
-
-
-if __name__ == "__main__":
- unittest.main()
Removed: lldb/trunk/test/tools/lldb-mi/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/TestMiExit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiExit.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiExit.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiExit.py (removed)
@@ -1,84 +0,0 @@
-"""
-Test that the lldb-mi driver exits properly.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_exit(self):
- """Test that '-gdb-exit' terminates local debug session and exits."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -gdb-exit: try to exit and check that program is finished
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
- import pexpect
- self.expect(pexpect.EOF)
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_quit(self):
- """Test that 'quit' exits immediately."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test quit: try to exit and check that program is finished
- self.runCmd("quit")
- import pexpect
- self.expect(pexpect.EOF)
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_q(self):
- """Test that 'q' exits immediately."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test q: try to exit and check that program is finished
- self.runCmd("q")
- import pexpect
- self.expect(pexpect.EOF)
Removed: lldb/trunk/test/tools/lldb-mi/TestMiFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiFile.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiFile.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiFile.py (removed)
@@ -1,77 +0,0 @@
-"""
-Test lldb-mi -file-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_file_exec_and_symbols_file(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -file-exec-and-symbols works for filename
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_file_exec_and_symbols_absolute_path(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -file-exec-and-symbols works for absolute path
- import os
- path = os.path.join(os.getcwd(), self.myexe)
- self.runCmd("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_file_exec_and_symbols_relative_path(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -file-exec-and-symbols works for relative path
- path = "./%s" % self.myexe
- self.runCmd("-file-exec-and-symbols %s" % path)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_file_exec_and_symbols_unknown_path(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -file-exec-and-symbols fails on unknown path
- path = "unknown_dir/%s" % self.myexe
- self.runCmd("-file-exec-and-symbols %s" % path)
- self.expect("\^error")
Removed: lldb/trunk/test/tools/lldb-mi/TestMiGdbSetShow.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiGdbSetShow.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiGdbSetShow.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiGdbSetShow.py (removed)
@@ -1,189 +0,0 @@
-"""
-Test lldb-mi -gdb-set and -gdb-show commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import lldbmi_testcase
-from lldbtest import *
-
-class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_set_target_async_default(self):
- """Test that 'lldb-mi --interpreter' switches to async mode by default."""
-
- self.spawnLldbMi(args = None)
-
- # Switch to sync mode
- self.runCmd("-gdb-set target-async off")
- self.expect("\^done")
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"off\"")
-
- # Test that -gdb-set switches to async by default
- self.runCmd("-gdb-set target-async")
- self.expect("\^done")
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"on\"")
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_set_target_async_on(self):
- """Test that 'lldb-mi --interpreter' can execute commands in async mode."""
-
- self.spawnLldbMi(args = None)
-
- # Switch to sync mode
- self.runCmd("-gdb-set target-async off")
- self.expect("\^done")
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"off\"")
-
- # Test that -gdb-set can switch to async mode
- self.runCmd("-gdb-set target-async on")
- self.expect("\^done")
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"on\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that program is executed in async mode
- self.runCmd("-exec-run")
- self.expect("\*running")
- self.expect("@\"argc=1")
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureLinux # Failing in ~11/600 dosep runs (build 3120-3122)
- def test_lldbmi_gdb_set_target_async_off(self):
- """Test that 'lldb-mi --interpreter' can execute commands in sync mode."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -gdb-set can switch to sync mode
- self.runCmd("-gdb-set target-async off")
- self.expect("\^done")
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"off\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that program is executed in async mode
- self.runCmd("-exec-run")
- unexpected = [ "\*running" ] # "\*running" is async notification
- it = self.expect(unexpected + [ "@\"argc=1\\\\r\\\\n" ])
- if it < len(unexpected):
- self.fail("unexpected found: %s" % unexpected[it])
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_show_target_async(self):
- """Test that 'lldb-mi --interpreter' in async mode by default."""
-
- self.spawnLldbMi(args = None)
-
- # Test that default target-async value is "on"
- self.runCmd("-gdb-show target-async")
- self.expect("\^done,value=\"on\"")
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_show_language(self):
- """Test that 'lldb-mi --interpreter' can get current language."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -gdb-show language gets current language
- self.runCmd("-gdb-show language")
- self.expect("\^done,value=\"c\+\+\"")
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.expectedFailure("-gdb-set ignores unknown properties")
- def test_lldbmi_gdb_set_unknown(self):
- """Test that 'lldb-mi --interpreter' fails when setting an unknown property."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -gdb-set fails if property is unknown
- self.runCmd("-gdb-set unknown some_value")
- self.expect("\^error")
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.expectedFailure("-gdb-show ignores unknown properties")
- def test_lldbmi_gdb_show_unknown(self):
- """Test that 'lldb-mi --interpreter' fails when showing an unknown property."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -gdb-show fails if property is unknown
- self.runCmd("-gdb-show unknown")
- self.expect("\^error")
-
-
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_gdb_set_ouptut_radix(self):
- """Test that 'lldb-mi --interpreter' works for -gdb-set output-radix."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to BP_printf
- line = line_number('main.cpp', '// BP_printf')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running");
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Setup variable
- self.runCmd("-var-create var_a * a");
- self.expect("\^done,name=\"var_a\",numchild=\"0\",value=\"10\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
-
- # Test default output
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"10\"");
-
- # Test hex output
- self.runCmd("-gdb-set output-radix 16");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"0xa\"");
-
- # Test octal output
- self.runCmd("-gdb-set output-radix 8");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"012\"");
-
- # Test decimal output
- self.runCmd("-gdb-set output-radix 10");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"10\"");
Removed: lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py (removed)
@@ -1,33 +0,0 @@
-"""
-Test lldb-mi =library-loaded notifications.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_library_loaded(self):
- """Test that 'lldb-mi --interpreter' shows the =library-loaded notifications."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test =library-loaded
- import os
- path = os.path.join(os.getcwd(), self.myexe)
- symbols_path = os.path.join(path + ".dSYM", "Contents", "Resources", "DWARF", self.myexe)
- def add_slashes(x): return x.replace("\\", "\\\\").replace("\"", "\\\"").replace("\'", "\\\'").replace("\0", "\\\0")
- self.expect([ "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\",size=\"[0-9]+\"" % (add_slashes(path), add_slashes(path), add_slashes(path), add_slashes(symbols_path)),
- "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\"" % (add_slashes(path), add_slashes(path), add_slashes(path)) ])
Removed: lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py (removed)
@@ -1,54 +0,0 @@
-"""
-Test that the lldb-mi driver prints prompt properly.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_prompt(self):
- """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
-
- self.spawnLldbMi(args = None)
-
- # Test that lldb-mi is ready after unknown command
- self.runCmd("-unknown-command")
- self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -file-exec-and-symbols
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -break-insert
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-run
- self.runCmd("-exec-run")
- self.expect("\*running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after BP hit
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-continue
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after program exited
- self.expect("\*stopped,reason=\"exited-normally\"")
- self.expect(self.child_prompt, exactly = True)
Removed: lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (removed)
@@ -1,247 +0,0 @@
-"""
-Test lldb-mi -break-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import lldbmi_testcase
-from lldbtest import *
-
-class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll("llvm.org/pr24717", oslist=["linux"])
- def test_lldbmi_break_insert_function_pending(self):
- """Test that 'lldb-mi --interpreter' works for pending function breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f printf")
- #FIXME function name is unknown on Darwin, fullname should be ??, line is -1
- #self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- #FIXME function name is unknown on Darwin, fullname should be ??, line -1
- #self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_break_insert_function(self):
- """Test that 'lldb-mi --interpreter' works for function breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -break-insert can set non-pending BP
- self.runCmd("-break-insert printf")
- #FIXME function name is unknown on Darwin
- #self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- #FIXME function name is unknown on Darwin
- #self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- # FIXME function name is unknown on Darwin
- #self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
-
- # Test that -break-insert fails if non-pending BP can't be resolved
- self.runCmd("-break-insert unknown_func")
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_func' not found\"")
-
- # Test that non-pending BP was set correctly
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"2\"")
-
- # Test that we can set a BP using the file:func syntax
- self.runCmd("-break-insert main.cpp:main")
- self.expect("\^done,bkpt={number=\"4\"")
- self.runCmd("-break-insert main.cpp:ns::foo1")
- self.expect("\^done,bkpt={number=\"5\"")
- #FIXME: quotes on filenames aren't handled correctly in lldb-mi.
- #self.runCmd("-break-insert \"main.cpp\":main")
- #self.expect("\^done,bkpt={number=\"6\"")
-
- # We should hit BP #5 on 'main.cpp:ns::foo1'
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"5\"")
-
- #FIXME: this test is disabled due to lldb bug llvm.org/pr24271.
- # Test that we can set a BP using the global namespace token
- #self.runCmd("-break-insert ::main")
- #self.expect("\^done,bkpt={number=\"7\"")
- #self.runCmd("-break-insert main.cpp:::main")
- #self.expect("\^done,bkpt={number=\"8\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_break_insert_file_line_pending(self):
- """Test that 'lldb-mi --interpreter' works for pending file:line breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Find the line number to break inside main() and set
- # pending BP
- line = line_number('main.cpp', '// BP_return')
- self.runCmd("-break-insert -f main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line, line))
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line, line))
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_break_insert_file_line(self):
- """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -break-insert can set non-pending BP
- line = line_number('main.cpp', '// BP_return')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line))
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line))
-
- # Test that -break-insert fails if non-pending BP can't be resolved
- self.runCmd("-break-insert unknown_file:1")
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_file:1' not found\"")
-
- # Test that non-pending BP was set correctly
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @unittest2.expectedFailure("-break-insert doesn't work for absolute path")
- def test_lldbmi_break_insert_file_line_absolute_path(self):
- """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- import os
- path = os.path.join(os.getcwd(), "main.cpp")
- line = line_number('main.cpp', '// BP_return')
- self.runCmd("-break-insert %s:%d" % (path, line))
- self.expect("\^done,bkpt={number=\"2\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_break_insert_settings(self):
- """Test that 'lldb-mi --interpreter' can set breakpoints accoridng to global options."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set target.move-to-nearest-code=off and try to set BP #1 that shouldn't be hit
- self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code off\"")
- self.expect("\^done")
- line = line_number('main.cpp', '// BP_before_main')
- self.runCmd("-break-insert -f main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Test that non-pending BP will not be set on non-existing line if target.move-to-nearest-code=off
- # Note: this increases the BP number by 1 even though BP #2 is invalid.
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'main.cpp:%d' not found\"" % line)
-
- # Set target.move-to-nearest-code=on and target.skip-prologue=on and set BP #3
- self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code on\"")
- self.runCmd("-interpreter-exec console \"settings set target.skip-prologue on\"")
- self.expect("\^done")
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
- # Set target.skip-prologue=off and set BP #4
- self.runCmd("-interpreter-exec console \"settings set target.skip-prologue off\"")
- self.expect("\^done")
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
-
- # Test that BP #4 is located before BP #3
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"4\"")
-
- # Test that BP #3 is hit
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
-
- # Test that the target.language=pascal setting works and that BP #5 is NOT set
- self.runCmd("-interpreter-exec console \"settings set target.language c\"")
- self.expect("\^done")
- self.runCmd("-break-insert ns.foo1")
- self.expect("\^error")
-
- # Test that the target.language=c++ setting works and that BP #6 is hit
- self.runCmd("-interpreter-exec console \"settings set target.language c++\"")
- self.expect("\^done")
- self.runCmd("-break-insert ns::foo1")
- self.expect("\^done,bkpt={number=\"6\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"")
-
- # Test that BP #1 and #2 weren't set by running to program exit
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
Removed: lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (removed)
@@ -1,27 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-namespace ns
-{
- int foo1(void) { printf("In foo1\n"); return 1; }
- int foo2(void) { printf("In foo2\n"); return 2; }
-}
-
-// BP_before_main
-
-int x;
-int
-main(int argc, char const *argv[])
-{
- printf("Print a formatted string so that GCC does not optimize this printf call: %s\n", argv[0]);
- x = ns::foo1() + ns::foo2();
- return 0; // BP_return
-}
Removed: lldb/trunk/test/tools/lldb-mi/control/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/control/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (removed)
@@ -1,462 +0,0 @@
-"""
-Test lldb-mi -exec-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureLinux # llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped
- def test_lldbmi_exec_run(self):
- """Test that 'lldb-mi --interpreter' can stop at entry."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that program is stopped at entry
- self.runCmd("-exec-run --start")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
- # Test that lldb-mi is ready to execute next commands
- self.expect(self.child_prompt, exactly = True)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
- def test_lldbmi_exec_abort(self):
- """Test that 'lldb-mi --interpreter' works for -exec-abort."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -exec-abort fails on invalid process
- self.runCmd("-exec-abort")
- self.expect("\^error,msg=\"Command 'exec-abort'\. Invalid process during debug session\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments arg1")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that arguments were passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"2\"")
-
- # Test that program may be aborted
- self.runCmd("-exec-abort")
- self.expect("\^done")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- # Test that program can be run again
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that arguments were passed again
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"2\"")
-
- # Test that program may be aborted again
- self.runCmd("-exec-abort")
- self.expect("\^done")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
- def test_lldbmi_exec_arguments_set(self):
- """Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments --arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Check argc and argv to see if arg passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"5\"")
- #self.runCmd("-data-evaluate-expression argv[1]")
- #self.expect("\^done,value=\"--arg1\"")
- self.runCmd("-interpreter-exec command \"print argv[1]\"")
- self.expect("\"--arg1\"")
- #self.runCmd("-data-evaluate-expression argv[2]")
- #self.expect("\^done,value=\"2nd arg\"")
- self.runCmd("-interpreter-exec command \"print argv[2]\"")
- self.expect("\"2nd arg\"")
- #self.runCmd("-data-evaluate-expression argv[3]")
- #self.expect("\^done,value=\"third_arg\"")
- self.runCmd("-interpreter-exec command \"print argv[3]\"")
- self.expect("\"third_arg\"")
- #self.runCmd("-data-evaluate-expression argv[4]")
- #self.expect("\^done,value=\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
- self.runCmd("-interpreter-exec command \"print argv[4]\"")
- self.expect("\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
- def test_lldbmi_exec_arguments_reset(self):
- """Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments arg1")
- self.expect("\^done")
- self.runCmd("-exec-arguments")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Check argc to see if arg passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"1\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_next(self):
- """Test that 'lldb-mi --interpreter' works for stepping."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensitive to the lines in the source
-
- # Test -exec-next
- self.runCmd("-exec-next --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
-
- # Test that --thread is optional
- self.runCmd("-exec-next --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
-
- # Test that --frame is optional
- self.runCmd("-exec-next --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"31\"")
-
- # Test that both --thread and --frame are optional
- self.runCmd("-exec-next")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"32\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-next --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-next --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-next --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailurei386 #xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64
- @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
- def test_lldbmi_exec_next_instruction(self):
- """Test that 'lldb-mi --interpreter' works for instruction stepping."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensitive to the lines in the
- # source and optimizations
-
- # Test -exec-next-instruction
- self.runCmd("-exec-next-instruction --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
-
- # Test that --thread is optional
- self.runCmd("-exec-next-instruction --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
-
- # Test that --frame is optional
- self.runCmd("-exec-next-instruction --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
-
- # Test that both --thread and --frame are optional
- self.runCmd("-exec-next-instruction")
- self.expect("\^running")
- # Depending on compiler, it can stop at different line
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-next-instruction --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-next-instruction --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-next-instruction --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_step(self):
- """Test that 'lldb-mi --interpreter' works for stepping into."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensitive to the lines in the source
-
- # Test that -exec-step steps into (or not) printf depending on debug info
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
- self.runCmd("-exec-step --thread 1 --frame 0")
- self.expect("\^running")
- it = self.expect([ "\*stopped,reason=\"end-stepping-range\".+?func=\"main\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
- # Exit from printf if needed
- if it == 1:
- self.runCmd("-exec-finish")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
-
- # Test that -exec-step steps into g_MyFunction and back out
- # (and that --thread is optional)
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
- # Use -exec-finish here to make sure that control reaches the caller.
- # -exec-step can keep us in the g_MyFunction for gcc
- self.runCmd("-exec-finish --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
-
- # Test that -exec-step steps into s_MyFunction
- # (and that --frame is optional)
- self.runCmd("-exec-step --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
-
- # Test that -exec-step steps into g_MyFunction from inside
- # s_MyFunction (and that both --thread and --frame are optional)
- self.runCmd("-exec-step")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-step --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-step --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-step --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_step_instruction(self):
- """Test that 'lldb-mi --interpreter' works for instruction stepping into."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Warning: the following is sensitive to the lines in the
- # source and optimizations
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-next steps over printf
- self.runCmd("-exec-next --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
-
- # Test that -exec-step-instruction steps over non branching
- # instruction
- self.runCmd("-exec-step-instruction --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\"")
-
- # Test that -exec-step-instruction steps into g_MyFunction
- # instruction (and that --thread is optional)
- self.runCmd("-exec-step-instruction --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
-
- # Test that -exec-step-instruction steps over non branching
- # (and that --frame is optional)
- self.runCmd("-exec-step-instruction --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
-
- # Test that -exec-step-instruction steps into g_MyFunction
- # (and that both --thread and --frame are optional)
- self.runCmd("-exec-step-instruction")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-step-instruction --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-step-instruction --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-step-instruction --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
- def test_lldbmi_exec_finish(self):
- """Test that 'lldb-mi --interpreter' works for -exec-finish."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set BP at g_MyFunction and run to BP
- self.runCmd("-break-insert -f g_MyFunction")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish returns from g_MyFunction
- self.runCmd("-exec-finish --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
-
- # Run to BP inside s_MyFunction call
- self.runCmd("-break-insert s_MyFunction")
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish hits BP at g_MyFunction call inside
- # s_MyFunction (and that --thread is optional)
- self.runCmd("-exec-finish --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish returns from g_MyFunction call inside
- # s_MyFunction (and that --frame is optional)
- self.runCmd("-exec-finish --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
-
- # Test that -exec-finish returns from s_MyFunction
- # (and that both --thread and --frame are optional)
- self.runCmd("-exec-finish")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-finish --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-finish --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- #self.runCmd("-exec-finish --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- # Set BP at printf and run to BP
- self.runCmd("-break-insert -f printf")
- self.expect("\^done,bkpt={number=\"3\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- ## Test that -exec-finish returns from printf
- self.runCmd("-exec-finish --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
Removed: lldb/trunk/test/tools/lldb-mi/control/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/control/main.cpp (removed)
@@ -1,33 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-void
-g_MyFunction(void)
-{
- printf("g_MyFunction");
-}
-
-static void
-s_MyFunction(void)
-{
- g_MyFunction();
- printf("s_MyFunction");
-}
-
-int
-main(int argc, char const *argv[])
-{
- printf("start");
- g_MyFunction();
- s_MyFunction();
- printf("exit");
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/data/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/data/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/TestMiData.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (removed)
@@ -1,333 +0,0 @@
-"""
-Test lldb-mi -data-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import unittest2
-import lldbmi_testcase
-from lldbtest import *
-
-class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_disassemble(self):
- """Test that 'lldb-mi --interpreter' works for -data-disassemble."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get an address for disassembling: use main
- self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
- addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
-
- # Test -data-disassemble: try to disassemble some address
- self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
- self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
-
- # Run to hello_world
- self.runCmd("-break-insert -f hello_world")
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get an address for disassembling: use hello_world
- self.runCmd("-data-evaluate-expression hello_world")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`hello_world\(\) at main.cpp:[0-9]+\)\"")
- addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
-
- # Test -data-disassemble: try to disassemble some address
- self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
-
- # This matches a line similar to:
- # Darwin: {address="0x0000000100000f18",func-name="hello_world()",offset="8",size="7",inst="leaq 0x65(%rip), %rdi; \"Hello, World!\\n\""},
- # Linux: {address="0x0000000000400642",func-name="hello_world()",offset="18",size="5",inst="callq 0x4004d0; symbol stub for: printf"}
- # To match the escaped characters in the ouptut, we must use four backslashes per matches backslash
- # See https://docs.python.org/2/howto/regex.html#the-backslash-plague
- self.expect([ "{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; \\\\\"Hello, World!\\\\\\\\n\\\\\"\"}",
- "{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; symbol stub for: printf\"}" ])
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @unittest2.skip("-data-evaluate-expression doesn't work on globals") #FIXME: the global case worked before refactoring
- def test_lldbmi_data_read_memory_bytes_global(self):
- """Test that -data-read-memory-bytes can access global buffers."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get address of char[] (global)
- self.runCmd("-data-evaluate-expression &g_CharArray")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- addr = int(self.child.after.split("\"")[1], 16)
- size = 5
-
- # Test that -data-read-memory-bytes works for char[] type (global)
- self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
-
- # Get address of static char[]
- self.runCmd("-data-evaluate-expression &s_CharArray")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- addr = int(self.child.after.split("\"")[1], 16)
- size = 5
-
- # Test that -data-read-memory-bytes works for static char[] type
- self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_read_memory_bytes_local(self):
- """Test that -data-read-memory-bytes can access local buffers."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd('-file-exec-and-symbols %s' % self.myexe)
- self.expect(r'\^done')
-
- # Run to BP_local_array_test_inner
- line = line_number('main.cpp', '// BP_local_array_test_inner')
- self.runCmd('-break-insert main.cpp:%d' % line)
- self.expect(r'\^done,bkpt=\{number="1"')
- self.runCmd('-exec-run')
- self.expect(r'\^running')
- self.expect(r'\*stopped,reason="breakpoint-hit"')
-
- # Get address of local char[]
- self.runCmd('-data-evaluate-expression "(void *)&array"')
- self.expect(r'\^done,value="0x[0-9a-f]+"')
- addr = int(self.child.after.split('"')[1], 16)
- size = 4
-
- # Test that an unquoted hex literal address works
- self.runCmd('-data-read-memory-bytes %#x %d' % (addr, size))
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # Test that a double-quoted hex literal address works
- self.runCmd('-data-read-memory-bytes "%#x" %d' % (addr, size))
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # Test that unquoted expressions work
- self.runCmd('-data-read-memory-bytes &array %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # This doesn't work, and perhaps that makes sense, but it does work on GDB
- self.runCmd('-data-read-memory-bytes array 4')
- self.expect(r'\^error')
- #self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- self.runCmd('-data-read-memory-bytes &array[2] 2')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="0304"\}\]' % (addr + 2, addr + size))
-
- self.runCmd('-data-read-memory-bytes first_element_ptr %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # Test that double-quoted expressions work
- self.runCmd('-data-read-memory-bytes "&array" %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- self.runCmd('-data-read-memory-bytes "&array[0] + 1" 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
-
- self.runCmd('-data-read-memory-bytes "first_element_ptr + 1" 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
-
- # Test the -o (offset) option
- self.runCmd('-data-read-memory-bytes -o 1 &array 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
-
- # Test the --thread option
- self.runCmd('-data-read-memory-bytes --thread 1 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # Test the --thread option with an invalid value
- self.runCmd('-data-read-memory-bytes --thread 999 &array 4')
- self.expect(r'\^error')
-
- # Test the --frame option (current frame)
- self.runCmd('-data-read-memory-bytes --frame 0 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
-
- # Test the --frame option (outer frame)
- self.runCmd('-data-read-memory-bytes --frame 1 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="05060708"\}\]')
-
- # Test the --frame option with an invalid value
- self.runCmd('-data-read-memory-bytes --frame 999 &array 4')
- self.expect(r'\^error')
-
- # Test all the options at once
- self.runCmd('-data-read-memory-bytes --thread 1 --frame 1 -o 2 &array 2')
- self.expect(r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="0708"\}\]')
-
- # Test that an expression that references undeclared variables doesn't work
- self.runCmd('-data-read-memory-bytes "&undeclared_array1 + undeclared_array2[1]" 2')
- self.expect(r'\^error')
-
- # Test that the address argument is required
- self.runCmd('-data-read-memory-bytes')
- self.expect(r'\^error')
-
- # Test that the count argument is required
- self.runCmd('-data-read-memory-bytes &array')
- self.expect(r'\^error')
-
- # Test that the address and count arguments are required when other options are present
- self.runCmd('-data-read-memory-bytes --thread 1')
- self.expect(r'\^error')
-
- self.runCmd('-data-read-memory-bytes --thread 1 --frame 0')
- self.expect(r'\^error')
-
- # Test that the count argument is required when other options are present
- self.runCmd('-data-read-memory-bytes --thread 1 &array')
- self.expect(r'\^error')
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_list_register_names(self):
- """Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -data-list-register-names: try to get all registers
- self.runCmd("-data-list-register-names")
- self.expect("\^done,register-names=\[\".+?\",")
-
- # Test -data-list-register-names: try to get specified registers
- self.runCmd("-data-list-register-names 0")
- self.expect("\^done,register-names=\[\".+?\"\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_list_register_values(self):
- """Test that 'lldb-mi --interpreter' works for -data-list-register-values."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -data-list-register-values: try to get all registers
- self.runCmd("-data-list-register-values x")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"")
-
- # Test -data-list-register-values: try to get specified registers
- self.runCmd("-data-list-register-values x 0")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"}\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_info_line(self):
- """Test that 'lldb-mi --interpreter' works for -data-info-line."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get the address of main and its line
- self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
- addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
- line = line_number('main.cpp', '// FUNC_main')
-
- # Test that -data-info-line works for address
- self.runCmd("-data-info-line *%#x" % addr)
- self.expect("\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line))
-
- # Test that -data-info-line works for file:line
- self.runCmd("-data-info-line main.cpp:%d" % line)
- self.expect("\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line))
-
- # Test that -data-info-line fails when invalid address is specified
- self.runCmd("-data-info-line *0x0")
- self.expect("\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
-
- # Test that -data-info-line fails when file is unknown
- self.runCmd("-data-info-line unknown_file:1")
- self.expect("\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
-
- # Test that -data-info-line fails when line has invalid format
- self.runCmd("-data-info-line main.cpp:bad_line")
- self.expect("\^error,msg=\"error: invalid line number string 'bad_line'")
- self.runCmd("-data-info-line main.cpp:0")
- self.expect("\^error,msg=\"error: zero is an invalid line number")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_evaluate_expression(self):
- """Test that 'lldb-mi --interpreter' works for -data-evaluate-expression."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- line = line_number('main.cpp', '// BP_local_2d_array_test')
- self.runCmd('-break-insert main.cpp:%d' % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Check 2d array
- self.runCmd("-data-evaluate-expression array2d")
- self.expect("\^done,value=\"\{\[0\] = \{\[0\] = 1, \[1\] = 2, \[2\] = 3\}, \[1\] = \{\[0\] = 4, \[1\] = 5, \[2\] = 6\}\}\"")
Removed: lldb/trunk/test/tools/lldb-mi/data/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/data/main.cpp (removed)
@@ -1,59 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <stdio.h>
-
-const char g_CharArray[] = "\x10\x11\x12\x13";
-static const char s_CharArray[] = "\x20\x21\x22\x23";
-
-void
-local_array_test_inner()
-{
- char array[] = { 0x01, 0x02, 0x03, 0x04 };
- char *first_element_ptr = &array[0];
- // BP_local_array_test_inner
- return;
-}
-
-void
-local_array_test()
-{
- char array[] = { 0x05, 0x06, 0x07, 0x08 };
- // BP_local_array_test
- local_array_test_inner();
- return;
-}
-
-void
-local_2d_array_test()
-{
- int array2d[2][3];
- array2d[0][0] = 1;
- array2d[0][1] = 2;
- array2d[0][2] = 3;
- array2d[1][0] = 4;
- array2d[1][1] = 5;
- array2d[1][2] = 6;
- return; // BP_local_2d_array_test
-}
-
-void
-hello_world()
-{
- printf("Hello, World!\n"); // BP_hello_world
-}
-
-int
-main(int argc, char const *argv[])
-{ // FUNC_main
- local_array_test();
- hello_world();
- local_2d_array_test();
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/interpreter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/interpreter/TestMiCliSupport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/TestMiCliSupport.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/TestMiCliSupport.py (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/TestMiCliSupport.py (removed)
@@ -1,206 +0,0 @@
-"""
-Test lldb-mi can interpret CLI commands directly.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_target_create(self):
- """Test that 'lldb-mi --interpreter' can create target by 'target create' command."""
-
- self.spawnLldbMi(args = None)
-
- # Test that "target create" loads executable
- self.runCmd("target create \"%s\"" % self.myexe)
- self.expect("\^done")
-
- # Test that executable was loaded properly
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_breakpoint_set(self):
- """Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that "breakpoint set" sets a breakpoint
- self.runCmd("breakpoint set --name main")
- self.expect("\^done")
- self.expect("=breakpoint-created,bkpt={number=\"1\"")
-
- # Test that breakpoint was set properly
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\"")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_settings_set_target_run_args_before(self):
- """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
-
- self.spawnLldbMi(args = None)
-
- # Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
- self.expect("\^done")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
-
- # Test that arguments were passed properly
- self.expect("@\"argc=5\\\\r\\\\n\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_settings_set_target_run_args_after(self):
- """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
-
- # Test that arguments were passed properly
- self.expect("@\"argc=5\\\\r\\\\n\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_process_launch(self):
- """Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set breakpoint
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Test that "process launch" launches executable
- self.runCmd("process launch")
- self.expect("\^done")
-
- # Test that breakpoint hit
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_thread_step_in(self):
- """Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread step-in" steps into (or not) printf depending on debug info
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
- self.runCmd("thread step-in")
- self.expect("\^done")
- it = self.expect([ "@\"argc=1\\\\r\\\\n\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
- if it == 0:
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_thread_step_over(self):
- """Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread step-over" steps over
- self.runCmd("thread step-over")
- self.expect("\^done")
- self.expect("@\"argc=1\\\\r\\\\n\"")
- self.expect("\*stopped,reason=\"end-stepping-range\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_thread_continue(self):
- """Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread continue" continues execution
- self.runCmd("thread continue")
- self.expect("\^done")
- self.expect("@\"argc=1\\\\r\\\\n")
- self.expect("\*stopped,reason=\"exited-normally\"")
Removed: lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (removed)
@@ -1,228 +0,0 @@
-"""
-Test lldb-mi -interpreter-exec command.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_target_create(self):
- """Test that 'lldb-mi --interpreter' can create target by 'target create' command."""
-
- self.spawnLldbMi(args = None)
-
- # Test that "target create" loads executable
- self.runCmd("-interpreter-exec console \"target create \\\"%s\\\"\"" % self.myexe)
- self.expect("\^done")
-
- # Test that executable was loaded properly
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_breakpoint_set(self):
- """Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that "breakpoint set" sets a breakpoint
- self.runCmd("-interpreter-exec console \"breakpoint set --name main\"")
- self.expect("\^done")
- self.expect("=breakpoint-created,bkpt={number=\"1\"")
-
- # Test that breakpoint was set properly
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\"")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureLinux # Failing in ~9/600 dosep runs (build 3120-3122)
- def test_lldbmi_settings_set_target_run_args_before(self):
- """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
-
- self.spawnLldbMi(args = None)
-
- # Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
- self.expect("\^done")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
-
- # Test that arguments were passed properly
- self.expect("@\"argc=5\\\\r\\\\n\"")
- self.expect("@\"argv.0.=.*lldb-mi")
- self.expect("@\"argv.1.=arg1\\\\r\\\\n\"")
- self.expect("@\"argv.2.=2nd arg\\\\r\\\\n\"")
- self.expect("@\"argv.3.=third_arg\\\\r\\\\n\"")
- self.expect("@\"argv.4.=fourth=4th arg\\\\r\\\\n\"")
-
- # Test that program exited normally
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureLinux # Failing in ~9/600 dosep runs (build 3120-3122)
- def test_lldbmi_settings_set_target_run_args_after(self):
- """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
- self.expect("\^done")
-
- # Run to BP_printf
- line = line_number('main.cpp', '// BP_printf')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running");
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Run to BP_return
- line = line_number('main.cpp', '// BP_return')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running");
-
- # Test that arguments were passed properly
- self.expect("@\"argc=5\\\\r\\\\n\"")
- self.expect("@\"argv.0.=.*lldb-mi")
- self.expect("@\"argv.1.=arg1\\\\r\\\\n\"")
- self.expect("@\"argv.2.=2nd arg\\\\r\\\\n\"")
- self.expect("@\"argv.3.=third_arg\\\\r\\\\n\"")
- self.expect("@\"argv.4.=fourth=4th arg\\\\r\\\\n\"")
-
- # Hit BP_return
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_process_launch(self):
- """Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set breakpoint
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Test that "process launch" launches executable
- self.runCmd("-interpreter-exec console \"process launch\"")
- self.expect("\^done")
-
- # Test that breakpoint hit
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_thread_step_in(self):
- """Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread step-in" steps into (or not) printf depending on debug info
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
- self.runCmd("-interpreter-exec console \"thread step-in\"")
- self.expect("\^done")
- it = self.expect([ "@\"argc=1\\\\r\\\\n\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
- if it == 0:
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_thread_step_over(self):
- """Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread step-over" steps over
- self.runCmd("-interpreter-exec console \"thread step-over\"")
- self.expect("\^done")
- self.expect("@\"argc=1\\\\r\\\\n\"")
- self.expect("\*stopped,reason=\"end-stepping-range\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_thread_continue(self):
- """Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that "thread continue" continues execution
- self.runCmd("-interpreter-exec console \"thread continue\"")
- self.expect("\^done")
- self.expect("@\"argc=1\\\\r\\\\n")
- self.expect("\*stopped,reason=\"exited-normally\"")
Removed: lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp (removed)
@@ -1,19 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-int
-main(int argc, char const *argv[])
-{
- printf("argc=%d\n", argc); // BP_printf
- for (int i = 0; i < argc; ++i)
- printf("argv[%d]=%s\n", i, argv[i]);
- return 0; // BP_return
-}
Removed: lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py (removed)
@@ -1,54 +0,0 @@
-"""
-Base class for lldb-mi test cases.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-from lldbtest import *
-
-class MiTestCaseBase(Base):
-
- mydir = None
- myexe = "a.out"
- mylog = "child.log"
-
- def getCategories(self):
- return ['lldb-mi']
-
- @classmethod
- def classCleanup(cls):
- TestBase.RemoveTempFile(cls.myexe)
- TestBase.RemoveTempFile(cls.mylog)
-
- def setUp(self):
- Base.setUp(self)
- self.buildDefault()
- self.child_prompt = "(gdb)"
-
- def tearDown(self):
- if self.TraceOn():
- print("\n\nContents of %s:" % self.mylog)
- try:
- print(open(self.mylog, "r").read())
- except IOError:
- pass
- Base.tearDown(self)
-
- def spawnLldbMi(self, args=None):
- import pexpect
- self.child = pexpect.spawn("%s --interpreter %s" % (
- self.lldbMiExec, args if args else ""))
- self.child.setecho(True)
- self.child.logfile_read = open(self.mylog, "w")
- # wait until lldb-mi has started up and is ready to go
- self.expect(self.child_prompt, exactly = True)
-
- def runCmd(self, cmd):
- self.child.sendline(cmd)
-
- def expect(self, pattern, exactly=False, *args, **kwargs):
- if exactly:
- return self.child.expect_exact(pattern, *args, **kwargs)
- return self.child.expect(pattern, *args, **kwargs)
Removed: lldb/trunk/test/tools/lldb-mi/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/main.cpp (removed)
@@ -1,19 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-int
-main(int argc, char const *argv[])
-{
- int a = 10;
-
- printf("argc=%d\n", argc); // BP_printf
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py (removed)
@@ -1,197 +0,0 @@
-"""
-Test that the lldb-mi handles signals properly.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- def test_lldbmi_stopped_when_interrupt(self):
- """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set doloop=1 and run (to loop forever)
- self.runCmd("-data-evaluate-expression \"do_loop=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that -exec-interrupt can interrupt an execution
- self.runCmd("-exec-interrupt")
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.+?thread-id=\"1\",stopped-threads=\"all\"")
-
- # Continue (to loop forever)
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that Ctrl+C can interrupt an execution
- self.child.sendintr() #FIXME: here uses self.child directly
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.*thread-id=\"1\",stopped-threads=\"all\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_stopped_when_stopatentry_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",frame={level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- self.expect([ "\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\},thread-id=\"1\",stopped-threads=\"all\"",
- "\*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"\?\?\",args=\[\],file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"" ])
-
- # Run to main to make sure we have not exited the application
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipUnlessDarwin
- def test_lldbmi_stopped_when_stopatentry_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
-
- # Prepare debugserver
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- self.skipTest("debugserver exe not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
- self.addTearDownHook(lambda: debugserver_child.terminate(force = True))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.+?thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_stopped_when_segfault_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set do_segfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS (code=1, address=0x0)\",thread-id=\"1\",stopped-threads=\"all\""
- # Linux: "*stopped,reason=\"exception-received\",exception=\"invalid address (fault address: 0x0)\",thread-id=\"1\",stopped-threads=\"all\""
- self.expect([ "\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"",
- "\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\"" ])
-
- @skipUnlessDarwin
- def test_lldbmi_stopped_when_segfault_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (remote)."""
-
- # Prepare debugserver
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- self.skipTest("debugserver exe not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
- self.addTearDownHook(lambda: debugserver_child.terminate(force = True))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- #FIXME -exec-run doesn't work
- self.runCmd("-interpreter-exec command \"process launch\"") #FIXME: self.runCmd("-exec-run")
- self.expect("\^done") #FIXME: self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set do_segfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
Removed: lldb/trunk/test/tools/lldb-mi/signal/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/main.cpp (removed)
@@ -1,33 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstddef>
-#include <unistd.h>
-
-int do_loop;
-int do_segfault;
-
-int
-main(int argc, char const *argv[])
-{
- if (do_loop)
- {
- do
- sleep(1);
- while (do_loop); // BP_loop_condition
- }
-
- if (do_segfault)
- {
- int *null_ptr = NULL;
- return *null_ptr;
- }
-
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/stack/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (removed)
@@ -1,479 +0,0 @@
-"""
-Test lldb-mi -stack-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_arguments(self):
- """Test that 'lldb-mi --interpreter' can shows arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-list-arguments lists empty stack arguments if range is empty
- self.runCmd("-stack-list-arguments 0 1 0")
- self.expect("\^done,stack-args=\[\]")
-
- # Test that -stack-list-arguments lists stack arguments without values
- # (and that low-frame and high-frame are optional)
- self.runCmd("-stack-list-arguments 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
- self.runCmd("-stack-list-arguments --no-values")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
-
- # Test that -stack-list-arguments lists stack arguments with all values
- self.runCmd("-stack-list-arguments 1 0 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
- self.runCmd("-stack-list-arguments --all-values 0 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
-
- # Test that -stack-list-arguments lists stack arguments with simple values
- self.runCmd("-stack-list-arguments 2 0 1")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
- self.runCmd("-stack-list-arguments --simple-values 0 1")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
-
- # Test that an invalid low-frame is handled
- # FIXME: -1 is treated as unsigned int
- self.runCmd("-stack-list-arguments 0 -1 0")
- #self.expect("\^error")
- self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
-
- # Test that an invalid high-frame is handled
- # FIXME: -1 is treated as unsigned int
- self.runCmd("-stack-list-arguments 0 0 -1")
- #self.expect("\^error")
-
- # Test that a missing low-frame or high-frame is handled
- self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
-
- # Test that an invalid low-frame is handled
- self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_locals(self):
- """Test that 'lldb-mi --interpreter' can shows local variables."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test int local variables:
- # Run to BP_local_int_test
- line = line_number('main.cpp', '// BP_local_int_test')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
-
- # Test struct local variable:
- # Run to BP_local_struct_test
- line = line_number('main.cpp', '// BP_local_struct_test')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]")
-
- # Test array local variable:
- # Run to BP_local_array_test
- line = line_number('main.cpp', '// BP_local_array_test')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"array\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"array\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]")
-
- # Test pointers as local variable:
- # Run to BP_local_pointer_test
- line = line_number('main.cpp', '// BP_local_pointer_test')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"5\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_variables(self):
- """Test that 'lldb-mi --interpreter' can shows local variables and arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test int local variables:
- # Run to BP_local_int_test
- line = line_number('main.cpp', '// BP_local_int_test_with_args')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-variables: use 0 or --no-values
- self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
- self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
-
- # Test -stack-list-variables: use 1 or --all-values
- self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
-
- # Test -stack-list-variables: use 2 or --simple-values
- self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
- self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
-
- # Test struct local variable:
- # Run to BP_local_struct_test
- line = line_number('main.cpp', '// BP_local_struct_test_with_args')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-variables: use 0 or --no-values
- self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
- self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
-
- # Test -stack-list-variables: use 1 or --all-values
- self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
- self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
-
- # Test -stack-list-variables: use 2 or --simple-values
- self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
- self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
-
- # Test array local variable:
- # Run to BP_local_array_test
- line = line_number('main.cpp', '// BP_local_array_test_with_args')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-variables: use 0 or --no-values
- self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
- self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
-
- # Test -stack-list-variables: use 1 or --all-values
- self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
- self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
-
- # Test -stack-list-variables: use 2 or --simple-values
- self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
- self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
-
- # Test pointers as local variable:
- # Run to BP_local_pointer_test
- line = line_number('main.cpp', '// BP_local_pointer_test_with_args')
- self.runCmd("-break-insert --file main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"5\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-variables: use 0 or --no-values
- self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
- self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
-
- # Test -stack-list-variables: use 1 or --all-values
- self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",value=\".*?\"},{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
- self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",value=\".*?\"},{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
-
- # Test -stack-list-variables: use 2 or --simple-values
- self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
- self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_info_depth(self):
- """Test that 'lldb-mi --interpreter' can shows depth of the stack."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-info-depth works
- # (and that max-depth is optional)
- self.runCmd("-stack-info-depth")
- self.expect("\^done,depth=\"[1-9]\"")
-
- # Test that max-depth restricts check of stack depth
- #FIXME: max-depth argument is ignored
- self.runCmd("-stack-info-depth 1")
- #self.expect("\^done,depth=\"1\"")
-
- # Test that invalid max-depth argument is handled
- #FIXME: max-depth argument is ignored
- self.runCmd("-stack-info-depth -1")
- #self.expect("\^error")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipUnlessDarwin
- def test_lldbmi_stack_info_frame(self):
- """Test that 'lldb-mi --interpreter' can show information about current frame."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -stack-info-frame fails when program isn't running
- self.runCmd("-stack-info-frame")
- self.expect("\^error,msg=\"Command 'stack-info-frame'\. Invalid process during debug session\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-info-frame works when program was stopped on BP
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
-
- # Select frame #1
- self.runCmd("-stack-select-frame 1")
- self.expect("\^done")
-
- # Test that -stack-info-frame works when specified frame was selected
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
-
- # Test that -stack-info-frame fails when an argument is specified
- #FIXME: unknown argument is ignored
- self.runCmd("-stack-info-frame unknown_arg")
- #self.expect("\^error")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_frames(self):
- """Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test stack frame: get frame #0 info
- self.runCmd("-stack-list-frames 0 0")
- self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_select_frame(self):
- """Test that 'lldb-mi --interpreter' can choose current frame."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-select-frame requires 1 mandatory argument
- self.runCmd("-stack-select-frame")
- self.expect("\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Validation failed. Mandatory args not found: frame\"")
-
- # Test that -stack-select-frame fails on invalid frame number
- self.runCmd("-stack-select-frame 99")
- self.expect("\^error,msg=\"Command 'stack-select-frame'\. Frame ID invalid\"")
-
- # Test that current frame is #0
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
-
- # Test that -stack-select-frame can select the selected frame
- self.runCmd("-stack-select-frame 0")
- self.expect("\^done")
-
- # Test that current frame is still #0
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
-
- # Test that -stack-select-frame can select frame #1 (parent frame)
- self.runCmd("-stack-select-frame 1")
- self.expect("\^done")
-
- # Test that current frame is #1
- # Note that message is different in Darwin and Linux:
- # Darwin: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\"start\",file=\"??\",fullname=\"??\",line=\"-1\"}"
- # Linux: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"\d+\"}"
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\"\}")
-
- # Test that -stack-select-frame can select frame #0 (child frame)
- self.runCmd("-stack-select-frame 0")
- self.expect("\^done")
-
- # Test that current frame is #0 and it has the same information
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
Removed: lldb/trunk/test/tools/lldb-mi/stack/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/main.cpp (removed)
@@ -1,127 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-struct inner
-{
- int var_d;
-};
-
-struct my_type
-{
- int var_a;
- char var_b;
- struct inner inner_;
-};
-
-int
-local_int_test(void)
-{
- int a = 10, b = 20;
- return 0; // BP_local_int_test
-}
-
-int
-local_int_test_with_args(int c, int d)
-{
- int a = 10, b = 20;
- return 0; // BP_local_int_test_with_args
-}
-
-int
-local_struct_test(void)
-{
- struct my_type var_c;
- var_c.var_a = 10;
- var_c.var_b = 'a';
- var_c.inner_.var_d = 30;
- return 0; // BP_local_struct_test
-}
-
-int local_struct_test_with_args(struct my_type var_e)
-{
- struct my_type var_c;
- var_c.var_a = 10;
- var_c.var_b = 'a';
- var_c.inner_.var_d = 30;
- return 0; // BP_local_struct_test_with_args
-}
-
-int
-local_array_test(void)
-{
- int array[3];
- array[0] = 100;
- array[1] = 200;
- array[2] = 300;
- return 0; // BP_local_array_test
-}
-
-int
-local_array_test_with_args(int* other_array)
-{
- int array[3];
- array[0] = 100;
- array[1] = 200;
- array[2] = 300;
- return 0; // BP_local_array_test_with_args
-}
-
-int
-local_pointer_test(void)
-{
- const char *test_str = "Rakaposhi";
- int var_e = 24;
- int *ptr = &var_e;
- return 0; // BP_local_pointer_test
-}
-
-int
-local_pointer_test_with_args(const char *arg_str, int *arg_ptr)
-{
- const char *test_str = "Rakaposhi";
- int var_e = 24;
- int *ptr = &var_e;
- return 0; // BP_local_pointer_test_with_args
-}
-
-int do_tests_with_args()
-{
- local_int_test_with_args(30, 40);
-
- struct my_type var_e;
- var_e.var_a = 20;
- var_e.var_b = 'b';
- var_e.inner_.var_d = 40;
- local_struct_test_with_args(var_e);
-
- int array[3];
- array[0] = 400;
- array[1] = 500;
- array[2] = 600;
- local_array_test_with_args(array);
-
- const char *test_str = "String";
- int var_z = 25;
- int *ptr = &var_z;
- local_pointer_test_with_args(test_str, ptr);
-
- return 0;
-}
-
-int
-main(int argc, char const *argv[])
-{
- local_int_test();
- local_struct_test();
- local_array_test();
- local_pointer_test();
-
- do_tests_with_args();
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (removed)
@@ -1,290 +0,0 @@
-"""
-Test lldb-mi startup options.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_executable_option_file(self):
- """Test that 'lldb-mi --interpreter %s' loads executable file."""
-
- self.spawnLldbMi(args = "%s" % self.myexe)
-
- # Test that the executable is loaded when file was specified
- self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
- self.expect("\^done")
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Continue
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_executable_option_unknown_file(self):
- """Test that 'lldb-mi --interpreter %s' fails on unknown executable file."""
-
- # Prepare path to executable
- path = "unknown_file"
-
- self.spawnLldbMi(args = "%s" % path)
-
- # Test that the executable isn't loaded when unknown file was specified
- self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_executable_option_absolute_path(self):
- """Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
-
- # Prepare path to executable
- import os
- path = os.path.join(os.getcwd(), self.myexe)
-
- self.spawnLldbMi(args = "%s" % path)
-
- # Test that the executable is loaded when file was specified using absolute path
- self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^done")
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_executable_option_relative_path(self):
- """Test that 'lldb-mi --interpreter %s' loads executable which is specified via relative path."""
-
- # Prepare path to executable
- path = "./%s" % self.myexe
-
- self.spawnLldbMi(args = "%s" % path)
-
- # Test that the executable is loaded when file was specified using relative path
- self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^done")
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_executable_option_unknown_path(self):
- """Test that 'lldb-mi --interpreter %s' fails on executable file which is specified via unknown path."""
-
- # Prepare path to executable
- path = "unknown_dir/%s" % self.myexe
-
- self.spawnLldbMi(args = "%s" % path)
-
- # Test that the executable isn't loaded when file was specified using unknown path
- self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_source_option_start_script(self):
- """Test that 'lldb-mi --interpreter' can execute user's commands after initial commands were executed."""
-
- # Prepared source file
- sourceFile = "start_script"
-
- self.spawnLldbMi(args = "--source %s" % sourceFile)
-
- # After '-file-exec-and-symbols a.out'
- self.expect("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # After '-break-insert -f main'
- self.expect("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- # After '-exec-run'
- self.expect("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # After '-break-insert main.cpp:BP_return'
- line = line_number('main.cpp', '//BP_return')
- self.expect("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
-
- # After '-exec-continue'
- self.expect("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
-
- # Try to evaluate 'a' expression
- self.runCmd("-data-evaluate-expression a")
- self.expect("\^done,value=\"10\"")
- self.expect(self.child_prompt, exactly = True)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_source_option_start_script_exit(self):
- """Test that 'lldb-mi --interpreter' can execute a prepared file which passed via --source option."""
-
- # Prepared source file
- sourceFile = "start_script_exit"
-
- self.spawnLldbMi(args = "--source %s" % sourceFile)
-
- # After '-file-exec-and-symbols a.out'
- self.expect("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # After '-break-insert -f main'
- self.expect("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- # After '-exec-run'
- self.expect("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # After '-break-insert main.cpp:BP_return'
- line = line_number('main.cpp', '//BP_return')
- self.expect("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
-
- # After '-exec-continue'
- self.expect("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # After '-data-evaluate-expression a'
- self.expect("-data-evaluate-expression a")
- self.expect("\^done,value=\"10\"")
-
- # After '-gdb-exit'
- self.expect("-gdb-exit")
- self.expect("\^exit")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_source_option_start_script_error(self):
- """Test that 'lldb-mi --interpreter' stops execution of initial commands in case of error."""
-
- # Prepared source file
- sourceFile = "start_script_error"
-
- self.spawnLldbMi(args = "--source %s" % sourceFile)
-
- # After '-file-exec-and-symbols a.out'
- self.expect("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # After '-break-ins -f main'
- self.expect("-break-ins -f main")
- self.expect("\^error")
-
- # Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_log_option(self):
- """Test that 'lldb-mi --log' creates a log file in the current directory."""
-
- logDirectory = "."
- self.spawnLldbMi(args = "%s --log" % self.myexe)
-
- # Test that the executable is loaded when file was specified
- self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
- self.expect("\^done")
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- # Check log file is created
- import glob,os
- logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
-
- if not logFile:
- self.fail("log file not found")
-
- # Delete log
- for f in logFile:
- os.remove(f)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_log_directory_option(self):
- """Test that 'lldb-mi --log --log-dir' creates a log file in the directory specified by --log-dir."""
-
- # Create log in temp directory
- import tempfile
- logDirectory = tempfile.gettempdir()
-
- self.spawnLldbMi(args = "%s --log --log-dir=%s" % (self.myexe,logDirectory))
-
- # Test that the executable is loaded when file was specified
- self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
- self.expect("\^done")
-
- # Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- # Check log file is created
- import glob,os
- logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
-
- if not logFile:
- self.fail("log file not found")
-
- # Delete log
- for f in logFile:
- os.remove(f)
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/main.cpp (removed)
@@ -1,15 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-int
-main(int argc, char const *argv[])
-{
- int a = 10;
- return 0; //BP_return
-}
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/start_script
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/start_script?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/start_script (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/start_script (removed)
@@ -1,5 +0,0 @@
--file-exec-and-symbols a.out
--break-insert -f main
--exec-run
--break-insert main.cpp:14
--exec-continue
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/start_script_error
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/start_script_error?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/start_script_error (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/start_script_error (removed)
@@ -1,2 +0,0 @@
--file-exec-and-symbols a.out
--break-ins -f main
Removed: lldb/trunk/test/tools/lldb-mi/startup_options/start_script_exit
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/start_script_exit?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/start_script_exit (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/start_script_exit (removed)
@@ -1,7 +0,0 @@
--file-exec-and-symbols a.out
--break-insert -f main
--exec-run
--break-insert main.cpp:14
--exec-continue
--data-evaluate-expression a
--gdb-exit
Removed: lldb/trunk/test/tools/lldb-mi/symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp symbol_list_lines_inline_test.cpp symbol_list_lines_inline_test2.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py (removed)
@@ -1,73 +0,0 @@
-"""
-Test lldb-mi -symbol-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_symbol_list_lines_file(self):
- """Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get address of main and its line
- self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
- addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
- line = line_number('main.cpp', '// FUNC_main')
-
- # Test that -symbol-list-lines works on valid data
- self.runCmd("-symbol-list-lines main.cpp")
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
-
- # Test that -symbol-list-lines doesn't include lines from other sources
- # by checking the first and last line, and making sure the other lines
- # are between 30 and 39.
- sline = line_number('symbol_list_lines_inline_test2.cpp', '// FUNC_gfunc2')
- eline = line_number('symbol_list_lines_inline_test2.cpp', '// END_gfunc2')
- self.runCmd("-symbol-list-lines symbol_list_lines_inline_test2.cpp")
- self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*\]" % (sline, eline))
- ##FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716
- ##sline = line_number('symbol_list_lines_inline_test.cpp', '// FUNC_gfunc')
- ##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s')
- ##self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.cpp")
- ##self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}\]" % (sline, eline))
-
- # Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_file")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'\. error: no source filenames matched any command arguments \"")
-
- # Test that -symbol-list-lines fails when file is specified using relative path
- self.runCmd("-symbol-list-lines ./main.cpp")
- self.expect("\^error,message=\"warning: No source filenames matched '\./main\.cpp'\. error: no source filenames matched any command arguments \"")
-
- # Test that -symbol-list-lines works when file is specified using absolute path
- import os
- path = os.path.join(os.getcwd(), "main.cpp")
- self.runCmd("-symbol-list-lines \"%s\"" % path)
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
-
- # Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main\.cpp'\. error: no source filenames matched any command arguments \"")
Removed: lldb/trunk/test/tools/lldb-mi/symbol/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/main.cpp (removed)
@@ -1,18 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-extern int j;
-extern int gfunc(int i);
-extern int gfunc2(int i);
-int
-main()
-{ // FUNC_main
- int i = gfunc(j) + gfunc2(j);
- return i == 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp (removed)
@@ -1,39 +0,0 @@
-// Skip lines so we can make sure we're not seeing any lines from
-// symbol_list_lines_inline_test.h included in -symbol-list-lines
-// symbol_list_lines_inline_test.cpp, by checking that all the lines
-// are between 30 and 39.
-// line 5
-// line 6
-// line 7
-// line 8
-// line 9
-// line 10
-// line 11
-// line 12
-// line 13
-// line 14
-// line 15
-// line 16
-// line 17
-// line 18
-// line 19
-// line 20
-// line 21
-// line 22
-// line 23
-// line 24
-// line 25
-// line 26
-// line 27
-// line 28
-// line 29
-#include "symbol_list_lines_inline_test.h"
-int
-gfunc(int i)
-{ // FUNC_gfunc
- return ns::ifunc(i);
-}
-namespace ns
-{
-S s; // STRUCT_s
-}
Removed: lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h (removed)
@@ -1,24 +0,0 @@
-namespace ns
-{
-inline int
-ifunc(int i)
-{
- return i;
-}
-struct S
-{
- int a;
- int b;
- S()
- : a(3)
- , b(4)
- {
- }
- int
- mfunc()
- {
- return a + b;
- }
-};
-extern S s;
-}
Removed: lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp (removed)
@@ -1,38 +0,0 @@
-// Skip lines so we can make sure we're not seeing any lines from
-// symbol_list_lines_inline_test.h included in -symbol-list-lines
-// symbol_list_lines_inline_test2.cpp, by checking that all the lines
-// are between 30 and 39.
-// line 5
-// line 6
-// line 7
-// line 8
-// line 9
-// line 10
-// line 11
-// line 12
-// line 13
-// line 14
-// line 15
-// line 16
-// line 17
-// line 18
-// line 19
-// line 20
-// line 21
-// line 22
-// line 23
-// line 24
-// line 25
-// line 26
-// line 27
-// line 28
-// line 29
-#include "symbol_list_lines_inline_test.h"
-int j = 2;
-int
-gfunc2(int i)
-{ // FUNC_gfunc2
- i += ns::s.mfunc();
- i += ns::ifunc(i);
- return i == 0; // END_gfunc2
-}
Removed: lldb/trunk/test/tools/lldb-mi/syntax/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/syntax/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/syntax/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/syntax/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py (original)
+++ lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py (removed)
@@ -1,80 +0,0 @@
-"""
-Test that the lldb-mi driver understands MI command syntax.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_tokens(self):
- """Test that 'lldb-mi --interpreter' prints command tokens."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
- self.expect("000\^done")
-
- # Run to main
- self.runCmd("100000001-break-insert -f main")
- self.expect("100000001\^done,bkpt={number=\"1\"")
- self.runCmd("2-exec-run")
- self.expect("2\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Exit
- self.runCmd("0000000000000000000003-exec-continue")
- self.expect("0000000000000000000003\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_specialchars(self):
- """Test that 'lldb-mi --interpreter' handles complicated strings."""
-
- # Create an alias for myexe
- complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
- os.symlink(self.myexe, complicated_myexe)
- self.addTearDownHook(lambda: os.unlink(complicated_myexe))
-
- self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
-
- # Test that the executable was loaded
- self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
- self.expect("\^done")
-
- # Check that it was loaded correctly
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureLinux # Failing in ~6/600 dosep runs (build 3120-3122)
- def test_lldbmi_process_output(self):
- """Test that 'lldb-mi --interpreter' wraps process output correctly."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run
- self.runCmd("-exec-run")
- self.expect("\^running")
-
- # Test that a process output is wrapped correctly
- self.expect("\@\"'\\\\r\\\\n\"")
- self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")
Removed: lldb/trunk/test/tools/lldb-mi/syntax/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/syntax/main.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/syntax/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/syntax/main.cpp (removed)
@@ -1,17 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-int
-main(int argc, char const *argv[])
-{
- printf("'\n` - it's \\n\x12\"\\\"");
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/target/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/target/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/target/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/target/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := test_attach.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/target/TestMiTarget.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/target/TestMiTarget.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/target/TestMiTarget.py (original)
+++ lldb/trunk/test/tools/lldb-mi/target/TestMiTarget.py (removed)
@@ -1,125 +0,0 @@
-"""
-Test lldb-mi -target-xxx commands.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
- def test_lldbmi_target_attach_wait_for(self):
- """Test that 'lldb-mi --interpreter' works for -target-attach -n <name> --waitfor."""
-
- # Build target executable with unique name
- exeName = self.testMethodName
- d = {'EXE': exeName}
- self.buildProgram("test_attach.cpp", exeName)
- self.addTearDownCleanup(dictionary=d)
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- # FIXME: -file-exec-and-sybmols is not required for target attach, but the test will not pass without this
- self.runCmd("-file-exec-and-symbols %s" % exeName)
- self.expect("\^done")
-
- # Set up attach
- self.runCmd("-target-attach -n %s --waitfor" % exeName)
- time.sleep(4) # Give attach time to setup
-
- # Start target process
- self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
- self.addTearDownHook(self.cleanupSubprocesses)
- self.expect("\^done")
-
- # Set breakpoint on printf
- line = line_number('test_attach.cpp', '// BP_i++')
- self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Continue to breakpoint
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Detach
- self.runCmd("-target-detach")
- self.expect("\^done")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
- def test_lldbmi_target_attach_name(self):
- """Test that 'lldb-mi --interpreter' works for -target-attach -n <name>."""
-
- # Build target executable with unique name
- exeName = self.testMethodName
- d = {'EXE': exeName}
- self.buildProgram("test_attach.cpp", exeName)
- self.addTearDownCleanup(dictionary=d)
-
- # Start target process
- targetProcess = self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
- self.addTearDownHook(self.cleanupSubprocesses)
-
- self.spawnLldbMi(args = None)
-
- # Set up atatch
- self.runCmd("-target-attach -n %s" % exeName)
- self.expect("\^done")
-
- # Set breakpoint on printf
- line = line_number('test_attach.cpp', '// BP_i++')
- self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Continue to breakpoint
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Detach
- self.runCmd("-target-detach")
- self.expect("\^done")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
- def test_lldbmi_target_attach_pid(self):
- """Test that 'lldb-mi --interpreter' works for -target-attach <pid>."""
-
- # Build target executable with unique name
- exeName = self.testMethodName
- d = {'EXE': exeName}
- self.buildProgram("test_attach.cpp", exeName)
- self.addTearDownCleanup(dictionary=d)
-
- # Start target process
- targetProcess = self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
- self.addTearDownHook(self.cleanupSubprocesses)
-
- self.spawnLldbMi(args = None)
-
- # Set up atatch
- self.runCmd("-target-attach %d" % targetProcess.pid)
- self.expect("\^done")
-
- # Set breakpoint on printf
- line = line_number('test_attach.cpp', '// BP_i++')
- self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- # Continue to breakpoint
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Detach
- self.runCmd("-target-detach")
- self.expect("\^done")
Removed: lldb/trunk/test/tools/lldb-mi/target/test_attach.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/target/test_attach.cpp?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/target/test_attach.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/target/test_attach.cpp (removed)
@@ -1,21 +0,0 @@
-//===-- main.cpp ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstdio>
-
-int
-main(int argc, char const *argv[])
-{
- int i = 0;
- for (;;)
- {
- i++; // BP_i++
- }
- return 0;
-}
Removed: lldb/trunk/test/tools/lldb-mi/variable/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/Makefile?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/Makefile (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES := main.cpp
-
-include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py?rev=251531&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py (removed)
@@ -1,227 +0,0 @@
-#coding=utf8
-"""
-Test lldb-mi -gdb-set and -gdb-show commands for 'print option-name'.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import lldbmi_testcase
-from lldbtest import *
-
-class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- # evaluates array when char-array-as-string is off
- def eval_and_check_array(self, var, typ, length):
- self.runCmd("-var-create - * %s" % var)
- self.expect('\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' % (length, length, typ, length))
-
- # evaluates any type which can be represented as string of characters
- def eval_and_match_string(self, var, value, typ):
- value=value.replace("\\", "\\\\").replace("\"", "\\\"")
- self.runCmd("-var-create - * " + var)
- self.expect('\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' % (value, typ))
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
- def test_lldbmi_gdb_set_show_print_char_array_as_string(self):
- """Test that 'lldb-mi --interpreter' can print array of chars as string."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to BP_gdb_set_show_print_char_array_as_string_test
- line = line_number('main.cpp', '// BP_gdb_set_show_print_char_array_as_string_test')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that default print char-array-as-string value is "off"
- self.runCmd("-gdb-show print char-array-as-string")
- self.expect("\^done,value=\"off\"")
-
- # Test that a char* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*')
-
- # Test that a char[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("ca", "const char", 10);
-
- # Test that a char16_t* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*')
-
- # Test that a char16_t[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("u16a", "const char16_t", 10);
-
- # Test that a char32_t* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*')
-
- # Test that a char32_t[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("u32a", "const char32_t", 10);
-
- # Test that -gdb-set can set print char-array-as-string flag
- self.runCmd("-gdb-set print char-array-as-string on")
- self.expect("\^done")
- self.runCmd("-gdb-set print char-array-as-string 1")
- self.expect("\^done")
- self.runCmd("-gdb-show print char-array-as-string")
- self.expect("\^done,value=\"on\"")
-
- # Test that a char* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*')
-
- # Test that a char[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("ca", r'\"\\t\\\"hello\\\"\\n\"', r'const char \[10\]')
-
- # Test that a char16_t* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*')
-
- # Test that a char16_t[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u16a", r'u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \[10\]')
-
- # Test that a char32_t* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*')
-
- # Test that a char32_t[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u32a", r'U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \[10\]')
-
- # Test russian unicode strings
- self.eval_and_match_string("u16p_rus", r'0x[0-9a-f]+ u\"\\\\Ðламо-ÑквеÑ\"', r'const char16_t \*')
- self.eval_and_match_string("u16a_rus", r'u\"\\\\ÐейвÑÑ\"', r'const char16_t \[8\]')
- self.eval_and_match_string("u32p_rus", r'0x[0-9a-f]+ U\"\\\\ЧайнаÑаÑн\"', r'const char32_t \*')
- self.eval_and_match_string("u32a_rus", r'U\"\\\\ÐогпаÑÑ\"', r'const char32_t \[9\]')
-
- # Test that -gdb-set print char-array-as-string fails if "on"/"off" isn't specified
- self.runCmd("-gdb-set print char-array-as-string")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
-
- # Test that -gdb-set print char-array-as-string fails when option is unknown
- self.runCmd("-gdb-set print char-array-as-string unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @expectedFailureGcc("https://llvm.org/bugs/show_bug.cgi?id=23357")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_set_show_print_expand_aggregates(self):
- """Test that 'lldb-mi --interpreter' can expand aggregates everywhere."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to BP_gdb_set_show_print_expand_aggregates
- line = line_number('main.cpp', '// BP_gdb_set_show_print_expand_aggregates')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that default print expand-aggregates value is "off"
- self.runCmd("-gdb-show print expand-aggregates")
- self.expect("\^done,value=\"off\"")
-
- # Test that composite type isn't expanded when print expand-aggregates is "off"
- self.runCmd("-var-create var1 * complx")
- self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that composite type[] isn't expanded when print expand-aggregates is "off"
- self.eval_and_check_array("complx_array", "complex_type", 2)
-
- # Test that a struct with a char first element is not formatted as a string
- self.runCmd("-var-create - * &nstr")
- self.expect("\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that -gdb-set can set print expand-aggregates flag
- self.runCmd("-gdb-set print expand-aggregates on")
- self.expect("\^done")
- self.runCmd("-gdb-set print expand-aggregates 1")
- self.expect("\^done")
- self.runCmd("-gdb-show print expand-aggregates")
- self.expect("\^done,value=\"on\"")
-
- # Test that composite type is expanded when print expand-aggregates is "on"
- self.runCmd("-var-create var3 * complx")
- self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that composite type[] is expanded when print expand-aggregates is "on"
- self.runCmd("-var-create var4 * complx_array")
- self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't specified
- self.runCmd("-gdb-set print expand-aggregates")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
-
- # Test that -gdb-set print expand-aggregates fails when option is unknown
- self.runCmd("-gdb-set print expand-aggregates unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @expectedFailureGcc("https://llvm.org/bugs/show_bug.cgi?id=23357")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdb_set_show_print_aggregate_field_names(self):
- """Test that 'lldb-mi --interpreter' can expand aggregates everywhere."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to BP_gdb_set_show_print_aggregate_field_names
- line = line_number('main.cpp', '// BP_gdb_set_show_print_aggregate_field_names')
- self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that default print aggregatep-field-names value is "on"
- self.runCmd("-gdb-show print aggregate-field-names")
- self.expect("\^done,value=\"on\"")
-
- # Set print expand-aggregates flag to "on"
- self.runCmd("-gdb-set print expand-aggregates on")
- self.expect("\^done")
-
- # Test that composite type is expanded with field name when print aggregate-field-names is "on"
- self.runCmd("-var-create var1 * complx")
- self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that composite type[] is expanded with field name when print aggregate-field-names is "on"
- self.runCmd("-var-create var2 * complx_array")
- self.expect("\^done,name=\"var2\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that -gdb-set can set print aggregate-field-names flag
- self.runCmd("-gdb-set print aggregate-field-names off")
- self.expect("\^done")
- self.runCmd("-gdb-set print aggregate-field-names 0")
- self.expect("\^done")
- self.runCmd("-gdb-show print aggregate-field-names")
- self.expect("\^done,value=\"off\"")
-
- # Test that composite type is expanded without field name when print aggregate-field-names is "off"
- self.runCmd("-var-create var3 * complx")
- self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{3,\{3\},0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that composite type[] is expanded without field name when print aggregate-field-names is "off"
- self.runCmd("-var-create var4 * complx_array")
- self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{{4,\{4\},0x[0-9a-f]+},{5,\{5\},0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
-
- # Test that -gdb-set print aggregate-field-names fails if "on"/"off" isn't specified
- self.runCmd("-gdb-set print aggregate-field-names")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
-
- # Test that -gdb-set print aggregate-field-names fails when option is unknown
- self.runCmd("-gdb-set print aggregate-field-names unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
More information about the lldb-commits
mailing list