Opened 12 years ago

Closed 12 years ago

#8173 closed bug (fixed)

Weird characters in gdb Terminal title

Reported by: humdinger Owned by: anevilyak
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

This is hrev43375.

When entering gdb after a crash or debugging a thread, the Terminal title sports some curious characters:

Weird characters

Attachments (2)

gdb-terminal-title.png (5.1 KB ) - added by humdinger 12 years ago.
Weird characters
debug_server.patch (5.8 KB ) - added by anevilyak 12 years ago.
Proposed fix

Download all attachments as: .zip

Change History (16)

by humdinger, 12 years ago

Attachment: gdb-terminal-title.png added

Weird characters

comment:1 by humdinger, 12 years ago

After a suggestion by DeadYak, I tried hrev43318. No problems there.

comment:2 by anevilyak, 12 years ago

Owner: changed from jackburton to bonefish
Status: newassigned

comment:3 by anevilyak, 12 years ago

Had a quick look, and I'm somewhat puzzled right now... the diff for debug_server itself as part of hrev43319 at least looks fine, and Terminal had no changes.

Last edited 12 years ago by anevilyak (previous) (diff)

comment:4 by anevilyak, 12 years ago

On second thought, I might see the problem. The paths that get assigned inside _SetupGDBArguments() are assigned from BPath objects that are set up on the stack, and not copied. These potentially get trashed afterwards when returning from there and executing other things, leaving us with a bogus argv array, no?

in reply to:  4 comment:5 by bonefish, 12 years ago

Replying to anevilyak:

On second thought, I might see the problem. The paths that get assigned inside _SetupGDBArguments() are assigned from BPath objects that are set up on the stack, and not copied. These potentially get trashed afterwards when returning from there and executing other things, leaving us with a bogus argv array, no?

Yes, the window title is also on the stack. Furthermore _SetupGDBArguments() should really return a status_t.

comment:6 by anevilyak, 12 years ago

Owner: changed from bonefish to anevilyak

Will try to find time to deal with it this weekend then. Thanks!

comment:7 by humdinger, 12 years ago

I now tried hrev43319 and that shows the same issue... sorry guys...

comment:8 by SeanCollins, 12 years ago

Problem with charecters inside the terminal window itself as well. screenshot attached.

Version 0, edited 12 years ago by SeanCollins (next)

in reply to:  7 ; comment:9 by siarzhuk, 12 years ago

Replying to SeanCollins:

Problem with charecters inside the terminal window itself as well. screenshot attached.hrev 43354-dirty gcc2hybrid

That one has nothing to do with the Terminal - the bash profile was not loaded because of settings path change some weeks ago - it should be fixed in the recent revisions. Just check and open another bug if it still observed. Please remove the attachment from this ticket.

Replying to humdinger:

I now tried hrev43319 and that shows the same issue... sorry guys...

Handling of OSC ANSI codes are done here http://cgit.haiku-os.org/haiku/tree/src/apps/terminal/TermParse.cpp#n1043 can you check with putting some dprintf tracing about the header gdb which trying to set in Terminal? May be some garbage data was interpreted as ANSI OSC sequence.

Are there any way to reproduce this situation?

in reply to:  9 comment:10 by SeanCollins, 12 years ago

Replying to siarzhuk:

Replying to SeanCollins:

Problem with charecters inside the terminal window itself as well. screenshot attached.hrev 43354-dirty gcc2hybrid

That one has nothing to do with the Terminal - the bash profile was not loaded because of settings path change some weeks ago - it should be fixed in the recent revisions. Just check and open another bug if it still observed. Please remove the attachment from this ticket.

I can't edit the ticket. and the hrev I am on is 5 days old.

by anevilyak, 12 years ago

Attachment: debug_server.patch added

Proposed fix

comment:11 by anevilyak, 12 years ago

Attached a patch for review: We now pass in a BString object that _SetupGDBArguments() can build up its command string in, with marker characters indicating the bounds of the arguments, then replace those with nulls before building up the argv array. This ensures that the character buffer for all the args is valid when calling load_image(). Thoughts?

comment:12 by bonefish, 12 years ago

Mmh, not so nice IMO. I'd use the BStringList class (which I sneaked in recently) to construct the arguments list and prepare the argv vector from it just before calling load_image().

BTW, the patch also contains debug output in src/kits/interface/ColumnListView.cpp.

in reply to:  12 comment:13 by anevilyak, 12 years ago

Replying to bonefish:

Mmh, not so nice IMO. I'd use the BStringList class (which I sneaked in recently) to construct the arguments list and prepare the argv vector from it just before calling load_image().

Wish I'd known about that one sooner :) will rework it, thanks for the hint.

comment:14 by anevilyak, 12 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev43431.

Note: See TracTickets for help on using tickets.