Skip to content

Commit

Permalink
scope - small fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
zhekov committed Oct 12, 2013
1 parent cbf1430 commit a48d7c2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
13 changes: 12 additions & 1 deletion scope/ChangeLog
@@ -1,4 +1,15 @@
2013-07-25 Dimitar Zhekov <dimitar.zhekov@gmail.com>
2013-10-12 Dimitar Zhekov <dimitar.zhekov@gmail.com>

* src/debug.c:
Fixed a lapsus which prevented gdb stdout resync on overflow.
* src/memory.c:
Improved re-selection of the current line.
* src/memory.c, src/pref.c:
Decreased the maximum memory block size to 15.5K and increased
the default gdb stdout buffer size to 32K to match each other.


2013-09-25 Dimitar Zhekov <dimitar.zhekov@gmail.com>

* src/scope.c:
Register ScpTreeStore dynamically, making Scope unloadable again.
Expand Down
2 changes: 1 addition & 1 deletion scope/src/debug.c
Expand Up @@ -307,7 +307,7 @@ static gboolean source_dispatch(G_GNUC_UNUSED GSource *source,
else
{
reading_pos++;
leading_receive = FALSE;
leading_receive = TRUE;
}
}

Expand Down
31 changes: 12 additions & 19 deletions scope/src/memory.c
Expand Up @@ -134,9 +134,9 @@ static void memory_configure(void)

static guint64 memory_start;
static guint memory_count = 0;
#define MAX_BYTES (128 * MAX_BYTES_PER_LINE)
#define MAX_BYTES (124 * MAX_BYTES_PER_LINE)

static void write_block(guint64 start, const char *contents, guint count)
static void write_block(guint64 start, const char *contents, guint count, const char *maddr)
{
if (!memory_count)
memory_start = start;
Expand All @@ -149,8 +149,6 @@ static void write_block(guint64 start, const char *contents, guint count)
GString *ascii = g_string_new(" ");
gint n = 0;

scp_tree_store_append(store, &iter, NULL);

while (n < bytes_per_line)
{
char locale;
Expand Down Expand Up @@ -185,8 +183,10 @@ static void write_block(guint64 start, const char *contents, guint count)
g_string_append_c(bytes, ' ');
}

scp_tree_store_set(store, &iter, MEMORY_ADDR, addr, MEMORY_BYTES, bytes->str,
MEMORY_ASCII, ascii->str, -1);
scp_tree_store_append_with_values(store, &iter, NULL, MEMORY_ADDR, addr,
MEMORY_BYTES, bytes->str, MEMORY_ASCII, ascii->str, -1);
if (!g_strcmp0(addr, maddr))
gtk_tree_selection_select_iter(selection, &iter);

g_free(addr);
g_string_free(bytes, TRUE);
Expand All @@ -202,7 +202,7 @@ static void write_block(guint64 start, const char *contents, guint count)
dc_error("memory: too much data");
}

static void memory_node_read(const ParseNode *node, G_GNUC_UNUSED gpointer gdata)
static void memory_node_read(const ParseNode *node, const char *maddr)
{
iff (node->type == PT_ARRAY, "memory: contains value")
{
Expand All @@ -218,7 +218,7 @@ static void memory_node_read(const ParseNode *node, G_GNUC_UNUSED gpointer gdata
sscanf(begin, "%" G_GINT64_MODIFIER "i", &start);

iff (count, "memory: contents too short")
write_block(start, contents, count);
write_block(start, contents, count, maddr);
}
}
}
Expand All @@ -228,10 +228,10 @@ void on_memory_read_bytes(GArray *nodes)
if (pointer_size <= MAX_POINTER_SIZE)
{
GtkTreeIter iter;
char *addr = NULL;
char *maddr = NULL;

if (gtk_tree_selection_get_selected(selection, NULL, &iter))
gtk_tree_model_get((GtkTreeModel *) store, &iter, MEMORY_ADDR, &addr, -1);
gtk_tree_model_get((GtkTreeModel *) store, &iter, MEMORY_ADDR, &maddr, -1);

store_clear(store);
memory_count = 0;
Expand All @@ -243,15 +243,8 @@ void on_memory_read_bytes(GArray *nodes)
gtk_tree_view_column_queue_resize(get_column("memory_ascii_column"));
}

parse_foreach(parse_lead_array(nodes), (GFunc) memory_node_read,
GINT_TO_POINTER(TRUE));

if (addr)
{
if (store_find(store, &iter, MEMORY_ADDR, addr))
utils_tree_set_cursor(selection, &iter, -1);
g_free(addr);
}
parse_foreach(parse_lead_array(nodes), (GFunc) memory_node_read, maddr);
g_free(maddr);
}
}

Expand Down
2 changes: 1 addition & 1 deletion scope/src/prefs.c
Expand Up @@ -233,7 +233,7 @@ void prefs_init(void)
group = stash_group_new("scope");
stash_group_add_string(group, &pref_gdb_executable, "gdb_executable", "gdb");
stash_group_add_boolean(group, &pref_gdb_async_mode, "gdb_async_mode", FALSE);
stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 16383);
stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 32767);
stash_group_add_integer(group, &pref_gdb_wait_death, "gdb_wait_death", 20);
#ifndef G_OS_UNIX
stash_group_add_integer(group, &pref_gdb_send_interval, "gdb_send_interval", 5);
Expand Down

0 comments on commit a48d7c2

Please sign in to comment.