Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Conversation

@hughbe
Copy link
Collaborator

@hughbe hughbe commented Dec 12, 2016

This requires some CMake stuff, some upstream cherry-picking, and some modification of swift-specific source code.

Note: the changes in "Fix invalid namespace qualified UTF conversion helpers on Windows" changes lldb code. However: other actual lldb code was changed from llvm::UTF8 to UTF8 in swift-clang, swift-llvm and swift-lldb. This just manifests itself now, because we never built these files on non-Windows platforms.

/cc @compnerd @jrose-apple

@hughbe
Copy link
Collaborator Author

hughbe commented Dec 12, 2016

I'm fairly sure I've found a bug in ExpressionSourceCode.cpp on non-Windows platforms.
Take a look at this code: https://github.com/hughbe/swift-lldb/blob/10d41feb230bf7c1c0137aef071aaddff0d9df8a/source/Expression/ExpressionSourceCode.cpp#L232-L251

Notice that we append .cpp or .swift to the end of the file template. However, this goes against the documentation for mkstemp

The last six characters of template must be "XXXXXX" and these are
replaced with a string that makes the filename unique.

However, surely if we append .cpp or .swift to the file path passed to mkstemp, then the last six characters won't be XXXXXX. Not sure what's going on here.

@jrose-apple
Copy link
Contributor

We need LLDB reviewers in here more than us. Calling @scallanan and @clayborg.

break;
}

#if defined(_WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If making temp files needs abstraction for other systems we should look and see if there is a LLVM equivalent. We don't want every place in the LLVM/Clang/LLDB source base to do any "#if defined(_WIN32)"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is ugly. Let me know about this function: http://llvm.org/docs/doxygen/html/namespacellvm_1_1sys_1_1fs.html#ae3cdedf952d5eeb089d175c61d9f6fee

I think it does what we want

#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectRegister.h"
#ifndef LLDB_DISABLE_LIBEDIT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file differ from the LLDB llvm.org SVN top of tree and the changes here are just syncing with top of tree SVN?

Copy link
Collaborator Author

@hughbe hughbe Dec 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically fixed the build errors that I presume were caused by a bad merge - many syntax errors occured as a result - e.g. missing {, unhandled identifiers etc. The changes to this file were copy-pasted from upstream, but the file is different.

Take a look at this commit here: https://github.com/hughbe/swift-lldb/commit/8d544a47ba95533c369949fa3bf0ad01dadea0a3
It demonstrates what the diff looks like when I copy-and-paste the remaining bits of IOHandler.cpp from upstream. Basically, its changes in API that I didn't want to modify right now because I don't really wan't to break all the things!

if (!success)
FileSystem::Unlink(FileSpec(expr_source_path.c_str(), true));

#if defined(_WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line and the two below should go away if we abstract temp filenames into llvm or the LLDB host layer.

if (log)
log->Printf("%p Socket::Close (fd = %i)", static_cast<void *>(this),
m_socket);
static_cast<int>(m_socket));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't m_socket a SOCKET on windows?:

SOCKET WSAAPI socket(
In int af,
In int type,
In int protocol
);

How does casting this to an integer help here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Socket is defined as:

typedef UINT_PTR        SOCKET;

The warning we therefore get is trying to convert unsigned long long to int

class ParserVars {
public:
ParserVars(ClangExpressionDeclMap &decl_map) : m_decl_map(decl_map) {}
ParserVars() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let Sean Callanan comment on all expression parser changes.

@tfiala
Copy link
Contributor

tfiala commented Dec 12, 2016

No harm in testing.

@swift-ci Please test

@tfiala
Copy link
Contributor

tfiala commented Dec 12, 2016

@swift-ci Please test

@scallanan
Copy link
Contributor

It looks like the expression parser changes are just cleanup that removes unused state. I love it (assuming the tests succeed)!

hughbe and others added 10 commits January 9, 2017 14:41
Summary:
Previously the builting demangler was on for platforms that explicitly set a flag by modifying
Mangled.cpp (windows, freebsd). The Xcode build always used builtin demangler by passing a
compiler flag. This adds a cmake flag (defaulting to ON) to configure the demangling library used
at build time. The flag is only available on non-windows platforms as there the system demangler
is not present (in the form we're trying to use it, at least).
The impact of this change is:
- linux: switches to the builtin demangler
- freebsd, windows: NFC (I hope)
- netbsd: switches to the builtin demangler
- osx cmake build: switches to the builtin demangler (matching the XCode build)

The main motivation for this is the cross-platform case, where it should bring more consistency
by removing the dependency on the host demangler (which can be completely unrelated to the debug
target).

Reviewers: zturner, emaste, krytarowski

Subscribers: emaste, clayborg, lldb-commits

Differential Revision: https://reviews.llvm.org/D23830

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@279808 91177308-0d34-0410-b5e6-96231b3b80d8
- Basically copied from upstream
@hughbe
Copy link
Collaborator Author

hughbe commented Jan 16, 2017

@swift-ci please test

@hughbe
Copy link
Collaborator Author

hughbe commented Jan 25, 2017

I get the feeling this is targeting the wrong branch... Which branch should I submit this PR to? (there's no upstream-with-swift here, so its unclear)

@kubamracek
Copy link
Contributor

I believe you should just target the master branch.

@hughbe
Copy link
Collaborator Author

hughbe commented Jan 28, 2017

Thanks! I know that trying to change the branch of this PR will end up notifying and sending emails to several hundred people as GitHub attempts to push their commits from the old branch to the new branch - see apple/swift-clang#44

So unfortunately, I'll have to close this PR and create a new one: #125

Sorry for losing the discussion history

@hughbe hughbe closed this Jan 28, 2017
@hughbe hughbe deleted the lldb-windows branch January 28, 2017 11:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants